Salome HOME
PAL8196. Fix GetAlgo() for the case with the same algo on several ancestors
authoreap <eap@opencascade.com>
Fri, 24 Jun 2005 10:52:06 +0000 (10:52 +0000)
committereap <eap@opencascade.com>
Fri, 24 Jun 2005 10:52:06 +0000 (10:52 +0000)
src/SMESH/SMESH_Gen.cxx

index 143c05296374087d4f125cdcd2096979804c2d2f..a6e1bd55023b1e684dbbf1814eb2888b0b979b0d 100644 (file)
@@ -602,8 +602,14 @@ SMESH_Algo *SMESH_Gen::GetAlgo(SMESH_Mesh & aMesh, const TopoDS_Shape & aShape)
 
   list <const SMESHDS_Hypothesis * > algoList;
   aMesh.GetHypotheses( aShape, filter, algoList, true );
-  if (algoList.size() != 1 )
-    return NULL;
+
+  if (algoList.size() != 1 ) { // check if there is one algo several times
+    list <const SMESHDS_Hypothesis * >::iterator algo = algoList.begin();
+    for ( ; algo != algoList.end(); ++algo )
+      if ( (*algo) != algoList.front() &&
+           (*algo)->GetName() != algoList.front()->GetName() )
+        return NULL;
+  }
 
   return const_cast<SMESH_Algo*> ( static_cast<const SMESH_Algo* >( algoList.front() ));
 }