33 bool 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 77 actualTypeName_(rhs.actualTypeName_),
86 const word& patchName,
91 <<
" (Actual type " << actualTypeName_ <<
')' 92 <<
"\n on patch " << patchName
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
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_)
131 if (
key ==
"type" || (separateValue &&
key ==
"value"))
137 processEntry(dEntry, patchSize, patchName,
io);
146 const label patchSize,
147 const word& patchName,
151 if (!dEntry.isStream())
156 const keyType&
key = dEntry.keyword();
157 ITstream& is = dEntry.stream();
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 " 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 " 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 " 339 const keyType&
key =
e.keyword();
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
381 for (
const entry& dEntry : dict_)
383 const keyType&
key = dEntry.keyword();
385 if (
key ==
"type" || (separateValue &&
key ==
"value"))
391 putEntry(dEntry,
os);
399 const genericPatchFieldBase& rhs,
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); \ List< ReturnType > get(const UPtrList< T > &list, const AccessOp &aop)
List of values generated by applying the access operation to each list item.
List< scalar > scalarList
List of scalar.
A class for handling keywords in dictionaries.
errorManipArg< error, int > exit(error &err, const int errNo=1)
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
A list of keyword definitions, which are a keyword followed by a number of values (eg...
void writeGeneric(Ostream &os, const bool separateValue) const
Write all generic entries from dictionary, optionally treating the "value" entry separately.
const word & name() const noexcept
Return the object name.
constexpr char nl
The newline '\n' character (0x0a)
Ostream & writeEntry(const keyType &key, const T &value)
Write a keyword/value entry.
::Foam::direction nComponents(const expressions::valueTypeCode) noexcept
The number of components associated with given valueTypeCode.
bool processEntry(const entry &dEntry, const label patchSize, const word &patchName, const IOobject &io)
fileName objectPath() const
The complete path + object name.
void reportMissingEntry(const word &entryName, const word &patchName, const IOobject &io) const
FatalError for missing entry.
const dimensionedScalar e
Elementary charge.
const keyType & keyword() const noexcept
Return keyword.
void genericFatalSolveError(const word &patchName, const IOobject &io) const
Add error message to FatalError about solving with generic condition.
SymmTensor< scalar > symmTensor
SymmTensor of scalars, i.e. SymmTensor<scalar>.
A class for handling words, derived from Foam::string.
void processGeneric(const label patchSize, const word &patchName, const IOobject &io, const bool separateValue)
static constexpr direction nComponents
Number of components in this vector space.
void rmapGeneric(const genericPatchFieldBase &rhs, const labelList &addr)
Implementation for reverse map given patch field onto this patch field.
OBJstream os(runTime.globalPath()/outputName)
Generic infrastructure for reading/writing unknown patch types.
void putEntry(const entry &e, Ostream &os) const
Write a single entry, with lookup of hashed values.
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
auto key(const Type &t) -> typename std::enable_if< std::is_enum< Type >::value, typename std::underlying_type< Type >::type >::type
A class representing the concept of 0 (zero) that can be used to avoid manipulating objects known to ...
SphericalTensor< scalar > sphericalTensor
SphericalTensor of scalars, i.e. SphericalTensor<scalar>.
List< label > labelList
A List of labels.
IOobject io("surfaceFilmProperties", mesh.time().constant(), mesh, IOobject::READ_IF_PRESENT, IOobject::NO_WRITE, IOobject::NO_REGISTER)
static autoPtr< T > New(Args &&... args)
Construct autoPtr with forwarding arguments.
Defines the attributes of an object for which implicit objectRegistry management is supported...
#define doLocalCode(ValueType, Member)
genericPatchFieldBase()=default
Default construct, generally not useful.
A keyword and a list of tokens is an 'entry'.
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 ...