35template<
class Type,
class GeoMesh>
36void Foam::DimensionedField<Type, GeoMesh>::readField
39 const word& fieldDictEntry
42 dimensions_.readEntry(
"dimensions", fieldDict);
50 oriented_.read(fieldDict);
53 const label meshSize = GeoMesh::size(mesh_);
63 fld.reserve_exact(meshSize);
64 fld.resize_nocopy(meshSize);
65 fld.assign(fieldDictEntry, fieldDict, meshSize);
69template<
class Type,
class GeoMesh>
70void Foam::DimensionedField<Type, GeoMesh>::readField
72 const word& fieldDictEntry
95 readField(
dict, fieldDictEntry);
99template<
class Type,
class GeoMesh>
100bool Foam::DimensionedField<Type, GeoMesh>::readIfPresent
102 const word& fieldDictEntry
107 this->isReadRequired()
108 || (this->isReadOptional() && this->headerOk())
111 readField(fieldDictEntry);
121template<
class Type,
class GeoMesh>
126 const word& fieldDictEntry,
127 const bool extraCapacity
137 GeoMesh::size(
mesh) + GeoMesh::boundary_size(
mesh)
140 readField(fieldDictEntry);
144template<
class Type,
class GeoMesh>
150 const word& fieldDictEntry,
151 const bool extraCapacity
161 GeoMesh::size(
mesh) + GeoMesh::boundary_size(
mesh)
164 readField(fieldDict, fieldDictEntry);
170template<
class Type,
class GeoMesh>
174 const word& fieldDictEntry
177 os.writeEntry(
"dimensions", dimensions());
180 if (oriented_.writeEntry(
os))
194template<
class Type,
class GeoMesh>
195Foam::Ostream& Foam::operator<<
207template<
class Type,
class GeoMesh>
208Foam::Ostream& Foam::operator<<
214 tfld().writeData(
os);
Useful combination of include files which define Sin, Sout and Serr and the use of IO streams general...
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...
DimensionedField(const IOobject &io, const Mesh &mesh, const dimensionSet &dims, const Field< Type > &field)
Construct from components, copy initial field content.
GeoMesh::Mesh Mesh
The mesh type for the DimensionedField.
const Mesh & mesh() const noexcept
Return const reference to mesh.
const dimensionSet & dimensions() const noexcept
Return dimensions.
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...
void reserve_exact(const label len)
Reserve allocation space for at least this size, allocating new space if required and retaining old c...
constexpr DynamicField() noexcept
@ NO_REGISTER
Do not request registration (bool: false).
@ MUST_READ
Reading required.
@ NO_WRITE
Ignore writing from objectRegistry::writeObject().
Defines the attributes of an object for which implicit objectRegistry management is supported,...
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
void writeEntry(Ostream &os) const
Write the UList with its compound type.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
static dictionary readContents(const IOobject &io)
Read and return contents, testing for "dictionary" type. The IOobject will not be registered.
regIOobject is an abstract class derived from IOobject to handle automatic object registration with t...
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.
OBJstream os(runTime.globalPath()/outputName)
const word GlobalIOList< Tuple2< scalar, vector > >::typeName("scalarVectorTable")
constexpr char nl
The newline '\n' character (0x0a).