Write faces/points (optionally with fields) as a vtp file or a legacy vtk file. More...
Public Member Functions | |
polyWriter (const vtk::outputOptions opts=vtk::formatType::INLINE_BASE64) | |
Construct from components (default format INLINE_BASE64) More... | |
polyWriter (const fileName &file, bool parallel=Pstream::parRun()) | |
polyWriter (const vtk::outputOptions opts, const fileName &file, bool parallel=Pstream::parRun()) | |
Construct from components and open the file for writing. More... | |
virtual | ~polyWriter ()=default |
Destructor. More... | |
virtual bool | writeGeometry () |
Dummy write mesh topology method - Fatal if called. More... | |
bool | writeLineGeometry (const pointField &points, const edgeList &edges) |
bool | writePolyGeometry (const pointField &points, const faceList &faces) |
virtual bool | beginCellData (label nFields=0) |
Begin CellData output section for specified number of fields. More... | |
virtual bool | beginPointData (label nFields=0) |
Begin PointData for specified number of fields. More... | |
template<class Type > | |
void | write (const word &fieldName, const UList< Type > &field) |
Write primitive field of CellData (Poly or Line) or PointData values. More... | |
template<class Type > | |
void | writeCellData (const word &fieldName, const UList< Type > &field) |
Write primitive field of CellData. More... | |
template<class Type > | |
void | writePointData (const word &fieldName, const UList< Type > &field) |
Write primitive field of PointData. More... | |
![]() | |
fileWriter (const vtk::fileTag contentType, const vtk::outputOptions opts) | |
Construct from components. More... | |
virtual | ~fileWriter () |
Destructor. More... | |
vtk::fileTag | contentType () const |
The content type. More... | |
vtk::outputOptions | opts () const |
The output options in use. More... | |
word | ext () const |
File extension for current format type. More... | |
bool | legacy () const |
Commonly used query. More... | |
bool | parallel () const noexcept |
Parallel output requested? More... | |
const word & | state () const |
The output state in printable format. More... | |
const fileName & | output () const noexcept |
The current output file name. More... | |
bool | open (const fileName &file, bool parallel=Pstream::parRun()) |
Open file for writing (creates parent directory). More... | |
void | close () |
End the file contents and close the file after writing. More... | |
virtual bool | beginFile (std::string title="") |
Write file header (non-collective) More... | |
bool | beginFieldData (label nFields=0) |
Begin FieldData output section for specified number of fields. More... | |
label | nCellData () const noexcept |
Return the number of CellData written for the Piece thus far. More... | |
label | nPointData () const noexcept |
Return the number of PointData written for the Piece thus far. More... | |
bool | endFieldData () |
Explicitly end FieldData output and switch to DECLARED state. More... | |
bool | endCellData () |
Explicitly end CellData output and switch to PIECE state. More... | |
bool | endPointData () |
Explicitly end PointData output and switch to PIECE state. More... | |
void | writeTimeValue (scalar timeValue) |
Write "TimeValue" FieldData (name as per Catalyst output) More... | |
Static Public Member Functions | |
static word | ext (vtk::outputOptions opts) |
File extension for given output type. More... | |
Protected Member Functions | |
template<class Type > | |
void | writeUniformValue (const label nCellValues, const word &fieldName, const Type &val) |
Write a uniform field of Cell (Poly or Line) or Point values. More... | |
![]() | |
void | checkFormatterValidity () const |
Verify that formatter in either allocated or not required. More... | |
Ostream & | reportBadState (Ostream &, outputState expected) const |
Generate message reporting bad writer state. More... | |
Ostream & | reportBadState (Ostream &, outputState, outputState) const |
Generate message reporting bad writer state. More... | |
std::ofstream & | os () noexcept |
The backend ostream in use. More... | |
vtk::formatter & | format () |
The VTK formatter in use. More... | |
bool | isState (outputState test) const noexcept |
True if output state corresponds to the test state. More... | |
bool | notState (outputState test) const noexcept |
True if output state does not correspond to the test state. More... | |
template<class Type > | |
void | beginDataArray (const word &fieldName, const label nValues) |
Start of a field or DataArray output (legacy or non-legacy). More... | |
void | endDataArray () |
Flush formatter and end of DataArray output (non-legacy) More... | |
void | beginPoints (const label nPoints) |
Start of a POINTS DataArray. More... | |
void | endPoints () |
End of a POINTS DataArray. More... | |
bool | enter_Piece () |
Trigger change state to Piece. Resets nCellData_, nPointData_. More... | |
bool | endPiece () |
Explicitly end Piece output and switch to DECLARED state. More... | |
bool | enter_CellData (label nEntries, label nFields) |
Trigger change state to CellData. More... | |
bool | enter_PointData (label nEntries, label nFields) |
Trigger change state to PointData. More... | |
bool | exit_File () |
Emit file footer (end data, end piece, end file) More... | |
template<class Type > | |
void | writeUniform (const word &fieldName, const Type &val, const label nValues) |
Write uniform field content. More... | |
template<class Type > | |
void | writeBasicField (const word &fieldName, const UList< Type > &field) |
Write basic (primitive) field content. More... | |
bool | writeProcIDs (const label nValues) |
Write nValues of processor ids as CellData (no-op in serial) More... | |
fileWriter (const fileWriter &)=delete | |
No copy construct. More... | |
void | operator= (const fileWriter &)=delete |
No copy assignment. More... | |
Protected Attributes | |
label | numberOfPoints_ |
The number of field points for the current Piece. More... | |
label | numberOfCells_ |
The number of field cells (edges or faces) for the current Piece. More... | |
label | nLocalPoints_ |
Local number of points. More... | |
label | nLocalLines_ |
Local number of lines (edges) More... | |
label | nLocalPolys_ |
Local number of polys (faces) More... | |
![]() | |
vtk::fileTag | contentType_ |
The content type. More... | |
outputOptions | opts_ |
The requested output options. More... | |
bool | parallel_ |
Writing in parallel (via master) More... | |
outputState | state_ |
The output state. More... | |
label | nCellData_ |
The number of CellData written for the Piece thus far. More... | |
label | nPointData_ |
The number of PointData written for the Piece thus far. More... | |
fileName | outputFile_ |
The output file name. More... | |
autoPtr< vtk::formatter > | format_ |
The VTK formatter in use (only valid on master process) More... | |
std::ofstream | os_ |
The backend ostream in use (only opened on master process) More... | |
Additional Inherited Members | |
![]() | |
enum | outputState { CLOSED = 0, OPENED, DECLARED, FIELD_DATA, PIECE, CELL_DATA, POINT_DATA } |
Internal tracking of the output state. More... | |
![]() | |
static const Enum< outputState > | stateNames |
Names for the output state (for messages, not for file output). More... | |
Write faces/points (optionally with fields) as a vtp file or a legacy vtk file.
The file output states are managed by the Foam::vtk::fileWriter class. FieldData (eg, TimeValue) must appear before any geometry pieces.
Definition at line 67 of file foamVtkPolyWriter.H.
|
explicit |
Construct from components (default format INLINE_BASE64)
Definition at line 563 of file foamVtkPolyWriter.C.
|
explicit |
Construct from components (default format INLINE_BASE64), and open the file for writing.
The file name is with/without an extension.
Definition at line 580 of file foamVtkPolyWriter.C.
polyWriter | ( | const vtk::outputOptions | opts, |
const fileName & | file, | ||
bool | parallel = Pstream::parRun() |
||
) |
Construct from components and open the file for writing.
The file name is with/without an extension.
Definition at line 593 of file foamVtkPolyWriter.C.
|
virtualdefault |
Destructor.
|
protected |
Write a uniform field of Cell (Poly or Line) or Point values.
Definition at line 32 of file foamVtkPolyWriterTemplates.C.
References Foam::endl(), Foam::exit(), Foam::FatalError, FatalErrorInFunction, Foam::nl, and Foam::expressions::POINT_DATA.
|
inlinestatic |
File extension for given output type.
Definition at line 179 of file foamVtkPolyWriter.H.
References outputOptions::ext(), fileWriter::opts(), and Foam::vtk::POLY_DATA.
|
virtual |
Dummy write mesh topology method - Fatal if called.
Provided for special-purpose writers that do not hold their own geomety, but use writePolyGeometry() directly
Implements fileWriter.
Reimplemented in GenericPatchWriter< PatchType >, lineWriter, and surfaceWriter.
Definition at line 607 of file foamVtkPolyWriter.C.
References Foam::abort(), Foam::endl(), Foam::FatalError, FatalErrorInFunction, and Foam::nl.
bool writeLineGeometry | ( | const pointField & | points, |
const edgeList & | edges | ||
) |
Low-level write edge/point topology. Normally used by writeGeometry() in a derived class
Also writes the file header if not previously written.
Definition at line 619 of file foamVtkPolyWriter.C.
References globalIndex::localStart(), and points.
bool writePolyGeometry | ( | const pointField & | points, |
const faceList & | faces | ||
) |
Low-level write face/point topology. Normally used by writeGeometry() in a derived class
Also writes the file header if not previously written.
Definition at line 649 of file foamVtkPolyWriter.C.
References globalIndex::localStart(), and points.
|
virtual |
Begin CellData output section for specified number of fields.
Must be called prior to writing any cell data fields.
nFields | is for legacy format only. When nFields=0, this a no-op for legacy format. |
Implements fileWriter.
Definition at line 678 of file foamVtkPolyWriter.C.
|
virtual |
Begin PointData for specified number of fields.
Must be called prior to writing any point data fields.
nFields | is for legacy format only. When nFields=0, this a no-op for legacy format. |
Implements fileWriter.
Definition at line 684 of file foamVtkPolyWriter.C.
Write primitive field of CellData (Poly or Line) or PointData values.
Definition at line 72 of file foamVtkPolyWriterTemplates.C.
References Foam::endl(), Foam::exit(), Foam::FatalError, FatalErrorInFunction, field(), Foam::nl, and Foam::expressions::POINT_DATA.
Write primitive field of CellData.
Definition at line 109 of file foamVtkPolyWriterTemplates.C.
References Foam::endl(), Foam::exit(), Foam::FatalError, FatalErrorInFunction, field(), and Foam::nl.
Write primitive field of PointData.
Definition at line 136 of file foamVtkPolyWriterTemplates.C.
References Foam::endl(), Foam::exit(), Foam::FatalError, FatalErrorInFunction, field(), Foam::nl, and Foam::expressions::POINT_DATA.
|
protected |
The number of field points for the current Piece.
Definition at line 76 of file foamVtkPolyWriter.H.
|
protected |
The number of field cells (edges or faces) for the current Piece.
Definition at line 79 of file foamVtkPolyWriter.H.
|
protected |
Local number of points.
Definition at line 82 of file foamVtkPolyWriter.H.
|
protected |
Local number of lines (edges)
Definition at line 85 of file foamVtkPolyWriter.H.
Referenced by lineWriter::writeUniform().
|
protected |
Local number of polys (faces)
Definition at line 88 of file foamVtkPolyWriter.H.
Referenced by GenericPatchWriter< PatchType >::writeProcIDs(), and surfaceWriter::writeUniform().