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

A collection of static methods to assist converting OpenFOAM data structures into VTK internal data structures. More...

Classes

struct  Patch
 Convert OpenFOAM patch to vtkPolyData. More...

Functions

UList< uint8_t > asUList (vtkUnsignedCharArray *array, const label size)
 Wrap vtkUnsignedCharArray as a UList.
UList< vtkIdType > asUList (vtkIdTypeArray *array, const label size)
 Wrap vtkIdTypeArray as a UList.
vtkSmartPointer< vtkPoints > NewPoints (vtkIdType count)
 Allocate vtkPoints.
vtkSmartPointer< vtkPoints > Points (const UList< point > &pts)
 Return a list of points as vtkPoints.
vtkSmartPointer< vtkPoints > Points (const UList< point > &pts, const labelUList &addr)
 Return an indirect list of points as vtkPoints.
template<class Face>
vtkSmartPointer< vtkCellArray > Faces (const UList< Face > &faces)
 Convert a list of faces (or triFaces) to vtk polygon cells.
vtkSmartPointer< vtkPolyData > Vertices (const UList< point > &pts)
 Return vtkPolyData of vertices for each point.
vtkSmartPointer< vtkPolyData > Vertices (const UList< point > &pts, const labelUList &addr)
 Return vtkPolyData of vertices for each point.
scalarMinMax rangeOf (vtkDataArray *data)
 Min/Max of scalar, or mag() of non-scalars. Includes nullptr check.
template<class Type>
void foamToVtkTuple (float output[], const Type &value)
 Older name for copyTuple.
template<class Type>
void foamToVtkTuple (double output[], const Type &value)
 Older name for copyTuple.
template<class Type>
label transcribeFloatData (vtkDataArray *array, const UList< Type > &input, vtkIdType start=0)
 Copy list to pre-allocated vtk array.
template<class Type, class DataArrayType = vtkFloatArray>
vtkSmartPointer< DataArrayType > zeroField (const word &name, const label size)
 Create named field initialized to zero.
template<class Type, class DataArrayType = vtkFloatArray>
vtkSmartPointer< DataArrayType > convertFieldToVTK (const word &name, const UList< Type > &fld)
 Convert field data to a vtkFloatArray.
template<class Type, class DataArrayType = vtkFloatArray>
vtkSmartPointer< DataArrayType > convertFieldToVTK (const word &name, const UList< Type > &fld, const labelUList &addr)
 Convert field data to a vtkFloatArray, using indirect addressing.
vtkSmartPointer< vtkCellArray > identityVertices (const vtkIdType size)
 An identity list of VTK_VERTEX.
template<class Type>
Type copyTuple (const Type &value)
 Return a copy of the value, with components changed from OpenFOAM order to VTK order (for symmTensor).
template<class FloatType, class Type>
const FloatType * copyTuple_impl (FloatType output[], const Type &value)
 Implementation detail - not for general use!
template<class Type>
const double * copyTuple (double output[], const Type &value)
 Copy/transcribe components of OpenFOAM value to the output buffer (which must be large enough to contain all components).
template<class Type>
const float * copyTuple (float output[], const Type &value)
 Copy/transcribe components of OpenFOAM value to the output buffer (which must be large enough to contain all components).
template<class Type>
void reorderTuple (Type &value)
 Inplace component reordering of value from OpenFOAM order to VTK order.

Detailed Description

A collection of static methods to assist converting OpenFOAM data structures into VTK internal data structures.

A collection of static methods to help with conversion to/from VTK data.

Remapping of the symmTensor order is required in input or output directions. OpenFOAM uses (XX, XY, XZ, YY, YZ, ZZ) order, VTK uses (XX, YY, ZZ, XY, YZ, XZ) order.

Note
This file is implemented as headers-only.
Source files

Source files

Function Documentation

◆ asUList() [1/2]

Foam::UList< uint8_t > asUList ( vtkUnsignedCharArray * array,
const label size )
inline

Wrap vtkUnsignedCharArray as a UList.

Definition at line 23 of file foamVtkToolsI.H.

Referenced by vtuAdaptor::internal().

Here is the caller graph for this function:

◆ asUList() [2/2]

Foam::UList< vtkIdType > asUList ( vtkIdTypeArray * array,
const label size )
inline

Wrap vtkIdTypeArray as a UList.

Definition at line 36 of file foamVtkToolsI.H.

◆ NewPoints()

vtkSmartPointer< vtkPoints > NewPoints ( vtkIdType count)
inline

Allocate vtkPoints.

Definition at line 50 of file foamVtkToolsI.H.

Referenced by Points(), and Points().

Here is the caller graph for this function:

◆ Points() [1/2]

vtkSmartPointer< vtkPoints > Points ( const UList< point > & pts)
inline

Return a list of points as vtkPoints.

Definition at line 71 of file foamVtkToolsI.H.

References NewPoints(), p, and pts.

Referenced by Vertices(), and Vertices().

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

◆ Points() [2/2]

vtkSmartPointer< vtkPoints > Points ( const UList< point > & pts,
const labelUList & addr )
inline

Return an indirect list of points as vtkPoints.

Definition at line 89 of file foamVtkToolsI.H.

References NewPoints(), p, pts, and UList< T >::size().

Here is the call graph for this function:

◆ Faces()

template<class Face>
vtkSmartPointer< vtkCellArray > Faces ( const UList< Face > & faces)

Convert a list of faces (or triFaces) to vtk polygon cells.

References pts.

◆ Vertices() [1/2]

vtkSmartPointer< vtkPolyData > Vertices ( const UList< point > & pts)
inline

Return vtkPolyData of vertices for each point.

Definition at line 109 of file foamVtkToolsI.H.

References identityVertices(), Points(), and pts.

Here is the call graph for this function:

◆ Vertices() [2/2]

vtkSmartPointer< vtkPolyData > Vertices ( const UList< point > & pts,
const labelUList & addr )
inline

Return vtkPolyData of vertices for each point.

Definition at line 124 of file foamVtkToolsI.H.

References identityVertices(), Points(), pts, and UList< T >::size().

Here is the call graph for this function:

◆ rangeOf()

Foam::scalarMinMax rangeOf ( vtkDataArray * data)
inline

Min/Max of scalar, or mag() of non-scalars. Includes nullptr check.

Definition at line 139 of file foamVtkToolsI.H.

References range.

◆ foamToVtkTuple() [1/2]

template<class Type>
void foamToVtkTuple ( float output[],
const Type & value )

Older name for copyTuple.

Definition at line 318 of file foamVtkTools.H.

References copyTuple().

Here is the call graph for this function:

◆ foamToVtkTuple() [2/2]

template<class Type>
void foamToVtkTuple ( double output[],
const Type & value )

Older name for copyTuple.

Definition at line 327 of file foamVtkTools.H.

References copyTuple().

Here is the call graph for this function:

◆ transcribeFloatData()

template<class Type>
label transcribeFloatData ( vtkDataArray * array,
const UList< Type > & input,
vtkIdType start = 0 )

Copy list to pre-allocated vtk array.

Returns
number of input items copied
Parameters
[out]arraydestination (vtkFloatArray or vtkDoubleArray) can also be a nullptr (no-op)
startThe write offset into output array

◆ zeroField()

template<class Type, class DataArrayType = vtkFloatArray>
vtkSmartPointer< DataArrayType > zeroField ( const word & name,
const label size )

Create named field initialized to zero.

References Foam::name().

Here is the call graph for this function:

◆ convertFieldToVTK() [1/2]

template<class Type, class DataArrayType = vtkFloatArray>
vtkSmartPointer< DataArrayType > convertFieldToVTK ( const word & name,
const UList< Type > & fld )

Convert field data to a vtkFloatArray.

References fld(), and Foam::name().

Here is the call graph for this function:

◆ convertFieldToVTK() [2/2]

template<class Type, class DataArrayType = vtkFloatArray>
vtkSmartPointer< DataArrayType > convertFieldToVTK ( const word & name,
const UList< Type > & fld,
const labelUList & addr )

Convert field data to a vtkFloatArray, using indirect addressing.

References fld(), and Foam::name().

Here is the call graph for this function:

◆ identityVertices()

vtkSmartPointer< vtkCellArray > identityVertices ( const vtkIdType size)
inline

An identity list of VTK_VERTEX.

Definition at line 161 of file foamVtkToolsI.H.

References cells.

Referenced by Vertices(), and Vertices().

Here is the caller graph for this function:

◆ copyTuple() [1/3]

template<class Type>
Type copyTuple ( const Type & value)

Return a copy of the value, with components changed from OpenFOAM order to VTK order (for symmTensor).

Referenced by foamToVtkTuple(), and foamToVtkTuple().

Here is the caller graph for this function:

◆ copyTuple_impl()

template<class FloatType, class Type>
const FloatType * copyTuple_impl ( FloatType output[],
const Type & value )

Implementation detail - not for general use!

◆ copyTuple() [2/3]

template<class Type>
const double * copyTuple ( double output[],
const Type & value )

Copy/transcribe components of OpenFOAM value to the output buffer (which must be large enough to contain all components).

Note
When copying, the components of Foam::symmTensor are reordering to match the VTK order:
  • OpenFOAM : (XX, XY, XZ, YY, YZ, ZZ)
  • VTK order: (XX, YY, ZZ, XY, YZ, XZ)
Returns
the pointer to output buffer, which allows this routine to act as pass-through filter.
Parameters
[out]outputthe output/work buffer

◆ copyTuple() [3/3]

template<class Type>
const float * copyTuple ( float output[],
const Type & value )

Copy/transcribe components of OpenFOAM value to the output buffer (which must be large enough to contain all components).

Parameters
[out]outputthe output/work buffer

◆ reorderTuple()

template<class Type>
void reorderTuple ( Type & value)

Inplace component reordering of value from OpenFOAM order to VTK order.

Reordering is currently only applied for Foam::symmTensor, all other types are a no-op.

See also
copyTuple