41#ifndef Foam_DimensionedField_H
42#define Foam_DimensionedField_H
57template<
class Type,
class GeoMesh>
64template<
class Type,
class GeoMesh>
76template<
class Type,
class GeoMesh>
119 void checkFieldSize()
const;
122 bool readIfPresent(
const word& fieldDictEntry =
"value");
125 void readField(
const word& fieldDictEntry =
"value");
130 template<
class... Args>
201 const bool checkIOFlags =
true,
203 const bool extraCapacity =
false
215 const bool checkIOFlags =
true,
217 const bool extraCapacity =
false
229 const bool checkIOFlags =
true,
231 const bool extraCapacity =
false
239 const word& fieldDictEntry =
"value",
241 const bool extraCapacity =
false
250 const word& fieldDictEntry =
"value",
252 const bool extraCapacity =
false
519 template<
class AnyType>
532 template<
class AnyType>
552 const word& fieldDictEntry =
"value"
590 tmp<DimensionedField<cmptType, GeoMesh>>
component
Info<< nl;Info<< "Write faMesh in vtk format:"<< nl;{ vtk::uindirectPatchWriter writer(aMesh.patch(), fileName(aMesh.time().globalPath()/vtkBaseFileName));writer.writeGeometry();globalIndex procAddr(aMesh.nFaces());labelList cellIDs;if(UPstream::master()) { cellIDs.resize(procAddr.totalSize());for(const labelRange &range :procAddr.ranges()) { auto slice=cellIDs.slice(range);slice=identity(range);} } writer.beginCellData(4);writer.writeProcIDs();writer.write("cellID", cellIDs);writer.write("area", aMesh.S().field());writer.write("normal", aMesh.faceAreaNormals());writer.beginPointData(1);writer.write("normal", aMesh.pointAreaNormals());Info<< " "<< writer.output().name()<< nl;}{ vtk::lineWriter writer(aMesh.points(), aMesh.edges(), fileName(aMesh.time().globalPath()/(vtkBaseFileName+"-edges")));writer.writeGeometry();writer.beginCellData(4);writer.writeProcIDs();{ Field< scalar > fld(faMeshTools::flattenEdgeField(aMesh.magLe(), true))
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
tmp< DimensionedField< Type, GeoMesh > > T() const
Return the field transpose (only defined for second rank tensors).
DynamicField< Type > & field() noexcept
Return reference to the primitive field values.
bool is_oriented() const noexcept
True if field is ORIENTED.
tmp< DimensionedField< Type, GeoMesh > > clone() const
Clone.
dimensionSet & dimensions() noexcept
Return non-const access to dimensions.
void operator=(Foam::zero)
Assign value zero (no dimension checks).
void readField(const dictionary &fieldDict, const word &fieldDictEntry="value")
Resize to the mesh size and read the field from the dictionary. Internal implementation checks field ...
void setOriented(bool on=true) noexcept
DimensionedField(const IOobject &io, const Mesh &mesh, const word &fieldDictEntry="value", const bool extraCapacity=false)
Construct from Istream (uses an intermediate dictionary).
DimensionedField(const word &newName, DimensionedField< Type, GeoMesh > &df, bool reuse)
Copy or move construct, resetting name.
void operator/=(const DimensionedField< scalar, GeoMesh > &df)
static const this_type & null() noexcept
Return a null DimensionedField (reference to a nullObject).
DimensionedField(const IOobject &io, const Mesh &mesh, const Type &value, const dimensionSet &dims, const bool checkIOFlags=true, const bool extraCapacity=false)
Construct from components, setting dimensions and initial uniform field value.
TypeName("DimensionedField")
Runtime type information.
DimensionedField(const DimensionedField< Type, GeoMesh > &df)
Copy construct.
void operator-=(const dimensioned< Type > &dt)
void operator=(const dimensioned< Type > &dt)
Assign value (with dimension check).
void operator+=(const DimensionedField< Type, GeoMesh > &df)
DimensionedField< Type, areaMesh > Internal
static tmp< DimensionedField< Type, GeoMesh > > New(const word &newName, const tmp< DimensionedField< Type, GeoMesh > > &tfld)
Return renamed tmp field (NO_READ, NO_WRITE) retaining its instance/local.
DimensionedField< Type, areaMesh > this_type
static tmp< DimensionedField< Type, GeoMesh > > New(const word &name, IOobjectOption::registerOption regOpt, const Mesh &mesh, const dimensionSet &dims, Field< Type > &&iField)
Return tmp field (NO_READ, NO_WRITE) from name, mesh, dimensions, move internal field contents....
void operator=(const tmp< DimensionedField< Type, GeoMesh > > &tdf)
DimensionedField(DimensionedField< Type, GeoMesh > &df, bool reuse)
Copy construct or reuse (move) as specified.
void operator-=(const tmp< DimensionedField< Type, GeoMesh > > &tdf)
DimensionedField(const IOobject &io, const Mesh &mesh, const dimensionSet &dims, const Field< Type > &field)
Construct from components, copy initial field content.
static tmp< DimensionedField< Type, GeoMesh > > New(const word &name, IOobjectOption::registerOption regOpt, const Mesh &mesh, const dimensionSet &dims)
Return tmp field (NO_READ, NO_WRITE) from name, mesh, dimensions. [Takes current timeName from the me...
DimensionedField(const IOobject &io, const Mesh &mesh, const dimensionSet &dims, Field< Type > &&field)
Construct from components, transferring initial field content.
bool writeData(Ostream &os) const
The writeData function (required by regIOobject), calls writeData with dictionary entry name = "value...
this_type & constCast() const noexcept
Return non-const reference to this field.
DimensionedField(const IOobject &io, DimensionedField< Type, GeoMesh > &df, bool reuse)
Copy or move construct, resetting IO parameters.
const DynamicField< Type > & field() const noexcept
DynamicField< Type > FieldType
static tmp< DimensionedField< Type, GeoMesh > > New(const word &name, const Mesh &mesh, const dimensionSet &dims)
Return tmp field (NO_READ, NO_WRITE) from name, mesh, dimensions. [Takes current timeName from the me...
void operator*=(const DimensionedField< scalar, GeoMesh > &df)
void operator/=(const tmp< DimensionedField< scalar, GeoMesh > > &tdf)
tmp< DimensionedField< cmptType, GeoMesh > > component(const direction d) const
Return a component field of the field.
const Mesh & mesh() const noexcept
DimensionedField(const IOobject &io, const Mesh &mesh, const dictionary &fieldDict, const word &fieldDictEntry="value", const bool extraCapacity=false)
Construct from dictionary.
void operator/=(const dimensioned< scalar > &dt)
const dimensionSet & dimensions() const noexcept
Return dimensions.
void operator=(const DimensionedField< Type, GeoMesh > &df)
void replace(const direction d, const DimensionedField< cmptType, GeoMesh > &df)
Replace a component field of the field.
orientedType oriented() const noexcept
Return oriented type.
bool writeData(Ostream &os, const word &fieldDictEntry) const
Write dimensions, oriented flag (if valid) and the field data as a dictionary entry with the specifie...
static tmp< DimensionedField< Type, GeoMesh > > New(const word &name, const Mesh &mesh, const dimensionSet &dims, const tmp< Field< Type > > &tfield)
Return tmp field (NO_READ, NO_WRITE) from name, mesh, dimensions, primitive field (tmp)....
DimensionedField(const word &newName, const DimensionedField< Type, GeoMesh > &df)
Copy construct with a new name.
void operator+=(const tmp< DimensionedField< Type, GeoMesh > > &tdf)
Field< Type >::cmptType cmptType
DimensionedField(const tmp< DimensionedField< Type, GeoMesh > > &tdf)
Construct from tmp<DimensionedField> deleting argument.
DimensionedField(const IOobject &io, const Mesh &mesh, const dimensioned< Type > &dt, const bool checkIOFlags=true, const bool extraCapacity=false)
Construct from components, setting dimensions and initial uniform field value.
DimensionedField(const IOobject &io, const DimensionedField< Type, GeoMesh > &df)
Copy construct, resetting IO parameters.
void operator*=(const tmp< DimensionedField< scalar, GeoMesh > > &tdf)
static tmp< DimensionedField< Type, GeoMesh > > New(const word &name, const Mesh &mesh, const dimensionSet &dims, const Field< Type > &iField)
Return tmp field (NO_READ, NO_WRITE) from name, mesh, dimensions, copy of internal field....
DimensionedField(const IOobject &io, const Mesh &mesh, const dimensionSet &dims, List< Type > &&field)
Construct from components, transferring initial field content.
static tmp< DimensionedField< Type, GeoMesh > > New(const word &name, IOobjectOption::registerOption regOpt, const Mesh &mesh, const dimensioned< Type > &dt)
Return tmp field (NO_READ, NO_WRITE) from name, mesh, dimensioned-type. [Takes current timeName from ...
static tmp< DimensionedField< Type, GeoMesh > > New(const word &name, const Mesh &mesh, const Type &value, const dimensionSet &dims)
Return tmp field (NO_READ, NO_WRITE) from name, mesh, value, dimensions. [Takes current timeName from...
DimensionedField(const IOobject &io, const tmp< DimensionedField< Type, GeoMesh > > &tdf)
Construct from tmp<DimensionedField> deleting argument, resetting IO parameters.
static tmp< DimensionedField< Type, GeoMesh > > New(const DimensionedField< AnyType, GeoMesh > &fld, const word &name, const dimensionSet &dims)
Construct tmp field (NO_READ, NO_WRITE) based on mesh/registry information from an existing field....
dimensioned< Type > average(const label comm=UPstream::worldComm) const
Return the global arithmetic average.
friend Ostream & operator(Ostream &os, const DimensionedField< Type, GeoMesh > &df)
Calls DimensionedField::writeData().
DimensionedField(DimensionedField< Type, GeoMesh > &&df)
Move construct.
DimensionedField(const IOobject &io, const Mesh &mesh, const dimensionSet &dims, const bool checkIOFlags=true, const bool extraCapacity=false)
Construct from components, setting initial size and dimensions, but not initialising any field values...
dimensioned< Type > weightedAverage(const tmp< DimensionedField< scalar, GeoMesh > > &tweights, const label comm=UPstream::worldComm) const
Return the global weighted average.
void replace(const direction d, const tmp< DimensionedField< cmptType, GeoMesh > > &tdf)
Replace a component field of the field.
DimensionedField(const IOobject &io, const Mesh &mesh, const dimensionSet &dims, const tmp< Field< Type > > &tfield)
Construct from components, copy or transfer tmp content.
static tmp< DimensionedField< Type, GeoMesh > > New(const word &name, IOobjectOption::registerOption regOpt, const Mesh &mesh, const dimensionSet &dims, const tmp< Field< Type > > &tfield)
Return tmp field (NO_READ, NO_WRITE) from name, mesh, dimensions, primitive field (tmp)....
dimensioned< Type > weightedAverage(const DimensionedField< scalar, GeoMesh > &weights, const label comm=UPstream::worldComm) const
Return the global weighted average.
orientedType & oriented() noexcept
Return non-const access to the oriented type.
static tmp< DimensionedField< Type, GeoMesh > > New(const word &name, const Mesh &mesh, const dimensionSet &dims, Field< Type > &&iField)
Return tmp field (NO_READ, NO_WRITE) from name, mesh, dimensions, move internal field contents....
void operator-=(const DimensionedField< Type, GeoMesh > &df)
void operator*=(const dimensioned< scalar > &dt)
void operator+=(const dimensioned< Type > &dt)
static tmp< DimensionedField< Type, GeoMesh > > New(const word &name, IOobjectOption::registerOption regOpt, const Mesh &mesh, const dimensionSet &dims, const Field< Type > &iField)
Return tmp field (NO_READ, NO_WRITE) from name, mesh, dimensions, copy of internal field....
DimensionedField(const word &newName, DimensionedField< Type, GeoMesh > &&df)
Move construct with a new name.
static tmp< DimensionedField< Type, GeoMesh > > New(const word &newName, IOobjectOption::registerOption regOpt, const tmp< DimensionedField< Type, GeoMesh > > &tfld)
Return renamed tmp field (NO_READ, NO_WRITE) retaining its instance/local.
static tmp< DimensionedField< Type, GeoMesh > > New(const word &name, IOobjectOption::registerOption regOpt, const Mesh &mesh, const Type &value, const dimensionSet &dims)
Return tmp field (NO_READ, NO_WRITE) from name, mesh, value, dimensions. [Takes current timeName from...
DimensionedField(const IOobject &io, DimensionedField< Type, GeoMesh > &&df)
Move construct, resetting IO parameters.
DimensionedField(const word &newName, const tmp< DimensionedField< Type, GeoMesh > > &tdf)
Construct with a new name from tmp<DimensionedField>.
static tmp< DimensionedField< Type, GeoMesh > > New(const DimensionedField< AnyType, GeoMesh > &fld, const word &name, const dimensioned< Type > &dt)
Construct tmp field (NO_READ, NO_WRITE) based on mesh/registry information from an existing field and...
static tmp< DimensionedField< Type, GeoMesh > > New(const word &name, const Mesh &mesh, const dimensioned< Type > &dt)
Return tmp field (NO_READ, NO_WRITE) from name, mesh, dimensioned-type. [Takes current timeName from ...
virtual ~DimensionedField()
Destructor.
Dynamically sized Field. Similar to DynamicList, but inheriting from a Field instead of a List.
constexpr DynamicField() noexcept
Generic templated field type that is much like a Foam::List except that it is expected to hold numeri...
pTraits< Type >::cmptType cmptType
Component type.
registerOption
Enumeration for use with registerObject(). Values map to bool (false/true).
Defines the attributes of an object for which implicit objectRegistry management is supported,...
const word & name() const noexcept
Return the object name.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
static label worldComm
Communicator for all ranks. May differ from commGlobal() if local worlds are in use.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Dimension set for the base types, which can be used to implement rigorous dimension checking for alge...
Generic dimensioned Type class.
Class to determine the 'oriented' status of surface fields.
regIOobject(const IOobject &io, const bool isTimeObject=false)
Construct from IOobject. The optional flag adds special handling if the object is the top-level regIO...
A class for managing temporary objects.
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 ...
OBJstream os(runTime.globalPath()/outputName)
const T & NullObjectRef() noexcept
Const reference (of type T) to the nullObject.
Foam::argList args(argc, argv)
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.