Skip to content

Commit

Permalink
smesh: Fix build failure with vtk 9.4
Browse files Browse the repository at this point in the history
  • Loading branch information
wwmayer committed Dec 17, 2024
1 parent 1289997 commit 6223495
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions src/3rdParty/salomesmesh/src/SMDS/SMDS_UnstructuredGrid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -249,14 +249,16 @@ void SMDS_UnstructuredGrid::compactGrid(std::vector<int>& idNodesOldToNew, int n
}
}

if (this->FaceLocations)
vtkIdTypeArray* thisFaceLocations = GetFaceLocations();
vtkIdTypeArray* thisFaces = GetFaces();
if (thisFaceLocations)
{
vtkIdTypeArray *newFaceLocations = vtkIdTypeArray::New();
newFaceLocations->Initialize();
newFaceLocations->Allocate(newTypes->GetSize());
vtkIdTypeArray *newFaces = vtkIdTypeArray::New();
newFaces->Initialize();
newFaces->Allocate(this->Faces->GetSize());
newFaces->Allocate(thisFaces->GetSize());
for (int i = 0; i < oldCellSize; i++)
{
if (this->Types->GetValue(i) == VTK_EMPTY_CELL)
Expand All @@ -265,16 +267,16 @@ void SMDS_UnstructuredGrid::compactGrid(std::vector<int>& idNodesOldToNew, int n
if (newTypes->GetValue(newCellId) == VTK_POLYHEDRON)
{
newFaceLocations->InsertNextValue(newFaces->GetMaxId()+1);
int oldFaceLoc = this->FaceLocations->GetValue(i);
int nCellFaces = this->Faces->GetValue(oldFaceLoc++);
int oldFaceLoc = thisFaceLocations->GetValue(i);
int nCellFaces = thisFaces->GetValue(oldFaceLoc++);
newFaces->InsertNextValue(nCellFaces);
for (int n=0; n<nCellFaces; n++)
{
int nptsInFace = this->Faces->GetValue(oldFaceLoc++);
int nptsInFace = thisFaces->GetValue(oldFaceLoc++);
newFaces->InsertNextValue(nptsInFace);
for (int k=0; k<nptsInFace; k++)
{
int oldpt = this->Faces->GetValue(oldFaceLoc++);
int oldpt = thisFaces->GetValue(oldFaceLoc++);
newFaces->InsertNextValue(idNodesOldToNew[oldpt]);
}
}
Expand All @@ -292,7 +294,7 @@ void SMDS_UnstructuredGrid::compactGrid(std::vector<int>& idNodesOldToNew, int n
}
else
{
this->SetCells(newTypes, newLocations, newConnectivity, FaceLocations, Faces);
this->SetCells(newTypes, newLocations, newConnectivity, thisFaceLocations, thisFaces);
}

newPoints->Delete();
Expand Down

0 comments on commit 6223495

Please sign in to comment.