023544: SMESH's performance issues (note 22293)

This commit is contained in:
eap 2018-04-16 15:04:33 +03:00
parent 5e2c97c386
commit eb177ba645
2 changed files with 18 additions and 2 deletions

View File

@ -25,15 +25,18 @@ radial_Quad_algo = mesh.Quadrangle(algo=smeshBuilder.RADIAL_QUAD)
# The Radial Quadrange algorithm can work without any hypothesis
# In this case it uses "Default Nb of Segments" preferences parameter to discretize edges
# So by default there will be 15 segments in both radial and circular directions
mesh.Compute()
# The Radial Quadrange uses global or local 1d hypotheses if it does
# not have its own hypotheses.
# Define global hypotheses to discretize radial edges and a local one for circular edge
# So that there will be 5 radial layers and 10 circular segments
global_Nb_Segments = mesh.Segment().NumberOfSegments(5)
local_Nb_Segments = mesh.Segment(circle).NumberOfSegments(10)
mesh.Compute()
# Define own parameters of Radial Quadrange algorithm
# The number of radial layers will be 4
radial_Quad_algo.NumberOfLayers( 4 )
mesh.Compute()

View File

@ -2916,9 +2916,10 @@ void SMDS_Mesh::CompactMesh()
for ( ; holder != myElemHolders.end(); ++holder )
(*holder)->beforeCompacting();
}
int oldCellSize = myCellFactory->GetMaxID();
// remove "holes" in SMDS numeration
std::vector<int> idNodesOldToNew, idCellsNewToOld;
std::vector<int> idNodesOldToNew, idCellsNewToOld, idCellsOldToNew;
myNodeFactory->Compact( idNodesOldToNew );
myCellFactory->Compact( idCellsNewToOld );
@ -2927,10 +2928,22 @@ void SMDS_Mesh::CompactMesh()
int newCellSize = myCellFactory->NbUsedElements();
myGrid->compactGrid( idNodesOldToNew, newNodeSize, idCellsNewToOld, newCellSize );
if ( idsChange && !myElemHolders.empty() )
{
// idCellsNewToOld -> idCellsOldToNew
idCellsOldToNew.resize( oldCellSize, oldCellSize );
for ( size_t iNew = 0; iNew < idCellsNewToOld.size(); ++iNew )
{
if ( idCellsNewToOld[ iNew ] >= (int) idCellsOldToNew.size() )
idCellsOldToNew.resize( ( 1 + idCellsNewToOld[ iNew ]) * 1.5, oldCellSize );
idCellsOldToNew[ idCellsNewToOld[ iNew ]] = iNew;
}
}
std::set< SMDS_ElementHolder* >::iterator holder = myElemHolders.begin();
for ( ; holder != myElemHolders.end(); ++holder )
if ( idsChange )
(*holder)->restoreElements( idNodesOldToNew, idCellsNewToOld );
(*holder)->restoreElements( idNodesOldToNew, idCellsOldToNew );
else
(*holder)->compact();