44 Foam::vtkTopo::vtkTopo(
const polyMesh& mesh)
49 addPointCellLabels_(),
68 const labelList& owner = mesh.faceOwner();
76 const cellModel& model = cellShapes[celli].model();
88 const cell& cFaces = mesh_.cells()[celli];
92 const face& f = mesh_.faces()[cFaces[cFacei]];
96 f.nTrianglesQuads(mesh_.points(), nTris, nQuads);
98 nAddCells += nQuads + nTris;
110 addPointCellLabels_.setSize(nAddPoints);
114 superCells_.setSize(nAddCells);
117 vertLabels_.setSize(cellShapes.size() + nAddCells);
120 cellTypes_.setSize(cellShapes.size() + nAddCells);
123 label addPointi = 0, addCelli = 0;
127 const cellShape& cellShape = cellShapes[celli];
128 const cellModel& cellModel = cellShape.model();
130 labelList& vtkVerts = vertLabels_[celli];
132 if (cellModel == tet)
134 vtkVerts = cellShape;
136 cellTypes_[celli] = VTK_TETRA;
138 else if (cellModel == pyr)
140 vtkVerts = cellShape;
142 cellTypes_[celli] = VTK_PYRAMID;
144 else if (cellModel == prism)
148 vtkVerts = cellShape;
153 cellTypes_[celli] = VTK_WEDGE;
155 else if (cellModel == tetWedge && decomposePoly)
159 vtkVerts[0] = cellShape[0];
160 vtkVerts[1] = cellShape[2];
161 vtkVerts[2] = cellShape[1];
162 vtkVerts[3] = cellShape[3];
163 vtkVerts[4] = cellShape[4];
164 vtkVerts[5] = cellShape[3];
166 cellTypes_[celli] = VTK_WEDGE;
168 else if (cellModel == wedge)
172 vtkVerts[0] = cellShape[0];
173 vtkVerts[1] = cellShape[1];
174 vtkVerts[2] = cellShape[2];
175 vtkVerts[3] = cellShape[2];
176 vtkVerts[4] = cellShape[3];
177 vtkVerts[5] = cellShape[4];
178 vtkVerts[6] = cellShape[5];
179 vtkVerts[7] = cellShape[6];
181 cellTypes_[celli] = VTK_HEXAHEDRON;
183 else if (cellModel == hex)
185 vtkVerts = cellShape;
187 cellTypes_[celli] = VTK_HEXAHEDRON;
189 else if (decomposePoly)
194 addPointCellLabels_[addPointi] = celli;
197 const label newVertexLabel = mesh_.nPoints() + addPointi;
200 bool substituteCell =
true;
202 const labelList& cFaces = mesh_.cells()[celli];
205 const face& f = mesh_.faces()[cFaces[cFacei]];
206 const bool isOwner = (owner[cFaces[cFacei]] == celli);
211 f.nTrianglesQuads(mesh_.points(), nTris, nQuads);
218 f.trianglesQuads(mesh_.points(), trii, quadi, triFcs, quadFcs);
227 substituteCell =
false;
231 thisCelli = mesh_.nCells() + addCelli;
232 superCells_[addCelli++] = celli;
235 labelList& addVtkVerts = vertLabels_[thisCelli];
239 const face& quad = quadFcs[quadI];
250 addVtkVerts[0] = quad[3];
251 addVtkVerts[1] = quad[2];
252 addVtkVerts[2] = quad[1];
253 addVtkVerts[3] = quad[0];
257 addVtkVerts[0] = quad[0];
258 addVtkVerts[1] = quad[1];
259 addVtkVerts[2] = quad[2];
260 addVtkVerts[3] = quad[3];
262 addVtkVerts[4] = newVertexLabel;
264 cellTypes_[thisCelli] = VTK_PYRAMID;
274 substituteCell =
false;
278 thisCelli = mesh_.nCells() + addCelli;
279 superCells_[addCelli++] = celli;
283 labelList& addVtkVerts = vertLabels_[thisCelli];
285 const face& tri = triFcs[triI];
292 addVtkVerts[0] = tri[2];
293 addVtkVerts[1] = tri[1];
294 addVtkVerts[2] = tri[0];
298 addVtkVerts[0] = tri[0];
299 addVtkVerts[1] = tri[1];
300 addVtkVerts[2] = tri[2];
302 addVtkVerts[3] = newVertexLabel;
304 cellTypes_[thisCelli] = VTK_TETRA;
313 cellTypes_[celli] = VTK_POLYHEDRON;
315 const labelList& cFaces = mesh_.cells()[celli];
318 label nData = 1 + cFaces.size();
323 const face& f = mesh.faces()[cFaces[cFacei]];
327 vtkVerts.setSize(nData);
330 vtkVerts[nData++] = cFaces.size();
335 const face& f = mesh.faces()[cFaces[cFacei]];
336 const bool isOwner = (owner[cFaces[cFacei]] == celli);
339 vtkVerts[nData++] = f.size();
345 vtkVerts[nData++] = f[fp];
354 vtkVerts[nData++] = f[fp];
363 Pout<<
" Original cells:" << mesh_.nCells()
364 <<
" points:" << mesh_.nPoints()
365 <<
" Additional cells:" << superCells_.size()
366 <<
" additional points:" << addPointCellLabels_.size()
#define forAll(list, i)
Loop across all elements in list.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
static const cellModel * lookup(const word &)
Look up a model by name and return a pointer to the model or nullptr.
Ostream & endl(Ostream &os)
Add newline and flush stream.
#define forAllReverse(list, i)
Reverse loop across all elements in list.
List< cellShape > cellShapeList
List of cellShapes and PtrList of List of cellShape.
static bool decomposePoly
Enable/disable polyhedron decomposition. Default = true.
List< label > labelList
A List of labels.
void setSize(const label)
Reset size of List.
prefixOSstream Pout(cout, "Pout")