34template<
class LabelListListType>
38 const LabelListListType& listOfLists,
39 const label pointOffset
42 const label off = (pointOffset + 1);
46 for (
const label pointi : listOfLists[listi])
48 os.write(pointi + off);
55template<
template<
typename>
class FieldContainer,
class Type>
59 const FieldContainer<Type>& input,
63 if (cmptBuffer.
size() < input.size())
66 <<
"Component buffer too small: "
67 << cmptBuffer.
size() <<
" < " << input.size() <<
nl
71 auto iter = cmptBuffer.
begin();
73 for (
const Type& val : input)
81template<
template<
typename>
class FieldContainer,
class Type>
85 const FieldContainer<Type>&
fld,
90 parallel = parallel && Pstream::parRun();
101 if (Pstream::master())
105 for (
direction d=0; d < pTraits<Type>::nComponents; ++d)
112 os.writeList(cmptBuffer);
115 for (
const label proci :
procAddr.subProcs())
120 UPstream::commsTypes::scheduled,
125 os.writeList(cmptBuffer);
134 for (
direction d=0; d < pTraits<Type>::nComponents; ++d)
141 UPstream::commsTypes::scheduled,
142 UPstream::masterNo(),
151template<
template<
typename>
class FieldContainer>
156 const word& partName,
158 const FieldContainer<Foam::point>&
fld,
162 parallel = parallel && Pstream::parRun();
164 if (Pstream::master())
166 os.beginPart(partId, partName);
170 ensightOutput::Detail::writeFieldContent(
os,
fld, parallel);
176template<
template<
typename>
class FieldContainer,
class Type>
181 const FieldContainer<Type>&
fld,
185 parallel = parallel && Pstream::parRun();
189 bool hasField = !
fld.empty();
197 if (!hasField)
return false;
201 if (Pstream::master())
203 os.writeKeyword(key);
206 ensightOutput::Detail::writeFieldContent(
os,
fld, parallel);
221 parallel = parallel && Pstream::parRun();
226 if (parallel ? !part.
total() : !part.
size())
return false;
228 bool hasField = !
fld.empty();
236 if (!hasField)
return false;
240 if (Pstream::master())
245 for (
int typei=0; typei < ensightFaces::nTypes; ++typei)
249 ensightOutput::Detail::writeFieldComponents
252 ensightFaces::key(etype),
271 parallel = parallel && Pstream::parRun();
276 if (parallel ? !part.
total() : !part.
size())
return false;
278 bool hasField = !
fld.empty();
286 if (!hasField)
return false;
296 if (!validAddressing)
299 <<
"Called without faceOrder having been set" <<
nl
304 if (Pstream::master())
309 for (
int typei=0; typei < ensightFaces::nTypes; ++typei)
313 ensightOutput::Detail::writeFieldComponents
316 ensightFaces::key(etype),
337 parallel = parallel && Pstream::parRun();
342 if (parallel ? !part.
total() : !part.
size())
return false;
344 bool hasField = !
fld.empty();
352 if (!hasField)
return false;
356 if (Pstream::master())
361 for (
int typei=0; typei < ensightCells::nTypes; ++typei)
365 ensightOutput::Detail::writeFieldComponents
368 ensightCells::key(etype),
387 parallel = parallel && Pstream::parRun();
392 if (parallel ? !part.
total() : !part.
size())
return false;
394 bool hasField = !
fld.empty();
402 if (!hasField)
return false;
406 if (Pstream::master())
411 for (
int typei=0; typei < ensightFaces::nTypes; ++typei)
415 ensightOutput::Detail::writeFieldComponents
418 ensightFaces::key(etype),
Info<< nl<< "Wrote faMesh in vtk format: "<< writer.output().name()<< nl;}{ vtk::lineWriter writer(aMesh.points(), aMesh.edges(), fileName(aMesh.mesh().time().globalPath()/"finiteArea-edges"));writer.writeGeometry();writer.beginCellData(4);writer.writeProcIDs();{ Field< scalar > fld(faMeshTools::flattenEdgeField(aMesh.magLe(), true))
globalIndex procAddr(aMesh.nFaces())
reduce(hasMovingMesh, orOp< bool >())
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects.
void resize_nocopy(const label len)
Generic templated field type.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
SubField is a Field obtained as a section of another Field, without its own allocation....
A List with indirect addressing. Like IndirectList but does not store addressing.
iterator begin() noexcept
Return an iterator to begin traversing the UList.
char * data_bytes() noexcept
Return pointer to the underlying array serving as data storage,.
const char * cdata_bytes() const noexcept
Return pointer to the underlying array serving as data storage,.
void size(const label n)
Older name for setAddressableSize.
std::streamsize size_bytes() const noexcept
Number of contiguous bytes for the List data.
Sorting/classification of cells (3D) into corresponding ensight element types.
label size(const elemType etype) const
Processor-local size of the specified element type.
elemType
Supported ensight 'Cell' element types.
label total() const
The global size of all element types.
const labelList & cellIds() const
Processor-local cell ids of all elements.
Sorting/classification of faces (2D) into corresponding ensight types.
labelRange range(const elemType etype) const
Processor-local offset/size of element type.
const labelList & faceIds() const noexcept
Processor-local face ids of all elements.
const labelList & faceOrder() const noexcept
label size(const elemType etype) const
Processor-local size of the specified element type.
elemType
Supported ensight 'Face' element types.
label total() const
The global size of all element types.
Ensight output with specialized write() for strings, integers and floats. Correctly handles binary wr...
Specialized Ensight output with extra geometry file header.
label index() const noexcept
The index in a list (0-based)
Calculates a unique integer (label so might not have enough room - 2G max) for processor + local inde...
A class for handling words, derived from Foam::string.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
OBJstream os(runTime.globalPath()/outputName)
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.
bool writeFaceSubField(ensightFile &os, const Field< Type > &fld, const ensightFaces &part, bool parallel)
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 copyComponent(List< scalar > &cmptBuffer, const FieldContainer< Type > &input, const direction cmpt)
void writeFieldContent(ensightFile &os, const FieldContainer< Type > &fld, bool parallel)
Write field content (component-wise)
void writeLabelListList(ensightGeoFile &os, const labelUList &offsets, const labelUList &values, const label pointOffset)
Write CompactListList<label> by components.
bool writeFaceLocalField(ensightFile &os, const Field< Type > &fld, const ensightFaces &part, bool parallel)
bool writeField(ensightFile &os, const Field< Type > &fld, const ensightCells &part, bool parallel)
void component(FieldField< Field, typename FieldField< Field, Type >::cmptType > &sf, const FieldField< Field, Type > &f, const direction d)
errorManipArg< error, int > exit(error &err, const int errNo=1)
constexpr char nl
The newline '\n' character (0x0a)
#define forAll(list, i)
Loop across all elements in list.
Ensight names and component order for base types.