34 void Foam::vtk::coordSetWriter::beginPiece()
44 const label npts =
pts.size();
55 case elemOutputType::NO_ELEMENTS:
60 case elemOutputType::DEFAULT_ELEMENTS:
62 if (points_.size() < 2)
70 case elemOutputType::POINT_ELEMENTS:
76 case elemOutputType::LINE_ELEMENTS:
106 void Foam::vtk::coordSetWriter::writePoints()
121 void Foam::vtk::coordSetWriter::writeVertsLegacy()
129 const label nLocalConns = nLocalVerts_;
133 labelList vertLabels(nLocalVerts_ + nLocalConns);
135 auto iter = vertLabels.begin();
137 for (label pointi = 0; pointi < nLocalVerts_; ++pointi)
152 void Foam::vtk::coordSetWriter::writeLinesLegacy()
160 label nLocalConns = nLocalPoints_;
164 labelList vertLabels(nLocalLines_ + nLocalConns);
166 auto iter = vertLabels.begin();
168 label localPointi = 0;
171 label npts =
pts.size();
178 *iter++ = localPointi;
193 void Foam::vtk::coordSetWriter::writeVerts()
201 const label nLocalConns = nLocalVerts_;
213 label nOffs = vertOffsets.size();
222 const uint64_t payLoad = vtk::sizeofData<label>(nOffs);
225 format().writeSize(payLoad);
237 auto iter = vertOffsets.begin();
239 for (label pointi = 0; pointi < nLocalVerts_; ++pointi)
261 label nConns = nLocalConns;
270 const uint64_t payLoad = vtk::sizeofData<label>(nConns);
273 format().writeSize(payLoad *
sizeof(label));
280 auto iter = vertLabels.begin();
282 for (label pointi = 0; pointi < nLocalVerts_; ++pointi)
305 void Foam::vtk::coordSetWriter::writeLines()
313 label nLocalConns = nLocalPoints_;
325 label nOffs = vertOffsets.size();
334 const uint64_t payLoad = vtk::sizeofData<label>(nOffs);
337 format().writeSize(payLoad);
349 auto iter = vertOffsets.begin();
353 const label npts =
pts.size();
378 label nConns = nLocalConns;
387 const uint64_t payLoad = vtk::sizeofData<label>(nConns);
390 format().writeSize(payLoad *
sizeof(label));
397 auto iter = vertLabels.begin();
399 label localPointi = 0;
402 label npts =
pts.size();
406 *iter++ = localPointi;
431 Foam::vtk::coordSetWriter::coordSetWriter
437 vtk::polyWriter(opts),
441 elemOutput_(DEFAULT_ELEMENTS)
445 Foam::vtk::coordSetWriter::coordSetWriter
454 open(file, parallel);
458 Foam::vtk::coordSetWriter::coordSetWriter
476 const elemOutputType elemOutput
479 elemOutput_ = elemOutput;
506 if (!instant_.name().empty())
510 "time='" + instant_.name() +
"'" 549 if (!instant_.name().empty())
bool parallel() const noexcept
Parallel output requested?
virtual void setTime(const instant &inst)
Define a time name/value for the output.
autoPtr< vtk::formatter > format_
The VTK formatter in use (only valid on master process)
void setElementType(const elemOutputType elemOutput)
Define preferred element type.
A class for handling file names.
label nLocalVerts_
Local number of vertices (points)
vtk::formatter & format()
The VTK formatter in use. FatalError for off-processor.
bool writeProcIDs()
Write processor ids for each line as CellData (no-op in serial)
Write as points/lines, optionally with fields, as a vtp file or a legacy vtk file.
void writeTimeValue()
Write the currently set time as "TimeValue" FieldData.
void writeTimeValue(scalar timeValue)
Write "TimeValue" FieldData (name as per Catalyst output)
bool legacy() const noexcept
Commonly used query.
Encapsulated combinations of output format options. This is primarily useful when defining the output...
void beginPoints(std::ostream &os, label nPoints)
Emit header for POINTS (with trailing newline).
label nLocalLines_
Local number of lines (edges)
vectorField pointField
pointField is a vectorField.
virtual bool open(const fileName &file, bool parallel=false)
Open file for writing. Non-parallel only.
label nLocalPoints_
Local number of points.
A list of pointers to objects of type <T>, without allocation/deallocation management of the pointers...
void beginLines(std::ostream &os, label nLines, label nConnectivity=0)
Emit header for LINES (with trailing newline).
void writeList(vtk::formatter &fmt, const UList< uint8_t > &values)
Write a list of uint8_t values.
virtual bool open(const fileName &file, bool parallel=UPstream::parRun())
Open file for writing (creates parent directory).
virtual bool writeGeometry()
Write patch topology.
word format(conversionProperties.get< word >("format"))
An instant of time. Contains the time value and name. Uses Foam::Time when formatting the name...
virtual bool beginFile(std::string title="")
Write file header (non-collective)
void piece(const UPtrList< const pointField > &points)
Reset point references to begin a new piece.
label nLocalPolys_
Local number of polys (faces)
virtual bool beginFile(std::string title="")
Write file header (non-collective)
List< label > labelList
A List of labels.
void beginVerts(std::ostream &os, label nVerts, label nConnectivity=0)
Emit header for VERTICES (with trailing newline).