Salome HOME
Merge branch 'V9_9_BR'
[modules/yacs.git] / src / engine / Bloc.cxx
index 4df68b4a638f93fc92af8af2947ac14782172ff4..2a70697d6f621566e9e63844cfc6b3dea334feb8 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2006-2015  CEA/DEN, EDF R&D
+// Copyright (C) 2006-2022  CEA/DEN, EDF R&D
 //
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
@@ -25,7 +25,9 @@
 #include "OutputDataStreamPort.hxx"
 #include "ElementaryNode.hxx"
 #include "Visitor.hxx"
+#include "ForkBlocPoint.hxx"
 #include "SetOfPoints.hxx"
+#include "PlayGround.hxx"
 
 #include <queue>
 #include <iostream>
@@ -171,7 +173,7 @@ void Bloc::exUpdateState()
  * If node name already used in bloc, throw exception.
  * Publish inputPorts in current bloc and ancestors.
  */
-bool Bloc::edAddChild(Node *node) throw(YACS::Exception)
+bool Bloc::edAddChild(Node *node)
 {
   if(isNodeAlreadyAggregated(node))
     {
@@ -215,7 +217,7 @@ bool Bloc::edAddChild(Node *node) throw(YACS::Exception)
  * @exception If 'node' is NOT the son of 'this'.
  */
 
-void Bloc::edRemoveChild(Node *node) throw(YACS::Exception)
+void Bloc::edRemoveChild(Node *node)
 {
   StaticDefinedComposedNode::edRemoveChild(node);
   list<Node *>::iterator iter=find(_setOfNode.begin(),_setOfNode.end(),node);
@@ -274,7 +276,7 @@ std::vector< std::list<Node *> > Bloc::splitIntoIndependantGraph() const
   return ret;
 }
 
-Node *Bloc::getChildByShortName(const std::string& name) const throw(YACS::Exception)
+Node *Bloc::getChildByShortName(const std::string& name) const
 {
   for (list<Node *>::const_iterator iter = _setOfNode.begin(); iter != _setOfNode.end(); iter++)
     if ((*iter)->getName() == name)
@@ -333,7 +335,7 @@ bool insertNodeChildrenInSet(Node *node, std::set<Node *>& nodeSet)
  *        \b WARNING : When using this method 'node' has to be checked in order to be part of direct children of 'this'. 
  *
  */
-void Bloc::checkNoCyclePassingThrough(Node *node) throw(YACS::Exception)
+void Bloc::checkNoCyclePassingThrough(Node *node)
 {
   set<Node *> currentNodesToTest;
   //don't insert node to test in set. 
@@ -403,7 +405,7 @@ YACS::Event Bloc::updateStateOnFinishedEventFrom(Node *node)
  * \param node : node that has emitted the event
  * \return the event to notify to bloc's father
  */
-YACS::Event Bloc::updateStateOnFailedEventFrom(Node *node)
+YACS::Event Bloc::updateStateOnFailedEventFrom(Node *node, const Executor *execInst)
 {
   node->exForwardFailed();
   if(areAllSubNodesFinished())
@@ -452,16 +454,30 @@ void Bloc::accept(Visitor* visitor)
  * for all concurrent branches in \a this.
  */
 int Bloc::getMaxLevelOfParallelism() const
+{
+  std::list< AbstractPoint * > pts(analyzeParallelism());
+  ForkBlocPoint fbp(pts,NULL);
+  return fbp.getMaxLevelOfParallelism();
+}
+
+std::list< AbstractPoint * > Bloc::analyzeParallelism() const
 {
   std::vector< std::list<Node *> > r(splitIntoIndependantGraph());
-  int ret(0);
+  std::list< AbstractPoint * > pts;
   for(std::vector< std::list<Node *> >::const_iterator it=r.begin();it!=r.end();it++)
     {
       SetOfPoints sop(*it);
       sop.simplify();
-      ret+=sop.getMaxLevelOfParallelism();
+      pts.push_back(sop.getUniqueAndReleaseIt());
     }
-  return ret;
+  return pts;
+}
+
+void Bloc::getWeightRegardingDPL(ComplexWeight *weight)
+{
+  std::list< AbstractPoint * > pts(analyzeParallelism());
+  ForkBlocPoint fbp(pts,NULL);
+  fbp.getWeightRegardingDPL(weight);
 }
 
 void Bloc::removeRecursivelyRedundantCL()
@@ -476,6 +492,15 @@ void Bloc::removeRecursivelyRedundantCL()
   destructCFComputations(info);
 }
 
+void Bloc::partitionRegardingDPL(const PartDefinition *pd, std::map<ComposedNode *, YACS::BASES::AutoRefCnt<PartDefinition> >& zeMap)
+{
+  if(!pd)
+    throw Exception("Bloc::partitionRegardingDPL : NULL pointer !");
+  std::list< AbstractPoint * > pts(analyzeParallelism());
+  ForkBlocPoint fbp(pts,NULL);
+  fbp.partitionRegardingDPL(pd,zeMap);
+}
+
 void Bloc::performCFComputationsOnlyOneLevel(LinkInfo& info) const
 {
   delete _fwLinks;//Normally useless