Go to the documentation of this file.
34 template<
template<
typename>
class FieldContainer,
class Type>
38 const FieldContainer<Type>&
input,
42 if (cmptBuffer.size() <
input.size())
45 <<
"Component buffer too small: "
46 << cmptBuffer.size() <<
" < " <<
input.size() <<
nl
50 auto iter = cmptBuffer.begin();
52 for (
const Type& val :
input)
60 template<
template<
typename>
class FieldContainer,
class Type>
64 const FieldContainer<Type>&
fld,
69 parallel = parallel && Pstream::parRun();
75 procAddr.
reset(UPstream::listGatherValues<label>(
fld.size()));
84 if (Pstream::master())
88 for (
direction d=0; d < pTraits<Type>::nComponents; ++d)
95 os.writeList(cmptBuffer);
98 for (
const label proci : procAddr.
subProcs())
103 UPstream::commsTypes::scheduled,
105 cmptBuffer.data_bytes(),
106 cmptBuffer.size_bytes()
108 os.writeList(cmptBuffer);
117 for (
direction d=0; d < pTraits<Type>::nComponents; ++d)
124 UPstream::commsTypes::scheduled,
126 cmptBuffer.cdata_bytes(),
127 cmptBuffer.size_bytes()
134 template<
template<
typename>
class FieldContainer>
139 const word& partName,
141 const FieldContainer<Foam::point>&
fld,
145 parallel = parallel && Pstream::parRun();
147 if (Pstream::master())
149 os.beginPart(partId, partName);
159 template<
template<
typename>
class FieldContainer,
class Type>
164 const FieldContainer<Type>&
fld,
168 parallel = parallel && Pstream::parRun();
172 bool hasField = !
fld.empty();
180 if (!hasField)
return false;
184 if (Pstream::master())
186 os.writeKeyword(
key);
204 parallel = parallel && Pstream::parRun();
209 if (parallel ? !part.
total() : !part.
size())
return false;
211 bool hasField = !
fld.empty();
219 if (!hasField)
return false;
223 if (Pstream::master())
228 for (
int typei=0; typei < ensightFaces::nTypes; ++typei)
254 parallel = parallel && Pstream::parRun();
259 if (parallel ? !part.
total() : !part.
size())
return false;
261 bool hasField = !
fld.empty();
269 if (!hasField)
return false;
272 bool validAddressing = (part.
size() == part.
faceOrder().size());
279 if (!validAddressing)
282 <<
"Called without faceOrder having been set" <<
nl
287 if (Pstream::master())
292 for (
int typei=0; typei < ensightFaces::nTypes; ++typei)
320 parallel = parallel && Pstream::parRun();
325 if (parallel ? !part.
total() : !part.
size())
return false;
327 bool hasField = !
fld.empty();
335 if (!hasField)
return false;
339 if (Pstream::master())
344 for (
int typei=0; typei < ensightCells::nTypes; ++typei)
370 parallel = parallel && Pstream::parRun();
375 if (parallel ? !part.
total() : !part.
size())
return false;
377 bool hasField = !
fld.empty();
385 if (!hasField)
return false;
389 if (Pstream::master())
394 for (
int typei=0; typei < ensightFaces::nTypes; ++typei)
const labelList & faceIds() const noexcept
Processor-local face ids of all elements.
List< label > labelList
A List of labels.
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.
label index() const noexcept
The index in a list (0-based)
Ensight names and component order for base types.
auto key(const Type &t) -> typename std::enable_if< std::is_enum< Type >::value, typename std::underlying_type< Type >::type >::type
A class representing the concept of 1 (one) that can be used to avoid manipulating objects known to b...
label localSize() const
My local size.
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 resize_nocopy(const label len)
Adjust allocated size of list without necessarily.
Sorting/classification of faces (2D) into corresponding ensight types.
labelRange range(const elemType etype) const
Processor-local offset/size of element type.
label maxSize() const
Global max of localSizes.
label total() const
The global size of all element types.
SubField is a Field obtained as a section of another Field, without its own allocation....
bool writeFaceLocalField(ensightFile &os, const Field< Type > &fld, const ensightFaces &part, bool parallel)
Specialized Ensight output with extra geometry file header.
Generic templated field type.
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 >())
OBJstream os(runTime.globalPath()/outputName)
const labelList & faceOrder() const noexcept
Ensight output with specialized write() for strings, integers and floats. Correctly handles binary wr...
Calculates a unique integer (label so might not have enough room - 2G max) for processor + local inde...
void reset(const label localSize)
Reset from local size.
errorManipArg< error, int > exit(error &err, const int errNo=1)
labelRange subProcs() const noexcept
Range of process indices for addressed sub-offsets (processes)
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.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
bool writeField(ensightFile &os, const Field< Type > &fld, const ensightCells &part, bool parallel)
static Istream & input(Istream &is, IntRange< T > &range)
void write(vtk::formatter &fmt, const Type &val, const label n=1)
Component-wise write of a value (N times)
A List with indirect addressing.
void writeFieldContent(ensightFile &os, const FieldContainer< Type > &fld, bool parallel)
Write field content (component-wise)
void copyComponent(List< scalar > &cmptBuffer, const FieldContainer< Type > &input, const direction cmpt)
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.