Go to the documentation of this file.
50 for (
const face&
f : pp)
95 const uint64_t payLoad =
96 vtk::sizeofData<float, 3>(numberOfPoints_);
102 format().writeSize(payLoad);
109 for (
const label
patchId : patchIDs_)
121 const label
nPatches = patchIDs_.size();
154 for (
const label
patchId : patchIDs_)
184 label nFaces = nLocalFaces_;
185 label nVerts = nLocalVerts_;
193 if (nFaces != numberOfCells_)
196 <<
"Expecting " << numberOfCells_
197 <<
" faces, but found " << nFaces
203 labelList vertLabels(nLocalFaces_ + nLocalVerts_);
209 auto iter = vertLabels.begin();
211 label off = pointOffset;
213 for (
const label
patchId : patchIDs_)
222 for (
const label pfi :
f)
264 label nVerts = nLocalVerts_;
273 const uint64_t payLoad =
274 vtk::sizeofData<label>(nVerts);
277 format().writeSize(payLoad);
284 auto iter = vertLabels.begin();
286 label off = pointOffset;
288 for (
const label
patchId : patchIDs_)
294 for (
const label pfi :
f)
327 label nOffs = vertOffsets.size();
336 const uint64_t payLoad =
337 vtk::sizeofData<label>(nOffs);
340 format().writeSize(payLoad);
351 auto iter = vertOffsets.begin();
353 for (
const label
patchId : patchIDs_)
357 for (
const face&
f : pp)
423 open(file, parallel);
438 open(file, parallel);
457 patchIDs_.size() == 1
458 ? mesh_.boundaryMesh()[patchIDs_.first()].name()
468 if (patchIDs_.size() == 1)
472 "patch='" + mesh_.boundaryMesh()[patchIDs_.first()].name() +
"'"
479 "npatches='" +
Foam::name(patchIDs_.size()) +
"'"
485 " time='" + mesh_.time().timeName()
486 +
"' index='" +
Foam::name(mesh_.time().timeIndex())
502 const label pointOffset =
509 writePolysLegacy(pointOffset);
513 writePolys(pointOffset);
522 return enter_CellData(numberOfCells_, nFields);
528 return enter_PointData(numberOfPoints_, nFields);
541 <<
"Bad writer state (" << stateNames[state_]
543 <<
") for patchID field" <<
nl <<
endl
549 label nFaces = nLocalFaces_;
560 legacy::intField<1>(
format(),
"patchID", nFaces);
564 const uint64_t payLoad =
565 vtk::sizeofData<label>(nFaces);
567 format().beginDataArray<label>(
"patchID");
568 format().writeSize(payLoad);
574 for (
const label
patchId : patchIDs_)
599 for (label i=0; i < recv.size(); i += 2)
601 const label len = recv[i];
602 const label val = recv[i+1];
622 for (
const label
patchId : patchIDs_)
662 <<
"Bad writer state (" << stateNames[state_]
664 <<
") for patchID field" <<
nl <<
endl
668 label nFaces = nLocalFaces_;
679 legacy::intField<1>(
format(),
"procID", nFaces);
683 const uint64_t payLoad =
684 vtk::sizeofData<label>(nFaces);
686 format().beginDataArray<label>(
"procID");
687 format().writeSize(payLoad);
742 <<
"Bad writer state (" << stateNames[state_]
744 <<
") for patchID field" <<
nl <<
endl
750 label nFaces = nLocalFaces_;
761 legacy::intField<1>(
format(),
"neighID", nFaces);
765 const uint64_t payLoad =
766 vtk::sizeofData<label>(nFaces);
768 format().beginDataArray<label>(
"neighID");
769 format().writeSize(payLoad);
777 for (
const label
patchId : patchIDs_)
781 const label val = (pp ? pp->neighbProcNo() : -1);
808 for (label i=0; i < recv.size(); i += 2)
810 const label len = recv[i];
811 const label val = recv[i+1];
830 for (
const label
patchId : patchIDs_)
835 send[i+1] = (pp ? pp->neighbProcNo() : -1);
Encapsulated combinations of output format options. This is primarily useful when defining the output...
void writeListParallel(vtk::formatter &fmt, const UList< uint8_t > &values)
Write a list of uint8_t values.
virtual bool beginPointData(label nFields=0)
Begin PointData for specified number of fields.
void writePolysLegacy(const label pointOffset)
Write patch faces, legacy format.
Base class for VTK output writers that handle geometry and fields (eg, vtp, vtu data)....
Write OpenFOAM patches and patch fields in VTP or legacy vtk format.
static constexpr int masterNo() noexcept
Process index of the master.
bool legacy() const
Commonly used query.
A class for handling file names.
bool writeProcIDs()
Write processor ids as CellData. This is no-op in serial.
T returnReduce(const T &Value, const BinaryOp &bop, const int tag=Pstream::msgType(), const label comm=UPstream::worldComm)
A polyBoundaryMesh is a polyPatch list with additional search methods and registered IO.
label localStart() const
My local start.
Output inter-processor communications stream.
static label nProcs(const label communicator=0)
Number of processes in parallel run.
static bool & parRun()
Is this a parallel run?
patchMeshWriter(const patchMeshWriter &)=delete
No copy construct.
void beginPolys(std::ostream &os, label nPolys, label nConnectivity)
Emit header for POLYGONS (with trailing newline).
label localSize() const
My local size.
virtual bool beginFile(std::string title="")
Write file header (non-collective)
const polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
Ostream & endl(Ostream &os)
Add newline and flush stream.
label nLocalFaces_
Local number of faces.
autoPtr< vtk::formatter > format_
The VTK formatter in use (master process)
Mesh consisting of general polyhedral cells.
bool writeNeighIDs()
Write processor neighbour ids as CellData. This is no-op in serial.
word format(conversionProperties.get< word >("format"))
void reduce(const List< UPstream::commsStruct > &comms, T &Value, const BinaryOp &bop, const int tag, const label comm)
const polyMesh & mesh_
Reference to the OpenFOAM mesh (or subset)
label nLocalVerts_
Local face vertices (connectivity) count. Sum of face sizes.
static int lastSlave(const label communicator=0)
Process index of last slave.
A patch is a list of labels that address the faces in the global face list.
word name(const complex &c)
Return string representation of complex.
void writeList(vtk::formatter &fmt, const UList< uint8_t > &values)
Write a list of uint8_t values.
virtual bool beginFile(std::string title="")
Write file header (non-collective)
void beginPoints(std::ostream &os, label nPoints)
Emit header for POINTS (with trailing newline).
label nPoints() const
Return number of points supporting patch faces.
bool parallel_
Writing in parallel (via master)
const List< face_type > & localFaces() const
Return patch faces addressing into local point list.
Calculates a unique integer (label so might not have enough room - 2G max) for processor + local inde...
virtual bool beginCellData(label nFields=0)
Begin CellData output section for specified number of fields.
errorManipArg< error, int > exit(error &err, const int errNo=1)
const Field< point_type > & localPoints() const
Return pointField of points in patch.
static int myProcNo(const label communicator=0)
Number of this process (starting from masterNo() = 0)
static bool master(const label communicator=0)
Am I the master process.
static constexpr int firstSlave() noexcept
Process index of first slave.
label nLocalPoints_
Local number of points.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
label numberOfPoints_
The number of field points for the current Piece.
virtual bool writeGeometry()
Write patch topology.
const polyBoundaryMesh & patches
void write(vtk::formatter &fmt, const Type &val, const label n=1)
Component-wise write of a value (N times)
labelList patchIDs_
The selected patch ids.
label numberOfCells_
The number of field cells (faces) for the current Piece.
void writePoints()
Write patch points.
Input inter-processor communications stream.
A face is a list of labels corresponding to mesh vertices.
vtk::formatter & format()
The VTK formatter in use.
void writePatchIDs()
Write patch ids as CellData.
void writePolys(const label pointOffset)
Write patch faces.