foamVtuCells.H
Go to the documentation of this file.
1/*---------------------------------------------------------------------------*\
2 ========= |
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4 \\ / O peration |
5 \\ / A nd | www.openfoam.com
6 \\/ M anipulation |
7-------------------------------------------------------------------------------
8 Copyright (C) 2014-2021 OpenCFD Ltd.
9-------------------------------------------------------------------------------
10License
11 This file is part of OpenFOAM.
12
13 OpenFOAM is free software: you can redistribute it and/or modify it
14 under the terms of the GNU General Public License as published by
15 the Free Software Foundation, either version 3 of the License, or
16 (at your option) any later version.
17
18 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 for more details.
22
23 You should have received a copy of the GNU General Public License
24 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25
26Class
27 Foam::vtk::vtuCells
28
29Description
30 A deep-copy description of an OpenFOAM volume mesh in data structures
31 suitable for VTK UnstructuredGrid, including the possibility of
32 decomposing polyhedral cells into primitive cell types.
33
34 Knowledge of the vtkUnstructuredGrid and the corresponding \c .vtu
35 xml file-format aids in understanding this class.
36 The class can be used for the VTK xml format, legacy format, as well as a
37 VTK internal representation. The internal representation is somewhat
38 related to the xml format, but not entirely.
39
40SeeAlso
41 Foam::vtk::vtuSizing
42
43SourceFiles
44 foamVtuCells.C
45 foamVtuCellsI.H
46
47\*---------------------------------------------------------------------------*/
48
49#ifndef Foam_vtk_vtuCells_H
50#define Foam_vtk_vtuCells_H
51
52#include "foamVtkCore.H"
53#include "foamVtkMeshMaps.H"
54#include "foamVtuSizing.H"
55#include "labelList.H"
56
57// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
58
59namespace Foam
60{
61
62namespace vtk
63{
64// Forward Declarations
65class outputOptions;
66
67/*---------------------------------------------------------------------------*\
68 Class Foam::vtk::vtuCells Declaration
69\*---------------------------------------------------------------------------*/
71class vtuCells
72:
73 public vtuSizing
74{
75 // Private Data
76
77 // Requested output types
78
79 //- Output content type
80 contentType output_;
81
82 //- Bookkeeping for polyhedral cell decomposition
83 bool decomposeRequest_;
84
85
86 // Storage of output
87
88 //- Cell types (including added cells) in vtk numbering
89 // Range is 1-255
90 List<uint8_t> cellTypes_;
91
92 //- Vertices per cell (including added cells) in vtk ordering
93 List<label> vertLabels_;
94
95 //- Connectivity (vertices) offset for the end of each cell
96 List<label> vertOffset_;
97
98 //- Face lists per polyhedral cell
99 List<label> faceLabels_;
100
101 //- Face label offsets
102 List<label> faceOffset_;
103
104 //- Bookkeeping for polyhedral cell decomposition
105 foamVtkMeshMaps maps_;
106
107
108 // Private Member Functions
109
110 //- Resize storage
111 void resize_all();
112
113 //- Create the geometry entries
114 void populateOutput(const polyMesh& mesh);
115
116 //- Create the geometry entries from shapes
117 void populateOutput(const UList<cellShape>& shapes);
118
119 //- No copy construct
120 vtuCells(const vtuCells&) = delete;
121
122 //- No copy assignment
123 void operator=(const vtuCells&) = delete;
124
125
126public:
127
128 // Constructors
129
130 //- Default construct (XML format, no polyhedral decomposition)
131 explicit vtuCells
132 (
134 const bool decompose = false
135 );
136
137 //- Construct from components, create output information immediately
138 explicit vtuCells
139 (
140 const polyMesh& mesh,
142 const bool decompose = false
143 );
144
145 //- Construct from components.
146 // Optionally with polyhedral decomposition.
147 explicit vtuCells
148 (
149 const vtk::outputOptions opts,
150 const bool decompose = false
151 );
152
153 //- Construct from components, create output information immediately
155 (
156 const polyMesh& mesh,
157 const vtk::outputOptions opts,
158 const bool decompose = false
159 );
160
161
162 // Member Functions
163
164 // Access
165
166 //- The output content type
167 inline enum contentType content() const noexcept;
168
169 //- Query the polyhedral decompose requested flag.
170 inline bool decomposeRequested() const noexcept;
171
172 //- True if no cellTypes are populated.
173 inline bool empty() const noexcept;
174
175 //- The size of populated cellTypes.
176 inline label size() const noexcept;
177
178
179 // Edit
180
181 //- Reset all sizes to zero.
182 void clear();
183
184 //- Create the geometry using the previously requested output and
185 //- decomposition types.
186 void reset(const polyMesh& mesh);
187
188 //- Create the geometry for a mesh subset,
189 //- using previously requested output and decomposition types.
190 void reset
191 (
192 const polyMesh& mesh,
193 const labelUList& subsetCellsIds
194 );
195
196 //- Respecify requested output and decomposition type prior to
197 //- creating the geometry
198 void reset
199 (
200 const polyMesh& mesh,
201 const enum contentType output,
202 const bool decompose
203 );
204
205 //- Reset sizing using primitive shapes only (ADVANCED USAGE)
206 // Effectively removes any polyhedrals!
207 void resetShapes(const UList<cellShape>& shapes);
208
209 //- Renumber cell ids to account for subset meshes
210 void renumberCells(const labelUList& mapping);
211
212 //- Renumber point ids to account for subset meshes
213 void renumberPoints(const labelUList& mapping);
214
215 //- Define which additional cell-centres are to be used (ADVANCED!)
216 void addPointCellLabels(const labelUList& cellIds);
217
218
219 // Storage Access
220
221 //- Values for "types" (XML) and "CELL_TYPES" (legacy)
222 inline const List<uint8_t>& cellTypes() const noexcept;
223
224 //- Values for "connectivity" (XML) or "CELLS" (legacy)
225 inline const labelList& vertLabels() const noexcept;
226
227 //- Values for "offsets" (XML only)
228 inline const labelList& vertOffsets() const noexcept;
229
230 //- Values for "faces" (XML only)
231 inline const labelList& faceLabels() const noexcept;
232
233 //- Values for "faceoffset" (XML only)
234 inline const labelList& faceOffsets() const noexcept;
235
236 //- Additional point addressing (from added point to original cell)
237 inline const labelList& addPointCellLabels() const noexcept;
238
239 //- Original cell ids for all cells (regular and decomposed).
240 inline const labelList& cellMap() const noexcept;
241};
242
243
244// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
245
246} // End namespace vtk
247} // End namespace Foam
248
249// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
250
251#include "foamVtuCellsI.H"
252
253// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
254
255#endif
256
257// ************************************************************************* //
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition: List.H:77
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
Definition: UList.H:94
Bookkeeping for mesh subsetting and/or polyhedral cell decomposition. Although the main use case is f...
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:81
Encapsulated combinations of output format options. This is primarily useful when defining the output...
A deep-copy description of an OpenFOAM volume mesh in data structures suitable for VTK UnstructuredGr...
Definition: foamVtuCells.H:73
void resetShapes(const UList< cellShape > &shapes)
Reset sizing using primitive shapes only (ADVANCED USAGE)
Definition: foamVtuCells.C:274
const List< uint8_t > & cellTypes() const noexcept
Values for "types" (XML) and "CELL_TYPES" (legacy)
Definition: foamVtuCellsI.H:58
const labelList & vertOffsets() const noexcept
Values for "offsets" (XML only)
Definition: foamVtuCellsI.H:72
bool empty() const noexcept
True if no cellTypes are populated.
Definition: foamVtuCellsI.H:45
const labelList & faceOffsets() const noexcept
Values for "faceoffset" (XML only)
Definition: foamVtuCellsI.H:86
void renumberPoints(const labelUList &mapping)
Renumber point ids to account for subset meshes.
Definition: foamVtuCells.C:348
const labelList & addPointCellLabels() const noexcept
Additional point addressing (from added point to original cell)
Definition: foamVtuCellsI.H:93
void reset(const polyMesh &mesh)
Definition: foamVtuCells.C:232
label size() const noexcept
The size of populated cellTypes.
Definition: foamVtuCellsI.H:51
void renumberCells(const labelUList &mapping)
Renumber cell ids to account for subset meshes.
Definition: foamVtuCells.C:342
bool decomposeRequested() const noexcept
Query the polyhedral decompose requested flag.
Definition: foamVtuCellsI.H:39
const labelList & cellMap() const noexcept
Original cell ids for all cells (regular and decomposed).
enum contentType content() const noexcept
The output content type.
Definition: foamVtuCellsI.H:33
const labelList & vertLabels() const noexcept
Values for "connectivity" (XML) or "CELLS" (legacy)
Definition: foamVtuCellsI.H:65
void clear()
Reset all sizes to zero.
Definition: foamVtuCells.C:219
const labelList & faceLabels() const noexcept
Values for "faces" (XML only)
Definition: foamVtuCellsI.H:79
Sizing descriptions and routines for transcribing an OpenFOAM volume mesh into a VTK unstructured gri...
bool decompose() const noexcept
Query the decompose flag (normally off)
contentType
Types of content that the storage may represent.
@ XML
XML (VTU) content.
dynamicFvMesh & mesh
Namespace for OpenFOAM.
static Ostream & output(Ostream &os, const IntRange< T > &range)
Definition: IntRanges.C:66