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:
119 void Foam::vtk::coordSetWriter::writePoints()
134 void Foam::vtk::coordSetWriter::writeVertsLegacy()
142 const label nLocalConns = nLocalVerts_;
146 labelList vertLabels(nLocalVerts_ + nLocalConns);
148 auto iter = vertLabels.begin();
150 for (label pointi = 0; pointi < nLocalVerts_; ++pointi)
165 void Foam::vtk::coordSetWriter::writeLinesLegacy()
173 label nLocalConns = nLocalPoints_;
177 labelList vertLabels(nLocalLines_ + nLocalConns);
179 auto iter = vertLabels.begin();
181 label localPointi = 0;
184 label npts =
pts.size();
191 *iter++ = localPointi;
206 void Foam::vtk::coordSetWriter::writeVerts()
214 const label nLocalConns = nLocalVerts_;
226 label nOffs = vertOffsets.size();
235 const uint64_t payLoad = vtk::sizeofData<label>(nOffs);
238 format().writeSize(payLoad);
250 auto iter = vertOffsets.begin();
252 for (label pointi = 0; pointi < nLocalVerts_; ++pointi)
274 label nConns = nLocalConns;
283 const uint64_t payLoad = vtk::sizeofData<label>(nConns);
286 format().writeSize(payLoad *
sizeof(label));
293 auto iter = vertLabels.begin();
295 for (label pointi = 0; pointi < nLocalVerts_; ++pointi)
318 void Foam::vtk::coordSetWriter::writeLines()
326 label nLocalConns = nLocalPoints_;
338 label nOffs = vertOffsets.size();
347 const uint64_t payLoad = vtk::sizeofData<label>(nOffs);
350 format().writeSize(payLoad);
362 auto iter = vertOffsets.begin();
366 const label npts =
pts.size();
391 label nConns = nLocalConns;
400 const uint64_t payLoad = vtk::sizeofData<label>(nConns);
403 format().writeSize(payLoad *
sizeof(label));
410 auto iter = vertLabels.begin();
412 label localPointi = 0;
415 label npts =
pts.size();
419 *iter++ = localPointi;
444 Foam::vtk::coordSetWriter::coordSetWriter
450 vtk::polyWriter(opts),
454 elemOutput_(DEFAULT_ELEMENTS)
458 Foam::vtk::coordSetWriter::coordSetWriter
467 open(file, parallel);
471 Foam::vtk::coordSetWriter::coordSetWriter
489 const elemOutputType elemOutput
492 elemOutput_ = elemOutput;
519 if (!instant_.name().empty())
523 "time='" + instant_.name() +
"'" 562 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 or for each point as PointData, depending on isPointDat...
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)
label numberOfPoints_
The number of field points for the current Piece.
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).
label numberOfCells_
The number of field cells (edges or faces) for the current Piece.