From 83b9e1e926f4b78db4238e00e11b4397ea36d222 Mon Sep 17 00:00:00 2001 From: eap Date: Tue, 29 Jan 2013 15:14:57 +0000 Subject: [PATCH] 0022082: EDF 1891 SMESH: Performance issues in SMESH filters In MapCells(SALOME_Actor*,const TColStd_IndexedMapOfInteger& theMap), move the following code out of the loop on theMap UnShrink(); if(theMapActor->IsShrunk()){ SetShrinkFactor(theMapActor->GetShrinkFactor()); } myMapIndex = theMap; --- src/OBJECT/SMESH_SVTKActor.cxx | 38 ++++++++++++++++++---------------- 1 file changed, 20 insertions(+), 18 deletions(-) diff --git a/src/OBJECT/SMESH_SVTKActor.cxx b/src/OBJECT/SMESH_SVTKActor.cxx index 0158f7f91..48ad86910 100644 --- a/src/OBJECT/SMESH_SVTKActor.cxx +++ b/src/OBJECT/SMESH_SVTKActor.cxx @@ -124,29 +124,32 @@ SMESH_SVTKActor for(int ind = 1; ind <= aNbOfParts; ind++){ int aPartId = theMapIndex( ind ); if(vtkCell* aCell = theMapActor->GetElemCell(aPartId)) - { + { #if VTK_XVERSION > 50700 if (aCell->GetCellType() != VTK_POLYHEDRON) #endif - if(aCell->GetCellType() == VTK_VERTEX ) { - my0DGrid->InsertNextCell(aCell->GetCellType(),aCell->GetPointIds()); - } else if(aCell->GetCellType() == VTK_POLY_VERTEX ) { - myBallGrid->InsertNextCell(aCell->GetCellType(),aCell->GetPointIds()); - } else { - myUnstructuredGrid->InsertNextCell(aCell->GetCellType(),aCell->GetPointIds()); + { + if(aCell->GetCellType() == VTK_VERTEX ) { + my0DGrid->InsertNextCell(aCell->GetCellType(),aCell->GetPointIds()); + } else if(aCell->GetCellType() == VTK_POLY_VERTEX ) { + myBallGrid->InsertNextCell(aCell->GetCellType(),aCell->GetPointIds()); + } else { + myUnstructuredGrid->InsertNextCell(aCell->GetCellType(),aCell->GetPointIds()); + } } #if VTK_XVERSION > 50700 else - { - vtkPolyhedron *polyhedron = dynamic_cast(aCell); - if (!polyhedron) - throw SALOME_Exception(LOCALIZED ("not a polyhedron")); - vtkIdType *pts = polyhedron->GetFaces(); - myUnstructuredGrid->InsertNextCell(aCell->GetCellType(),pts[0], pts+1); - } -#endif + { + vtkPolyhedron *polyhedron = dynamic_cast(aCell); + if (!polyhedron) + throw SALOME_Exception(LOCALIZED ("not a polyhedron")); + vtkIdType *pts = polyhedron->GetFaces(); + myUnstructuredGrid->InsertNextCell(aCell->GetCellType(),pts[0], pts+1); } - +#endif + } + } + UnShrink(); if(theMapActor->IsShrunk()){ SetShrinkFactor(theMapActor->GetShrinkFactor()); @@ -154,9 +157,8 @@ SMESH_SVTKActor } myMapIndex = theMapIndex; - } } - + void SMESH_SVTKActor ::Initialize() -- 2.39.2