Go to the documentation of this file.
39 bool hasPointData =
false;
43 if (hasVariable(
name) && variable(
name).isType<Type>())
46 hasPointData = tvar().isPointData();
48 else if (isGlobalVariable<Type>(
name))
56 const auto& var = tvar.
cref();
59 const label len = (hasPointData ? this->pointSize() : this->size());
70 <<
"Variable " <<
name
71 <<
" is nonuniform and does not fit the size"
72 <<
". Using average" <<
endl;
86 return getField<Type>(
name);
94 return getField<Type>(
name);
102 return getField<Type>(
name);
118 const label patchIndex = patch_.index();
133 for (
int checki = 0; !
found && checki < 2; ++checki)
143 if (!ioptr)
continue;
147 vfield.
cref(
dynamic_cast<const vfieldType*
>(ioptr));
152 sfield.
cref(
dynamic_cast<const sfieldType*
>(ioptr));
157 pfield.
cref(
dynamic_cast<const pfieldType*
>(ioptr));
164 if (!
found && searchFiles())
166 const word fldType = this->getTypeOfField(
name);
168 if (fldType == vfieldType::typeName)
170 vfield = this->readAndRegister<vfieldType>(
name,
mesh());
172 else if (fldType == sfieldType::typeName)
174 sfield = this->readAndRegister<sfieldType>(
name,
mesh());
176 else if (fldType == pfieldType::typeName)
178 pfield = this->readAndRegister<pfieldType>
191 vfield().boundaryField()[patchIndex]
198 sfield().boundaryField()[patchIndex]
203 return pfield().boundaryField()[patchIndex].patchInternalField();
208 <<
"No field '" <<
name <<
"' of type "
212 << vfieldType::typeName <<
" Fields: "
216 << sfieldType::typeName <<
" Fields: "
220 << pfieldType::typeName <<
" Fields: "
245 const label patchIndex = patch_.index();
258 for (
int checki = 0; !
found && checki < 2; ++checki)
268 if (!ioptr)
continue;
272 vfield.
cref(
dynamic_cast<const vfieldType*
>(ioptr));
277 pfield.
cref(
dynamic_cast<const pfieldType*
>(ioptr));
284 if (!
found && searchFiles())
286 const word fldType = this->getTypeOfField(
name);
288 if (fldType == vfieldType::typeName)
290 vfield = this->readAndRegister<vfieldType>(
name,
mesh());
292 else if (fldType == pfieldType::typeName)
294 pfield = this->readAndRegister<pfieldType>
305 return vfield().boundaryField()[patchIndex].patchInternalField();
309 return pfield().boundaryField()[patchIndex].patchInternalField();
314 <<
"No field '" <<
name <<
"' of type "
318 << vfieldType::typeName <<
" Fields: "
322 << pfieldType::typeName <<
" Fields: "
347 const label patchIndex = patch_.index();
358 for (
int checki = 0; !
found && checki < 2; ++checki)
368 if (!ioptr)
continue;
372 vfield.
cref(
dynamic_cast<const vfieldType*
>(ioptr));
379 if (!
found && searchFiles())
381 const word fldType = this->getTypeOfField(
name);
383 if (fldType == vfieldType::typeName)
385 vfield = this->readAndRegister<vfieldType>(
name,
mesh());
392 return vfield().boundaryField()[patchIndex].patchNeighbourField();
397 <<
"No field '" <<
name <<
"' of type "
401 << vfieldType::typeName <<
" Fields: "
426 const label patchIndex = patch_.index();
437 for (
int checki = 0; !
found && checki < 2; ++checki)
447 if (!ioptr)
continue;
451 vfield.
cref(
dynamic_cast<const vfieldType*
>(ioptr));
458 if (!
found && searchFiles())
460 const word fldType = this->getTypeOfField(
name);
462 if (fldType == vfieldType::typeName)
464 vfield = this->readAndRegister<vfieldType>(
name,
mesh());
471 return vfield().boundaryField()[patchIndex].snGrad();
476 <<
"No field '" <<
name <<
"' of type "
480 << vfieldType::typeName <<
" Fields: "
wordList sortedNames() const
The sorted names of all objects.
A class for handling words, derived from Foam::string.
T returnReduce(const T &Value, const BinaryOp &bop, const int tag=Pstream::msgType(), const label comm=UPstream::worldComm)
A class for managing temporary objects.
Type gAverage(const FieldField< Field, Type > &f)
tmp< Field< Type > > getVariableIfAvailable(const word &fldName) const
Retrieve variable as field if possible.
tmp< Field< Type > > pointToFaceInterpolate(const Field< Type > &pf) const
Interpolate from points to faces.
static const pointMesh & New(const polyMesh &mesh, Args &&... args)
Get existing or create a new MeshObject.
tmp< Field< Type > > getField(const word &fldName)
Return named field.
Ostream & endl(Ostream &os)
Add newline and flush stream.
Registry of regIOobjects.
bool valid() const noexcept
Identical to good(), or bool operator.
tmp< Field< Type > > getSurfaceField(const word &fldName)
Retrieve field (surface field)
Generic templated field type.
const regIOobject * cfindIOobject(const word &name, const bool recursive=false) const
Return const pointer to the regIOobject.
tmp< Field< Type > > patchInternalField(const word &fldName)
Return internal field next to patch.
tmp< Field< Type > > patchNormalField(const word &fldName)
Return surface normal field (snGrad)
tmp< Field< Type > > patchNeighbourField(const word &fldName)
Return patchField on the opposite patch of a coupled patch.
FlatOutput::OutputAdaptor< Container, Delimiters > flatOutput(const Container &obj, Delimiters delim)
Global flatOutput() function with specified output delimiters.
tmp< Field< Type > > faceToPointInterpolate(const Field< Type > &ff) const
Interpolate from faces to points.
tmp< Field< Type > > pointToFace(const Field< Type > &field) const
Interpolate point to face values.
errorManipArg< error, int > exit(error &err, const int errNo=1)
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh >> &tdf1, const word &name, const dimensionSet &dimensions)
Global function forwards to reuseTmpDimensionedField::New.
regIOobject is an abstract class derived from IOobject to handle automatic object registration with t...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
const regIOobject * cfindContextIOobject(const word &name) const
Find named context field, if it exists.
Interpolation class within a primitive patch. Allows interpolation from points to faces and vice vers...
A traits class, which is primarily used for primitives.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
tmp< Field< Type > > getVolField(const word &fldName)
Retrieve field (vol field)
tmp< Field< Type > > faceToPoint(const Field< Type > &field) const
Interpolate face to point.
bool valid() const noexcept
Identical to good(), or bool operator.
tmp< Field< Type > > getPointField(const word &fldName)
Retrieve field (point field)
#define WarningInFunction
Report a warning using Foam::Warning.
A class for managing references or pointers (no reference counting)