]> SALOME platform Git repositories - modules/yacs.git/commitdiff
Salome HOME
XML load of ForEachLoopDyn is now OK
authorAnthony Geay <anthony.geay@edf.fr>
Thu, 19 Mar 2020 20:41:37 +0000 (21:41 +0100)
committerAnthony Geay <anthony.geay@edf.fr>
Thu, 19 Mar 2020 20:41:37 +0000 (21:41 +0100)
src/yacsloader/blocParsers.hxx
src/yacsloader/loopParsers.hxx
src/yacsloader/procParsers.hxx
src/yacsloader_swig/Test/testFEDyn.py

index 61b6b9a8513859679274d3b0d0a74a24569a24b8..dcaadc12ddbdb6e8ba0f2adeaeaa80f3f9b2406f 100644 (file)
@@ -178,7 +178,7 @@ struct bloctypeParser:parser
       //fullname += ".splitter";
       //currentProc->nodeMap[fullname]=b->getChildByShortName("splitter");
     }
-  virtual void foreach (YACS::ENGINE::ForEachLoop* const& b)
+  virtual void foreach (YACS::ENGINE::ForEachLoopGen* const& b)
     {
       DEBTRACE( "bloc_foreach_set: " << b->getName() )             
       _bloc->edAddChild(b);
index ee42b9ab32ad136025d0d99ddba5619e49acfe9e..a7a6d6ce146a07721923423faf16e3f9a3ee778c 100644 (file)
@@ -608,7 +608,6 @@ struct foreachloopdyntypeParser:dynparalooptypeParser<T>
         {
           if(std::string(attr[i]) == "name")name(attr[i+1]);
           if(std::string(attr[i]) == "state")this->state(attr[i+1]);
-          if(std::string(attr[i]) == "nbranch")nbranch(atoi(attr[i+1]));
           if(std::string(attr[i]) == "loopWeight")weight(atof(attr[i+1]));
           if(std::string(attr[i]) == "type")datatype(attr[i+1]);
         }
@@ -616,7 +615,6 @@ struct foreachloopdyntypeParser:dynparalooptypeParser<T>
     }
   virtual void pre ()
     {
-      _nbranch=0;
       _weight=-1.;
       this->looptypeParser<T>::pre();
     }
@@ -626,11 +624,6 @@ struct foreachloopdyntypeParser:dynparalooptypeParser<T>
       _name=name;
       _fullname=currentProc->names.back()+name;
     }
-  virtual void nbranch (const int& n)
-    {
-      DEBTRACE("foreach_nbranch: " << n )
-      _nbranch=n;
-    }
   virtual void weight (const double& x)
     {
       DEBTRACE("foreach_weight: " << x )
@@ -661,7 +654,6 @@ struct foreachloopdyntypeParser:dynparalooptypeParser<T>
       }
       this->_cnode=theRuntime->createForEachLoopDyn(_name,currentProc->typeMap[_datatype]);
       //set number of branches
-      if(_nbranch > 0)this->_cnode->edGetNbOfBranchesPort()->edInit(_nbranch);
       if(_weight > 0)this->_cnode->setWeight(_weight);
       this->_cnodes.push_back(this->_cnode);
       currentProc->names.push_back(_fullname + '.');
@@ -675,7 +667,6 @@ struct foreachloopdyntypeParser:dynparalooptypeParser<T>
       this->_cnode=this->_cnodes.empty() ? 0 : this->_cnodes.back();
       return b;
     }
-  int _nbranch;
   double _weight;
   std::string _fullname;
   std::string _name;
index c2c112cbb5bc62f84286ef46da2e9b979c4bc0fc..46884614f944a4357e96a239550cdfa0078cbc3b 100644 (file)
@@ -196,6 +196,7 @@ void proctypeParser<T>::onStart(const XML_Char* el, const XML_Char** attr)
     else if(element == "bloc")pp=&bloctypeParser<>::blocParser;
     else if(element == "forloop")pp=&forlooptypeParser<>::forloopParser;
     else if(element == "foreach")pp=&foreachlooptypeParser<>::foreachloopParser;
+    else if(element == "foreachdyn")pp=&foreachloopdyntypeParser<>::foreachloopdynParser;
     else if(element == "optimizer")pp=&optimizerlooptypeParser<>::optimizerloopParser;
     else if(element == "while")pp=&whilelooptypeParser<>::whileloopParser;
     else if(element == "switch")pp=&switchtypeParser::switchParser;
@@ -252,6 +253,7 @@ void proctypeParser<T>::onEnd(const char *el,parser* child)
       else if(element == "bloc")this->bloc(((bloctypeParser<>*)child)->post());
       else if(element == "forloop")this->forloop(((forlooptypeParser<>*)child)->post());
       else if(element == "foreach")this->foreach(((foreachlooptypeParser<>*)child)->post());
+      else if(element == "foreachdyn")this->foreach(((foreachloopdyntypeParser<>*)child)->post());
       else if(element == "optimizer")this->optimizer(((optimizerlooptypeParser<>*)child)->post());
       else if(element == "while")this->while_(((whilelooptypeParser<>*)child)->post());
       else if(element == "switch")this->switch_(((switchtypeParser*)child)->post());
index 86027a12dea28af410729d363288c76604f79ae7..d31e26c7ee3d229422c6156631f5e4664638089d 100644 (file)
@@ -22,8 +22,8 @@ n0=r.createScriptNode("","n0")
 o0=n0.edAddOutputPort("o0",tsi)
 n0.setScript("o0=[ elt for elt in range(8) ]")
 p.edAddChild(n0)
-n1=r.createForEachLoop("n1",ti)#Dyn
-n1.getInputPort("nbBranches").edInitPy(2)
+n1=r.createForEachLoopDyn("n1",ti)#Dyn
+#n1.getInputPort("nbBranches").edInitPy(2)
 n10=r.createScriptNode("","n10")
 n10.setExecutionMode("remote")
 n10.setContainer(cont)
@@ -49,8 +49,8 @@ p.edAddChild(n2)
 p.edAddCFLink(n1,n2)
 p.edAddLink(o2,i3)
 # Second parallel foreach
-n11=r.createForEachLoop("n11",ti)#Dyn
-n11.getInputPort("nbBranches").edInitPy(2)
+n11=r.createForEachLoopDyn("n11",ti)
+#n11.getInputPort("nbBranches").edInitPy(2)
 n110=r.createScriptNode("","n110")
 n110.setExecutionMode("remote")
 n110.setContainer(cont)