43 if (components.
size() != Type::nComponents)
54 typeFields.insert(keyword,
new Field<Type>(size, t));
89 if (!
dict.found(
"value"))
92 <<
"\n Cannot find 'value' entry"
97 <<
" which is required to set the"
98 " values of the generic patch field." <<
nl
100 <<
"\n Please add the 'value' entry to the write function "
101 "of the user-defined boundary-condition\n"
107 if (iter().keyword() !=
"type" && iter().keyword() !=
"value")
112 && iter().stream().
size()
118 token firstToken(is);
123 && firstToken.
wordToken() ==
"nonuniform"
126 token fieldToken(is);
145 <<
"\n token following 'nonuniform' "
147 <<
"\n on patch " << this->
patch().
name()
156 #define ReadTypeField(Type, nullArg) \
159 fieldToken.compoundToken().type() \
160 == token::Compound<List<Type>>::typeName \
163 Field<Type>* fPtr = new Field<Type>; \
166 dynamicCast<token::Compound<List<Type>>> \
168 fieldToken.transferCompoundToken(is) \
172 if (fPtr->size() != this->size()) \
174 FatalIOErrorInFunction(dict) \
175 << "\n size of field " \
176 << iter().keyword() \
177 << " (" << fPtr->size() << ')' \
178 << " is not the same size as the patch (" \
179 << this->size() << ')' \
181 << this->patch().name() \
183 << this->internalField().name() \
185 << this->internalField().objectPath() \
186 << exit(FatalIOError); \
189 Type##Fields_.insert(iter().keyword(), fPtr); \
199 <<
"\n on patch " << this->
patch().
name()
213 token fieldToken(is);
233 #define InsertUniformTypeField(Type, nullArg) \
234 || insertUniformTypeField \
244 <<
"\n unrecognised native type " << l
245 <<
"\n on patch " << this->
patch().
name()
252 #undef InsertUniformTypeField
274 #define MapTypeFields(Type, nullArg) \
275 forAllConstIter(HashPtrTable<Field<Type>>, ptf.Type##Fields_, iter) \
277 Type##Fields_.insert \
280 mapper(*iter()).ptr() \
298 scalarFields_(ptf.scalarFields_),
299 vectorFields_(ptf.vectorFields_),
300 sphericalTensorFields_(ptf.sphericalTensorFields_),
301 symmTensorFields_(ptf.symmTensorFields_),
302 tensorFields_(ptf.tensorFields_)
318 refCast<const genericFvPatchField<Type>>(ptf);
320 #define MapTypeFields(Type, nullArg) \
321 forAllIter(HashPtrTable<Field<Type>>, Type##Fields_, iter) \
323 HashPtrTable<Field<Type>>::const_iterator dptfIter = \
324 dptf.Type##Fields_.find(iter.key()); \
326 if (dptfIter != dptf.Type##Fields_.end()) \
328 mapper(*iter(), *dptfIter()); \
345 refCast<const genericFvPatchField<Type>>(ptf);
347 #define ResetTypeFields(Type, nullArg) \
348 forAllIter(HashPtrTable<Field<Type>>, Type##Fields_, iter) \
350 HashPtrTable<Field<Type>>::const_iterator dptfIter = \
351 dptf.Type##Fields_.find(iter.key()); \
353 if (dptfIter != dptf.Type##Fields_.end()) \
355 iter()->reset(*dptfIter()); \
359 #undef ResetTypeFields
371 <<
"cannot be called for a genericFvPatchField"
372 " (actual type " << actualTypeName() <<
")"
373 <<
"\n on patch " << this->patch().name()
374 <<
" of field " << this->internalField().name()
375 <<
" in file " << this->internalField().objectPath()
376 <<
"\n You are probably trying to solve for a field with a "
377 "generic boundary condition."
392 <<
"cannot be called for a genericFvPatchField"
393 " (actual type " << actualTypeName() <<
")"
394 <<
"\n on patch " << this->patch().name()
395 <<
" of field " << this->internalField().name()
396 <<
" in file " << this->internalField().objectPath()
397 <<
"\n You are probably trying to solve for a field with a "
398 "generic boundary condition."
410 <<
"cannot be called for a genericFvPatchField"
411 " (actual type " << actualTypeName() <<
")"
412 <<
"\n on patch " << this->patch().name()
413 <<
" of field " << this->internalField().name()
414 <<
" in file " << this->internalField().objectPath()
415 <<
"\n You are probably trying to solve for a field with a "
416 "generic boundary condition."
427 <<
"cannot be called for a genericFvPatchField"
428 " (actual type " << actualTypeName() <<
")"
429 <<
"\n on patch " << this->patch().name()
430 <<
" of field " << this->internalField().name()
431 <<
" in file " << this->internalField().objectPath()
432 <<
"\n You are probably trying to solve for a field with a "
433 "generic boundary condition."
447 if (iter().keyword() !=
"type" && iter().keyword() !=
"value")
452 && iter().stream().size()
453 && iter().stream()[0].isWord()
454 && iter().stream()[0].wordToken() ==
"nonuniform"
457 #define WriteTypeFieldEntry(Type, nullArg) \
458 else if (Type##Fields_.found(iter().keyword())) \
464 *Type##Fields_.find(iter().keyword())() \
468 #undef WriteTypeFieldEntry
#define forAll(list, i)
Loop across all elements in list.
#define forAllConstIter(Container, container, iter)
Iterate across all elements in the container object of type.
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Pre-declare SubField and related Field type.
A HashTable specialisation for hashing pointers.
void putBack(const token &)
Put back token.
label size() const
Return the number of elements in the UList.
void size(const label)
Override size to be inconsistent with allocated storage.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
This boundary condition is not designed to be evaluated; it is assumed that the value is assigned via...
virtual void map(const fvPatchField< Type > &, const fieldMapper &)
Map the given fvPatchField onto this fvPatchField.
A list of keyword definitions, which are a keyword followed by any number of values (e....
Abstract base class for field mapping.
Abstract base class with a fat-interface to all derived classes covering all possible ways in which t...
const DimensionedField< Type, volMesh > & internalField() const
Return dimensioned internal field reference.
virtual void reset(const fvPatchField< Type > &)
Reset the fvPatchField to the given fvPatchField.
const fvPatch & patch() const
Return patch.
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
virtual const word & name() const
Return name.
Base class for generic field types. Facilitates down-casting so that the actual type can be queried.
const word & actualTypeName() const
Return the actual type name.
This boundary condition provides a generic version of the calculated condition, useful as a fallback ...
virtual void write(Ostream &) const
Write.
tmp< Field< Type > > gradientInternalCoeffs() const
Return the matrix diagonal coefficients corresponding to the.
virtual tmp< Field< Type > > valueInternalCoeffs(const tmp< scalarField > &) const
Return the matrix diagonal coefficients corresponding to the.
genericFvPatchField(const fvPatch &, const DimensionedField< Type, volMesh > &, const dictionary &)
Construct from patch, internal field and dictionary.
tmp< Field< Type > > gradientBoundaryCoeffs() const
Return the matrix source coefficients corresponding to the.
virtual void reset(const fvPatchField< Type > &)
Reset the fvPatchField to the given fvPatchField.
virtual tmp< Field< Type > > valueBoundaryCoeffs(const tmp< scalarField > &) const
Return the matrix source coefficients corresponding to the.
virtual void map(const fvPatchField< Type > &, const fieldMapper &)
Map the given fvPatchField onto this fvPatchField.
A class for managing temporary objects.
A token holds items read from Istream.
bool isPunctuation() const
const compound & compoundToken() const
const word & wordToken() const
A class for handling words, derived from string.
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
#define WriteTypeFieldEntry(Type, nullArg)
#define ResetTypeFields(Type, nullArg)
#define MapTypeFields(Type, nullArg)
#define ReadTypeField(Type, nullArg)
#define InsertUniformTypeField(Type, nullArg)
errorManipArg< error, int > exit(error &err, const int errNo=1)
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
errorManip< error > abort(error &err)
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
void writeEntry(Ostream &os, const HashTable< T, Key, Hash > &ht)
bool insertUniformTypeField(const scalarList &components, const word &keyword, const label size, HashPtrTable< Field< Type >> &typeFields)
FOR_ALL_FIELD_TYPES(makeFieldSourceTypedef)