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...
Public Types | |
enum | contentType { LEGACY, XML, INTERNAL1, INTERNAL2 } |
Types of content that the storage may represent. More... | |
enum | slotType { CELLS, CELLS_OFFSETS, FACES, FACES_OFFSETS } |
The possible storage 'slots' that can be used. More... | |
Public Member Functions | |
vtuSizing () noexcept | |
Default construct. More... | |
vtuSizing (const polyMesh &mesh) | |
Construct sizing by analyzing the mesh. More... | |
vtuSizing (const polyMesh &mesh, const bool decompose) | |
Construct sizing by analyzing the mesh. More... | |
void | reset (const polyMesh &mesh, const bool decompose=false) |
Reset sizing by analyzing the mesh. More... | |
void | clear () noexcept |
Reset all sizes to zero. More... | |
bool | decompose () const |
Query the decompose flag (normally off) More... | |
label | nCells () const |
Number of cells for the mesh. More... | |
label | nPoints () const |
Number of points for the mesh. More... | |
label | nVertLabels () const |
Number of vertex labels for the mesh. More... | |
label | nFaceLabels () const |
Number of polyhedral face labels for the mesh. More... | |
label | nCellsPoly () const |
Number of polyhedral cells for the mesh. More... | |
label | nVertPoly () const |
Number of vertex labels for polyhedral cells of the mesh. More... | |
label | nAddCells () const |
Number of additional (decomposed) cells for the mesh. More... | |
label | nAddPoints () const |
Number of additional (decomposed) points for the mesh. More... | |
label | nAddVerts () const |
Number of additional (decomposed) vertices for the mesh. More... | |
label | nFieldCells () const |
Number of field cells = nCells + nAddCells. More... | |
label | nFieldPoints () const |
Number of field points = nPoints + nAddPoints. More... | |
label | sizeOf (const enum contentType output, const enum slotType slot) const |
Return the required size for the storage slot. More... | |
label | sizeLegacy () const |
The calculated size for legacy storage. More... | |
label | sizeLegacy (const enum slotType slot) const |
The calculated size for legacy storage of the specified slot. More... | |
label | sizeXml (const enum slotType slot) const |
The calculated size for xml storage of the specified slot. More... | |
label | sizeInternal1 (const enum slotType slot) const |
The calculated size for vtk-internal storage of the specified slot. More... | |
label | sizeInternal2 (const enum slotType slot) const |
The calculated size for vtk-internal storage of the specified slot. More... | |
void | populateLegacy (const polyMesh &mesh, UList< uint8_t > &cellTypes, labelUList &connectivity, foamVtkMeshMaps &maps) const |
Populate lists for Legacy output. More... | |
void | populateXml (const polyMesh &mesh, UList< uint8_t > &cellTypes, labelUList &connectivity, labelUList &offsets, labelUList &faces, labelUList &facesOffsets, foamVtkMeshMaps &maps) const |
Populate lists for XML output. More... | |
void | populateInternal (const polyMesh &mesh, UList< uint8_t > &cellTypes, UList< int > &connectivity, UList< int > &offsets, UList< int > &faces, UList< int > &facesOffsets, foamVtkMeshMaps &maps, const enum contentType output) const |
Populate lists for Internal VTK format. More... | |
void | populateInternal (const polyMesh &mesh, UList< uint8_t > &cellTypes, UList< int > &connectivity, UList< int > &offsets, UList< int > &faces, UList< int > &facesOffsets, labelUList &cellMap, labelUList &addPointsIds, const enum contentType output) const |
Populate lists for Internal VTK format. More... | |
void | populateInternal (const polyMesh &mesh, UList< uint8_t > &cellTypes, UList< long > &connectivity, UList< long > &offsets, UList< long > &faces, UList< long > &facesOffsets, foamVtkMeshMaps &maps, const enum contentType output) const |
Populate lists for Internal VTK format. More... | |
void | populateInternal (const polyMesh &mesh, UList< uint8_t > &cellTypes, UList< long > &connectivity, UList< long > &offsets, UList< long > &faces, UList< long > &facesOffsets, labelUList &cellMap, labelUList &addPointsIds, const enum contentType output) const |
Populate lists for Internal VTK format. More... | |
void | populateInternal (const polyMesh &mesh, UList< uint8_t > &cellTypes, UList< long long > &connectivity, UList< long long > &offsets, UList< long long > &faces, UList< long long > &facesOffsets, foamVtkMeshMaps &maps, const enum contentType output) const |
Populate lists for Internal VTK format. More... | |
void | populateInternal (const polyMesh &mesh, UList< uint8_t > &cellTypes, UList< long long > &connectivity, UList< long long > &offsets, UList< long long > &faces, UList< long long > &facesOffsets, labelUList &cellMap, labelUList &addPointsIds, const enum contentType output) const |
Populate lists for Internal VTK format. More... | |
void | info (Ostream &os) const |
Report some information. More... | |
bool | operator== (const vtuSizing &rhs) const |
Test equality. More... | |
bool | operator!= (const vtuSizing &rhs) const |
Test inequality. More... | |
Static Public Member Functions | |
static labelList | copyVertLabelsLegacy (const labelUList &connectivity, const label globalPointOffset) |
Copy vertex labels with a global point offset - legacy format. More... | |
static labelList | copyVertLabelsXml (const labelUList &connectivity, const label globalPointOffset) |
Copy vertex labels with a global point offset - XML format. More... | |
static labelList | copyFaceLabelsXml (const labelUList &faceLabels, const label globalPointOffset) |
Copy faces stream labels with a global point offset - XML format. More... | |
static labelList | copyFaceOffsetsXml (const labelUList &faceOffsets, const label prevOffset) |
Copy face offsets with an offset from previous - XML format. More... | |
static void | renumberVertLabelsLegacy (labelUList &connectivity, const label globalPointOffset) |
Renumber vertex labels by global point offset - legacy format. More... | |
static void | renumberVertLabelsXml (labelUList &connectivity, const label globalPointOffset) |
Renumber vertex labels by global point offset - XML format. More... | |
static void | renumberFaceLabelsXml (labelUList &faceLabels, const label globalPointOffset) |
Renumber faces stream labels by global point offset - XML format. More... | |
static void | renumberFaceOffsetsXml (labelUList &faceOffsets, const label prevOffset) |
Renumber face offsets with an offset from previous - XML format. More... | |
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.
This class is intended to populate externally allocated arrays with content that is compatible with what VTK expects. This approach allows an improved separation of the OpenFOAM mesh description and the storage, and allows support of alternative storage containers (eg, std::vector, vtkDataArray). The ideal goal would be a zero-copy mechanism, but this does not work for several reasons:
These are the storage entries normally associate with each output-type:
legacy output | |
---|---|
| vtk cell type (1-255) |
| nLabels and unique vertex labels used by the cell, or |
| [nLabels nFaces, nFace0Pts, id1, id2, ..., nFace1Pts, id1, id2, ...] |
xml output | |
---|---|
| vtk cell type (1-255) |
| unique vertex labels used by the cell |
| end offset for each of connectivity |
| face stream for polyhedral cells |
| [nFaces, nFace0Pts, id1, id2, ..., nFace1Pts, id1, id2, ...] |
| end offset for each of faces , with -1 for primitive cells |
internal1 storage (VTK-8 and earlier) | |
---|---|
| vtk cell type (1-255) |
| nLabels and unique vertex labels used by the cell |
| begin location for each of connectivity |
| face stream for polyhedral cells |
| [nFaces, nFace0Pts, id1, id2, ..., nFace1Pts, id1, id2, ...] |
| begin location for each of faces , with -1 for primitive cells |
internal2 storage (with VTK_CELL_ARRAY_V2) | |
---|---|
| vtk cell type (1-255) |
| unique vertex labels used by the cell |
| begin/end offsets for connectivity |
| face stream for polyhedral cells |
| [nFaces, nFace0Pts, id1, id2, ..., nFace1Pts, id1, id2, ...] |
| begin location for each of faces , with -1 for primitive cells |
The VTK storage concept for "connectivity" and "faces" somewhat resemble a CompactListList.
Definition at line 200 of file foamVtuSizing.H.
enum contentType |
Types of content that the storage may represent.
Enumerator | |
---|---|
LEGACY | Legacy VTK content. |
XML | XML (VTU) content. |
INTERNAL1 | Internal vtkUnstructuredGrid content. |
INTERNAL2 | Internal vtkUnstructuredGrid content, VTK_CELL_ARRAY_V2. |
Definition at line 207 of file foamVtuSizing.H.
enum slotType |
The possible storage 'slots' that can be used.
Definition at line 216 of file foamVtuSizing.H.
|
noexcept |
Default construct.
Definition at line 47 of file foamVtuSizing.C.
References clear().
Construct sizing by analyzing the mesh.
No polyhedral decomposition.
Construct sizing by analyzing the mesh.
Optionally with polyhedral decomposition.
Definition at line 54 of file foamVtuSizing.C.
Reset sizing by analyzing the mesh.
Optionally with polyhedral decomposition.
Definition at line 84 of file foamVtuSizing.C.
References HashTable< T, Key, Hash >::clear(), f(), cellModel::HEX, Foam::hex(), HashSet< Key, Hash >::insert(), mesh, cellShape::model(), cellModel::PRISM, cellModel::PYR, cellModel::ref(), HashTable< T, Key, Hash >::size(), cellModel::TET, cellModel::TETWEDGE, and cellModel::WEDGE.
|
noexcept |
Reset all sizes to zero.
Definition at line 66 of file foamVtuSizing.C.
|
inline |
Query the decompose flag (normally off)
Definition at line 32 of file foamVtuSizingI.H.
Referenced by vtuSizing::operator==().
|
inline |
Number of cells for the mesh.
Definition at line 38 of file foamVtuSizingI.H.
Referenced by vtuSizing::operator==().
|
inline |
Number of points for the mesh.
Definition at line 44 of file foamVtuSizingI.H.
Referenced by vtuSizing::operator==().
|
inline |
Number of vertex labels for the mesh.
Definition at line 50 of file foamVtuSizingI.H.
Referenced by vtuSizing::operator==().
|
inline |
Number of polyhedral face labels for the mesh.
Definition at line 56 of file foamVtuSizingI.H.
Referenced by vtuSizing::operator==().
|
inline |
Number of polyhedral cells for the mesh.
Definition at line 62 of file foamVtuSizingI.H.
Referenced by vtuSizing::operator==().
|
inline |
Number of vertex labels for polyhedral cells of the mesh.
Definition at line 68 of file foamVtuSizingI.H.
Referenced by vtuSizing::operator==().
|
inline |
Number of additional (decomposed) cells for the mesh.
Definition at line 74 of file foamVtuSizingI.H.
Referenced by vtuSizing::operator==().
|
inline |
Number of additional (decomposed) points for the mesh.
Definition at line 80 of file foamVtuSizingI.H.
Referenced by vtuSizing::operator==().
|
inline |
Number of additional (decomposed) vertices for the mesh.
Definition at line 86 of file foamVtuSizingI.H.
Referenced by vtuSizing::operator==().
|
inline |
Number of field cells = nCells + nAddCells.
Definition at line 92 of file foamVtuSizingI.H.
Referenced by vtuAdaptor::internal().
|
inline |
Number of field points = nPoints + nAddPoints.
Definition at line 98 of file foamVtuSizingI.H.
Foam::label sizeOf | ( | const enum contentType | output, |
const enum slotType | slot | ||
) | const |
Return the required size for the storage slot.
Definition at line 207 of file foamVtuSizing.C.
References Foam::vtk::CELLS, Foam::vtk::FACES, and Foam::output().
Referenced by vtuAdaptor::internal().
|
inline |
The calculated size for legacy storage.
Definition at line 104 of file foamVtuSizingI.H.
References Foam::vtk::CELLS.
|
inline |
The calculated size for legacy storage of the specified slot.
Definition at line 111 of file foamVtuSizingI.H.
|
inline |
The calculated size for xml storage of the specified slot.
Definition at line 120 of file foamVtuSizingI.H.
|
inline |
The calculated size for vtk-internal storage of the specified slot.
Definition at line 129 of file foamVtuSizingI.H.
|
inline |
The calculated size for vtk-internal storage of the specified slot.
Definition at line 138 of file foamVtuSizingI.H.
void populateLegacy | ( | const polyMesh & | mesh, |
UList< uint8_t > & | cellTypes, | ||
labelUList & | connectivity, | ||
foamVtkMeshMaps & | maps | ||
) | const |
Populate lists for Legacy output.
Definition at line 314 of file foamVtuSizing.C.
References foamVtkMeshMaps::additionalIds(), foamVtkMeshMaps::cellMap(), cellTypes, and mesh.
void populateXml | ( | const polyMesh & | mesh, |
UList< uint8_t > & | cellTypes, | ||
labelUList & | connectivity, | ||
labelUList & | offsets, | ||
labelUList & | faces, | ||
labelUList & | facesOffsets, | ||
foamVtkMeshMaps & | maps | ||
) | const |
Populate lists for XML output.
Definition at line 343 of file foamVtuSizing.C.
References foamVtkMeshMaps::additionalIds(), foamVtkMeshMaps::cellMap(), cellTypes, and mesh.
void populateInternal | ( | const polyMesh & | mesh, |
UList< uint8_t > & | cellTypes, | ||
UList< int > & | connectivity, | ||
UList< int > & | offsets, | ||
UList< int > & | faces, | ||
UList< int > & | facesOffsets, | ||
foamVtkMeshMaps & | maps, | ||
const enum contentType | output | ||
) | const |
Populate lists for Internal VTK format.
Definition at line 432 of file foamVtuSizing.C.
Referenced by vtuAdaptor::internal().
void populateInternal | ( | const polyMesh & | mesh, |
UList< uint8_t > & | cellTypes, | ||
UList< int > & | connectivity, | ||
UList< int > & | offsets, | ||
UList< int > & | faces, | ||
UList< int > & | facesOffsets, | ||
labelUList & | cellMap, | ||
labelUList & | addPointsIds, | ||
const enum contentType | output | ||
) | const |
Populate lists for Internal VTK format.
Definition at line 432 of file foamVtuSizing.C.
void populateInternal | ( | const polyMesh & | mesh, |
UList< uint8_t > & | cellTypes, | ||
UList< long > & | connectivity, | ||
UList< long > & | offsets, | ||
UList< long > & | faces, | ||
UList< long > & | facesOffsets, | ||
foamVtkMeshMaps & | maps, | ||
const enum contentType | output | ||
) | const |
Populate lists for Internal VTK format.
Definition at line 433 of file foamVtuSizing.C.
void populateInternal | ( | const polyMesh & | mesh, |
UList< uint8_t > & | cellTypes, | ||
UList< long > & | connectivity, | ||
UList< long > & | offsets, | ||
UList< long > & | faces, | ||
UList< long > & | facesOffsets, | ||
labelUList & | cellMap, | ||
labelUList & | addPointsIds, | ||
const enum contentType | output | ||
) | const |
Populate lists for Internal VTK format.
Definition at line 433 of file foamVtuSizing.C.
void populateInternal | ( | const polyMesh & | mesh, |
UList< uint8_t > & | cellTypes, | ||
UList< long long > & | connectivity, | ||
UList< long long > & | offsets, | ||
UList< long long > & | faces, | ||
UList< long long > & | facesOffsets, | ||
foamVtkMeshMaps & | maps, | ||
const enum contentType | output | ||
) | const |
Populate lists for Internal VTK format.
Definition at line 434 of file foamVtuSizing.C.
void populateInternal | ( | const polyMesh & | mesh, |
UList< uint8_t > & | cellTypes, | ||
UList< long long > & | connectivity, | ||
UList< long long > & | offsets, | ||
UList< long long > & | faces, | ||
UList< long long > & | facesOffsets, | ||
labelUList & | cellMap, | ||
labelUList & | addPointsIds, | ||
const enum contentType | output | ||
) | const |
Populate lists for Internal VTK format.
Definition at line 434 of file foamVtuSizing.C.
|
static |
Copy vertex labels with a global point offset - legacy format.
Definition at line 443 of file foamVtuSizing.C.
References Foam::output().
|
static |
Copy vertex labels with a global point offset - XML format.
Definition at line 526 of file foamVtuSizing.C.
References Foam::output().
|
static |
Copy faces stream labels with a global point offset - XML format.
Definition at line 565 of file foamVtuSizing.C.
References Foam::output().
|
static |
Copy face offsets with an offset from previous - XML format.
Definition at line 620 of file foamVtuSizing.C.
References Foam::output().
|
static |
Renumber vertex labels by global point offset - legacy format.
Definition at line 461 of file foamVtuSizing.C.
References UList< T >::begin(), and UList< T >::end().
|
static |
Renumber vertex labels by global point offset - XML format.
Definition at line 544 of file foamVtuSizing.C.
|
static |
Renumber faces stream labels by global point offset - XML format.
Definition at line 583 of file foamVtuSizing.C.
References UList< T >::begin(), and UList< T >::end().
|
static |
Renumber face offsets with an offset from previous - XML format.
Definition at line 638 of file foamVtuSizing.C.
void info | ( | Ostream & | os | ) | const |
Report some information.
Definition at line 663 of file foamVtuSizing.C.
Test equality.
Definition at line 698 of file foamVtuSizing.C.
References vtuSizing::decompose(), vtuSizing::nAddCells(), vtuSizing::nAddPoints(), vtuSizing::nAddVerts(), vtuSizing::nCells(), vtuSizing::nCellsPoly(), vtuSizing::nFaceLabels(), nPoints, vtuSizing::nPoints(), vtuSizing::nVertLabels(), and vtuSizing::nVertPoly().
Test inequality.
Definition at line 717 of file foamVtuSizing.C.
References Foam::operator==().