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