Update with new UG faces API for VTK master

This commit is contained in:
Louis Gombert 2024-08-08 21:27:52 +00:00
parent 08f42ae643
commit 7a70a55209

View File

@ -227,11 +227,6 @@ void SMDS_UnstructuredGrid::compactGrid(std::vector<smIdType>& idNodesOldToNew,
this->Connectivity->Squeeze();
this->CellLocations->Squeeze();
this->Types->Squeeze();
if ( this->FaceLocations )
{
this->FaceLocations->Squeeze();
this->Faces->Squeeze();
}
this->Connectivity->Modified();
return;
}
@ -284,30 +279,30 @@ void SMDS_UnstructuredGrid::compactGrid(std::vector<smIdType>& idNodesOldToNew,
}
}
if (this->FaceLocations)
if (this->GetFaceLocations())
{
vtkIdTypeArray *newFaceLocations = vtkIdTypeArray::New();
newFaceLocations->Initialize();
newFaceLocations->Allocate(newTypes->GetSize());
vtkIdTypeArray *newFaces = vtkIdTypeArray::New();
newFaces->Initialize();
newFaces->Allocate(this->Faces->GetSize());
newFaces->Allocate(this->GetFaces()->GetSize());
for ( vtkIdType newCellID = 0; newCellID < newCellSize; newCellID++ )
{
if ( newTypes->GetValue( newCellID ) == VTK_POLYHEDRON )
{
smIdType oldCellId = idCellsNewToOld[ newCellID ];
newFaceLocations->InsertNextValue( newFaces->GetMaxId()+1 );
smIdType oldFaceLoc = this->FaceLocations->GetValue( FromSmIdType<vtkIdType>(oldCellId) );
smIdType nCellFaces = this->Faces->GetValue( FromSmIdType<vtkIdType>(oldFaceLoc++) );
smIdType oldFaceLoc = this->GetFaceLocations()->GetValue( FromSmIdType<vtkIdType>(oldCellId) );
smIdType nCellFaces = this->GetFaces()->GetValue( FromSmIdType<vtkIdType>(oldFaceLoc++) );
newFaces->InsertNextValue( FromSmIdType<vtkIdType>(nCellFaces) );
for ( int n = 0; n < nCellFaces; n++ )
{
int nptsInFace = this->Faces->GetValue( FromSmIdType<vtkIdType>(oldFaceLoc++) );
int nptsInFace = this->GetFaces()->GetValue( FromSmIdType<vtkIdType>(oldFaceLoc++) );
newFaces->InsertNextValue( nptsInFace );
for ( int k = 0; k < nptsInFace; k++ )
{
vtkIdType oldpt = this->Faces->GetValue( FromSmIdType<vtkIdType>(oldFaceLoc++) );
vtkIdType oldpt = this->GetFaces()->GetValue( FromSmIdType<vtkIdType>(oldFaceLoc++) );
newFaces->InsertNextValue( idNodesOldToNew[ oldpt ]);
}
}
@ -319,14 +314,14 @@ void SMDS_UnstructuredGrid::compactGrid(std::vector<smIdType>& idNodesOldToNew,
}
newFaceLocations->Squeeze();
newFaces->Squeeze();
this->SetCells( newTypes, newLocations, newConnectivity, newFaceLocations, newFaces );
this->SetCells( newTypes, newConnectivity, newFaceLocations, newFaces );
this->CellLocations = newLocations;
newFaceLocations->Delete();
newFaces->Delete();
}
else
{
this->SetCells( newTypes, newLocations, newConnectivity, FaceLocations, Faces );
this->SetCells( newTypes, newConnectivity, this->GetFaceLocations(), this->GetFaces() );
this->CellLocations = newLocations;
}