//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);
{
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]);
}
}
virtual void pre ()
{
- _nbranch=0;
_weight=-1.;
this->looptypeParser<T>::pre();
}
_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 )
}
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 + '.');
this->_cnode=this->_cnodes.empty() ? 0 : this->_cnodes.back();
return b;
}
- int _nbranch;
double _weight;
std::string _fullname;
std::string _name;
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;
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());
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)
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)