mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2025-03-15 19:31:27 +05:00
23418: [OCC] Mesh: Minimization of memory usage of SMESH
attempt to improve compacting
This commit is contained in:
parent
7d38b59de5
commit
2c9f1eaba0
@ -188,10 +188,10 @@ void SMDS_UnstructuredGrid::compactGrid(std::vector<int>& idNodesOldToNew, int n
|
||||
|
||||
int oldNodeSize = this->GetNumberOfPoints();
|
||||
bool updateNodes = ( oldNodeSize > newNodeSize );
|
||||
if ( updateNodes )
|
||||
if ( true /*updateNodes*/ )
|
||||
{
|
||||
// 21125: EDF 1233 SMESH: Degradation of precision in a test case for quadratic conversion
|
||||
// using double type for storing coordinates of nodes instead float.
|
||||
// Use double type for storing coordinates of nodes instead float.
|
||||
vtkPoints *newPoints = vtkPoints::New();
|
||||
newPoints->SetDataType( VTK_DOUBLE );
|
||||
newPoints->SetNumberOfPoints( newNodeSize );
|
||||
@ -212,8 +212,11 @@ void SMDS_UnstructuredGrid::compactGrid(std::vector<int>& idNodesOldToNew, int n
|
||||
this->SetPoints(newPoints);
|
||||
newPoints->Delete();
|
||||
}
|
||||
else
|
||||
{
|
||||
this->Points->Squeeze();
|
||||
this->Points->Modified();
|
||||
}
|
||||
|
||||
// Compact cells if VTK IDs do not correspond to SMDS IDs or nodes compacted
|
||||
|
||||
@ -222,7 +225,7 @@ void SMDS_UnstructuredGrid::compactGrid(std::vector<int>& idNodesOldToNew, int n
|
||||
for ( int newID = 0, nbIDs = idCellsNewToOld.size(); newID < nbIDs && !updateCells; ++newID )
|
||||
updateCells = ( idCellsNewToOld[ newID ] != newID );
|
||||
|
||||
if ( !updateCells ) // no holes in elements
|
||||
if ( false /*!updateCells*/ ) // no holes in elements
|
||||
{
|
||||
this->Connectivity->Squeeze();
|
||||
this->Locations->Squeeze();
|
||||
@ -245,10 +248,15 @@ void SMDS_UnstructuredGrid::compactGrid(std::vector<int>& idNodesOldToNew, int n
|
||||
|
||||
// --- create new compacted Connectivity, Locations and Types
|
||||
|
||||
int newConnectivitySize = this->Connectivity->GetNumberOfConnectivityEntries();
|
||||
if ( newCellSize != oldCellSize )
|
||||
for ( int i = 0; i < oldCellSize - 1; ++i )
|
||||
if ( this->Types->GetValue( i ) == VTK_EMPTY_CELL )
|
||||
newConnectivitySize -= this->Locations->GetValue( i+1 ) - this->Locations->GetValue( i );
|
||||
|
||||
vtkCellArray *newConnectivity = vtkCellArray::New();
|
||||
newConnectivity->Initialize();
|
||||
int oldCellDataSize = this->Connectivity->GetData()->GetSize();
|
||||
newConnectivity->Allocate(oldCellDataSize);
|
||||
newConnectivity->Allocate( newConnectivitySize );
|
||||
|
||||
vtkUnsignedCharArray *newTypes = vtkUnsignedCharArray::New();
|
||||
newTypes->Initialize();
|
||||
@ -262,7 +270,6 @@ void SMDS_UnstructuredGrid::compactGrid(std::vector<int>& idNodesOldToNew, int n
|
||||
|
||||
copyBloc(newTypes, idCellsNewToOld, idNodesOldToNew,
|
||||
newConnectivity, newLocations, pointsCell );
|
||||
newConnectivity->Squeeze();
|
||||
|
||||
if (vtkDoubleArray* diameters =
|
||||
vtkDoubleArray::SafeDownCast( vtkDataSet::CellData->GetScalars() )) // Balls
|
||||
|
Loading…
x
Reference in New Issue
Block a user