50 addPointCellLabels_(),
69 const labelList& owner = mesh.faceOwner();
77 const cellModel& model = cellShapes[celli].model();
89 const cell& cFaces = mesh_.cells()[celli];
93 const face& f = mesh_.faces()[cFaces[cFacei]];
97 nAddCells += f.nTriangles();
114 addPointCellLabels_.setSize(nAddPoints);
118 superCells_.setSize(nAddCells);
121 vertLabels_.setSize(cellShapes.size() + nAddCells);
124 cellTypes_.setSize(cellShapes.size() + nAddCells);
127 polygonTriangulate triEngine;
130 label addPointi = 0, addCelli = 0;
134 const cellShape& cellShape = cellShapes[celli];
135 const cellModel& cellModel = cellShape.model();
137 labelList& vtkVerts = vertLabels_[celli];
139 if (cellModel == tet)
141 vtkVerts = cellShape;
143 cellTypes_[celli] = VTK_TETRA;
145 else if (cellModel == pyr)
147 vtkVerts = cellShape;
149 cellTypes_[celli] = VTK_PYRAMID;
151 else if (cellModel == prism)
155 vtkVerts = cellShape;
160 cellTypes_[celli] = VTK_WEDGE;
162 else if (cellModel == tetWedge && decomposePoly)
166 vtkVerts[0] = cellShape[0];
167 vtkVerts[1] = cellShape[2];
168 vtkVerts[2] = cellShape[1];
169 vtkVerts[3] = cellShape[3];
170 vtkVerts[4] = cellShape[4];
171 vtkVerts[5] = cellShape[3];
173 cellTypes_[celli] = VTK_WEDGE;
175 else if (cellModel == wedge)
179 vtkVerts[0] = cellShape[0];
180 vtkVerts[1] = cellShape[1];
181 vtkVerts[2] = cellShape[2];
182 vtkVerts[3] = cellShape[2];
183 vtkVerts[4] = cellShape[3];
184 vtkVerts[5] = cellShape[4];
185 vtkVerts[6] = cellShape[5];
186 vtkVerts[7] = cellShape[6];
188 cellTypes_[celli] = VTK_HEXAHEDRON;
190 else if (cellModel == hex)
192 vtkVerts = cellShape;
194 cellTypes_[celli] = VTK_HEXAHEDRON;
196 else if (decomposePoly)
201 addPointCellLabels_[addPointi] = celli;
204 const label newVertexLabel = mesh_.nPoints() + addPointi;
207 bool substituteCell =
true;
209 const labelList& cFaces = mesh_.cells()[celli];
212 const face& f = mesh_.faces()[cFaces[cFacei]];
213 const bool isOwner = (owner[cFaces[cFacei]] == celli);
216 faceList triFcs(f.size() == 4 ? 0 : f.nTriangles());
217 faceList quadFcs(f.size() == 4 ? 1 : 0);
220 triEngine.triangulate
222 UIndirectList<point>(mesh.points(),
f)
224 forAll(triEngine.triPoints(), trii)
226 triFcs[trii] = triEngine.triPoints(trii, f);
241 substituteCell =
false;
245 thisCelli = mesh_.nCells() + addCelli;
246 superCells_[addCelli++] = celli;
249 labelList& addVtkVerts = vertLabels_[thisCelli];
253 const face& quad = quadFcs[quadI];
264 addVtkVerts[0] = quad[3];
265 addVtkVerts[1] = quad[2];
266 addVtkVerts[2] = quad[1];
267 addVtkVerts[3] = quad[0];
271 addVtkVerts[0] = quad[0];
272 addVtkVerts[1] = quad[1];
273 addVtkVerts[2] = quad[2];
274 addVtkVerts[3] = quad[3];
276 addVtkVerts[4] = newVertexLabel;
278 cellTypes_[thisCelli] = VTK_PYRAMID;
288 substituteCell =
false;
292 thisCelli = mesh_.nCells() + addCelli;
293 superCells_[addCelli++] = celli;
297 labelList& addVtkVerts = vertLabels_[thisCelli];
299 const face& tri = triFcs[triI];
306 addVtkVerts[0] = tri[2];
307 addVtkVerts[1] = tri[1];
308 addVtkVerts[2] = tri[0];
312 addVtkVerts[0] = tri[0];
313 addVtkVerts[1] = tri[1];
314 addVtkVerts[2] = tri[2];
316 addVtkVerts[3] = newVertexLabel;
318 cellTypes_[thisCelli] = VTK_TETRA;
327 cellTypes_[celli] = VTK_POLYHEDRON;
329 const labelList& cFaces = mesh_.cells()[celli];
332 label nData = 1 + cFaces.size();
337 const face& f = mesh.faces()[cFaces[cFacei]];
341 vtkVerts.setSize(nData);
344 vtkVerts[nData++] = cFaces.size();
349 const face& f = mesh.faces()[cFaces[cFacei]];
350 const bool isOwner = (owner[cFaces[cFacei]] == celli);
353 vtkVerts[nData++] = f.size();
359 vtkVerts[nData++] = f[fp];
368 vtkVerts[nData++] = f[fp];
377 Pout<<
" Original cells:" << mesh_.nCells()
378 <<
" points:" << mesh_.nPoints()
379 <<
" Additional cells:" << superCells_.size()
380 <<
" 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.
vtkTopo(const polyMesh &)
Construct from components.
void setSize(const label)
Reset size of List.
prefixOSstream Pout(cout, "Pout")