MCPcopy Create free account
hub / github.com/Kitware/VTK / InsertCellsToGrid

Method InsertCellsToGrid

IO/Geometry/vtkOpenFOAMReader.cxx:7229–8073  ·  view source on GitHub ↗

------------------------------------------------------------------------------ determine cell shape and insert the cell into the mesh hexahedron, prism, pyramid, tetrahedron and decompose polyhedron

Source from the content-addressed store, hash-verified

7227// determine cell shape and insert the cell into the mesh
7228// hexahedron, prism, pyramid, tetrahedron and decompose polyhedron
7229void vtkOpenFOAMReaderPrivate::InsertCellsToGrid(
7230 vtkUnstructuredGrid* internalMesh, vtkSmartPointer<vtkCellArray>& meshCells,
7231 const vtkSmartPointer<vtkCellArray>& meshFaces, vtkIdList* cellLabels
7232#if VTK_FOAMFILE_DECOMPOSE_POLYHEDRA
7233 ,
7234 vtkIdTypeArray* additionalCells, vtkFloatArray* pointArray
7235#endif
7236)
7237{
7238 // Scratch arrays
7239 vtkFoamStackVector<vtkIdType, 256> cellPoints; // For inserting primitive cell points
7240 vtkFoamStackVector<vtkIdType, 256> polyOffsets; // For inserting polyhedral faces offsets
7241 vtkFoamStackVector<vtkIdType, 1024> polyPoints; // For inserting polyhedral faces
7242 vtkNew<vtkIdList> cellFacesList, facePointsList, otherFacePointsList;
7243 vtkIdType numCellFaces, numFacePoints, numOtherFacePoints;
7244 const vtkIdType *cellFaces, *facePoints, *otherFacePoints;
7245#ifdef VTK_USE_64BIT_IDS
7246 vtkNew<vtkTypeInt64Array> offsets;
7247 vtkNew<vtkTypeInt64Array> connectivity;
7248#else // VTK_USE_64BIT_IDS
7249 vtkNew<vtkTypeInt32Array> offsets;
7250 vtkNew<vtkTypeInt32Array> connectivity;
7251#endif // VTK_USE_64BIT_IDS
7252 vtkNew<vtkCellArray> faces;
7253 faces->SetData(offsets, connectivity);
7254
7255 const bool faceOwner64Bit = ::Is64BitArray(this->FaceOwner);
7256 const bool cellLabels64Bit = faceOwner64Bit; // reasonable assumption
7257
7258 const vtkIdType nCells = (cellLabels == nullptr ? this->NumCells : cellLabels->GetNumberOfIds());
7259
7260#if VTK_FOAMFILE_DECOMPOSE_POLYHEDRA
7261 // Local variable for polyhedral decomposition
7262 vtkIdType nAdditionalPoints = 0;
7263
7264 if (additionalCells && cellLabels) // sanity check
7265 {
7266 vtkErrorMacro(<< "Decompose polyhedral is not supported on mesh subset");
7267 return;
7268 }
7269#endif
7270 if (!nCells)
7271 {
7272 return;
7273 }
7274 if (!meshCells)
7275 {
7276 meshCells = this->CreateCellFaces();
7277 }
7278
7279 for (vtkIdType celli = 0; celli < nCells; ++celli)
7280 {
7281 vtkIdType cellId = celli;
7282 if (cellLabels != nullptr)
7283 {
7284 cellId = cellLabels->GetId(celli);
7285 if (cellId < 0 || cellId >= this->NumCells)
7286 {

Callers 2

MakeInternalMeshMethod · 0.95
GetCellZoneMeshMethod · 0.95

Calls 15

CreateCellFacesMethod · 0.95
Is64BitArrayFunction · 0.85
GetLabelValueFunction · 0.85
AppendLabelValueFunction · 0.85
GetDataSizeMethod · 0.80
copy_resizeMethod · 0.80
copy_reserveMethod · 0.80
NewFunction · 0.50
SetDataMethod · 0.45
GetNumberOfIdsMethod · 0.45
GetIdMethod · 0.45
GetCellAtIdMethod · 0.45

Tested by

no test coverage detected