Salome HOME
Algorithm of level of parallelism has been extended to more complex cases.
[modules/yacs.git] / src / engine / LinkedBlocPoint.cxx
index babe45ddd227b42eaa66ad1f1566b9fdf54ae712..c037e9e59891499667a0fa1dea95631eb35bf9b3 100644 (file)
@@ -18,6 +18,9 @@
 //
 
 #include "LinkedBlocPoint.hxx"
+#include "ElementaryPoint.hxx"
+#include "NotSimpleCasePoint.hxx"
+#include "ForkBlocPoint.hxx"
 #include "PointVisitor.hxx"
 #include "Exception.hxx"
 
@@ -32,6 +35,14 @@ LinkedBlocPoint::LinkedBlocPoint(const std::list<AbstractPoint *>& nodes, Abstra
 {
 }
 
+AbstractPoint *LinkedBlocPoint::deepCopy(AbstractPoint *father) const
+{
+  LinkedBlocPoint *ret(new LinkedBlocPoint);
+  ret->deepCopyFrom(*this);
+  ret->setFather(father);
+  return ret;
+}
+
 Node *LinkedBlocPoint::getFirstNode()
 {
   if(_nodes.empty())
@@ -85,6 +96,35 @@ std::string LinkedBlocPoint::getRepr() const
   return ret;
 }
 
+AbstractPoint *LinkedBlocPoint::expandNonSimpleCaseOn(NotSimpleCasePoint *pathologicalPt, const std::set<Node *>& uncatchedNodes)
+{
+  if(anyOf(uncatchedNodes))
+    {
+      for(auto& it : _nodes)
+        {
+          AbstractPoint *ret(it->expandNonSimpleCaseOn(pathologicalPt,uncatchedNodes));
+          if(ret!=it)
+            {
+              ret->setFather(this);
+              auto oldIt(it);
+              it = ret;
+              delete oldIt;
+            }
+        }
+      return this;
+    }
+  else
+    {
+      std::list<AbstractPoint *> l;
+      AbstractPoint *p0(this->deepCopy(getFather())),*p1(pathologicalPt->getUnique()->deepCopy(getFather()));
+      l.push_back(p0);
+      l.push_back(p1);
+      AbstractPoint *ret(new ForkBlocPoint(l,getFather()));
+      p0->setFather(ret); p1->setFather(ret);
+      return ret;
+    }
+}
+
 void LinkedBlocPoint::accept(PointVisitor *pv)
 {
   pv->beginLinkedBlocPoint(this);