Salome HOME
[EDF12520] : Optimization of placements of Kernel containers in ForEachLoop/HP Contai...
[modules/yacs.git] / src / engine / DynParaLoop.cxx
index cca32828ba0ac1aaf2709accbc8a631a5895b0a8..632f72478c50835cdd4f4188feb26c10e77e8a9f 100644 (file)
@@ -44,7 +44,7 @@ const char DynParaLoop::NAME_OF_NUMBER_OF_BRANCHES[]="nbBranches";
 DynParaLoop::DynParaLoop(const std::string& name, TypeCode *typeOfDataSplitted)
   : ComposedNode(name),_node(0),_initNode(0),_finalizeNode(0),_nbOfEltConsumed(0),
     _nbOfBranches(NAME_OF_NUMBER_OF_BRANCHES,this,Runtime::_tc_int),
-    _splittedPort(NAME_OF_SPLITTED_SEQ_OUT,this,typeOfDataSplitted),_initializingCounter(0),_unfinishedCounter(0),_failedCounter(0)
+    _splittedPort(NAME_OF_SPLITTED_SEQ_OUT,this,typeOfDataSplitted),_initializingCounter(0),_unfinishedCounter(0),_failedCounter(0),_weight(1.)
 {
 }
 
@@ -58,7 +58,7 @@ DynParaLoop::~DynParaLoop()
 DynParaLoop::DynParaLoop(const DynParaLoop& other, ComposedNode *father, bool editionOnly)
   : ComposedNode(other,father), _nbOfBranches(other._nbOfBranches,this),
     _splittedPort(other._splittedPort,this), _node(0), _initNode(0), _finalizeNode(0),
-    _nbOfEltConsumed(0),_initializingCounter(0),_unfinishedCounter(0),_failedCounter(0)
+    _nbOfEltConsumed(0),_initializingCounter(0),_unfinishedCounter(0),_failedCounter(0),_weight(1.)
 {
   if(other._node)
     _node=other._node->clone(this,editionOnly);
@@ -423,6 +423,13 @@ DynParaLoop::TypeOfNode DynParaLoop::getIdentityOfNotifyerNode(const Node *node,
       return FINALIZE_NODE;
 }
 
+void DynParaLoop::setWeight(double newVal)
+{
+  if(newVal<=0.)
+    throw Exception("DynParaLoop::setWeight : invalid input value !");
+  _weight=newVal;
+}
+
 bool DynParaLoop::isMultiplicitySpecified(unsigned& value) const
 {
   if(_nbOfBranches.edIsManuallyInitialized())
@@ -896,6 +903,14 @@ int DynParaLoop::getMaxLevelOfParallelism() const
   return _nbOfBranches.getIntValue() * _node->getMaxLevelOfParallelism();
 }
 
+void DynParaLoop::partitionRegardingDPL(const PartDefinition *pd, std::map<ComposedNode *, YACS::BASES::AutoRefCnt<PartDefinition> >& zeMap)
+{
+  YACS::BASES::AutoRefCnt<PartDefinition> pd2(pd->copy());
+  zeMap[this]=pd2;
+  if(_node)
+    _node->partitionRegardingDPL(pd,zeMap);
+}
+
 void DynParaLoop::shutdown(int level)
 {
   if(level==0)return;