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

index 143c05296374087d4f125cdcd2096979804c2d2f..7a3c34a50a0f8d309bcebfc26aacba9878ac1b16 100644 (file)
@@ -602,9 +602,18 @@ 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 )
+
+  if ( algoList.empty() )
     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() ));
 }