Salome HOME
[EDF27816] Management of double foreach and management of proxyfile lifecycle
[modules/yacs.git] / src / engine / SetOfPoints.cxx
index 76f892577b9db0403fa5aaf0eae719728446d1d6..25090eeb7a7c3d1a2731aa52d862c111522bad0f 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2015-2016  CEA/DEN, EDF R&D
+// Copyright (C) 2015-2023  CEA, EDF
 //
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
@@ -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,11 +58,44 @@ 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
 {
   return _bp->getRepr();
@@ -101,3 +132,8 @@ AbstractPoint *SetOfPoints::getUniqueAndReleaseIt() const
 {
   return _bp->getUniqueAndReleaseIt();
 }
+
+void SetOfPoints::accept(PointVisitor *pv)
+{
+  _bp->accept(pv);
+}