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 : char { LEGACY , XML , INTERNAL1 , INTERNAL2 } |
Types of content that the storage may represent. More... | |
enum | slotType : char { CELLS , CELLS_OFFSETS , FACES , FACES_OFFSETS } |
The possible storage 'slots' that can be used. More... | |
enum | selectionModeType : char { FULL_MESH , SUBSET_MESH , SHAPE_MESH } |
How the mesh cells have been selected or defined. 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 | reset (const polyMesh &mesh, const labelUList &subsetCellsIds, const bool decompose=false) |
Reset sizing by analyzing a subset of the mesh. More... | |
void | resetShapes (const UList< cellShape > &shapes) |
Reset sizing using primitive shapes only (ADVANCED USAGE) More... | |
void | clear () noexcept |
Reset all sizes to zero. More... | |
bool | decompose () const noexcept |
Query the decompose flag (normally off) More... | |
bool | manifold () const noexcept |
Manifold mesh cells detected? Globally consistent quantity. More... | |
selectionModeType | selectionMode () const noexcept |
Query how the mesh cells have been selected or defined. More... | |
label | nCells () const noexcept |
Number of cells for the mesh. More... | |
label | nPoints () const noexcept |
Number of points for the mesh. More... | |
label | nVertLabels () const noexcept |
Number of vertex labels for the mesh. More... | |
label | nFaceLabels () const noexcept |
Number of polyhedral face labels for the mesh. More... | |
label | nCellsPoly () const noexcept |
Number of polyhedral cells for the mesh. More... | |
label | nVertPoly () const noexcept |
Number of vertex labels for polyhedral cells of the mesh. More... | |
label | nAddCells () const noexcept |
Number of additional (decomposed) cells for the mesh. More... | |
label | nAddPoints () const noexcept |
Number of additional (decomposed) points for the mesh. More... | |
label | nAddVerts () const noexcept |
Number of additional (decomposed) vertices for the mesh. More... | |
label | nFieldCells () const noexcept |
Number of field cells = nCells + nAddCells. More... | |
label | nFieldPoints () const noexcept |
Number of field points = nPoints + nAddPoints. More... | |
void | setNumPoints (label n) noexcept |
Alter number of mesh points (ADVANCED USAGE) More... | |
void | setNumAddPoints (label n) noexcept |
Alter number of additional (cell-centre) points (ADVANCED USAGE) 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... | |
Protected Member Functions | |
void | populateShapesLegacy (const UList< cellShape > &shapes, UList< uint8_t > &cellTypes, labelUList &connectivity, foamVtkMeshMaps &maps) const |
Reset list for primitive shapes only (ADVANCED USAGE) More... | |
void | populateShapesXml (const UList< cellShape > &shapes, UList< uint8_t > &cellTypes, labelUList &connectivity, labelUList &offsets, labelUList &faces, labelUList &facesOffsets, foamVtkMeshMaps &maps) const |
Reset list for primitive shapes only (ADVANCED USAGE) 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 DataFile Version 2.0) | |
---|---|
| 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 201 of file foamVtuSizing.H.
enum contentType : char |
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 208 of file foamVtuSizing.H.
enum slotType : char |
The possible storage 'slots' that can be used.
Definition at line 217 of file foamVtuSizing.H.
enum selectionModeType : char |
How the mesh cells have been selected or defined.
Enumerator | |
---|---|
FULL_MESH | |
SUBSET_MESH | |
SHAPE_MESH |
Definition at line 227 of file foamVtuSizing.H.
|
noexcept |
Default construct.
Definition at line 204 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 210 of file foamVtuSizing.C.
|
protected |
Reset list for primitive shapes only (ADVANCED USAGE)
Definition at line 616 of file foamVtuSizing.C.
References foamVtkMeshMaps::additionalIds(), foamVtkMeshMaps::cellMap(), and cellTypes.
|
protected |
Reset list for primitive shapes only (ADVANCED USAGE)
Definition at line 674 of file foamVtuSizing.C.
References foamVtkMeshMaps::additionalIds(), foamVtkMeshMaps::cellMap(), and cellTypes.
Reset sizing by analyzing the mesh.
Optionally with polyhedral decomposition.
Definition at line 242 of file foamVtuSizing.C.
References mesh.
void reset | ( | const polyMesh & | mesh, |
const labelUList & | subsetCellsIds, | ||
const bool | decompose = false |
||
) |
Reset sizing by analyzing a subset of the mesh.
A labelUList::null() selection corresponds to the entire mesh. Polyhedral decomposition is disabled for subsets.
const cellList& meshCells = mesh.cells();
Definition at line 252 of file foamVtuSizing.C.
References HashTable< T, Key, Hash >::clear(), f(), hex, cellModel::HEX, HashSet< Key, Hash >::insert(), mesh, cellShape::model(), Time::New(), Foam::notNull(), cellModel::PRISM, cellModel::PYR, dictionary::Searcher< Const >::ref(), HashTable< T, Key, Hash >::size(), UList< T >::size(), cellModel::TET, cellModel::TETWEDGE, and cellModel::WEDGE.
Reset sizing using primitive shapes only (ADVANCED USAGE)
Effectively removes any polyhedrals!
Definition at line 411 of file foamVtuSizing.C.
References Foam::exit(), Foam::FatalError, FatalErrorInFunction, hex, cellModel::HEX, Foam::max(), cellShape::model(), Foam::nl, cellModel::PRISM, cellModel::PYR, dictionary::Searcher< Const >::ref(), UList< T >::size(), and cellModel::TET.
Referenced by vtuCells::resetShapes().
|
noexcept |
Reset all sizes to zero.
Definition at line 223 of file foamVtuSizing.C.
Referenced by vtuCells::clear().
|
inlinenoexcept |
Query the decompose flag (normally off)
Definition at line 32 of file foamVtuSizingI.H.
Referenced by vtuSizing::operator==().
|
inlinenoexcept |
Manifold mesh cells detected? Globally consistent quantity.
Definition at line 38 of file foamVtuSizingI.H.
|
inlinenoexcept |
Query how the mesh cells have been selected or defined.
Definition at line 45 of file foamVtuSizingI.H.
|
inlinenoexcept |
Number of cells for the mesh.
Definition at line 51 of file foamVtuSizingI.H.
Referenced by vtuSizing::operator==(), and vtuCells::resetShapes().
|
inlinenoexcept |
Number of points for the mesh.
Definition at line 57 of file foamVtuSizingI.H.
Referenced by vtuSizing::operator==().
|
inlinenoexcept |
Number of vertex labels for the mesh.
Definition at line 63 of file foamVtuSizingI.H.
Referenced by vtuSizing::operator==().
|
inlinenoexcept |
Number of polyhedral face labels for the mesh.
Definition at line 69 of file foamVtuSizingI.H.
Referenced by vtuSizing::operator==().
|
inlinenoexcept |
Number of polyhedral cells for the mesh.
Definition at line 75 of file foamVtuSizingI.H.
Referenced by vtuSizing::operator==().
|
inlinenoexcept |
Number of vertex labels for polyhedral cells of the mesh.
Definition at line 81 of file foamVtuSizingI.H.
Referenced by vtuSizing::operator==().
|
inlinenoexcept |
Number of additional (decomposed) cells for the mesh.
Definition at line 87 of file foamVtuSizingI.H.
Referenced by vtuSizing::operator==().
|
inlinenoexcept |
Number of additional (decomposed) points for the mesh.
Definition at line 93 of file foamVtuSizingI.H.
Referenced by vtuSizing::operator==().
|
inlinenoexcept |
Number of additional (decomposed) vertices for the mesh.
Definition at line 99 of file foamVtuSizingI.H.
Referenced by vtuSizing::operator==().
|
inlinenoexcept |
Number of field cells = nCells + nAddCells.
Definition at line 105 of file foamVtuSizingI.H.
Referenced by vtuAdaptor::internal(), and internalMeshWriter::writeUniform().
|
inlinenoexcept |
Number of field points = nPoints + nAddPoints.
Definition at line 111 of file foamVtuSizingI.H.
Referenced by isoSurfaceTopo::isoSurfaceTopo(), and internalMeshWriter::writeUniform().
|
inlinenoexcept |
Alter number of mesh points (ADVANCED USAGE)
Definition at line 464 of file foamVtuSizing.H.
References n.
Referenced by isoSurfaceTopo::isoSurfaceTopo().
|
inlinenoexcept |
Alter number of additional (cell-centre) points (ADVANCED USAGE)
Definition at line 467 of file foamVtuSizing.H.
References n.
Foam::label sizeOf | ( | const enum contentType | output, |
const enum slotType | slot | ||
) | const |
Return the required size for the storage slot.
Definition at line 480 of file foamVtuSizing.C.
References Foam::output().
Referenced by vtuAdaptor::internal().
|
inline |
The calculated size for legacy storage.
Definition at line 117 of file foamVtuSizingI.H.
|
inline |
The calculated size for legacy storage of the specified slot.
Definition at line 123 of file foamVtuSizingI.H.
|
inline |
The calculated size for xml storage of the specified slot.
Definition at line 132 of file foamVtuSizingI.H.
|
inline |
The calculated size for vtk-internal storage of the specified slot.
Definition at line 141 of file foamVtuSizingI.H.
|
inline |
The calculated size for vtk-internal storage of the specified slot.
Definition at line 150 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 587 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 645 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 767 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 767 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 768 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 768 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 769 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 769 of file foamVtuSizing.C.
|
static |
Copy vertex labels with a global point offset - legacy format.
Definition at line 777 of file foamVtuSizing.C.
References Foam::output().
|
static |
Copy vertex labels with a global point offset - XML format.
Definition at line 860 of file foamVtuSizing.C.
References Foam::output().
|
static |
Copy faces stream labels with a global point offset - XML format.
Definition at line 899 of file foamVtuSizing.C.
References Foam::output().
|
static |
Copy face offsets with an offset from previous - XML format.
Definition at line 954 of file foamVtuSizing.C.
References Foam::output().
|
static |
Renumber vertex labels by global point offset - legacy format.
Definition at line 795 of file foamVtuSizing.C.
References UList< T >::begin(), UList< T >::end(), and nFaces().
|
static |
Renumber vertex labels by global point offset - XML format.
Definition at line 878 of file foamVtuSizing.C.
|
static |
Renumber faces stream labels by global point offset - XML format.
Definition at line 917 of file foamVtuSizing.C.
References UList< T >::begin(), UList< T >::end(), and nFaces().
|
static |
Renumber face offsets with an offset from previous - XML format.
Definition at line 972 of file foamVtuSizing.C.
void info | ( | Ostream & | os | ) | const |
Report some information.
Definition at line 998 of file foamVtuSizing.C.
References os().
Test equality.
Definition at line 1033 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 1052 of file foamVtuSizing.C.
References Foam::operator==().