Salome HOME
#17927: EDF 20035 - perfs of mesh creation
[modules/smesh.git] / src / SMESH / SMESH_Mesh.cxx
index 7201c528048d72564ee623658c256ffa14ca062b..77d19984f10bb7c4b445b7f426dbc85a939fd680 100644 (file)
@@ -1191,11 +1191,11 @@ void SMESH_Mesh::NotifySubMeshesHypothesisModification(const SMESH_Hypothesis* h
   if ( !GetMeshDS()->IsUsedHypothesis( hyp ))
     return;
 
-  bool toCallBack = true;
-  if ( _callUp && hyp && NbNodes() == 0 ) // for not loaded mesh (#16648)
+  int nbEntities = ( _myMeshDS->NbNodes() + _myMeshDS->NbElements() );
+  if ( hyp && _callUp && !_callUp->IsLoaded() ) // for not loaded mesh (#16648)
   {
-    _callUp->HypothesisModified( hyp->GetID() );
-    toCallBack = ( NbNodes() > 0 );
+    _callUp->HypothesisModified( hyp->GetID(), /*updateIcons=*/true );
+    nbEntities = ( _myMeshDS->NbNodes() + _myMeshDS->NbElements() ); // after loading mesh
   }
 
   SMESH_Algo *algo;
@@ -1265,8 +1265,9 @@ void SMESH_Mesh::NotifySubMeshesHypothesisModification(const SMESH_Hypothesis* h
   HasModificationsToDiscard(); // to reset _isModified flag if mesh becomes empty
   GetMeshDS()->Modified();
 
-  if ( _callUp && hyp && toCallBack )
-    _callUp->HypothesisModified( hyp->GetID() );
+  int newNbEntities = ( _myMeshDS->NbNodes() + _myMeshDS->NbElements() );
+  if ( hyp && _callUp )
+    _callUp->HypothesisModified( hyp->GetID(), newNbEntities != nbEntities );
 }
 
 //=============================================================================