Go to the documentation of this file.
33 template<
template<
typename>
class FieldContainer,
class Type>
37 const FieldContainer<Type>& input,
41 res.resize(input.size());
43 auto iter = res.begin();
45 for (
const Type& val : input)
53 template<
template<
typename>
class FieldContainer>
60 const FieldContainer<Foam::point>&
fld,
64 parallel = parallel && Pstream::parRun();
66 const label nSlaves = (parallel ? Pstream::nProcs() : 0);
73 if (Pstream::master())
80 for (
direction cmpt=0; cmpt < point::nComponents; ++cmpt)
85 for (
int slave=1; slave < nSlaves; ++slave)
87 IPstream fromSlave(Pstream::commsTypes::scheduled, slave);
97 for (
direction cmpt=0; cmpt < point::nComponents; ++cmpt)
103 Pstream::commsTypes::scheduled,
115 template<
template<
typename>
class FieldContainer,
class Type>
120 const FieldContainer<Type>&
fld,
124 parallel = parallel && Pstream::parRun();
126 const label nSlaves = (parallel ? Pstream::nProcs() : 0);
130 bool hasField = !
fld.empty();
138 if (!hasField)
return false;
147 if (Pstream::master())
153 for (
direction d=0; d < pTraits<Type>::nComponents; ++d)
160 for (label slave=1; slave < nSlaves; ++slave)
162 IPstream fromSlave(Pstream::commsTypes::scheduled, slave);
172 for (
direction d=0; d < pTraits<Type>::nComponents; ++d)
180 Pstream::commsTypes::scheduled,
201 parallel = parallel && Pstream::parRun();
206 if (parallel ? !part.
total() : !part.
size())
return false;
208 bool hasField = !
fld.empty();
216 if (!hasField)
return false;
220 if (Pstream::master())
227 for (
int typei=0; typei < ensightFaces::nTypes; ++typei)
234 ensightFaces::key(etype),
253 parallel = parallel && Pstream::parRun();
258 if (parallel ? !part.
total() : !part.
size())
return false;
260 bool hasField = !
fld.empty();
268 if (!hasField)
return false;
271 if (Pstream::master())
276 for (
int typei=0; typei < ensightCells::nTypes; ++typei)
283 ensightCells::key(etype),
302 parallel = parallel && Pstream::parRun();
307 if (parallel ? !part.
total() : !part.
size())
return false;
309 bool hasField = !
fld.empty();
317 if (!hasField)
return false;
321 if (Pstream::master())
326 for (
int typei=0; typei < ensightFaces::nTypes; ++typei)
333 ensightFaces::key(etype),
label index() const
The index in a list (0-based)
void component(FieldField< Field, typename FieldField< Field, Type >::cmptType > &sf, const FieldField< Field, Type > &f, const direction d)
A class for handling words, derived from Foam::string.
void beginPart(const label index, const string &description)
Begin a "part" (0-based index), with a description.
Output inter-processor communications stream.
bool writeFieldComponents(ensightFile &os, const char *key, const FieldContainer< Type > &fld, bool parallel)
Write field content (component-wise) for the given ensight element type.
void beginCoordinates(const label npoints)
Begin a "coordinates" block.
Sorting/classification of faces (2D) into corresponding ensight types.
labelRange range(const elemType etype) const
Processor-local offset/size of element type.
virtual Ostream & writeKeyword(const keyType &key)
label total() const
The global size of all element types.
SubField is a Field obtained as a section of another Field.
Conversion of OpenFOAM pTraits into the Ensight equivalent.
Specialized Ensight output with extra geometry file header.
label total() const
The global size of all element types.
const labelList & cellIds() const
Processor-local cell ids of all elements.
Sorting/classification of cells (3D) into corresponding ensight element types.
gmvFile<< "tracers "<< particles.size()<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().x()<< ' ';}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().y()<< ' ';}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().z()<< ' ';}gmvFile<< nl;for(const word &name :lagrangianScalarNames){ IOField< scalar > fld(IOobject(name, runTime.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
bool writeFaceSubField(ensightFile &os, const Field< Type > &fld, const ensightFaces &part, bool parallel)
reduce(hasMovingMesh, orOp< bool >())
const labelList & faceIds() const
Processor-local face ids of all elements.
Ensight output with specialized write() for strings, integers and floats. Correctly handles binary wr...
label size(const elemType etype) const
Processor-local size of the specified element type.
elemType
Supported ensight 'Cell' element types.
elemType
Supported ensight 'Face' element types.
void copyComponent(scalarField &res, const FieldContainer< Type > &input, const direction cmpt)
Copy specified field component into a scalarField.
bool writeField(ensightFile &os, const Field< Type > &fld, const ensightCells &part, bool parallel)
void beginPart(const label index)
Begin a part (0-based index internally).
A List with indirect addressing.
Input inter-processor communications stream.
void writeList(const UList< label > &field)
Write a list of integers as float values.
bool writeCoordinates(ensightGeoFile &os, const label partId, const word &partName, const label nPoints, const FieldContainer< Foam::point > &fld, bool parallel)
Write coordinates (component-wise) for the given part.
label size(const elemType etype) const
Processor-local size of the specified element type.