Salome HOME
Fix regression of SALOME_TESTS/Grids/smesh/3D_submesh_00/A6
authoreap <eap@opencascade.com>
Thu, 17 Mar 2016 12:30:10 +0000 (15:30 +0300)
committereap <eap@opencascade.com>
Thu, 17 Mar 2016 12:30:10 +0000 (15:30 +0300)
  Fix SMESH_subMesh::cleanDependsOn()

+ minor improvements in SMESH_submesh and sample scripts

doc/salome/examples/creating_meshes_ex04.py
doc/salome/examples/creating_meshes_ex06.py
src/SMESH/SMESH_Mesh.cxx
src/SMESH/SMESH_subMesh.cxx
src/SMESH/SMESH_subMesh.hxx
src/SMESHDS/SMESHDS_Mesh.cxx
src/StdMeshers/StdMeshers_QuadFromMedialAxis_1D2D.cxx

index f2cdfdb87aee36672f4a4066315c15ba8177e567..82408d5a3e5da222e9cc6863f046ed4f703f2a5d 100644 (file)
@@ -46,8 +46,7 @@ tria.Compute()
 PrintMeshInfo(tria)
 
 # remove a local hypothesis
 PrintMeshInfo(tria)
 
 # remove a local hypothesis
-mesh = tria.GetMesh()
-mesh.RemoveHypothesis(edge, hyp4)
+tria.RemoveHypothesis(hyp4, edge)
 
 # compute the mesh
 tria.Compute()
 
 # compute the mesh
 tria.Compute()
index d16e067d34f2aa6152bad601e78a13a5320e9544..8e52da6be2fb508070ce02f41877f4cb855c6f75 100644 (file)
@@ -1,5 +1,8 @@
 # Creating a hexahedral mesh on a cylinder.
 # Creating a hexahedral mesh on a cylinder.
-# Note: it is a copy of 'ex24_cylinder.py' from SMESH_SWIG
+#
+# This example uses Partition to divide the cylinder into blocks, which is
+# a general approach. But for the case of cylinder there is a dedicated
+# command creating a blocked cylinder: geompy.MakeDividedCylinder()
 
 import salome
 salome.salome_init()
 
 import salome
 salome.salome_init()
index ecc7888e7329341334607a3bbb45fdc22dd9355c..467fdd6a3b28c02e00008cc2985461ae72aafc2b 100644 (file)
@@ -679,8 +679,8 @@ SMESH_Mesh::AddHypothesis(const TopoDS_Shape & aSubShape,
 
   // shape
 
 
   // shape
 
-  bool isAlgo = ( anHyp->GetType() != SMESHDS_Hypothesis::PARAM_ALGO );
-  int   event = isAlgo ? SMESH_subMesh::ADD_ALGO : SMESH_subMesh::ADD_HYP;
+  bool                     isAlgo = ( anHyp->GetType() != SMESHDS_Hypothesis::PARAM_ALGO );
+  SMESH_subMesh::algo_event event = isAlgo ? SMESH_subMesh::ADD_ALGO : SMESH_subMesh::ADD_HYP;
 
   SMESH_Hypothesis::Hypothesis_Status ret = subMesh->AlgoStateEngine(event, anHyp);
 
 
   SMESH_Hypothesis::Hypothesis_Status ret = subMesh->AlgoStateEngine(event, anHyp);
 
@@ -755,8 +755,8 @@ SMESH_Hypothesis::Hypothesis_Status
   
   // shape 
   
   
   // shape 
   
-  bool isAlgo = ( !anHyp->GetType() == SMESHDS_Hypothesis::PARAM_ALGO );
-  int   event = isAlgo ? SMESH_subMesh::REMOVE_ALGO : SMESH_subMesh::REMOVE_HYP;
+  bool                     isAlgo = ( !anHyp->GetType() == SMESHDS_Hypothesis::PARAM_ALGO );
+  SMESH_subMesh::algo_event event = isAlgo ? SMESH_subMesh::REMOVE_ALGO : SMESH_subMesh::REMOVE_HYP;
 
   SMESH_subMesh *subMesh = GetSubMesh(aSubShape);
 
 
   SMESH_subMesh *subMesh = GetSubMesh(aSubShape);
 
index f395b7986c23b00d64c18f8984cb50ca2634aed0..ed082678218caaeeb386b5d7ebabab96f89cf5c8 100644 (file)
@@ -609,7 +609,7 @@ bool SMESH_subMesh::IsApplicableHypotesis(const SMESH_Hypothesis* theHypothesis,
 //================================================================================
 
 SMESH_Hypothesis::Hypothesis_Status
 //================================================================================
 
 SMESH_Hypothesis::Hypothesis_Status
-  SMESH_subMesh::AlgoStateEngine(int event, SMESH_Hypothesis * anHyp)
+  SMESH_subMesh::AlgoStateEngine(algo_event event, SMESH_Hypothesis * anHyp)
 {
   // **** les retour des evenement shape sont significatifs
   // (add ou remove fait ou non)
 {
   // **** les retour des evenement shape sont significatifs
   // (add ou remove fait ou non)
@@ -1167,7 +1167,7 @@ void SMESH_subMesh::setAlgoState(algo_state state)
 //================================================================================
 
 SMESH_Hypothesis::Hypothesis_Status
 //================================================================================
 
 SMESH_Hypothesis::Hypothesis_Status
-  SMESH_subMesh::SubMeshesAlgoStateEngine(int                event,
+  SMESH_subMesh::SubMeshesAlgoStateEngine(algo_event         event,
                                           SMESH_Hypothesis * anHyp,
                                           bool               exitOnFatal)
 {
                                           SMESH_Hypothesis * anHyp,
                                           bool               exitOnFatal)
 {
@@ -1232,9 +1232,11 @@ void SMESH_subMesh::cleanDependsOn( SMESH_Algo* algoRequiringCleaning/*=0*/ )
         if ( !sameShapeType )
         {
           // check if the algo allows presence of global algos of dimension the algo
         if ( !sameShapeType )
         {
           // check if the algo allows presence of global algos of dimension the algo
-          // can generate it-self
+          // can generate it-self;
+          // always keep a node on VERTEX, as this node can be shared by segments
+          // lying on EDGEs not shared by the VERTEX of sm, due to MergeNodes (PAL23068)
           int  shapeDim = SMESH_Gen::GetShapeDim( sm->GetSubShape() );
           int  shapeDim = SMESH_Gen::GetShapeDim( sm->GetSubShape() );
-          keepSubMeshes = algoRequiringCleaning->NeedLowerHyps( shapeDim );
+          keepSubMeshes = ( algoRequiringCleaning->NeedLowerHyps( shapeDim ) || shapeDim == 0 );
           prevShapeType = sm->GetSubShape().ShapeType();
           toKeepPrevShapeType = keepSubMeshes;
         }
           prevShapeType = sm->GetSubShape().ShapeType();
           toKeepPrevShapeType = keepSubMeshes;
         }
@@ -1345,7 +1347,7 @@ static void cleanSubMesh( SMESH_subMesh * subMesh )
  */
 //=============================================================================
 
  */
 //=============================================================================
 
-bool SMESH_subMesh::ComputeStateEngine(int event)
+bool SMESH_subMesh::ComputeStateEngine(compute_event event)
 {
   switch ( event ) {
   case MODIF_ALGO_STATE:
 {
   switch ( event ) {
   case MODIF_ALGO_STATE:
@@ -1982,7 +1984,7 @@ void SMESH_subMesh::updateSubMeshState(const compute_state theState)
 //purpose  :
 //=======================================================================
 
 //purpose  :
 //=======================================================================
 
-void SMESH_subMesh::ComputeSubMeshStateEngine(int event, const bool includeSelf)
+void SMESH_subMesh::ComputeSubMeshStateEngine(compute_event event, const bool includeSelf)
 {
   SMESH_subMeshIteratorPtr smIt = getDependsOnIterator(includeSelf,false);
   while ( smIt->more() )
 {
   SMESH_subMeshIteratorPtr smIt = getDependsOnIterator(includeSelf,false);
   while ( smIt->more() )
@@ -2453,7 +2455,7 @@ void SMESH_subMeshEventListener::ProcessEvent(const int          event,
     switch ( event ) {
     case SMESH_subMesh::CLEAN:
       for ( ; smIt != smEnd; ++ smIt)
     switch ( event ) {
     case SMESH_subMesh::CLEAN:
       for ( ; smIt != smEnd; ++ smIt)
-        (*smIt)->ComputeStateEngine( event );
+        (*smIt)->ComputeStateEngine( SMESH_subMesh::compute_event( event ));
       break;
     case SMESH_subMesh::COMPUTE:
     case SMESH_subMesh::COMPUTE_SUBMESH:
       break;
     case SMESH_subMesh::COMPUTE:
     case SMESH_subMesh::COMPUTE_SUBMESH:
index 8f9f83c2c7980fb6da7e67200215ba33e22b0155..f00841373b6405df5407401c1a138cead525439d 100644 (file)
@@ -216,10 +216,10 @@ protected:
 public:
 
   SMESH_Hypothesis::Hypothesis_Status
 public:
 
   SMESH_Hypothesis::Hypothesis_Status
-    AlgoStateEngine(int event, SMESH_Hypothesis * anHyp);
+    AlgoStateEngine(algo_event event, SMESH_Hypothesis * anHyp);
 
   SMESH_Hypothesis::Hypothesis_Status
 
   SMESH_Hypothesis::Hypothesis_Status
-    SubMeshesAlgoStateEngine(int event, SMESH_Hypothesis * anHyp, bool exitOnFatal=false);
+    SubMeshesAlgoStateEngine(algo_event event, SMESH_Hypothesis * anHyp, bool exitOnFatal=false);
 
   algo_state             GetAlgoState() const    { return _algoState; }
   compute_state          GetComputeState() const { return _computeState; }
 
   algo_state             GetAlgoState() const    { return _algoState; }
   compute_state          GetComputeState() const { return _computeState; }
@@ -227,8 +227,8 @@ public:
 
   void DumpAlgoState(bool isMain);
 
 
   void DumpAlgoState(bool isMain);
 
-  bool ComputeStateEngine(int event);
-  void ComputeSubMeshStateEngine(int event, const bool includeSelf=false);
+  bool ComputeStateEngine(compute_event event);
+  void ComputeSubMeshStateEngine(compute_event event, const bool includeSelf=false);
 
   bool Evaluate(MapShapeNbElems& aResMap);
 
 
   bool Evaluate(MapShapeNbElems& aResMap);
 
index ba7d59f37b178630a0283504c7b556c6fe8e3f58..0283b6b74c7279e99c6a500f0e9a2b35d4bbbcc5 100644 (file)
@@ -980,7 +980,7 @@ void SMESHDS_Mesh::RemoveFreeElement(const SMDS_MeshElement * elt,
 {
   //MESSAGE(" --------------------------------> SMESHDS_Mesh::RemoveFreeElement " << subMesh << " " << fromGroups);
   if (elt->GetType() == SMDSAbs_Node) {
 {
   //MESSAGE(" --------------------------------> SMESHDS_Mesh::RemoveFreeElement " << subMesh << " " << fromGroups);
   if (elt->GetType() == SMDSAbs_Node) {
-    RemoveFreeNode( static_cast<const SMDS_MeshNode*>(elt), subMesh);
+    RemoveFreeNode( static_cast<const SMDS_MeshNode*>(elt), subMesh, fromGroups);
     return;
   }
 
     return;
   }
 
index acd20284680a90ed6ab0b414249abb79a788b20c..58d179c553438fa5c759081b1281fc942c9c0242 100644 (file)
@@ -554,7 +554,7 @@ namespace
         return false;
 
       for ( size_t iS = 0; iS < theShortEdges[ nbBranchPoints > 0 ].size(); ++iS )
         return false;
 
       for ( size_t iS = 0; iS < theShortEdges[ nbBranchPoints > 0 ].size(); ++iS )
-        shortMap.Add( theShortEdges[ nbBranchPoints ][ iS ]);
+        shortMap.Add( theShortEdges[ nbBranchPoints > 0 ][ iS ]);
 
       ++nbBranchPoints;
     }
 
       ++nbBranchPoints;
     }