Loading...
Searching...
No Matches
Foam::vtk Namespace Reference

Namespace for handling VTK output. Contains classes and functions for writing VTK file content. More...

Namespaces

namespace  Tools
 A collection of static methods to assist converting OpenFOAM data structures into VTK internal data structures.
namespace  legacy
 Namespace for legacy VTK output constants and functions.

Classes

struct  Caching
 Bookkeeping for internal caching. More...
class  vtuAdaptor
 Bookkeeping for vtkUnstructuredGrid. More...
class  GenericPatchGeoFieldsWriter
 A Foam::vtk::GenericPatchWriter with support for geometric fields. More...
class  internalWriter
 Write an OpenFOAM volume (internal) geometry and internal fields as a vtu file or a legacy vtk file. More...
class  patchWriter
 Write OpenFOAM patches and patch fields in VTP or legacy vtk format. More...
class  surfaceFieldWriter
 Write surfaces fields (as PointData) in VTP format. Legacy VTK format is intentionally not supported. More...
class  fileWriter
 Base class for VTK output writers that handle geometry and fields (eg, vtp, vtu data). These output formats are structured as DECLARED, FIELD_DATA, PIECE followed by any CELL_DATA or POINT_DATA. More...
class  seriesWriter
 Provides a means of accumulating and generating VTK file series. More...
class  vtmWriter
 Provides a means of accumulating file entries for generating a vtkMultiBlockDataSet (.vtm) file. More...
class  appendBase64Formatter
 Appended base-64 encoded binary output. Uses an output filter layer to write base-64 encoded content. More...
class  appendRawFormatter
 Appended raw binary output. More...
class  asciiFormatter
 Inline ASCII output. Adds spaces between entries and a newline every 9 items (for consistency with what VTK itself outputs). More...
class  base64Formatter
 Inline base-64 encoded binary output. Uses an output filter layer to write base-64 encoded content. More...
class  foamVtkBase64Layer
 Base-64 encoded output layer - normally only used indirectly by formatters. More...
class  formatter
 Abstract class for a VTK output stream formatter. More...
class  legacyAsciiFormatter
 Formatting as per Foam::vtk::asciiFormatter, but with naming for legacy output. More...
class  legacyRawFormatter
 Binary output for the VTK legacy format, always written as big-endian and with 32-bit integers. More...
class  outputOptions
 Encapsulated combinations of output format options. This is primarily useful when defining the output type based on some command-line arguments or dictionary contents. However, it can also be a useful alternative to using the underlying enumeration directly, since this class provides additional methods not possible with an enum. More...
class  vtuCells
 A deep-copy description of an OpenFOAM volume mesh in data structures suitable for VTK UnstructuredGrid, including the possibility of decomposing polyhedral cells into primitive cell types. More...
class  vtuSizing
 Sizing descriptions and routines for transcribing an OpenFOAM volume mesh into a VTK unstructured grid, with possible decomposition of polyhedral cells into primitive cell types. More...
class  lineWriter
 Write edge/points (optionally with fields) as a vtp file or a legacy vtk file. More...
class  polyWriter
 Write faces/points (optionally with fields) as a vtp file or a legacy vtk file. More...
class  surfaceWriter
 Write faces/points (optionally with fields) as a vtp file or a legacy vtk file. More...
class  lagrangianWriter
 Write lagrangian (cloud) positions and fields (as PointData) in VTP format. Legacy VTK format is intentionally not supported since the VTP format provides much better field selection in ParaView, and for consistency with the Foam::functionObjects::vtkCloud function object. More...
class  coordSetWriter
 Write as points/lines, optionally with fields, as a vtp file or a legacy vtk file. More...
class  internalMeshWriter
 Write an OpenFOAM volume (internal) geometry and internal fields as a vtu file or a legacy vtk file. More...
class  GenericPatchWriter
 Write concrete PrimitivePatch faces/points (optionally with fields) as a vtp file or a legacy vtk file. The patch type is limited to representations of polygon faces and 3D points and must support the following methods: More...
class  patchMeshWriter
 Write OpenFOAM patches and patch fields in VTP or legacy vtk format. More...

Typedefs

typedef GenericPatchGeoFieldsWriter< indirectPrimitivePatchindirectPatchGeoFieldsWriter
 Write indirectPrimitivePatch faces/points as a vtp file or a legacy vtk file with support for geometric fields.
typedef GenericPatchGeoFieldsWriter< uindirectPrimitivePatchuindirectPatchGeoFieldsWriter
 Write uindirectPrimitivePatch faces/points as a vtp file or a legacy vtk file with support for geometric fields.
typedef indirectPatchGeoFieldsWriter surfaceMeshWriter
typedef GenericPatchWriter< indirectPrimitivePatchindirectPatchWriter
 Write indirectPrimitivePatch faces/points (optionally with fields) as a vtp file or a legacy vtk file.
typedef GenericPatchWriter< uindirectPrimitivePatchuindirectPatchWriter
 Write uindirectPrimitivePatch faces/points (optionally with fields) as a vtp file or a legacy vtk file.
typedef GenericPatchWriter< primitivePatchprimitivePatchWriter
 Write primitivePatch faces/points (optionally with fields) as a vtp file or a legacy vtk file.

Enumerations

enum  OutputContext : uint8_t { INLINE , HEADER , APPEND }
 The context when outputting a VTK file (XML or legacy). More...
enum class  formatType : uint8_t {
  INLINE_ASCII = 0 , INLINE_BASE64 = 0x01 , APPEND_BASE64 = 0x11 , APPEND_BINARY = 0x12 ,
  LEGACY_ASCII = 0x20 , LEGACY_BINARY = 0x22 , HDF_FORMAT = 0x40
}
 The output format type for file contents. More...
enum  cellType : uint8_t {
  VTK_EMPTY_CELL = 0 , VTK_VERTEX = 1 , VTK_POLY_VERTEX = 2 , VTK_LINE = 3 ,
  VTK_POLY_LINE = 4 , VTK_TRIANGLE = 5 , VTK_TRIANGLE_STRIP = 6 , VTK_POLYGON = 7 ,
  VTK_PIXEL = 8 , VTK_QUAD = 9 , VTK_TETRA = 10 , VTK_VOXEL = 11 ,
  VTK_HEXAHEDRON = 12 , VTK_WEDGE = 13 , VTK_PYRAMID = 14 , VTK_PENTAGONAL_PRISM = 15 ,
  VTK_HEXAGONAL_PRISM = 16 , VTK_POLYHEDRON = 42
}
 Equivalent to enumeration in "vtkCellType.h" (should be uint8_t). More...
enum class  fileTag : uint8_t {
  UNKNOWN , VTK_FILE , DATA_ARRAY , BLOCK ,
  PIECE , DATA_SET , POINTS , CELLS ,
  POLYS , VERTS , LINES , CELL_DATA ,
  POINT_DATA , FIELD_DATA , POLY_DATA , UNSTRUCTURED_GRID ,
  MULTI_BLOCK , VTK_HDF
}
 Some common XML tags for vtk files. More...
enum class  fileAttr : uint8_t {
  OFFSET , NUMBER_OF_COMPONENTS , NUMBER_OF_TUPLES , NUMBER_OF_POINTS ,
  NUMBER_OF_CELLS , NUMBER_OF_POLYS , NUMBER_OF_VERTS , NUMBER_OF_LINES
}
 Some common XML attributes for vtk files. More...
enum class  dataArrayAttr : uint8_t {
  POINTS , OFFSETS , CONNECTIVITY , TYPES ,
  FACES , FACEOFFSETS
}
 Some common names for XML DataArray entries. More...

Functions

bool isAppend (enum formatType fmt) noexcept
 Test for vtk append format (xml).
bool isLegacy (enum formatType fmt) noexcept
 Test for vtk legacy format.
bool isHDF (enum formatType fmt) noexcept
 Test for HDF format.
template<class Type, direction nComp = 1>
uint64_t sizeofData (label count)
 Commonly used calculation for header and payload sizes.
autoPtr< vtk::formatternewFormatter (std::ostream &os, unsigned prec=IOstream::defaultPrecision())
 Return a default asciiFormatter.
autoPtr< vtk::formatternewFormatter (std::ostream &os, const enum formatType fmtType, unsigned prec=IOstream::defaultPrecision())
 Return a new formatter based on the specified format type.
void writeIdentity (vtk::formatter &fmt, const label len, label start=0)
 Write an identity list of labels.
void writeList (vtk::formatter &fmt, const UList< uint8_t > &values)
 Write a list of uint8_t values.
template<class Type>
void write (vtk::formatter &fmt, const Type &val, const label n=1)
 Component-wise write of a value (N times).
template<class Type>
void writeValueParallel (vtk::formatter &fmt, const Type &val, const label count=1)
 Component-wise write of a value (N times) in parallel.
template<class Type>
void writeList (vtk::formatter &fmt, const UList< Type > &values)
 Write a list of values.
template<class Type, unsigned N>
void writeList (vtk::formatter &fmt, const FixedList< Type, N > &values)
 Write a list of values.
template<class Type>
void writeList (vtk::formatter &fmt, const UList< Type > &values, const labelUList &addressing)
 Write a list of values via indirect addressing.
template<class Type>
void writeList (vtk::formatter &fmt, const UList< Type > &values, const bitSet &selected)
 Write a list of values via indirect addressing.
template<class Type>
void writeLists (vtk::formatter &fmt, const UList< Type > &values1, const UList< Type > &values2, const labelUList &addressing)
 Write a list of values and a list of values via indirect addressing.
template<class Type>
void writeListParallel (vtk::formatter &fmt, const UList< Type > &values)
 Write a list of values.
void writeListParallel (vtk::formatter &fmt, const UList< label > &values, const globalIndex &procOffset)
 Write a list of values, with constant per-processor offset.
template<class Type>
void writeListParallel (vtk::formatter &fmt, const UList< Type > &values, const labelUList &addressing)
 Write a list of values via indirect addressing.
template<class Type>
void writeListParallel (vtk::formatter &fmt, const UList< Type > &values, const bitSet &selected)
 Write a list of values via indirect addressing.
template<class Type>
void writeListsParallel (vtk::formatter &fmt, const UList< Type > &values1, const UList< Type > &values2)
 Write a list of values and another list of values.
template<class Type>
void writeListsParallel (vtk::formatter &fmt, const UList< Type > &values1, const UList< Type > &values2, const labelUList &addressing)
 Write a list of values and a list of values via indirect addressing.
bool writeTopoSet (const polyMesh &mesh, const topoSet &set, const vtk::outputOptions opts, const fileName &file, bool parallel=UPstream::parRun())
 Dispatch to vtk::writeCellSetFaces, vtk::writeFaceSet, vtk::writePointSet.
bool writeFaceSet (const polyMesh &mesh, const faceSet &set, const vtk::outputOptions opts, const fileName &file, bool parallel=UPstream::parRun())
 Write faceSet as VTK polydata file.
bool writeCellSetFaces (const polyMesh &mesh, const cellSet &set, const vtk::outputOptions opts, const fileName &file, bool parallel=UPstream::parRun())
 Write perimeter faces of cellset to vtk polydata file.
bool writePointSet (const polyMesh &mesh, const pointSet &set, const vtk::outputOptions opts, const fileName &file, bool parallel=UPstream::parRun())
 Write pointSet to VTK polydata file.

Variables

const Foam::Enum< fileTagfileExtension
 File extension (without ".") for some vtk XML file content types.
const Foam::Enum< fileTagfileContentVersions
 Version string for some vtk XML file content types.
const Foam::Enum< fileTagfileTagNames
 Strings corresponding to the vtk XML tags.
const Foam::Enum< fileAttrfileAttrNames
 Strings corresponding to the vtk XML attributes.
const Foam::Enum< dataArrayAttrdataArrayAttrNames
 Strings corresponding to the vtk XML DataArray attributes.

Detailed Description

Namespace for handling VTK output. Contains classes and functions for writing VTK file content.

Typedef Documentation

◆ indirectPatchGeoFieldsWriter

Write indirectPrimitivePatch faces/points as a vtp file or a legacy vtk file with support for geometric fields.

Definition at line 59 of file foamVtkIndPatchGeoFieldsWriter.H.

◆ uindirectPatchGeoFieldsWriter

Write uindirectPrimitivePatch faces/points as a vtp file or a legacy vtk file with support for geometric fields.

See also
Foam::vtk::GenericPatchWriter

Definition at line 63 of file foamVtkIndPatchGeoFieldsWriter.H.

◆ surfaceMeshWriter

◆ indirectPatchWriter

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

Definition at line 57 of file foamVtkIndPatchWriter.H.

◆ uindirectPatchWriter

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

See also
Foam::vtk::GenericPatchWriter

Definition at line 61 of file foamVtkIndPatchWriter.H.

◆ primitivePatchWriter

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

See also
Foam::vtk::GenericPatchWriter

Definition at line 49 of file foamVtkPrimitivePatchWriter.H.

Enumeration Type Documentation

◆ OutputContext

enum OutputContext : uint8_t

The context when outputting a VTK file (XML or legacy).

Enumerator
INLINE 

Generate header and inline data.

HEADER 

Generate header only.

APPEND 

Generate append-data.

Definition at line 75 of file foamVtkCore.H.

◆ formatType

enum class formatType : uint8_t
strong

The output format type for file contents.

Upper bits for output type, lower bits for the format itself.

Enumerator
INLINE_ASCII 

XML inline ASCII, asciiFormatter.

INLINE_BASE64 

XML inline base64, base64Formatter.

APPEND_BASE64 

XML append base64, appendBase64Formatter.

APPEND_BINARY 

XML append raw binary, appendRawFormatter.

LEGACY_ASCII 

Legacy ASCII, legacyAsciiFormatter.

LEGACY_BINARY 

Legacy raw binary, legacyRawFormatter.

HDF_FORMAT 

VTKHDF format.

Definition at line 88 of file foamVtkCore.H.

◆ cellType

enum cellType : uint8_t

Equivalent to enumeration in "vtkCellType.h" (should be uint8_t).

Enumerator
VTK_EMPTY_CELL 
VTK_VERTEX 
VTK_POLY_VERTEX 
VTK_LINE 
VTK_POLY_LINE 
VTK_TRIANGLE 
VTK_TRIANGLE_STRIP 
VTK_POLYGON 
VTK_PIXEL 
VTK_QUAD 
VTK_TETRA 
VTK_VOXEL 
VTK_HEXAHEDRON 
VTK_WEDGE 
VTK_PYRAMID 
VTK_PENTAGONAL_PRISM 
VTK_HEXAGONAL_PRISM 
VTK_POLYHEDRON 

Definition at line 127 of file foamVtkCore.H.

◆ fileTag

enum class fileTag : uint8_t
strong

Some common XML tags for vtk files.

Enumerator
UNKNOWN 

placeholder

VTK_FILE 

"VTKFile"

DATA_ARRAY 

"DataArray"

BLOCK 

"Block"

PIECE 

"Piece"

DATA_SET 

"DataSet"

POINTS 

"Points"

CELLS 

"Cells"

POLYS 

"Polys"

VERTS 

"Verts"

LINES 

"Lines"

CELL_DATA 

"CellData"

POINT_DATA 

"PointData"

FIELD_DATA 

"FieldData"

POLY_DATA 

"PolyData"

UNSTRUCTURED_GRID 

"UnstructuredGrid"

MULTI_BLOCK 

"vtkMultiBlockDataSet"

VTK_HDF 

"VTKHDF" - used for the extension

Definition at line 153 of file foamVtkCore.H.

◆ fileAttr

enum class fileAttr : uint8_t
strong

Some common XML attributes for vtk files.

Enumerator
OFFSET 

"offset"

NUMBER_OF_COMPONENTS 

"NumberOfComponents"

NUMBER_OF_TUPLES 

"NumberOfTuples"

NUMBER_OF_POINTS 

"NumberOfPoints"

NUMBER_OF_CELLS 

"NumberOfCells"

NUMBER_OF_POLYS 

"NumberOfPolys"

NUMBER_OF_VERTS 

"NumberOfVerts"

NUMBER_OF_LINES 

"NumberOfLines"

Definition at line 193 of file foamVtkCore.H.

◆ dataArrayAttr

enum class dataArrayAttr : uint8_t
strong

Some common names for XML DataArray entries.

Enumerator
POINTS 

"Points"

OFFSETS 

"offsets"

CONNECTIVITY 

"connectivity"

TYPES 

"types"

FACES 

"faces"

FACEOFFSETS 

"faceoffsets"

Definition at line 213 of file foamVtkCore.H.

Function Documentation

◆ isAppend()

bool isAppend ( enum formatType fmt)
inlinenoexcept

Test for vtk append format (xml).

Definition at line 102 of file foamVtkCore.H.

◆ isLegacy()

bool isLegacy ( enum formatType fmt)
inlinenoexcept

Test for vtk legacy format.

Definition at line 110 of file foamVtkCore.H.

◆ isHDF()

bool isHDF ( enum formatType fmt)
inlinenoexcept

Test for HDF format.

Definition at line 118 of file foamVtkCore.H.

References HDF_FORMAT.

◆ sizeofData()

template<class Type, direction nComp = 1>
uint64_t sizeofData ( label count)
inline

Commonly used calculation for header and payload sizes.

Definition at line 730 of file foamVtkFormatter.H.

Referenced by VTPsurfaceFormat< Face >::write(), VTPsurfaceFormatCore::writeCellData(), VTPsurfaceFormatCore::writeCellData(), lumpedPointMovement::writeForcesAndMomentsVTP(), VTPsurfaceFormatCore::writeHeader(), and lumpedPointState::writeVTP().

Here is the caller graph for this function:

◆ newFormatter() [1/2]

autoPtr< vtk::formatter > newFormatter ( std::ostream & os,
unsigned prec = IOstream::defaultPrecision() )

Return a default asciiFormatter.

References IOstream::defaultPrecision(), and os().

Referenced by outputOptions::newFormatter(), lumpedPointMovement::writeForcesAndMomentsVTP(), and lumpedPointState::writeVTP().

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

◆ newFormatter() [2/2]

autoPtr< vtk::formatter > newFormatter ( std::ostream & os,
const enum formatType fmtType,
unsigned prec = IOstream::defaultPrecision() )

Return a new formatter based on the specified format type.

References IOstream::defaultPrecision(), and os().

Here is the call graph for this function:

◆ writeIdentity()

void writeIdentity ( vtk::formatter & fmt,
const label len,
label start = 0 )

Write an identity list of labels.

The output does not include the payload size.

Referenced by lumpedPointMovement::writeForcesAndMomentsVTP(), and lumpedPointState::writeVTP().

Here is the caller graph for this function:

◆ writeList() [1/5]

void writeList ( vtk::formatter & fmt,
const UList< uint8_t > & values )

◆ write()

template<class Type>
void write ( vtk::formatter & fmt,
const Type & val,
const label n = 1 )
inline

Component-wise write of a value (N times).

References n.

Referenced by VTKsurfaceFormatCore::writeCellData(), VTPsurfaceFormatCore::writeCellData(), and lumpedPointState::writeVTP().

Here is the caller graph for this function:

◆ writeValueParallel()

template<class Type>
void writeValueParallel ( vtk::formatter & fmt,
const Type & val,
const label count = 1 )
inline

Component-wise write of a value (N times) in parallel.

The value and count may differ on each processor

◆ writeList() [2/5]

template<class Type>
void writeList ( vtk::formatter & fmt,
const UList< Type > & values )

Write a list of values.

The output does not include the payload size.

◆ writeList() [3/5]

template<class Type, unsigned N>
void writeList ( vtk::formatter & fmt,
const FixedList< Type, N > & values )

Write a list of values.

The output does not include the payload size.

◆ writeList() [4/5]

template<class Type>
void writeList ( vtk::formatter & fmt,
const UList< Type > & values,
const labelUList & addressing )

Write a list of values via indirect addressing.

The output does not include the payload size.

◆ writeList() [5/5]

template<class Type>
void writeList ( vtk::formatter & fmt,
const UList< Type > & values,
const bitSet & selected )

Write a list of values via indirect addressing.

The output does not include the payload size.

◆ writeLists()

template<class Type>
void writeLists ( vtk::formatter & fmt,
const UList< Type > & values1,
const UList< Type > & values2,
const labelUList & addressing )

Write a list of values and a list of values via indirect addressing.

The output does not include the payload size.

◆ writeListParallel() [1/4]

template<class Type>
void writeListParallel ( vtk::formatter & fmt,
const UList< Type > & values )

Write a list of values.

The output does not include the payload size.

◆ writeListParallel() [2/4]

void writeListParallel ( vtk::formatter & fmt,
const UList< label > & values,
const globalIndex & procOffset )

Write a list of values, with constant per-processor offset.

The output does not include the payload size.

Parameters
procOffsetThe per-processor offset (needed on master only)

◆ writeListParallel() [3/4]

template<class Type>
void writeListParallel ( vtk::formatter & fmt,
const UList< Type > & values,
const labelUList & addressing )

Write a list of values via indirect addressing.

The output does not include the payload size.

◆ writeListParallel() [4/4]

template<class Type>
void writeListParallel ( vtk::formatter & fmt,
const UList< Type > & values,
const bitSet & selected )

Write a list of values via indirect addressing.

The output does not include the payload size.

◆ writeListsParallel() [1/2]

template<class Type>
void writeListsParallel ( vtk::formatter & fmt,
const UList< Type > & values1,
const UList< Type > & values2 )

Write a list of values and another list of values.

The output does not include the payload size.

◆ writeListsParallel() [2/2]

template<class Type>
void writeListsParallel ( vtk::formatter & fmt,
const UList< Type > & values1,
const UList< Type > & values2,
const labelUList & addressing )

Write a list of values and a list of values via indirect addressing.

The output does not include the payload size.

◆ writeTopoSet()

bool writeTopoSet ( const polyMesh & mesh,
const topoSet & set,
const vtk::outputOptions opts,
const fileName & file,
bool parallel = UPstream::parRun() )

Dispatch to vtk::writeCellSetFaces, vtk::writeFaceSet, vtk::writePointSet.

The file name is with/without an extension.

Returns
True on successful dispatch

References mesh, and UPstream::parRun().

Here is the call graph for this function:

◆ writeFaceSet()

bool writeFaceSet ( const polyMesh & mesh,
const faceSet & set,
const vtk::outputOptions opts,
const fileName & file,
bool parallel = UPstream::parRun() )

Write faceSet as VTK polydata file.

Only one CELL_DATA, which is the original faceID The file name is with/without an extension.

References mesh, and UPstream::parRun().

Here is the call graph for this function:

◆ writeCellSetFaces()

bool writeCellSetFaces ( const polyMesh & mesh,
const cellSet & set,
const vtk::outputOptions opts,
const fileName & file,
bool parallel = UPstream::parRun() )

Write perimeter faces of cellset to vtk polydata file.

The data are the original cell ids The file name is with/without an extension.

References mesh, and UPstream::parRun().

Here is the call graph for this function:

◆ writePointSet()

bool writePointSet ( const polyMesh & mesh,
const pointSet & set,
const vtk::outputOptions opts,
const fileName & file,
bool parallel = UPstream::parRun() )

Write pointSet to VTK polydata file.

Only one CELL_DATA, which is the original pointID The file name is with/without an extension.

References mesh, and UPstream::parRun().

Here is the call graph for this function:

Variable Documentation

◆ fileExtension

const Foam::Enum<fileTag> fileExtension
extern

File extension (without ".") for some vtk XML file content types.

Referenced by lagrangianWriter::ext(), outputOptions::ext(), surfaceFieldWriter::ext(), and vtmWriter::ext().

◆ fileContentVersions

const Foam::Enum<fileTag> fileContentVersions
extern

Version string for some vtk XML file content types.

Referenced by formatter::beginVTKFile(), and formatter::beginVTKFile().

◆ fileTagNames

const Foam::Enum<fileTag> fileTagNames
extern

◆ fileAttrNames

const Foam::Enum<fileAttr> fileAttrNames
extern

Strings corresponding to the vtk XML attributes.

Referenced by formatter::xmlAttr(), formatter::xmlAttr(), formatter::xmlAttr(), formatter::xmlAttr(), and formatter::xmlAttr().

◆ dataArrayAttrNames

const Foam::Enum<dataArrayAttr> dataArrayAttrNames
extern

Strings corresponding to the vtk XML DataArray attributes.

Referenced by formatter::beginDataArray().