50 #ifndef Foam_vtk_fileWriter_H 51 #define Foam_vtk_fileWriter_H 146 const
word& fieldName,
190 const
word& fieldName,
200 const
word& fieldName,
350 #include "foamVtkFileWriterI.H" bool notState(outputState test) const noexcept
True if output state does not correspond to the test state.
bool parallel() const noexcept
Parallel output requested?
autoPtr< vtk::formatter > format_
The VTK formatter in use (only valid on master process)
A class for handling file names.
vtk::fileTag contentType_
The content type (PolyData, UnstructuredGrid ...)
label nCellData() const noexcept
The number of CellData written for the Piece thus far.
void checkFormatterValidity() const
Verify that formatter in either allocated or not required.
bool isCellData() const noexcept
True if output state corresponds to CELL_DATA.
vtk::formatter & format()
The VTK formatter in use. FatalError for off-processor.
label nCellData_
The number of CellData written for the Piece thus far.
Base class for VTK output writers that handle geometry and fields (eg, vtp, vtu data). These output formats are structured as DECLARED, FIELD_DATA, PIECE followed by any CELL_DATA or POINT_DATA.
vtk::outputOptions opts_
Requested output options.
void endDataArray()
Flush formatter and end of DataArray output (non-legacy)
void writeBasicField(const word &fieldName, const UList< Type > &field)
Write basic (primitive) field content.
bool enter_CellData(label nEntries, label nFields)
Trigger change state to CellData.
bool enter_PointData(label nEntries, label nFields)
Trigger change state to PointData.
vtk::outputOptions opts() const noexcept
The output options in use.
File contents declared (VTKFile header written)
void writeTimeValue(scalar timeValue)
Write "TimeValue" FieldData (name as per Catalyst output)
outputState
Internal tracking of the output state.
virtual bool beginPointData(label nFields=0)=0
Begin PointData for specified number of fields.
label nPointData_
The number of PointData written for the Piece thus far.
bool isState(outputState test) const noexcept
True if output state corresponds to the test state.
bool endFieldData()
Explicitly end FieldData output and switch to DECLARED state.
bool parallel_
Parallel writing (via master)
void endPoints()
End of a POINTS DataArray.
bool legacy() const noexcept
Commonly used query.
outputState state_
The output state.
Encapsulated combinations of output format options. This is primarily useful when defining the output...
Ostream & reportBadState(Ostream &, outputState expected) const
Generate message reporting bad writer state.
bool enter_Piece()
Trigger change state to Piece. Resets nCellData_, nPointData_.
bool writeProcIDs(const label nValues)
Write nValues of processor ids as CellData or PointData (no-op in serial)
word ext() const
File extension for current format type.
A class for handling words, derived from Foam::string.
virtual bool writeGeometry()=0
Write mesh topology.
bool endCellData()
Explicitly end CellData output and switch to PIECE state.
bool endPointData()
Explicitly end PointData output and switch to PIECE state.
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
vtk::fileTag contentType() const noexcept
The content type.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
virtual bool open(const fileName &file, bool parallel=UPstream::parRun())
Open file for writing (creates parent directory).
bool beginFieldData(label nFields=0)
Begin FieldData output section for specified number of fields.
virtual bool beginFile(std::string title="")
Write file header (non-collective)
bool isPointData() const noexcept
True if output state corresponds to POINT_DATA.
void beginPoints(const label nPoints)
Start of a POINTS DataArray.
void writeUniform(const word &fieldName, const Type &val, const label nValues)
Write uniform field content.
fileTag
Some common XML tags for vtk files.
static const Enum< outputState > stateNames
Names for the output state (for messages, not for file output).
void close()
End the file contents and close the file after writing.
bool endPiece()
Explicitly end Piece output and switch to DECLARED state.
Pointer management similar to std::unique_ptr, with some additional methods and type checking...
fileName outputFile_
The output file name.
label nPointData() const noexcept
The number of PointData written for the Piece thus far.
const fileName & output() const noexcept
The current output file name.
std::ofstream & os() noexcept
The backend ostream in use.
std::ofstream os_
The backend ostream in use (only opened on master process)
bool exit_File()
Emit file footer (end data, end piece, end file)
void beginDataArray(const word &fieldName, const label nValues)
Start of a field or DataArray output (legacy or non-legacy).
Inter-processor communications stream.
const word & state() const
The output state in printable format.
Inside Piece (after geometry write)
virtual bool beginCellData(label nFields=0)=0
Begin CellData output section for specified number of fields.