Salome HOME
[EDF20032] : Algorithm is less strict to support new configuration
[modules/yacs.git] / src / engine / SetOfPoints.cxx
index 51a47468ce6bfb343d2aa702c233081ad2d83d5f..7264f2f8215f4995526f89df2f8aa9e6f284e22b 100644 (file)
@@ -40,12 +40,10 @@ SetOfPoints::SetOfPoints(const std::list<Node *>& nodes):_bp(0)
 
 SetOfPoints::~SetOfPoints()
 {
-  if(!_bp)
-    return;
   delete _bp;
 }
 
-void SetOfPoints::simplify()
+void SetOfPoints::basicSimplify()
 {
   while(_bp->size()>1)
     {
@@ -60,9 +58,42 @@ void SetOfPoints::simplify()
       if(somethingDone)
         continue;
       _bp->deal2Ter(somethingDone);
+      if(somethingDone)
+        continue;
+      _bp->deal2Quatro(somethingDone);
+      if(!somethingDone)
+        throw Exception("SetOfPoints::simplify : not implemented yet !\nPlease check if there are any recursively redundant links (can be removed by removeRecursivelyRedundantCL method).");
+    }
+}
+
+void SetOfPoints::simplify()
+{
+  while( _bp->internalContinueForSimplify() )
+    {
+      bool somethingDone(false);
+      _bp->deal1(somethingDone);
+      if(somethingDone)
+        continue;
+      _bp->deal2(somethingDone);
+      if(somethingDone)
+        continue;
+      _bp->deal2Bis(somethingDone);
+      if(somethingDone)
+        continue;
+      _bp->deal2Ter(somethingDone);
+      if(somethingDone)
+        continue;
+      _bp->deal2Quatro(somethingDone);
+      if(somethingDone)
+        continue;
+      _bp->dealNotSimpleCase(somethingDone);
       if(!somethingDone)
         throw Exception("SetOfPoints::simplify : not implemented yet !\nPlease check if there are any recursively redundant links (can be removed by removeRecursivelyRedundantCL method).");
     }
+  if( _bp->presenceOfNonSimpleCase() )
+    {
+      _bp->expandNonSimpleCase();
+    }
 }
 
 std::string SetOfPoints::getRepr() const