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())
86 DynamicList<scalar> cmptBuffer(procAddr.
maxSize());
88 for (
direction d=0; d < pTraits<Type>::nComponents; ++d)
90 const direction cmpt = ensightPTraits<Type>::componentOrder[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);
115 List<scalar> cmptBuffer(
fld.size());
117 for (
direction d=0; d < pTraits<Type>::nComponents; ++d)
119 const direction cmpt = ensightPTraits<Type>::componentOrder[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)
230 const auto etype = ensightFaces::elemType(typei);
236 SubField<Type>(
fld, part.
range(etype)),
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)
294 const auto etype = ensightFaces::elemType(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)
346 const auto etype = ensightCells::elemType(typei);
352 UIndirectList<Type>(
fld, part.
cellIds(etype)),
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)
396 const auto etype = ensightFaces::elemType(typei);
402 UIndirectList<Type>(
fld, part.
faceIds(etype)),
const labelList & faceIds() const noexcept
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
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...
bool writeFieldComponents(ensightFile &os, const char *key, const FieldContainer< Type > &fld, bool parallel)
void resize_nocopy(const label len)
Sorting/classification of faces (2D) into corresponding ensight types.
labelRange range(const elemType etype) const
bool writeFaceLocalField(ensightFile &os, const Field< Type > &fld, const ensightFaces &part, bool parallel)
Specialized Ensight output with extra geometry file header.
const labelList & cellIds() const
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)
errorManipArg< error, int > exit(error &err, const int errNo=1)
labelRange subProcs() const noexcept
label size(const elemType etype) const
#define FatalErrorInFunction
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)
void resize_nocopy(const label len)
A List with indirect addressing.
void writeFieldContent(ensightFile &os, const FieldContainer< Type > &fld, bool parallel)
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)
label size(const elemType etype) const