Loading...
Searching...
No Matches
patchWriter Class Reference

Write OpenFOAM patches and patch fields in VTP or legacy vtk format. More...

#include <foamVtkPatchWriter.H>

Inheritance diagram for patchWriter:
Collaboration diagram for patchWriter:

Public Member Functions

 patchWriter (const patchWriter &)=delete
 No copy construct.
void operator= (const patchWriter &)=delete
 No copy assignment.
 patchWriter (const polyMesh &mesh, const labelUList &patchIDs, const vtk::outputOptions opts=vtk::formatType::INLINE_BASE64, const bool useNearCellValue=false)
 Construct from components (default format INLINE_BASE64).
 patchWriter (const polyMesh &mesh, const labelUList &patchIDs, const fileName &file, bool parallel=UPstream::parRun())
 Construct from components (default format INLINE_BASE64), and open the file for writing.
 patchWriter (const polyMesh &mesh, const labelUList &patchIDs, const vtk::outputOptions opts, const fileName &file, bool parallel=UPstream::parRun())
 Construct from components (default format INLINE_BASE64), and open the file for writing.
virtual ~patchWriter ()=default
 Destructor.
bool useCellValue () const noexcept
 Use patch internal field values?
bool useCellValue (bool on) noexcept
 Select use of patch internal field values.
template<class Type, template< class > class PatchField>
void write (const GeometricField< Type, PatchField, pointMesh > &field)
 Write point field.
template<class Type, template< class > class PatchField>
void write (const GeometricField< Type, PatchField, volMesh > &field)
 Write volume field.
template<class Type>
void write (const GeometricField< Type, fvPatchField, volMesh > &field, const PrimitivePatchInterpolation< primitivePatch > &pInterp)
 Write volume field with point interpolation.
template<class Type>
void write (const GeometricField< Type, fvPatchField, volMesh > &field, const PrimitivePatchInterpolation< primitivePatch > *pInterp)
 Write volume field with point interpolation.
 patchWriter (const polyMesh &mesh, const labelUList &patchIDs, const vtk::outputOptions opts, const bool useNearCellValue, const fileName &file, bool parallel=UPstream::parRun())
 Construct with useNearCellValue setting.
Public Member Functions inherited from patchMeshWriter
 patchMeshWriter (const patchMeshWriter &)=delete
 No copy construct.
void operator= (const patchMeshWriter &)=delete
 No copy assignment.
 patchMeshWriter (const polyMesh &mesh, const labelUList &patchIDs, const vtk::outputOptions opts=vtk::formatType::INLINE_BASE64)
 Construct from components (default format INLINE_BASE64).
 patchMeshWriter (const polyMesh &mesh, const labelUList &patchIDs, const fileName &file, bool parallel=UPstream::parRun())
 Construct from components (default format INLINE_BASE64), and open the file for writing.
 patchMeshWriter (const polyMesh &mesh, const labelUList &patchIDs, const vtk::outputOptions opts, const fileName &file, bool parallel=UPstream::parRun())
 Construct from components and open the file for writing.
virtual ~patchMeshWriter ()=default
 Destructor.
const labelListpatchIDs () const noexcept
 The patch IDs.
virtual bool beginFile (std::string title="")
 Write file header (non-collective).
virtual bool writeGeometry ()
 Write patch topology.
virtual bool beginCellData (label nFields=0)
 Begin CellData output section for specified number of fields.
virtual bool beginPointData (label nFields=0)
 Begin PointData for specified number of fields.
void writePatchIDs ()
 Write patch ids as CellData.
bool writeProcIDs ()
 Write processor ids for each line as CellData or for each point as PointData, depending on isPointData() state. No-op in serial.
bool writeNeighIDs ()
 Write processor neighbour ids as CellData. This is no-op in serial.
template<class Type>
void writeUniform (const word &fieldName, const Type &val)
 Write a uniform field of Cell (Face) or Point values.
word ext () const
 File extension for current format type.
Public Member Functions inherited from fileWriter
 fileWriter (const vtk::fileTag contentType, const vtk::outputOptions opts)
 Construct from components.
virtual ~fileWriter ()
 Destructor.
vtk::fileTag contentType () const noexcept
 The content type.
vtk::outputOptions opts () const noexcept
 The output options in use.
word ext () const
 File extension for current format type.
bool legacy () const noexcept
 Commonly used query.
bool parallel () const noexcept
 Parallel output requested?
const wordstate () const
 The output state in printable format.
const fileNameoutput () const noexcept
 The current output file name.
virtual bool open (const fileName &file, bool parallel=UPstream::parRun())
 Open file for writing (creates parent directory).
void close ()
 End the file contents and close the file after writing.
bool beginFieldData (label nFields=0)
 Begin FieldData output section for specified number of fields.
bool isCellData () const noexcept
 True if output state corresponds to CELL_DATA.
bool isPointData () const noexcept
 True if output state corresponds to POINT_DATA.
label nCellData () const noexcept
 The number of CellData written for the Piece thus far.
label nPointData () const noexcept
 The number of PointData written for the Piece thus far.
bool endFieldData ()
 Explicitly end FieldData output and switch to DECLARED state.
bool endCellData ()
 Explicitly end CellData output and switch to PIECE state.
bool endPointData ()
 Explicitly end PointData output and switch to PIECE state.
void writeTimeValue (scalar timeValue)
 Write "TimeValue" FieldData (name as per Catalyst output).

Additional Inherited Members

Static Public Member Functions inherited from patchMeshWriter
static word ext (vtk::outputOptions opts)
 File extension for given output type.
Protected Types inherited from fileWriter
enum class  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 patchMeshWriter
label nTotalPoints () const noexcept
 Total number of field points for the current Piece.
label nTotalCells () const noexcept
 Total number of field cells (faces) for the current Piece.
void beginPiece ()
 Determine sizes and begin piece.
void writePoints ()
 Write patch points.
void writePolys_legacy ()
 Write patch faces, legacy format.
void writePolys ()
 Write patch faces.
Protected Member Functions inherited from fileWriter
void checkFormatterValidity () const
 Verify that formatter in either allocated or not required.
OstreamreportBadState (Ostream &, outputState expected) const
 Generate message reporting bad writer state.
OstreamreportBadState (Ostream &, outputState, outputState) const
 Generate message reporting bad writer state.
std::ofstream & os () noexcept
 The backend ostream in use.
vtk::formatterformat ()
 The VTK formatter in use. FatalError for off-processor.
bool isState (outputState test) const noexcept
 True if output state corresponds to the test state.
bool notState (outputState test) const noexcept
 True if output state does not correspond to the test state.
template<class Type>
void beginDataArray (const word &fieldName, const label nValues)
 Start of a field or DataArray output (legacy or non-legacy).
void endDataArray ()
 Flush formatter and end of DataArray output (non-legacy).
void beginPoints (const label nPoints)
 Start of a POINTS DataArray.
void endPoints ()
 End of a POINTS DataArray.
bool enter_Piece ()
 Trigger change state to Piece. Resets nCellData_, nPointData_.
bool endPiece ()
 Explicitly end Piece output and switch to DECLARED state.
bool enter_CellData (label nEntries, label nFields)
 Trigger change state to CellData.
bool enter_PointData (label nEntries, label nFields)
 Trigger change state to PointData.
bool exit_File ()
 Emit file footer (end data, end piece, end file).
template<class Type>
void writeUniform (const word &fieldName, const Type &val, const label nValues)
 Write uniform field content.
template<class Type>
void writeBasicField (const word &fieldName, const UList< Type > &field)
 Write basic (primitive) field content.
bool writeProcIDs (const label nValues)
 Write nValues of processor ids as CellData or PointData (no-op in serial).
 fileWriter (const fileWriter &)=delete
 No copy construct.
void operator= (const fileWriter &)=delete
 No copy assignment.
Protected Attributes inherited from patchMeshWriter
const polyMeshmesh_
 Reference to the OpenFOAM mesh (or subset).
labelList patchIDs_
 The selected patch ids.
OffsetRange< label > pointSlab_
 Slab addressing for field points of the current Piece.
OffsetRange< label > cellSlab_
 Slab addressing for field cells (faces) for the current Piece.
OffsetRange< label > connectivitySlab_
 Slab addressing for cell (face) connectivity count, which is just the sum of the face sizes.
Protected Attributes inherited from fileWriter
outputState state_
 The output state.
vtk::fileTag contentType_
 The content type (PolyData, UnstructuredGrid ...).
bool parallel_
 Parallel writing (via master).
vtk::outputOptions opts_
 Requested output options.
label nCellData_
 The number of CellData written for the Piece thus far.
label nPointData_
 The number of PointData written for the Piece thus far.
fileName outputFile_
 The output file name.
autoPtr< vtk::formatterformat_
 The VTK formatter in use (only valid on master process).
std::ofstream os_
 The backend ostream in use (only opened on master process).
Static Protected Attributes inherited from fileWriter
static const Enum< outputStatestateNames
 Names for the output state (for messages, not for file output).

Detailed Description

Write OpenFOAM patches and patch fields in VTP or legacy vtk format.

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.
See also
Foam::vtk::patchMeshWriter
Source files

Definition at line 64 of file foamVtkPatchWriter.H.

Constructor & Destructor Documentation

◆ patchWriter() [1/5]

patchWriter ( const patchWriter & )
delete

No copy construct.

References patchWriter().

Referenced by operator=(), patchWriter(), and patchWriter().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ patchWriter() [2/5]

patchWriter ( const polyMesh & mesh,
const labelUList & patchIDs,
const vtk::outputOptions opts = vtk::formatType::INLINE_BASE64,
const bool useNearCellValue = false )
inline

Construct from components (default format INLINE_BASE64).

Parameters
useNearCellValueUse patch internal instead of patch face values

Definition at line 95 of file foamVtkPatchWriter.H.

References Foam::vtk::INLINE_BASE64, mesh, fileWriter::opts(), patchMeshWriter::patchIDs(), and patchMeshWriter::patchMeshWriter().

Here is the call graph for this function:

◆ patchWriter() [3/5]

patchWriter ( const polyMesh & mesh,
const labelUList & patchIDs,
const fileName & file,
bool parallel = UPstream::parRun() )
inline

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

The file name is with/without an extension.

Definition at line 114 of file foamVtkPatchWriter.H.

References mesh, fileWriter::parallel(), UPstream::parRun(), patchMeshWriter::patchIDs(), and patchMeshWriter::patchMeshWriter().

Here is the call graph for this function:

◆ patchWriter() [4/5]

patchWriter ( const polyMesh & mesh,
const labelUList & patchIDs,
const vtk::outputOptions opts,
const fileName & file,
bool parallel = UPstream::parRun() )
inline

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

The file name is with/without an extension.

Definition at line 132 of file foamVtkPatchWriter.H.

References mesh, fileWriter::opts(), fileWriter::parallel(), UPstream::parRun(), patchMeshWriter::patchIDs(), and patchMeshWriter::patchMeshWriter().

Here is the call graph for this function:

◆ ~patchWriter()

virtual ~patchWriter ( )
virtualdefault

Destructor.

◆ patchWriter() [5/5]

patchWriter ( const polyMesh & mesh,
const labelUList & patchIDs,
const vtk::outputOptions opts,
const bool useNearCellValue,
const fileName & file,
bool parallel = UPstream::parRun() )
inline

Construct with useNearCellValue setting.

Deprecated
Parameters
useNearCellValueUse patch internal instead of patch face values

Definition at line 226 of file foamVtkPatchWriter.H.

References mesh, fileWriter::opts(), fileWriter::parallel(), patchMeshWriter::patchIDs(), patchMeshWriter::patchMeshWriter(), and patchWriter().

Here is the call graph for this function:

Member Function Documentation

◆ operator=()

void operator= ( const patchWriter & )
delete

No copy assignment.

References patchWriter().

Here is the call graph for this function:

◆ useCellValue() [1/2]

bool useCellValue ( ) const
inlinenoexcept

Use patch internal field values?

Definition at line 159 of file foamVtkPatchWriter.H.

References Foam::noexcept.

◆ useCellValue() [2/2]

bool useCellValue ( bool on)
inlinenoexcept

Select use of patch internal field values.

Returns
the previous state

Definition at line 169 of file foamVtkPatchWriter.H.

◆ write() [1/4]

template<class Type, template< class > class PatchField>
void write ( const GeometricField< Type, PatchField, pointMesh > & field)

Write point field.

References field().

Here is the call graph for this function:

◆ write() [2/4]

template<class Type, template< class > class PatchField>
void write ( const GeometricField< Type, PatchField, volMesh > & field)

Write volume field.

References field().

Here is the call graph for this function:

◆ write() [3/4]

template<class Type>
void write ( const GeometricField< Type, fvPatchField, volMesh > & field,
const PrimitivePatchInterpolation< primitivePatch > & pInterp )

Write volume field with point interpolation.

References field(), and pInterp.

Here is the call graph for this function:

◆ write() [4/4]

template<class Type>
void write ( const GeometricField< Type, fvPatchField, volMesh > & field,
const PrimitivePatchInterpolation< primitivePatch > * pInterp )

Write volume field with point interpolation.

References field(), and pInterp.

Here is the call graph for this function:

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