33bool Foam::genericPatchFieldBase::checkFieldSize
35 const label fieldSize,
36 const label patchSize,
37 const word& patchName,
42 const bool ok = (fieldSize == patchSize);
47 <<
"\n size of field " <<
key
48 <<
" (" << fieldSize <<
") != patch size (" << patchSize <<
')'
49 <<
"\n on patch " << patchName
50 <<
" of field " <<
io.name() <<
" in file "
51 <<
io.objectPath() <<
nl
66 actualTypeName_(
dict.get<
word>(
"type")),
77 actualTypeName_(
rhs.actualTypeName_),
86 const word& patchName,
91 <<
" (Actual type " << actualTypeName_ <<
')'
92 <<
"\n on patch " << patchName
93 <<
" of field " <<
io.name() <<
" in file " <<
io.objectPath() <<
nl
95 <<
" You are probably trying to solve for a field with a "
96 "generic boundary condition." <<
nl;
102 const word& entryName,
103 const word& patchName,
109 <<
" Missing required '" << entryName <<
"' entry"
110 <<
" on patch " << patchName
111 <<
" of field " <<
io.name() <<
" in file " <<
io.objectPath() <<
nl
112 <<
" (Actual type " << actualTypeName_ <<
')' <<
nl <<
nl
113 <<
" Please add the '" << entryName <<
"' entry to the"
114 " write function of the user-defined boundary-condition" <<
nl
121 const label patchSize,
122 const word& patchName,
124 const bool separateValue
127 for (
const entry& dEntry : dict_)
129 const keyType& key = dEntry.keyword();
131 if (key ==
"type" || (separateValue && key ==
"value"))
146 const label patchSize,
147 const word& patchName,
151 if (!dEntry.isStream())
168 if (tok.isWord(
"nonuniform"))
180 else if (!tok.isCompound())
183 <<
"\n non-compound token following 'nonuniform'"
184 <<
"\n on patch " << patchName <<
" field "
185 <<
io.name() <<
" in file "
186 <<
io.objectPath() <<
nl
192 #define doLocalCode(ValueType, Member) \
193 if (tok.isCompound<List<ValueType>>()) \
195 auto fPtr = autoPtr<Field<ValueType>>::New(); \
199 tok.transferCompoundToken<List<ValueType>>(is) \
202 if (!checkFieldSize(fPtr->size(), patchSize, patchName, key, io)) \
207 this->Member.insert(key, fPtr); \
221 <<
"\n unsupported compound " << tok.compoundToken() <<
nl
222 <<
"\n on patch " << patchName <<
" of field "
223 <<
io.name() <<
" in file "
224 <<
io.objectPath() <<
nl
228 else if (tok.isWord(
"uniform"))
232 if (!tok.isPunctuation())
252 vector vs(list[0], list[1], list[2]);
268 sphTensorFields_.insert
282 list[0], list[1], list[2],
287 symmTensorFields_.insert
301 list[0], list[1], list[2],
302 list[3], list[4], list[5],
303 list[6], list[7], list[8]
319 <<
"\n unrecognised native type " <<
flatOutput(list)
320 <<
"\n on patch " << patchName <<
" of field "
321 <<
io.name() <<
" in file "
322 <<
io.objectPath() <<
nl
344 &&
e.stream().peek().isWord(
"nonuniform")
348 #define doLocalCode(ValueType, Member) \
350 const auto iter = this->Member.cfind(key); \
353 iter.val()->writeEntry(key, os); \
376 const bool separateValue
379 os.writeEntry(
"type", actualTypeName_);
381 for (
const entry& dEntry : dict_)
383 const keyType& key = dEntry.keyword();
385 if (key ==
"type" || (separateValue && key ==
"value"))
404 #define doLocalCode(ValueType, Member) \
405 forAllIters(this->Member, iter) \
407 const auto iter2 = rhs.Member.cfind(iter.key()); \
411 iter.val()->rmap(*iter2.val(), addr); \
Defines the attributes of an object for which implicit objectRegistry management is supported,...
An input stream of tokens.
void putBack(const token &tok)
Put back a token (copy). Only a single put back is permitted.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
bool empty() const noexcept
True if List is empty (ie, size() is zero).
void size(const label n)
Older name for setAddressableSize.
static constexpr direction nComponents
Number of components in this vector space.
static autoPtr< T > New(Args &&... args)
Construct autoPtr with forwarding arguments.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
A keyword and a list of tokens is an 'entry'.
virtual ITstream & stream() const =0
Return token stream, if entry is a primitive entry.
virtual bool isStream() const noexcept
True if this entry is a stream.
const keyType & keyword() const noexcept
Return keyword.
Generic infrastructure for reading/writing unknown patch types.
void writeGeneric(Ostream &os, const bool separateValue) const
Write all generic entries from dictionary, optionally treating the "value" entry separately.
genericPatchFieldBase()=default
Default construct, generally not useful.
void rmapGeneric(const genericPatchFieldBase &rhs, const labelList &addr)
Implementation for reverse map given patch field onto this patch field.
void reportMissingEntry(const word &entryName, const word &patchName, const IOobject &io) const
FatalError for missing entry.
void putEntry(const entry &e, Ostream &os) const
Write a single entry, with lookup of hashed values.
genericPatchFieldBase(const Foam::zero, const genericPatchFieldBase &)
Partial copy construct. Only copy type and dictionary.
void genericFatalSolveError(const word &patchName, const IOobject &io) const
Add error message to FatalError about solving with generic condition.
void processGeneric(const label patchSize, const word &patchName, const IOobject &io, const bool separateValue)
bool processEntry(const entry &dEntry, const label patchSize, const word &patchName, const IOobject &io)
A class for handling keywords in dictionaries.
A token holds an item read from Istream.
bool isWord() const noexcept
Token is word-variant (WORD, DIRECTIVE).
A class for handling words, derived from Foam::string.
A class representing the concept of 0 (zero) that can be used to avoid manipulating objects known to ...
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
OBJstream os(runTime.globalPath()/outputName)
#define doLocalCode(FieldType, Variable)
constexpr auto key(const Type &t) noexcept
Helper function to return the enum value.
List< label > labelList
A List of labels.
FlatOutput::OutputAdaptor< Container, Delimiters > flatOutput(const Container &obj, Delimiters delim)
Global flatOutput() function with specified output delimiters.
IOerror FatalIOError
Error stream (stdout output on all processes), with additional 'FOAM FATAL IO ERROR' header text and ...
void rhs(fvMatrix< typename Expr::value_type > &m, const Expr &expression)
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
errorManipArg< error, int > exit(error &err, const int errNo=1)
SphericalTensor< scalar > sphericalTensor
SphericalTensor of scalars, i.e. SphericalTensor<scalar>.
List< scalar > scalarList
List of scalar.
SymmTensor< scalar > symmTensor
SymmTensor of scalars, i.e. SymmTensor<scalar>.
constexpr char nl
The newline '\n' character (0x0a).