Go to the documentation of this file.
34 void Foam::vtk::surfaceWriter::beginPiece()
37 nLocalPoints_ = points_.get().size();
38 nLocalFaces_ = faces_.get().size();
41 for (
const face&
f : faces_.get())
43 nLocalVerts_ +=
f.size();
46 numberOfPoints_ = nLocalPoints_;
47 numberOfCells_ = nLocalFaces_;
51 reduce(numberOfPoints_, sumOp<label>());
52 reduce(numberOfCells_, sumOp<label>());
71 void Foam::vtk::surfaceWriter::writePoints()
81 const uint64_t payLoad = vtk::sizeofData<float, 3>(numberOfPoints_);
87 format().writeSize(payLoad);
133 toMaster << points_.get();
153 void Foam::vtk::surfaceWriter::writePolysLegacy(
const label pointOffset)
157 label nFaces = nLocalFaces_;
158 label nVerts = nLocalVerts_;
162 reduce(nFaces, sumOp<label>());
163 reduce(nVerts, sumOp<label>());
166 if (nFaces != numberOfCells_)
169 <<
"Expecting " << numberOfCells_
170 <<
" faces, but found " << nFaces
176 labelList vertLabels(nLocalFaces_ + nLocalVerts_);
182 auto iter = vertLabels.begin();
184 label off = pointOffset;
187 for (
const face&
f : faces_.get())
219 void Foam::vtk::surfaceWriter::writePolys(
const label pointOffset)
232 label nVerts = nLocalVerts_;
236 reduce(nVerts, sumOp<label>());
241 const uint64_t payLoad = vtk::sizeofData<label>(nVerts);
251 auto iter = vertLabels.begin();
253 label off = pointOffset;
256 for (
const face&
f : faces_.get())
291 label nOffs = vertOffsets.size();
295 reduce(nOffs, sumOp<label>());
300 const uint64_t payLoad = vtk::sizeofData<label>(nOffs);
303 format().writeSize(payLoad);
310 parallel_ ? globalIndex(nLocalVerts_).localStart() : 0
314 auto iter = vertOffsets.begin();
317 for (
const face&
f : faces_.get())
352 Foam::vtk::surfaceWriter::surfaceWriter
360 points_(std::cref<pointField>(
points)),
361 faces_(std::cref<faceList>(faces)),
374 Foam::vtk::surfaceWriter::surfaceWriter
384 open(file, parallel);
388 Foam::vtk::surfaceWriter::surfaceWriter
399 open(file, parallel);
418 if (instant_.name().size())
422 "time='" + instant_.name() +
"'"
439 const label pointOffset =
446 writePolysLegacy(pointOffset);
450 writePolys(pointOffset);
459 return enter_CellData(numberOfCells_, nFields);
465 return enter_PointData(numberOfPoints_, nFields);
471 if (instant_.name().size())
486 points_ = std::cref<pointField>(
points);
487 faces_ = std::cref<faceList>(faces);
Encapsulated combinations of output format options. This is primarily useful when defining the output...
virtual bool beginFile(std::string title="")
Write file header (non-collective)
List< label > labelList
A List of labels.
vectorField pointField
pointField is a vectorField.
void writeListParallel(vtk::formatter &fmt, const UList< uint8_t > &values)
Write a list of uint8_t values.
void piece(const pointField &points, const faceList &faces)
Reset point, face references to begin a new piece.
Base class for VTK output writers that handle geometry and fields (eg, vtp, vtu data)....
static constexpr int masterNo() noexcept
Process index of the master.
bool legacy() const
Commonly used query.
A class for handling file names.
label localStart() const
My local start.
void writeTimeValue()
Write the currently set time as "TimeValue" FieldData.
virtual bool beginCellData(label nFields=0)
Begin CellData output section for specified number of fields.
void writeTimeValue(scalar timeValue)
Write "TimeValue" FieldData (name as per Catalyst output)
virtual bool writeGeometry()
Write patch topology.
void beginPolys(std::ostream &os, label nPolys, label nConnectivity)
Emit header for POLYGONS (with trailing newline).
virtual bool beginFile(std::string title="")
Write file header (non-collective)
autoPtr< vtk::formatter > format_
The VTK formatter in use (master process)
virtual void setTime(const instant &inst)
Define a time name/value for the output.
word format(conversionProperties.get< word >("format"))
void reduce(const List< UPstream::commsStruct > &comms, T &Value, const BinaryOp &bop, const int tag, const label comm)
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
static int lastSlave(const label communicator=0)
Process index of last slave.
void writeList(vtk::formatter &fmt, const UList< uint8_t > &values)
Write a list of uint8_t values.
void beginPoints(std::ostream &os, label nPoints)
Emit header for POINTS (with trailing newline).
bool parallel_
Writing in parallel (via master)
Calculates a unique integer (label so might not have enough room - 2G max) for processor + local inde...
errorManipArg< error, int > exit(error &err, const int errNo=1)
static bool master(const label communicator=0)
Am I the master process.
static constexpr int firstSlave() noexcept
Process index of first slave.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Write faces/points (optionally with fields) as a vtp file or a legacy vtk file.
vtk::formatter & format()
The VTK formatter in use.
An instant of time. Contains the time value and name.
virtual bool beginPointData(label nFields=0)
Begin PointData for specified number of fields.