51 for (
const face&
f : pp)
88 this->beginPoints(numberOfPoints_);
92 for (
const label
patchId : patchIDs_)
104 const label
nPatches = patchIDs_.size();
132 for (
const label
patchId : patchIDs_)
152 label nPolys = nLocalPolys_;
153 label nPolyConn = nLocalPolyConn_;
161 if (nPolys != numberOfCells_)
164 <<
"Expecting " << numberOfCells_
165 <<
" faces, but found " << nPolys
171 labelList vertLabels(nLocalPolys_ + nLocalPolyConn_);
177 auto iter = vertLabels.
begin();
179 label off = pointOffset;
181 for (
const label
patchId : patchIDs_)
190 for (
const label
id :
f)
232 label nVerts = nLocalPolyConn_;
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)
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);
503 if (isState(outputState::CELL_DATA))
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();
600 if (isState(outputState::CELL_DATA))
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();
Input inter-processor communications stream.
Output inter-processor communications stream.
label nPoints() const
Number of points supporting patch faces.
const Field< point_type > & localPoints() const
Return pointField of points in patch.
const List< face_type > & localFaces() const
Return patch faces addressing into local point list.
UPstream::rangeType subProcs() const noexcept
Range of sub-processes indices associated with PstreamBuffers.
iterator begin() noexcept
Return an iterator to begin traversing the UList.
void size(const label n)
Older name for setAddressableSize.
static constexpr int masterNo() noexcept
Process index of the master (always 0)
static bool & parRun() noexcept
Test if this a parallel run.
A face is a list of labels corresponding to mesh vertices.
A class for handling file names.
Calculates a unique integer (label so might not have enough room - 2G max) for processor + local inde...
label localStart() const
My local start.
A polyBoundaryMesh is a polyPatch list with additional search methods and registered IO.
Mesh consisting of general polyhedral cells.
const polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
A patch is a list of labels that address the faces in the global face list.
splitCell * master() const
Base class for VTK output writers that handle geometry and fields (eg, vtp, vtu data)....
bool legacy() const noexcept
Commonly used query.
autoPtr< vtk::formatter > format_
The VTK formatter in use (only valid on master process)
bool parallel_
Parallel writing (via master)
bool parallel() const noexcept
Parallel output requested?
vtk::outputOptions opts_
Requested output options.
virtual bool open(const fileName &file, bool parallel=Pstream::parRun())
Open file for writing (creates parent directory).
virtual bool beginFile(std::string title="")
Write file header (non-collective)
vtk::formatter & format()
The VTK formatter in use. FatalError for off-processor.
Encapsulated combinations of output format options. This is primarily useful when defining the output...
bool append() const noexcept
True if output format uses an append mode.
Write OpenFOAM patches and patch fields in VTP or legacy vtk format.
label nLocalPolys_
Local number of polys (faces)
bool writeNeighIDs()
Write processor neighbour ids as CellData. This is no-op in serial.
void writePolys(const label pointOffset)
Write patch faces.
label numberOfPoints_
The number of field points for the current Piece.
label nLocalPoints_
Local number of points.
label numberOfCells_
The number of field cells (faces) for the current Piece.
bool writeProcIDs()
Write processor ids as CellData. This is no-op in serial.
label nLocalPolyConn_
Local connectivity count for polys (faces) == sum of face sizes.
void writePoints()
Write patch points.
void writePatchIDs()
Write patch ids as CellData.
virtual bool writeGeometry()
Write patch topology.
virtual bool beginFile(std::string title="")
Write file header (non-collective)
const polyMesh & mesh_
Reference to the OpenFOAM mesh (or subset)
labelList patchIDs_
The selected patch ids.
void writePolysLegacy(const label pointOffset)
Write patch faces, legacy format.
const polyBoundaryMesh & patches
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
void beginPolys(std::ostream &os, label nPolys, label nConnectivity)
Emit header for POLYGONS (with trailing newline).
@ NUMBER_OF_POLYS
"NumberOfPolys"
@ NUMBER_OF_POINTS
"NumberOfPoints"
@ CONNECTIVITY
"connectivity"
fileTag
Some common XML tags for vtk files.
void write(vtk::formatter &fmt, const Type &val, const label n=1)
Component-wise write of a value (N times)
void writeList(vtk::formatter &fmt, const UList< uint8_t > &values)
Write a list of uint8_t values.
void writeListParallel(vtk::formatter &fmt, const UList< Type > &values)
Write a list of values.
Ostream & endl(Ostream &os)
Add newline and flush stream.
void reduce(const List< UPstream::commsStruct > &comms, T &value, const BinaryOp &bop, const int tag, const label comm)
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
T returnReduce(const T &value, const BinaryOp &bop, const int tag=UPstream::msgType(), const label comm=UPstream::worldComm)
Reduce (copy) and return value.
errorManipArg< error, int > exit(error &err, const int errNo=1)
constexpr char nl
The newline '\n' character (0x0a)
word format(conversionProperties.get< word >("format"))