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. More...
 
UList< vtkIdType > asUList (vtkIdTypeArray *array, const label size)
 Wrap vtkIdTypeArray as a UList. More...
 
vtkSmartPointer< vtkPoints > Points (const UList< point > &pts)
 Return a list of points as vtkPoints. More...
 
vtkSmartPointer< vtkPoints > Points (const UList< point > &pts, const labelUList &addr)
 Return an indirect list of points as vtkPoints. More...
 
template<class Face >
vtkSmartPointer< vtkCellArray > Faces (const UList< Face > &faces)
 Convert a list of faces (or triFaces) to vtk polygon cells. More...
 
vtkSmartPointer< vtkPolyData > Vertices (const UList< point > &pts)
 Return vtkPolyData of vertices for each point. More...
 
vtkSmartPointer< vtkPolyData > Vertices (const UList< point > &pts, const labelUList &addr)
 Return vtkPolyData of vertices for each point. More...
 
scalarMinMax rangeOf (vtkDataArray *data)
 Min/Max of scalar, or mag() of non-scalars. Includes nullptr check. More...
 
template<class Type >
void remapTuple (float data[])
 Remapping for some OpenFOAM data types (eg, symmTensor) More...
 
template<>
void remapTuple< symmTensor > (float data[])
 Template specialization for symmTensor ordering. More...
 
template<class Type >
void remapTuple (double data[])
 Remapping for some OpenFOAM data types (eg, symmTensor) More...
 
template<>
void remapTuple< symmTensor > (double data[])
 Template specialization for symmTensor ordering. More...
 
template<class Type >
void foamToVtkTuple (float output[], const Type &val)
 Copy/transcribe OpenFOAM data types to VTK format. More...
 
template<class Type >
void foamToVtkTuple (double output[], const Type &val)
 Copy/transcribe OpenFOAM data types to VTK format. More...
 
template<class Type >
label transcribeFloatData (vtkFloatArray *array, const UList< Type > &input, vtkIdType start=0)
 Copy list to pre-allocated vtk array. More...
 
template<class Type >
vtkSmartPointer< vtkFloatArray > zeroField (const word &name, const label size)
 Create named field initialized to zero. More...
 
template<class Type >
vtkSmartPointer< vtkFloatArray > convertFieldToVTK (const word &name, const UList< Type > &fld)
 Convert field data to a vtkFloatArray. More...
 
vtkSmartPointer< vtkCellArray > identityVertices (const label size)
 An identity list of VTK_VERTEX. More...
 

Detailed Description

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

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
The class is implemented as headers-only.
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 32 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 45 of file foamVtkToolsI.H.

◆ Points() [1/2]

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

Return a list of points as vtkPoints.

Definition at line 59 of file foamVtkToolsI.H.

References UList< T >::size().

Referenced by Patch::mesh(), and Patch::points().

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 76 of file foamVtkToolsI.H.

References UList< T >::size().

Here is the call graph for this function:

◆ Faces()

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

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

Definition at line 44 of file foamVtkToolsTemplates.C.

References cells, f(), and UList< T >::size().

Referenced by Patch::faces(), and Patch::mesh().

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

◆ Vertices() [1/2]

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

Return vtkPolyData of vertices for each point.

Definition at line 93 of file foamVtkToolsI.H.

References UList< T >::size().

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 105 of file foamVtkToolsI.H.

References 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 116 of file foamVtkToolsI.H.

References range.

◆ remapTuple() [1/2]

void remapTuple ( float  data[])
inline

Remapping for some OpenFOAM data types (eg, symmTensor)

Parameters
data[in,out]The data to be remapped in-place

Definition at line 256 of file foamVtkTools.H.

◆ remapTuple< symmTensor >() [1/2]

void remapTuple< symmTensor > ( float  data[])
inline

Template specialization for symmTensor ordering.

◆ remapTuple() [2/2]

void remapTuple ( double  data[])
inline

Remapping for some OpenFOAM data types (eg, symmTensor)

Parameters
data[in,out]The data to be remapped in-place

Definition at line 265 of file foamVtkTools.H.

◆ remapTuple< symmTensor >() [2/2]

void remapTuple< symmTensor > ( double  data[])
inline

Template specialization for symmTensor ordering.

◆ foamToVtkTuple() [1/2]

void foamToVtkTuple ( float  output[],
const Type &  val 
)
inline

Copy/transcribe OpenFOAM data types to VTK format.

This allows a change of data type (float vs double) as well as addressing any swapping issues (eg, symmTensor)

Parameters
output[out]The output scratch space. Must be long enough to hold the result.
val[in]The input data to copy/transcribe

Definition at line 213 of file foamVtkToolsI.H.

References Foam::component().

Referenced by vtuAdaptor::convertField().

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

◆ foamToVtkTuple() [2/2]

void foamToVtkTuple ( double  output[],
const Type &  val 
)
inline

Copy/transcribe OpenFOAM data types to VTK format.

This allows a change of data type (float vs double) as well as addressing any swapping issues (eg, symmTensor)

Parameters
output[out]The output scratch space. Must be long enough to hold the result.
val[in]The input data to copy/transcribe

Definition at line 228 of file foamVtkToolsI.H.

References Foam::component().

Here is the call graph for this function:

◆ transcribeFloatData()

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

Copy list to pre-allocated vtk array.

Returns
number of input items copied
Parameters
startThe write offset into output array

Referenced by convertFieldToVTK().

Here is the caller graph for this function:

◆ zeroField()

vtkSmartPointer< vtkFloatArray > zeroField ( const word name,
const label  size 
)

Create named field initialized to zero.

Definition at line 326 of file foamVtkToolsTemplates.C.

References Foam::name().

Here is the call graph for this function:

◆ convertFieldToVTK()

vtkSmartPointer< vtkFloatArray > convertFieldToVTK ( const word name,
const UList< Type > &  fld 
)

Convert field data to a vtkFloatArray.

Definition at line 354 of file foamVtkToolsTemplates.C.

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

Here is the call graph for this function:

◆ identityVertices()

vtkSmartPointer< vtkCellArray > identityVertices ( const label  size)
inline

An identity list of VTK_VERTEX.

Definition at line 137 of file foamVtkToolsI.H.

References cells.