]> SALOME platform Git repositories - modules/yacs.git/commitdiff
Salome HOME
Change implementation of getMaxLevelOfPara.
authorAnthony Geay <anthony.geay@edf.fr>
Thu, 1 Oct 2015 16:44:30 +0000 (18:44 +0200)
committerAnthony Geay <anthony.geay@edf.fr>
Thu, 1 Oct 2015 16:44:30 +0000 (18:44 +0200)
src/engine/Bloc.cxx

index 6395112b5de25f86ac5debea325fc050489347a0..a3dcd389915212047ad09b1ee4d6ed1c4167f13e 100644 (file)
@@ -25,6 +25,7 @@
 #include "OutputDataStreamPort.hxx"
 #include "ElementaryNode.hxx"
 #include "Visitor.hxx"
+#include "SetOfPoints.hxx"
 
 #include <queue>
 #include <iostream>
@@ -452,37 +453,15 @@ void Bloc::accept(Visitor* visitor)
  */
 int Bloc::getMaxLevelOfParallelism() const
 {
-  std::set<Node *> s(_setOfNode.begin(),_setOfNode.end());
-  for(std::set<Node *>::const_iterator it=s.begin();it!=s.end();it++)
-    (*it)->_colour=White;
-  std::vector<int> levs;
-  while(!s.empty())
+  std::vector< std::list<Node *> > r(splitIntoIndependantGraph());
+  int ret(0);
+  for(std::vector< std::list<Node *> >::const_iterator it=r.begin();it!=r.end();it++)
     {
-      Node *seed(*(s.begin()));
-      int myCurLev(0);
-      while(seed)
-        {
-          s.erase(seed);
-          std::set<InGate *> ingates(seed->getOutGate()->edSetInGate());
-          int myCurLev2(seed->getMaxLevelOfParallelism());
-          for(std::set<InGate *>::const_iterator it=ingates.begin();it!=ingates.end();it++)
-            {
-              Node *curNode((*it)->getNode());
-              curNode->_colour=Grey;
-              myCurLev2=std::max(curNode->getMaxLevelOfParallelism(),myCurLev2);
-            }
-          myCurLev=std::max(myCurLev,myCurLev2);
-          seed=0;
-          for(std::set<Node *>::const_iterator it=s.begin();it!=s.end();it++)
-            if((*it)->_colour==Grey)
-              {
-                seed=*it;
-                break;
-              }
-        }
-      levs.push_back(myCurLev);
+      SetOfPoints sop(*it);
+      sop.simplify();
+      ret+=sop.getMaxLevelOfParallelism();
     }
-  return std::accumulate(levs.begin(),levs.end(),0);
+  return ret;
 }
 
 /*!