surfaceWriter Class Reference

Write faces/points (optionally with fields) as a vtp file or a legacy vtk file. More...

Inheritance diagram for surfaceWriter:
Collaboration diagram for surfaceWriter:

Public Member Functions

 surfaceWriter (const surfaceWriter &)=delete
 No copy construct. More...
 
void operator= (const surfaceWriter &)=delete
 No copy assignment. More...
 
 surfaceWriter (const pointField &pts, const faceList &faces, const vtk::outputOptions opts=vtk::formatType::INLINE_BASE64)
 Construct from components (default format INLINE_BASE64) More...
 
 surfaceWriter (const pointField &pts, const faceList &faces, const fileName &file, bool parallel=UPstream::parRun())
 Construct from components (default format INLINE_BASE64), and open the file for writing. More...
 
 surfaceWriter (const pointField &pts, const faceList &faces, const vtk::outputOptions opts, const fileName &file, bool parallel=UPstream::parRun())
 Construct from components and open the file for writing. More...
 
virtual ~surfaceWriter ()=default
 Destructor. More...
 
bool vertexOutput () const noexcept
 Output as 1D vertex/point elements instead of faces. More...
 
bool vertexOutput (bool on) noexcept
 Output as 1D vertex/point elements instead of faces. More...
 
virtual void setTime (const instant &inst)
 Define a time name/value for the output. More...
 
virtual bool beginFile (std::string title="")
 Write file header (non-collective) More...
 
virtual bool writeGeometry ()
 Write faces topology. More...
 
void writeTimeValue ()
 Write the currently set time as "TimeValue" FieldData. More...
 
void piece (const pointField &points, const faceList &faces)
 Reset point/face references to begin a new piece. More...
 
- Public Member Functions inherited from polyWriter
 polyWriter (const vtk::outputOptions opts=vtk::formatType::INLINE_BASE64)
 Construct from components (default format INLINE_BASE64) More...
 
 polyWriter (const fileName &file, bool parallel=UPstream::parRun())
 Construct from components (default format INLINE_BASE64), and open the file for writing. More...
 
 polyWriter (const vtk::outputOptions opts, const fileName &file, bool parallel=UPstream::parRun())
 Construct from components and open the file for writing. More...
 
virtual ~polyWriter ()=default
 Destructor. More...
 
bool writeLineGeometry (const pointField &points, const UList< edge > &edges)
 Low-level write edge/point topology. Normally used by writeGeometry() in a derived class. More...
 
bool writePolyGeometry (const pointField &points, const UList< face > &faces)
 Low-level write face/point topology. Normally used by writeGeometry() in a derived class. More...
 
bool writeVertGeometry (const pointField &points)
 Low-level write vertex/point topology. Normally used by writeGeometry() in a derived class. More...
 
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...
 
bool writeProcIDs ()
 In parallel, write "procID" field as CellData or PointData (depending on the current context). A no-op in serial. More...
 
void writeLocalIDs (const word &fieldName)
 Write rank-local identity map as CellData or PointData (depending on the current context). More...
 
void writeGlobalIDs (const word &fieldName)
 Write global identity map as CellData or PointData (depending on the current context). More...
 
template<class Type >
void writeUniform (const word &fieldName, const Type &val)
 Write a uniform field of CellData or PointData (depending on the current context). More...
 
template<class Type >
void write (const word &fieldName, const UList< Type > &field)
 Write primitive field of CellData or PointData values (size depending on the current context). 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...
 
- Public Member Functions inherited from fileWriter
 fileWriter (vtk::fileTag contentType, vtk::outputOptions opts)
 Construct from components. More...
 
virtual ~fileWriter ()
 Destructor. More...
 
vtk::fileTag contentType () const noexcept
 The content type. More...
 
vtk::outputOptions opts () const noexcept
 The output options in use. More...
 
word ext () const
 File extension for current format type. More...
 
bool legacy () const noexcept
 Commonly used query. More...
 
bool parallel () const noexcept
 Parallel output requested? More...
 
const wordstate () const
 The output state in printable format. More...
 
const fileNameoutput () const noexcept
 The current output file name. More...
 
virtual bool open (const fileName &file, bool parallel=UPstream::parRun())
 Open file for writing (creates parent directory). More...
 
void close ()
 End the file contents and close the file after writing. More...
 
bool beginFieldData (label nFields=0)
 Begin FieldData output section for specified number of fields. More...
 
bool isCellData () const noexcept
 True if output state corresponds to CELL_DATA. More...
 
bool isPointData () const noexcept
 True if output state corresponds to POINT_DATA. More...
 
label nCellData () const noexcept
 The number of CellData written for the Piece thus far. More...
 
label nPointData () const noexcept
 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...
 

Additional Inherited Members

- Static Public Member Functions inherited from polyWriter
static word ext (vtk::outputOptions opts)
 File extension for given output type. More...
 
- Protected Types inherited from fileWriter
enum  outputState : uint8_t {
  CLOSED = 0, OPENED, DECLARED, FIELD_DATA,
  PIECE, CELL_DATA, POINT_DATA
}
 Internal tracking of the output state. More...
 
- Protected Member Functions inherited from polyWriter
label nTotalPoints () const noexcept
 Total number of field points for the current Piece. More...
 
label nTotalCells () const noexcept
 Total number of field cells (edges or faces) for the current Piece. More...
 
void writeVerts (const label nTotalVerts)
 Write verts (legacy or non-legacy format). More...
 
- Protected Member Functions inherited from fileWriter
void checkFormatterValidity () const
 Verify that formatter in either allocated or not required. More...
 
OstreamreportBadState (Ostream &, outputState expected) const
 Generate message reporting bad writer state. More...
 
OstreamreportBadState (Ostream &, outputState, outputState) const
 Generate message reporting bad writer state. More...
 
std::ofstream & os () noexcept
 The backend ostream in use. More...
 
vtk::formatterformat ()
 The VTK formatter in use. FatalError for off-processor. 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 (label localSize)
 In parallel, write "procID" field (processor ids) as CellData or PointData (depending on the current context). More...
 
void writeLocalIDs (const word &fieldName, label localSize)
 Write rank-local identity map. More...
 
void writeGlobalIDs (const word &fieldName, label localSize)
 Write global identity map. More...
 
 fileWriter (const fileWriter &)=delete
 No copy construct. More...
 
void operator= (const fileWriter &)=delete
 No copy assignment. More...
 
- Protected Attributes inherited from polyWriter
OffsetRange< label > pointSlab_
 Slab addressing for field points of the current Piece. More...
 
OffsetRange< label > cellSlab_
 Slab addressing for field cells (edges or faces) of the current Piece. More...
 
- Protected Attributes inherited from fileWriter
outputState state_
 The output state. More...
 
vtk::fileTag contentType_
 The content type (PolyData, UnstructuredGrid ...) More...
 
bool parallel_
 Parallel writing (via master) More...
 
vtk::outputOptions opts_
 Requested output options. 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::formatterformat_
 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...
 
- Static Protected Attributes inherited from fileWriter
static const Enum< outputStatestateNames
 Names for the output state (for messages, not for file output). More...
 

Detailed Description

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.

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 63 of file foamVtkSurfaceWriter.H.

Constructor & Destructor Documentation

◆ surfaceWriter() [1/4]

surfaceWriter ( const surfaceWriter )
delete

No copy construct.

◆ surfaceWriter() [2/4]

surfaceWriter ( const pointField pts,
const faceList faces,
const vtk::outputOptions  opts = vtk::formatType::INLINE_BASE64 
)

Construct from components (default format INLINE_BASE64)

◆ surfaceWriter() [3/4]

surfaceWriter ( const pointField pts,
const faceList faces,
const fileName file,
bool  parallel = UPstream::parRun() 
)

Construct from components (default format INLINE_BASE64), and open the file for writing.

The file name is with/without an extension.

◆ surfaceWriter() [4/4]

surfaceWriter ( const pointField pts,
const faceList faces,
const vtk::outputOptions  opts,
const fileName file,
bool  parallel = UPstream::parRun() 
)

Construct from components and open the file for writing.

The file name is with/without an extension.

◆ ~surfaceWriter()

virtual ~surfaceWriter ( )
virtualdefault

Destructor.

Member Function Documentation

◆ operator=()

void operator= ( const surfaceWriter )
delete

No copy assignment.

◆ vertexOutput() [1/2]

bool vertexOutput ( ) const
inlinenoexcept

Output as 1D vertex/point elements instead of faces.

Definition at line 156 of file foamVtkSurfaceWriter.H.

◆ vertexOutput() [2/2]

bool vertexOutput ( bool  on)
inlinenoexcept

Output as 1D vertex/point elements instead of faces.

Definition at line 161 of file foamVtkSurfaceWriter.H.

◆ setTime()

virtual void setTime ( const instant inst)
virtual

Define a time name/value for the output.

◆ beginFile()

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

Write file header (non-collective)

Note
Expected calling states: (OPENED).

Reimplemented from fileWriter.

Referenced by topOVariablesBase::writeSurfaceFiles().

Here is the caller graph for this function:

◆ writeGeometry()

virtual bool writeGeometry ( )
virtual

Write faces topology.

Also writes the file header if not previously written.

Note
Must be called prior to writing CellData or PointData

Reimplemented from polyWriter.

Referenced by topOVariablesBase::writeSurfaceFiles().

Here is the caller graph for this function:

◆ writeTimeValue()

void writeTimeValue ( )

Write the currently set time as "TimeValue" FieldData.

◆ piece()

void piece ( const pointField points,
const faceList faces 
)

Reset point/face references to begin a new piece.


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