Public Member Functions | Static Public Member Functions | List of all members
surfaceFieldWriter Class Reference

Write surfaces fields (as PointData) in VTP format. Legacy VTK format is intentionally not supported. More...

Inheritance diagram for surfaceFieldWriter:
Inheritance graph
[legend]
Collaboration diagram for surfaceFieldWriter:
Collaboration graph
[legend]

Public Member Functions

 surfaceFieldWriter (const fvMesh &mesh, const vtk::outputOptions opts=vtk::formatType::INLINE_BASE64)
 
 surfaceFieldWriter (const fvMesh &mesh, const fileName &file, bool parallel=Pstream::parRun())
 
 surfaceFieldWriter (const fvMesh &mesh, const vtk::outputOptions opts, const fileName &file, bool parallel=Pstream::parRun())
 
virtual ~surfaceFieldWriter ()=default
 
virtual bool beginFile (std::string title="")
 
virtual bool writeGeometry ()
 
virtual bool beginCellData (label nFields=0)
 
virtual bool beginPointData (label nFields=0)
 
void write (const surfaceVectorField &field)
 
- Public Member Functions inherited from fileWriter
 fileWriter (const vtk::fileTag contentType, const vtk::outputOptions opts)
 
virtual ~fileWriter ()
 
vtk::fileTag contentType () const
 
vtk::outputOptions opts () const
 
word ext () const
 
bool legacy () const
 
bool parallel () const noexcept
 
const wordstate () const
 
const fileNameoutput () const noexcept
 
bool open (const fileName &file, bool parallel=Pstream::parRun())
 
void close ()
 
bool beginFieldData (label nFields=0)
 
label nCellData () const noexcept
 
label nPointData () const noexcept
 
bool endFieldData ()
 
bool endCellData ()
 
bool endPointData ()
 
void writeTimeValue (scalar timeValue)
 

Static Public Member Functions

static word ext (vtk::outputOptions)
 

Additional Inherited Members

- Protected Types inherited from fileWriter
enum  outputState {
  CLOSED = 0, OPENED, DECLARED, FIELD_DATA,
  PIECE, CELL_DATA, POINT_DATA
}
 
- Protected Member Functions inherited from fileWriter
void checkFormatterValidity () const
 
OstreamreportBadState (Ostream &, outputState expected) const
 
OstreamreportBadState (Ostream &, outputState, outputState) const
 
std::ofstream & os () noexcept
 
vtk::formatterformat ()
 
bool isState (outputState test) const noexcept
 
bool notState (outputState test) const noexcept
 
template<class Type >
void beginDataArray (const word &fieldName, const label nValues)
 
void endDataArray ()
 
void beginPoints (const label nPoints)
 
void endPoints ()
 
bool enter_Piece ()
 
bool endPiece ()
 
bool enter_CellData (label nEntries, label nFields)
 
bool enter_PointData (label nEntries, label nFields)
 
bool exit_File ()
 
template<class Type >
void writeUniform (const word &fieldName, const Type &val, const label nValues)
 
template<class Type >
void writeBasicField (const word &fieldName, const UList< Type > &field)
 
bool writeProcIDs (const label nValues)
 
 fileWriter (const fileWriter &)=delete
 
void operator= (const fileWriter &)=delete
 
- Protected Attributes inherited from fileWriter
vtk::fileTag contentType_
 
outputOptions opts_
 
bool parallel_
 
outputState state_
 
label nCellData_
 
label nPointData_
 
fileName outputFile_
 
autoPtr< vtk::formatterformat_
 
std::ofstream os_
 
- Static Protected Attributes inherited from fileWriter
static const Enum< outputStatestateNames
 

Detailed Description

Write surfaces fields (as PointData) in VTP format. Legacy VTK format is intentionally not supported.

The file output is structured as HEAD, FIELD_DATA, PIECE followed by any CELL_DATA or POINT_DATA. These states are tracked internally to help detect logic errors.

The FieldData element is to be placed prior to writing any geometry Piece. This moves the information to the front of the output file for visibility and simplifies the logic.

Note
Parallel output is combined into a single Piece without point merging, which is similar to using multi-piece data sets, but allows more convenient creation as a streaming process. In the future, the duplicate points at processor connections may be addressed using ghost points.
Source files

Definition at line 67 of file foamVtkSurfaceFieldWriter.H.

Constructor & Destructor Documentation

◆ surfaceFieldWriter() [1/3]

Definition at line 55 of file foamVtkSurfaceFieldWriter.C.

References fileWriter::legacy().

Here is the call graph for this function:

◆ surfaceFieldWriter() [2/3]

surfaceFieldWriter ( const fvMesh mesh,
const fileName file,
bool  parallel = Pstream::parRun() 
)

Definition at line 70 of file foamVtkSurfaceFieldWriter.C.

◆ surfaceFieldWriter() [3/3]

surfaceFieldWriter ( const fvMesh mesh,
const vtk::outputOptions  opts,
const fileName file,
bool  parallel = Pstream::parRun() 
)

Definition at line 83 of file foamVtkSurfaceFieldWriter.C.

◆ ~surfaceFieldWriter()

virtual ~surfaceFieldWriter ( )
virtualdefault

Member Function Documentation

◆ ext()

static word ext ( vtk::outputOptions  )
inlinestatic

Definition at line 135 of file foamVtkSurfaceFieldWriter.H.

References Foam::vtk::fileExtension, and Foam::vtk::POLY_DATA.

◆ beginFile()

bool beginFile ( std::string  title = "")
virtual

Reimplemented from fileWriter.

Definition at line 98 of file foamVtkSurfaceFieldWriter.C.

References fileWriter::beginFile(), and Foam::name().

Here is the call graph for this function:

◆ writeGeometry()

bool writeGeometry ( )
virtual

◆ beginCellData()

bool beginCellData ( label  nFields = 0)
virtual

Implements fileWriter.

Definition at line 187 of file foamVtkSurfaceFieldWriter.C.

◆ beginPointData()

bool beginPointData ( label  nFields = 0)
virtual

Implements fileWriter.

Definition at line 194 of file foamVtkSurfaceFieldWriter.C.

◆ write()

void write ( const surfaceVectorField field)

The documentation for this class was generated from the following files: