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();
149 for (
const label
patchId : patchIDs_)
179 label nFaces = nLocalFaces_;
180 label nVerts = nLocalVerts_;
188 if (nFaces != numberOfCells_)
191 <<
"Expecting " << numberOfCells_
192 <<
" faces, but found " << nFaces
198 labelList vertLabels(nLocalFaces_ + nLocalVerts_);
204 auto iter = vertLabels.begin();
206 label off = pointOffset;
208 for (
const label
patchId : patchIDs_)
217 for (
const label pfi :
f)
259 label nVerts = nLocalVerts_;
268 const uint64_t payLoad =
269 vtk::sizeofData<label>(nVerts);
272 format().writeSize(payLoad);
279 auto iter = vertLabels.begin();
281 label off = pointOffset;
283 for (
const label
patchId : patchIDs_)
289 for (
const label pfi :
f)
322 label nOffs = vertOffsets.size();
331 const uint64_t payLoad =
332 vtk::sizeofData<label>(nOffs);
335 format().writeSize(payLoad);
346 auto iter = vertOffsets.begin();
348 for (
const label
patchId : patchIDs_)
352 for (
const face&
f : pp)
418 open(file, parallel);
433 open(file, parallel);
452 patchIDs_.size() == 1
453 ? mesh_.boundaryMesh()[patchIDs_.first()].name()
463 if (patchIDs_.size() == 1)
467 "patch='" + mesh_.boundaryMesh()[patchIDs_.first()].name() +
"'"
474 "npatches='" +
Foam::name(patchIDs_.size()) +
"'"
480 " time='" + mesh_.time().timeName()
481 +
"' index='" +
Foam::name(mesh_.time().timeIndex())
497 const label pointOffset =
504 writePolysLegacy(pointOffset);
508 writePolys(pointOffset);
517 return enter_CellData(numberOfCells_, nFields);
523 return enter_PointData(numberOfPoints_, nFields);
536 <<
"Bad writer state (" << stateNames[state_]
538 <<
") for patchID field" <<
nl <<
endl
544 label nFaces = nLocalFaces_;
555 legacy::intField<1>(
format(),
"patchID", nFaces);
559 const uint64_t payLoad =
560 vtk::sizeofData<label>(nFaces);
562 format().beginDataArray<label>(
"patchID");
563 format().writeSize(payLoad);
569 for (
const label
patchId : patchIDs_)
589 for (label i=0; i < recv.size(); i += 2)
591 const label len = recv[i];
592 const label val = recv[i+1];
612 for (
const label
patchId : patchIDs_)
652 <<
"Bad writer state (" << stateNames[state_]
654 <<
") for patchID field" <<
nl <<
endl
658 label nFaces = nLocalFaces_;
669 legacy::intField<1>(
format(),
"procID", nFaces);
673 const uint64_t payLoad =
674 vtk::sizeofData<label>(nFaces);
676 format().beginDataArray<label>(
"procID");
677 format().writeSize(payLoad);
732 <<
"Bad writer state (" << stateNames[state_]
734 <<
") for patchID field" <<
nl <<
endl
740 label nFaces = nLocalFaces_;
751 legacy::intField<1>(
format(),
"neighID", nFaces);
755 const uint64_t payLoad =
756 vtk::sizeofData<label>(nFaces);
758 format().beginDataArray<label>(
"neighID");
759 format().writeSize(payLoad);
767 for (
const label
patchId : patchIDs_)
771 const label val = (pp ? pp->neighbProcNo() : -1);
793 for (label i=0; i < recv.size(); i += 2)
795 const label len = recv[i];
796 const label val = recv[i+1];
815 for (
const label
patchId : patchIDs_)
820 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 (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.
static bool & parRun()
Test if this a parallel run, or allow modify access.
patchMeshWriter(const patchMeshWriter &)=delete
No copy construct.
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.
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)
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.
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.
label nLocalPoints_
Local number of points.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
static rangeType allProcs(const label communicator=worldComm)
Range of process indices for all processes.
static int myProcNo(const label communicator=worldComm)
Number of this process (starting from masterNo() = 0)
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.