Go to the documentation of this file.
51 for (
const face&
f : pp)
92 for (
const label
patchId : patchIDs_)
104 const label
nPatches = patchIDs_.size();
132 for (
const label
patchId : patchIDs_)
152 label nPolys = nLocalPolys_;
153 label nVerts = nLocalVerts_;
161 if (nPolys != numberOfCells_)
164 <<
"Expecting " << numberOfCells_
165 <<
" faces, but found " << nPolys
171 labelList vertLabels(nLocalPolys_ + nLocalVerts_);
177 auto iter = vertLabels.begin();
179 label off = pointOffset;
181 for (
const label
patchId : patchIDs_)
190 for (
const label
id :
f)
232 label nVerts = nLocalVerts_;
241 const uint64_t payLoad =
242 vtk::sizeofData<label>(nVerts);
245 format().writeSize(payLoad);
252 auto iter = vertLabels.begin();
254 label off = pointOffset;
256 for (
const label
patchId : patchIDs_)
262 for (
const label
id :
f)
295 label nOffs = vertOffsets.size();
304 const uint64_t payLoad =
305 vtk::sizeofData<label>(nOffs);
308 format().writeSize(payLoad);
319 auto iter = vertOffsets.begin();
321 for (
const label
patchId : patchIDs_)
325 for (
const face&
f : pp)
392 open(file, parallel);
407 open(file, parallel);
426 patchIDs_.size() == 1
427 ? mesh_.boundaryMesh()[patchIDs_.first()].name()
437 if (patchIDs_.size() == 1)
441 "patch='" + mesh_.boundaryMesh()[patchIDs_.first()].name() +
"'"
448 "npatches='" +
Foam::name(patchIDs_.size()) +
"'"
454 " time='" + mesh_.time().timeName()
455 +
"' index='" +
Foam::name(mesh_.time().timeIndex())
471 const label pointOffset =
478 writePolysLegacy(pointOffset);
482 writePolys(pointOffset);
491 return enter_CellData(numberOfCells_, nFields);
497 return enter_PointData(numberOfPoints_, nFields);
510 <<
" for patchID field" <<
nl <<
endl
516 label nPolys = nLocalPolys_;
524 this->beginDataArray<label>(
"patchID", nPolys);
528 for (
const label
patchId : patchIDs_)
548 for (label i=0; i < recv.size(); i += 2)
550 const label len = recv[i];
551 const label val = recv[i+1];
569 for (
const label
patchId : patchIDs_)
582 this->endDataArray();
607 <<
" for patchID field" <<
nl <<
endl
613 label nPolys = nLocalPolys_;
621 this->beginDataArray<label>(
"neighID", nPolys);
627 for (
const label
patchId : patchIDs_)
631 const label val = (pp ? pp->neighbProcNo() : -1);
653 for (label i=0; i < recv.size(); i += 2)
655 const label len = recv[i];
656 const label val = recv[i+1];
674 for (
const label
patchId : patchIDs_)
679 send[i+1] = (pp ? pp->neighbProcNo() : -1);
688 this->endDataArray();
Encapsulated combinations of output format options. This is primarily useful when defining the output...
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 (always 0)
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.
patchMeshWriter(const patchMeshWriter &)=delete
No copy construct.
label nLocalPolys_
Local number of polys (faces)
void beginPolys(std::ostream &os, label nPolys, label nConnectivity)
Emit header for POLYGONS (with trailing newline).
static bool master(const label communicator=worldComm)
Am I the master process.
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.
autoPtr< vtk::formatter > format_
The VTK formatter in use (only valid on 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)
static rangeType subProcs(const label communicator=worldComm)
Range of process indices for sub-processes.
label nLocalVerts_
Local face vertices (connectivity) count. Sum of face sizes.
A patch is a list of labels that address the faces in the global face list.
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
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.
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.
static bool & parRun() noexcept
Test if this a parallel run.
virtual bool writeGeometry()
Write patch topology.
bool writeProcIDs(const label nValues)
Write nValues of processor ids as CellData (no-op in serial)
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.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
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 writeListParallel(vtk::formatter &fmt, const UList< Type > &values)
Write a list of values.
void writePatchIDs()
Write patch ids as CellData.
void writePolys(const label pointOffset)
Write patch faces.