PR: compactGrid with polyhedrons

This commit is contained in:
prascle 2010-12-04 15:44:40 +00:00
parent 45ed5d9a93
commit 0d10253e8d

View File

@ -309,26 +309,53 @@ void SMDS_UnstructuredGrid::compactGrid(std::vector<int>& idNodesOldToNew, int n
this->SetPoints(newPoints); this->SetPoints(newPoints);
MESSAGE("NumberOfPoints: " << this->GetNumberOfPoints()); MESSAGE("NumberOfPoints: " << this->GetNumberOfPoints());
} }
//#ifdef VTK_HAVE_POLYHEDRON
// TODO compact faces for Polyhedrons if (this->FaceLocations)
// refaire completement faces et faceLocation {
// pour chaque cell, recup oldCellId, oldFacesId, recopie dans newFaces de la faceStream vtkIdTypeArray *newFaceLocations = vtkIdTypeArray::New();
// en changeant les numeros de noeuds newFaceLocations->Initialize();
// vtkIdTypeArray *newFaceLocations = vtkIdTypeArray::New(); newFaceLocations->Allocate(newTypes->GetSize());
// newFaceLocations->Initialize(); vtkIdTypeArray *newFaces = vtkIdTypeArray::New();
// vtkIdTypeArray *newFaces = vtkIdTypeArray::New(); newFaces->Initialize();
// newFaces->Initialize(); newFaces->Allocate(this->Faces->GetSize());
// newFaceLocations->DeepCopy(this->FaceLocations); for (int i = 0; i < oldCellSize; i++)
// newFaces->DeepCopy(this->Faces); {
// this->SetCells(newTypes, newLocations, newConnectivity, newFaceLocations, newFaces); if (newTypes->GetValue(i) == VTK_EMPTY_CELL)
// newFaceLocations->Delete(); continue;
// newFaces->Delete(); int newCellId = idCellsOldToNew[i];
if (this->FaceLocations) this->FaceLocations->Register(this); if (newTypes->GetValue(newCellId) == VTK_POLYHEDRON)
if (this->Faces) this->Faces->Register(this); {
this->SetCells(newTypes, newLocations, newConnectivity, FaceLocations, Faces); newFaceLocations->InsertNextValue(newFaces->GetMaxId()+1);
//#else int oldFaceLoc = this->FaceLocations->GetValue(i);
// this->SetCells(newTypes, newLocations, newConnectivity); int nCellFaces = this->Faces->GetValue(oldFaceLoc++);
//#endif newFaces->InsertNextValue(nCellFaces);
for (int n=0; n<nCellFaces; n++)
{
int nptsInFace = this->Faces->GetValue(oldFaceLoc++);
newFaces->InsertNextValue(nptsInFace);
for (int k=0; k<nptsInFace; k++)
{
int oldpt = this->Faces->GetValue(oldFaceLoc++);
newFaces->InsertNextValue(idNodesOldToNew[oldpt]);
}
}
}
else
{
newFaceLocations->InsertNextValue(-1);
}
}
newFaceLocations->Squeeze();
newFaces->Squeeze();
newFaceLocations->Register(this);
newFaces->Register(this);
this->SetCells(newTypes, newLocations, newConnectivity, newFaceLocations, newFaces);
newFaceLocations->Delete();
newFaces->Delete();
}
else
this->SetCells(newTypes, newLocations, newConnectivity, FaceLocations, Faces);
newTypes->Delete(); newTypes->Delete();
newLocations->Delete(); newLocations->Delete();
newConnectivity->Delete(); newConnectivity->Delete();