Salome HOME
Algorithm of level of parallelism has been extended to more complex cases.
[modules/yacs.git] / src / engine / ElementaryPoint.cxx
index b2bb5a82785ce23a496b64706af8c7d2ee70017e..07a216f871c26585fcf81513f8e8f068fda948eb 100644 (file)
@@ -19,6 +19,8 @@
 
 #include "ElementaryPoint.hxx"
 #include "PointVisitor.hxx"
+#include "NotSimpleCasePoint.hxx"
+#include "ForkBlocPoint.hxx"
 #include "Node.hxx"
 
 using namespace YACS::ENGINE;
@@ -32,14 +34,26 @@ AbstractPoint *ElementaryPoint::findPointWithNode(Node *node)
   if(node==_node)
     return this;
   else
-    return 0;
+    return nullptr;
 }
 
-bool ElementaryPoint::contains(Node *node)
+bool ElementaryPoint::contains(Node *node) const
 {
   return _node==node;
 }
 
+bool ElementaryPoint::anyOf(const std::set<Node *>& nodes) const
+{
+  return nodes.find(_node)!=nodes.end();
+}
+
+AbstractPoint *ElementaryPoint::deepCopy(AbstractPoint *father) const
+{
+  AbstractPoint *ret(new ElementaryPoint(_node));
+  ret->setFather(father);
+  return ret;
+}
+
 Node *ElementaryPoint::getFirstNode()
 {
   return _node;
@@ -80,3 +94,24 @@ void ElementaryPoint::accept(PointVisitor *pv)
   pv->beginElementaryPoint(this);
   pv->endElementaryPoint(this);
 }
+
+AbstractPoint *ElementaryPoint::expandNonSimpleCaseOn(NotSimpleCasePoint *pathologicalPt, const std::set<Node *>& uncatchedNodes)
+{
+  if(uncatchedNodes.find(_node)!=uncatchedNodes.end())
+    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;
+    }
+}
+
+std::string ElementaryPoint::getNodeName() const
+{
+  return _node->getName();
+}