Go to the documentation of this file.
38 void Foam::vtk::vtuSizing::presizeMaps(foamVtkMeshMaps& maps)
const
41 maps.additionalIds().resize(this->
nAddPoints());
60 reset(
mesh, decompose);
101 decompose_ = decompose;
102 nCells_ =
mesh.nCells();
103 nPoints_ =
mesh.nPoints();
107 nCellsPoly_ = nCells_;
112 const label len =
mesh.nCells();
114 for (label celli=0; celli < len; ++celli)
129 nVertLabels_ += shape.size();
131 else if (model == tetWedge && decompose)
135 else if (model == wedge && decompose)
147 const cell& cFaces =
mesh.cells()[celli];
148 for (
const label facei : cFaces)
154 label nTria = 0, nQuad = 0;
155 f.nTrianglesQuads(
mesh.points(), nTria, nQuad);
157 nAddCells_ += nTria + nQuad;
158 nAddVerts_ += (nTria * 4) + (nQuad * 5);
165 const label nvrt = (nQuad ? 5 : 4);
167 nVertLabels_ += nvrt;
184 for (
const label facei : cFaces)
187 nFaceLabels_ +=
f.size();
194 nVertLabels_ += hashUniqId.
size();
195 nVertPoly_ += hashUniqId.
size();
197 nFaceLabels_ += 1 + cFaces.size();
202 decompose_ = (decompose && nCellsPoly_);
214 case contentType::LEGACY:
224 nVertLabels() + nAddVerts() - nVertPoly()
236 case contentType::XML:
241 return (nVertLabels() + nAddVerts());
244 case slotType::CELLS_OFFSETS:
245 return nFieldCells();
249 return nFaceLabels();
252 case slotType::FACES_OFFSETS:
253 return nFaceLabels() ? nFieldCells() : 0;
259 case contentType::INTERNAL1:
265 return (nVertLabels() + nAddVerts() + nFieldCells());
268 case slotType::CELLS_OFFSETS:
269 return nFieldCells();
273 return nFaceLabels();
276 case slotType::FACES_OFFSETS:
277 return nFaceLabels() ? nFieldCells() : 0;
283 case contentType::INTERNAL2:
288 return (nVertLabels() + nAddVerts());
291 case slotType::CELLS_OFFSETS:
292 return (nFieldCells() + 1);
296 return nFaceLabels();
299 case slotType::FACES_OFFSETS:
300 return nFaceLabels() ? nFieldCells() : 0;
371 #undef definePopulateInternalMethod
372 #define definePopulateInternalMethod(Type) \
374 void Foam::vtk::vtuSizing::populateInternal \
376 const polyMesh& mesh, \
377 UList<uint8_t>& cellTypes, \
378 UList<Type>& connectivity, \
379 UList<Type>& offsets, \
380 UList<Type>& faces, \
381 UList<Type>& facesOffsets, \
382 foamVtkMeshMaps& maps, \
383 const enum contentType output \
399 maps.additionalIds() \
403 void Foam::vtk::vtuSizing::populateInternal \
405 const polyMesh& mesh, \
406 UList<uint8_t>& cellTypes, \
407 UList<Type>& connectivity, \
408 UList<Type>& offsets, \
409 UList<Type>& faces, \
410 UList<Type>& facesOffsets, \
411 labelUList& cellMap, \
412 labelUList& addPointsIds, \
413 const enum contentType output \
437 #undef definePopulateInternalMethod
445 const label globalPointOffset
448 if (!globalPointOffset)
454 renumberVertLabelsLegacy(
output, globalPointOffset);
463 const label globalPointOffset
466 if (!globalPointOffset)
484 auto iter = vertLabels.
begin();
485 const auto last = vertLabels.
end();
489 label nLabels = *iter;
498 *iter += globalPointOffset;
506 label nFaces = *iter;
516 *iter += globalPointOffset;
528 const label globalPointOffset
531 if (!globalPointOffset)
537 renumberVertLabelsXml(
output, globalPointOffset);
546 const label globalPointOffset
549 if (!globalPointOffset)
557 for (label& vertId : vertLabels)
559 vertId += globalPointOffset;
567 const label globalPointOffset
570 if (!globalPointOffset)
576 renumberFaceLabelsXml(
output, globalPointOffset);
585 const label globalPointOffset
588 if (!globalPointOffset)
596 auto iter = faceLabels.
begin();
597 const auto last = faceLabels.
end();
601 label nFaces = *iter;
606 label nLabels = *iter;
611 *iter += globalPointOffset;
622 const label prevOffset
631 renumberFaceOffsetsXml(
output, prevOffset);
640 const label prevOffset
651 for (label& val : faceOffsets)
665 os <<
"nFieldCells:" << nFieldCells();
668 os <<
" (" << nCells_ <<
"+" << nAddCells_ <<
")";
672 os <<
" (poly:" << nCellsPoly_ <<
")";
675 os <<
" nFieldPoints:" << nFieldPoints();
678 os <<
" (" << nPoints_ <<
"+" << nAddPoints_ <<
")";
681 os <<
" nVertLabels:" << (nVertLabels_ + nAddVerts_);
684 os <<
" (" << nVertLabels_ <<
"+" << nAddVerts_ <<
")";
688 os <<
" (poly:" << nVertPoly_ <<
")";
691 os <<
" nFaceLabels:" << nFaceLabels_;
692 os <<
" legacy-count:" << sizeLegacy();
704 && nCells() == rhs.
nCells()
label nCells() const
Number of cells for the mesh.
static void renumberFaceLabelsXml(labelUList &faceLabels, const label globalPointOffset)
Renumber faces stream labels by global point offset - XML format.
label size() const noexcept
The number of elements in table.
static Ostream & output(Ostream &os, const IntRange< T > &range)
bool decompose() const
Query the decompose flag (normally off)
label nCellsPoly() const
Number of polyhedral cells for the mesh.
void populateLegacy(const polyMesh &mesh, UList< uint8_t > &cellTypes, labelUList &connectivity, foamVtkMeshMaps &maps) const
Populate lists for Legacy output.
const labelList & cellMap() const
Original cell ids for all cells (regular and decomposed).
label nAddVerts() const
Number of additional (decomposed) vertices for the mesh.
void info(Ostream &os) const
Report some information.
iterator begin()
Return an iterator to begin traversing the UList.
Mesh consisting of general polyhedral cells.
static labelList copyVertLabelsLegacy(const labelUList &connectivity, const label globalPointOffset)
Copy vertex labels with a global point offset - legacy format.
bool operator!=(const vtuSizing &rhs) const
Test inequality.
label nFieldCells() const
Number of field cells = nCells + nAddCells.
label nVertPoly() const
Number of vertex labels for polyhedral cells of the 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.
tmp< faMatrix< Type > > operator==(const faMatrix< Type > &, const faMatrix< Type > &)
label nFaceLabels() const
Number of polyhedral face labels for the mesh.
static const cellModel & ref(const modelType model)
Look up reference to cellModel by enumeration. Fatal on failure.
static void renumberVertLabelsLegacy(labelUList &connectivity, const label globalPointOffset)
Renumber vertex labels by global point offset - legacy format.
label nPoints() const
Number of points for the mesh.
An analytical geometric cellShape.
label nVertLabels() const
Number of vertex labels for the mesh.
contentType
Types of content that the storage may represent.
Sizing descriptions and routines for transcribing an OpenFOAM volume mesh into a VTK unstructured gri...
static void renumberFaceOffsetsXml(labelUList &faceOffsets, const label prevOffset)
Renumber face offsets with an offset from previous - XML format.
IOstream & hex(IOstream &io)
void clear() noexcept
Reset all sizes to zero.
static labelList copyVertLabelsXml(const labelUList &connectivity, const label globalPointOffset)
Copy vertex labels with a global point offset - XML format.
const labelList & cellTypes
void clear()
Clear all entries from table.
static labelList copyFaceOffsetsXml(const labelUList &faceOffsets, const label prevOffset)
Copy face offsets with an offset from previous - XML format.
static void renumberVertLabelsXml(labelUList &connectivity, const label globalPointOffset)
Renumber vertex labels by global point offset - XML format.
static labelList copyFaceLabelsXml(const labelUList &faceLabels, const label globalPointOffset)
Copy faces stream labels with a global point offset - XML format.
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
bool insert(const Key &key)
Insert a new entry, not overwriting existing entries.
const labelList & additionalIds() const
Any additional (user) labels.
#define definePopulateInternalMethod(Type)
vtuSizing() noexcept
Default construct.
slotType
The possible storage 'slots' that can be used.
label nAddPoints() const
Number of additional (decomposed) points for the mesh.
A face is a list of labels corresponding to mesh vertices.
Maps a geometry to a set of cell primitives.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
iterator end()
Return an iterator to end traversing the UList.
label nAddCells() const
Number of additional (decomposed) cells for the mesh.
A cell is defined as a list of faces with extra functionality.
bool operator==(const vtuSizing &rhs) const
Test equality.
void reset(const polyMesh &mesh, const bool decompose=false)
Reset sizing by analyzing the mesh.
Bookkeeping for mesh subsetting and/or polyhedral cell decomposition. Although the main use case is f...
label sizeOf(const enum contentType output, const enum slotType slot) const
Return the required size for the storage slot.
const cellModel & model() const
Model reference.