39 bool hasPointData =
false;
46 hasPointData = tvar().isPointData();
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;
118 const label patchIndex = patch_.index();
127 for (
int checki = 0; !
found && checki < 2; ++checki)
135 : obr.cfindIOobject(
name)
137 if (!ioptr)
continue;
158 if (!
found && searchFiles())
160 const word fldType = this->getTypeOfField(
name);
164 vfield = this->readAndRegister<VolumeField<Type>>(
name,
mesh());
168 sfield = this->readAndRegister<SurfaceField<Type>>(
name,
mesh());
172 pfield = this->readAndRegister<PointField<Type>>
183 return tmp<Field<Type>>
::New
185 vfield().boundaryField()[patchIndex]
190 return tmp<Field<Type>>
::New
192 sfield().boundaryField()[patchIndex]
197 return pfield().boundaryField()[patchIndex].patchInternalField();
202 <<
"No field '" <<
name <<
"' of type "
203 << pTraits<Type>::typeName <<
nl <<
nl;
239 const label patchIndex = patch_.index();
247 for (
int checki = 0; !
found && checki < 2; ++checki)
255 : obr.cfindIOobject(
name)
257 if (!ioptr)
continue;
273 if (!
found && searchFiles())
275 const word fldType = this->getTypeOfField(
name);
279 vfield = this->readAndRegister<VolumeField<Type>>(
name,
mesh());
283 pfield = this->readAndRegister<PointField<Type>>
294 return vfield().boundaryField()[patchIndex].patchInternalField();
298 return pfield().boundaryField()[patchIndex].patchInternalField();
303 <<
"No field '" <<
name <<
"' of type "
304 << pTraits<Type>::typeName <<
nl <<
nl;
336 const label patchIndex = patch_.index();
343 for (
int checki = 0; !
found && checki < 2; ++checki)
351 : obr.cfindIOobject(
name)
353 if (!ioptr)
continue;
364 if (!
found && searchFiles())
366 const word fldType = this->getTypeOfField(
name);
370 vfield = this->readAndRegister<VolumeField<Type>>(
name,
mesh());
377 return vfield().boundaryField()[patchIndex].patchNeighbourField();
382 <<
"No field '" <<
name <<
"' of type "
383 << pTraits<Type>::typeName <<
nl <<
nl;
411 const label patchIndex = patch_.index();
418 for (
int checki = 0; !
found && checki < 2; ++checki)
426 : obr.cfindIOobject(
name)
428 if (!ioptr)
continue;
439 if (!
found && searchFiles())
441 const word fldType = this->getTypeOfField(
name);
445 vfield = this->readAndRegister<VolumeField<Type>>(
name,
mesh());
452 return vfield().boundaryField()[patchIndex].snGrad();
457 <<
"No field '" <<
name <<
"' of type "
458 << pTraits<Type>::typeName <<
nl <<
nl;
480 return interp.faceToPointInterpolate(
field);
static const char *const typeName
Typename for Field.
Generic templated field type that is much like a Foam::List except that it is expected to hold numeri...
static FOAM_NO_DANGLING_REFERENCE const pointMesh & New(const polyMesh &mesh, Args &&... args)
tmp< Field< Type > > faceToPointInterpolate(const Field< Type > &ff) const
Interpolate from faces to points.
tmp< Field< Type > > pointToFaceInterpolate(const Field< Type > &pf) const
Interpolate from points to faces.
void size(const label n)
Older name for setAddressableSize.
bool searchFiles() const noexcept
const regIOobject * cfindContextIOobject(const word &name) const
Find named context field, if it exists.
static autoPtr< fvExprDriver > New(const dictionary &dict, const fvMesh &mesh)
Return a reference to the selected value driver.
virtual exprResult & variable(const word &name)
Non-const access to the named variable (sub-classes only).
tmp< GeomField > readAndRegister(const word &name, const MeshRef &meshRef)
Helper function for getOrReadField.
const exprResult & lookupGlobal(const word &name) const
Return the global variable if available or a null result.
virtual bool hasVariable(const word &name) const
True if named variable exists.
word getTypeOfField(const word &fieldName) const
Read the IOobject for fieldName and return its headerClassName.
bool isGlobalVariable(const word &name, const bool wantPointData=false, const label expectedSize=-1) const
Test existence of a global variable.
virtual label size() const
The natural field size for the expression.
tmp< Field< Type > > getVariableIfAvailable(const word &fldName) const
Retrieve variable as field if possible.
tmp< Field< Type > > patchNormalField(const word &fldName)
Return surface normal field (snGrad).
tmp< Field< Type > > faceToPoint(const Field< Type > &field) const
Interpolate face to point.
tmp< Field< Type > > patchNeighbourField(const word &fldName)
Return patchField on the opposite patch of a coupled patch.
virtual label pointSize() const
The point field size for the expression.
tmp< Field< Type > > getVolField(const word &fldName)
Retrieve field (vol field).
tmp< Field< Type > > getPointField(const word &fldName)
Retrieve field (point field).
tmp< Field< Type > > pointToFace(const Field< Type > &field) const
Interpolate point to face values.
tmp< Field< Type > > getSurfaceField(const word &fldName)
Retrieve field (surface field).
tmp< Field< Type > > patchInternalField(const word &fldName)
Return internal field next to patch.
const fvPatch & patch_
The referenced patch.
tmp< Field< Type > > getField(const word &fldName)
Return named field.
Registry of regIOobjects.
wordList sortedNames() const
The sorted names of all objects.
const regIOobject * cfindIOobject(const word &name, const bool recursive=false) const
Return const pointer to the regIOobject.
const objectRegistry & thisDb() const noexcept
Return the object registry.
A traits class, which is primarily used for primitives and vector-space.
A class for managing references or pointers (no reference counting).
const T & cref() const
Return const reference to the object or to the contents of a (non-null) managed pointer.
bool valid() const noexcept
Identical to good(), or bool operator.
regIOobject is an abstract class derived from IOobject to handle automatic object registration with t...
A class for managing temporary objects.
const T & cref() const
Return const reference to the object or to the contents of a (non-null) managed pointer.
bool valid() const noexcept
Identical to good(), or bool operator.
A class for handling words, derived from Foam::string.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
#define WarningInFunction
Report a warning using Foam::Warning.
Type gAverage(const FieldField< Field, Type > &f, const label comm)
The global arithmetic average of a FieldField.
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh > > &tf1, const word &name, const dimensionSet &dimensions, const bool initCopy=false)
Global function forwards to reuseTmpDimensionedField::New.
GeometricField< Type, fvPatchField, volMesh > VolumeField
A volume field for a given type.
PrimitivePatchInterpolation< primitivePatch > primitivePatchInterpolation
Foam::primitivePatchInterpolation.
Ostream & endl(Ostream &os)
Add newline and flush stream.
bool returnReduceAnd(const bool value, const int communicator=UPstream::worldComm)
Perform logical (and) MPI Allreduce on a copy. Uses UPstream::reduceAnd.
FlatOutput::OutputAdaptor< Container, Delimiters > flatOutput(const Container &obj, Delimiters delim)
Global flatOutput() function with specified output delimiters.
bool isType(const U &obj)
Check if typeid of the object and Type are identical.
GeometricField< Type, pointPatchField, pointMesh > PointField
A point field for a given type.
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
errorManipArg< error, int > exit(error &err, const int errNo=1)
tmp< GeoField > getField(const IOobject &io, const typename GeoField::Mesh &mesh)
Get the field or FatalError.
GeometricField< Type, fvsPatchField, surfaceMesh > SurfaceField
A (volume) surface field for a given type.
constexpr char nl
The newline '\n' character (0x0a).