1 // Copyright (C) 2012-2016 CEA/DEN, EDF R&D
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 // Author : Anthony Geay (EDF R&D)
21 #include "YACSEvalYFXPattern.hxx"
22 #include "YACSEvalResource.hxx"
23 #include "YACSEvalSeqAny.hxx"
24 #include "YACSEvalSession.hxx"
25 #include "YACSEvalObserver.hxx"
26 #include "YACSEvalSessionInternal.hxx"
27 #include "YACSEvalAutoPtr.hxx"
28 #include "YACSEvalExecParams.hxx"
30 #include "ElementaryNode.hxx"
31 #include "RuntimeSALOME.hxx"
32 #include "Dispatcher.hxx"
33 #include "Executor.hxx"
34 #include "InputPort.hxx"
35 #include "LinkInfo.hxx"
36 #include "TypeCode.hxx"
38 #include "Dispatcher.hxx"
40 #include "PythonPorts.hxx"
41 #include "ForEachLoop.hxx"
42 #include "PythonNode.hxx"
43 #include "InlineNode.hxx"
44 #include "ServiceNode.hxx"
45 #include "PyStdout.hxx"
46 #include "AutoGIL.hxx"
48 #include "ResourcesManager.hxx"
59 const char YACSEvalYFXPattern::ST_OK[]="ALL_OK";
61 const char YACSEvalYFXPattern::ST_FAILED[]="SOME_SAMPLES_FAILED_AND_ALL_OF_THEM_FAILED_DETERMINISTICALLY";
63 const char YACSEvalYFXPattern::ST_ERROR[]="SOME_SAMPLES_FAILED_BUT_IMPOSSIBLE_TO_CONCLUDE_ON_THEM";
65 const std::size_t YACSEvalYFXPattern::MAX_LGTH_OF_INP_DUMP=10000;
67 const char YACSEvalYFXGraphGen::DFT_PROC_NAME[]="YFX";
69 const char YACSEvalYFXGraphGen::FIRST_FE_SUBNODE_NAME[]="Bloc";
71 const char YACSEvalYFXGraphGen::GATHER_NODE_NAME[]="__gather__";
73 class MyAutoThreadSaver
76 MyAutoThreadSaver(bool isToSave):_isToSave(isToSave),_save(0)
80 PyThreadState *save(PyThreadState_Swap(NULL));// safe call of PyEval_SaveThread()
88 ~MyAutoThreadSaver() { if(_isToSave) if(_save) { PyEval_AcquireLock(); PyThreadState_Swap(_save); /*safe call of PyEval_RestoreThread*/ } }
94 std::vector< YACSEvalInputPort *> YACSEvalYFXPattern::getFreeInputPorts() const
96 std::size_t sz(_inputs.size());
97 std::vector< YACSEvalInputPort *> ret;
98 std::vector< YACSEvalInputPort >::const_iterator it(_inputs.begin());
99 for(std::size_t i=0;i<sz;i++,it++)
100 ret.push_back(const_cast<YACSEvalInputPort *>(&(*it)));
104 std::vector< YACSEvalOutputPort *> YACSEvalYFXPattern::getFreeOutputPorts() const
106 std::size_t sz(_outputs.size());
107 std::vector< YACSEvalOutputPort *> ret;
108 std::vector< YACSEvalOutputPort >::const_iterator it(_outputs.begin());
109 for(std::size_t i=0;i<sz;i++,it++)
110 ret.push_back(const_cast<YACSEvalOutputPort *>(&(*it)));
114 YACSEvalYFXPattern *YACSEvalYFXPattern::FindPatternFrom(YACSEvalYFX *boss, YACS::ENGINE::Proc *scheme, bool ownScheme)
117 throw YACS::Exception("YACSEvalYFXPattern::FindPatternFrom : input scheme must be not null !");
119 YACS::ENGINE::ComposedNode *zeRunNode(0);
120 bool isMatchingRunOnlyPattern(YACSEvalYFXRunOnlyPattern::IsMatching(scheme,zeRunNode));
121 if(isMatchingRunOnlyPattern)
122 return new YACSEvalYFXRunOnlyPattern(boss,scheme,ownScheme,zeRunNode);
124 throw YACS::Exception("YACSEvalYFXPattern::FindPatternFrom : no pattern found for the input scheme !");
127 bool YACSEvalYFXPattern::isAlreadyComputedResources() const
132 void YACSEvalYFXPattern::checkNonAlreadyComputedResources() const
134 if(isAlreadyComputedResources())
135 throw YACS::Exception("checkNonAlreadyComputedResources : instance of computed resources already computed !");
138 void YACSEvalYFXPattern::checkAlreadyComputedResources() const
140 if(!isAlreadyComputedResources())
141 throw YACS::Exception("checkAlreadyComputedResources : instance of computed resources not already computed !");
144 void YACSEvalYFXPattern::checkLocked() const
147 throw YACS::Exception("YACSEvalYFXPattern::checkLocked : Pattern is not locked !");
150 void YACSEvalYFXPattern::checkNonLocked() const
153 throw YACS::Exception("YACSEvalYFXPattern::checkNonLocked : Pattern is locked !");
156 void YACSEvalYFXPattern::CheckNodeIsOK(YACS::ENGINE::ComposedNode *node)
158 /*YACS::ENGINE::LinkInfo info(YACS::ENGINE::LinkInfo::WARN_ONLY_DONT_STOP);
161 node->checkConsistency(info);
163 catch(YACS::Exception& e)
166 if(info.getNumberOfErrLinks(YACS::ENGINE::E_ALL)!=0)
167 throw YACS::Exception("YACSEvalYFXPattern::CheckNodeIsOK : found node is not OK !");
168 std::list<YACS::ENGINE::ElementaryNode *> allNodes(node->getRecursiveConstituents());
169 for(std::list<YACS::ENGINE::ElementaryNode *>::const_iterator it=allNodes.begin();it!=allNodes.end();it++)
171 YACS::ENGINE::ServiceNode *node0(dynamic_cast<YACS::ENGINE::ServiceNode *>(*it));
172 YACS::ENGINE::InlineNode *node1(dynamic_cast<YACS::ENGINE::InlineNode *>(*it));
175 YACS::ENGINE::Container *cont(node0->getContainer());
176 YACS::ENGINE::ComponentInstance *comp(node0->getComponent());
179 std::ostringstream oss; oss << "YACSEvalYFXPattern::CheckNodeIsOK : ServiceNode called \"" << node0->getName() << "\" is not correctly defined !";
180 throw YACS::Exception(oss.str());
185 YACS::ENGINE::Container *cont(node1->getContainer());
186 if(!cont && node1->getExecutionMode()==YACS::ENGINE::InlineNode::REMOTE_STR)
188 std::ostringstream oss; oss << "YACSEvalYFXPattern::CheckNodeIsOK : InlineNode called \"" << node1->getName() << "\" is not correctly defined !";
189 throw YACS::Exception(oss.str());
195 void YACSEvalYFXPattern::registerObserver(YACSEvalObserver *observer)
197 if(_observer==observer)
200 _observer->decrRef();
203 _observer->incrRef();
206 YACSEvalYFXPattern::YACSEvalYFXPattern(YACSEvalYFX *boss, YACS::ENGINE::Proc *scheme, bool ownScheme):_boss(boss),_scheme(scheme),_ownScheme(ownScheme),_parallelizeStatus(true),_rm(new ResourcesManager_cpp),_res(0),_observer(0)
210 YACS::ENGINE::TypeCode *YACSEvalYFXPattern::CreateSeqTypeCodeFrom(YACS::ENGINE::Proc *scheme, const std::string& zeType)
212 std::ostringstream oss; oss << "list[" << zeType << "]";
213 YACS::ENGINE::TypeCode *tc(scheme->getTypeCode(zeType));
214 return scheme->createSequenceTc(oss.str(),oss.str(),tc);
217 void YACSEvalYFXPattern::setResources(YACSEvalListOfResources *res)
219 checkNonAlreadyComputedResources();
225 void YACSEvalYFXPattern::resetResources()
231 YACSEvalSeqAny *YACSEvalYFXPattern::BuildValueInPort(YACS::ENGINE::InputPyPort *port)
234 throw YACS::Exception("YACSEvalYFXPattern::GetValueInPort : null input port !");
235 PyObject *obj(port->getPyObj());
236 YACS::ENGINE::TypeCode *tc(port->edGetType());
237 YACS::ENGINE::TypeCodeSeq *tcc(dynamic_cast<YACS::ENGINE::TypeCodeSeq *>(tc));
240 std::ostringstream oss; oss << "YACSEvalYFXPattern::GetValueInPort : internal error for tc of input \"" << port->getName() << "\"";
241 throw YACS::Exception(oss.str());
243 const YACS::ENGINE::TypeCode *tcct(tcc->contentType());
244 if(!PyList_Check(obj))
245 throw YACS::Exception("YACSEvalYFXPattern::GetValueInPort : internal error 2 !");
246 std::size_t sz(PyList_Size(obj));
247 if(tcct->kind()==YACS::ENGINE::Double)
249 std::vector<double> eltCpp(sz);
250 for(std::size_t i=0;i<sz;i++)
252 PyObject *elt(PyList_GetItem(obj,i));
253 eltCpp[i]=PyFloat_AsDouble(elt);
255 YACS::AutoCppPtr<YACSEvalSeqAnyDouble> elt(new YACSEvalSeqAnyDouble(eltCpp));
256 return elt.dettach();
258 else if(tcct->kind()==YACS::ENGINE::Int)
260 std::vector<int> eltCpp(sz);
261 for(std::size_t i=0;i<sz;i++)
263 PyObject *elt(PyList_GetItem(obj,i));
264 eltCpp[i]=PyInt_AsLong(elt);
266 YACS::AutoCppPtr<YACSEvalSeqAnyInt> elt(new YACSEvalSeqAnyInt(eltCpp));
267 return elt.dettach();
270 throw YACS::Exception("YACSEvalYFXPattern::GetValueInPort : not implemented yet for other than Double and Int !");
273 YACSEvalSeqAny *YACSEvalYFXPattern::BuildValueFromEngineFrmt(YACS::ENGINE::SequenceAny *data)
275 unsigned int sz(data->size());
276 std::vector<double> eltCpp(sz);
277 for(unsigned int ii=0;ii<sz;ii++)
279 YACS::ENGINE::AnyPtr elt((*data)[ii]);
280 YACS::ENGINE::Any *eltPtr((YACS::ENGINE::Any *)elt);
281 YACS::ENGINE::AtomAny *eltPtr2(dynamic_cast<YACS::ENGINE::AtomAny *>(eltPtr));
284 std::ostringstream oss; oss << "YACSEvalYFXPattern::BuildValueFromEngineFrmt : error at pos #" << ii << " ! It is not an AtomAny !";
285 throw YACS::Exception(oss.str());
287 eltCpp[ii]=eltPtr2->getDoubleValue();
289 return new YACSEvalSeqAnyDouble(eltCpp);
292 void YACSEvalYFXPattern::cleanScheme()
299 YACSEvalYFXPattern::~YACSEvalYFXPattern()
302 _observer->decrRef();
307 /////////////////////
309 class YACSEvalYFXRunOnlyPatternInternalObserver : public YACS::ENGINE::Observer
312 YACSEvalYFXRunOnlyPatternInternalObserver(YACSEvalYFXRunOnlyPattern *boss):_boss(boss) { if(!_boss) throw YACS::Exception("YACSEvalYFXRunOnlyPatternInternalObserver constructor : null boss not supported :)"); }
313 void notifyObserver2(YACS::ENGINE::Node *object, const std::string& event, void *something);
315 YACSEvalYFXRunOnlyPattern *_boss;
318 void YACSEvalYFXRunOnlyPatternInternalObserver::notifyObserver2(YACS::ENGINE::Node *object, const std::string& event, void *something)
320 YACS::ENGINE::ForEachLoop *object2(_boss->getUndergroundForEach());
321 YACSEvalObserver *obs(_boss->getObserver());
324 if(event=="progress_ok" && object2==object)
326 int *casted(reinterpret_cast<int *>(something));
327 obs->notifySampleOK(_boss->getBoss(),*casted);
330 if(event=="progress_ko" && object2==object)
332 int *casted(reinterpret_cast<int *>(something));
333 obs->notifySampleKO(_boss->getBoss(),*casted);
338 /////////////////////
340 YACSEvalYFXRunOnlyPattern::YACSEvalYFXRunOnlyPattern(YACSEvalYFX *boss, YACS::ENGINE::Proc *scheme, bool ownScheme, YACS::ENGINE::ComposedNode *runNode):YACSEvalYFXPattern(boss,scheme,ownScheme),_lockedStatus(false),_runNode(runNode),_gen(0),_obs(new YACSEvalYFXRunOnlyPatternInternalObserver(this))
343 throw YACS::Exception("YACSEvalYFXRunOnlyPattern : internal run node must be not null !");
348 YACSEvalYFXRunOnlyPattern::~YACSEvalYFXRunOnlyPattern()
354 void YACSEvalYFXRunOnlyPattern::setOutPortsOfInterestForEvaluation(const std::vector<YACSEvalOutputPort *>& outputsOfInterest)
357 _outputsOfInterest=outputsOfInterest;
361 void YACSEvalYFXRunOnlyPattern::resetOutputsOfInterest()
364 _outputsOfInterest.clear();
368 void YACSEvalYFXRunOnlyPattern::generateGraph()
371 if(getResourcesInternal()->isInteractive())
372 _gen=new YACSEvalYFXGraphGenInteractive(this);
374 _gen=new YACSEvalYFXGraphGenCluster(this);
375 _gen->generateGraph();
378 void YACSEvalYFXRunOnlyPattern::resetGeneratedGraph()
381 _gen->resetGeneratedGraph();
384 int YACSEvalYFXRunOnlyPattern::assignNbOfBranches()
386 checkAlreadyComputedResources();
388 throw YACS::Exception("YACSEvalYFXRunOnlyPattern::assignNbOfBranches : generator is NULL ! Please invoke generateGraph before !");
389 return _gen->assignNbOfBranches();
392 void YACSEvalYFXRunOnlyPattern::assignRandomVarsInputs()
394 std::size_t sz(std::numeric_limits<std::size_t>::max());
395 for(std::vector< YACSEvalInputPort >::const_iterator it=_inputs.begin();it!=_inputs.end();it++)
396 if((*it).isRandomVar())
398 std::size_t locSize((*it).initializeUndergroundWithSeq());
399 if(sz==std::numeric_limits<std::size_t>::max())
403 throw YACS::Exception("YACSEvalYFXRunOnlyPattern::assignRandomVarsInputs : length of sequences in random vars must be the same !");
407 bool YACSEvalYFXRunOnlyPattern::isLocked() const
409 return _lockedStatus;
412 YACSEvalListOfResources *YACSEvalYFXRunOnlyPattern::giveResources()
415 if(!isAlreadyComputedResources())
417 YACS::ENGINE::DeploymentTree dt(_runNode->getDeploymentTree());
418 _runNode->removeRecursivelyRedundantCL();
419 YACSEvalListOfResources *res(new YACSEvalListOfResources(_runNode->getMaxLevelOfParallelism(),getCatalogInAppli(),dt));
422 return getResourcesInternal();
425 YACS::ENGINE::Proc *YACSEvalYFXRunOnlyPattern::getUndergroundGeneratedGraph() const
427 return getGenerator()->getUndergroundGeneratedGraph();
430 std::string YACSEvalYFXRunOnlyPattern::getErrorDetailsInCaseOfFailure() const
432 std::string generatorErrors = getGenerator()->getErrors();
433 if(generatorErrors.size() > 0)
435 return generatorErrors;
437 std::string st(getStatusOfRunStr());//test if a run has occurred.
439 throw YACS::Exception("YACSEvalYFXRunOnlyPattern::getErrorDetailsInCaseOfFailure : The execution of scheme has been carried out to the end without any problem !");
440 // All the problem can only comes from foreach -> scan it
441 YACS::ENGINE::ForEachLoop *fe(getUndergroundForEach());
442 YACS::ENGINE::NodeStateNameMap nsm;
443 unsigned nbB(fe->getNumberOfBranchesCreatedDyn());
444 std::ostringstream oss;
445 for(unsigned j=0;j<nbB;j++)
447 YACS::ENGINE::Node *nn(fe->getChildByNameExec(YACSEvalYFXGraphGen::FIRST_FE_SUBNODE_NAME,j));
448 YACS::ENGINE::Bloc *nnc(dynamic_cast<YACS::ENGINE::Bloc *>(nn));
450 throw YACS::Exception("YACSEvalYFXRunOnlyPattern::getErrorDetailsInCaseOfFailure : internal error 1 ! The direct son of main foreach is expected to be a Bloc !");
451 if(nnc->getState()==YACS::DONE)
453 std::list< YACS::ENGINE::ElementaryNode *> fec(nnc->getRecursiveConstituents());
454 for(std::list< YACS::ENGINE::ElementaryNode *>::reverse_iterator it1=fec.rbegin();it1!=fec.rend();it1++)
456 YACS::StatesForNode st0((*it1)->getState());
459 oss << "NODE = " << nnc->getChildName(*it1) << std::endl;
460 oss << "STATUS = " << nsm[st0] << std::endl;
461 oss << "BRANCH ID = " << j << std::endl;
462 oss << "DETAILS = " << std::endl;
463 oss << (*it1)->getErrorDetails();
470 std::string YACSEvalYFXRunOnlyPattern::getStatusOfRunStr() const
472 YACS::StatesForNode st(getUndergroundGeneratedGraph()->getState());
478 case YACS::TOACTIVATE:
479 case YACS::ACTIVATED:
480 case YACS::SUSPENDED:
483 case YACS::DESACTIVATED:
485 std::ostringstream oss; oss << "YACSEvalYFXRunOnlyPattern::getStatusOfRunStr : Unexpected state \"" << YACS::ENGINE::Node::getStateName(st) << "\" ! Did you invoke run ?";
486 throw YACS::Exception(oss.str());
488 case YACS::LOADFAILED:
489 case YACS::EXECFAILED:
491 case YACS::INTERNALERR:
492 return std::string(ST_ERROR);
494 return std::string(ST_FAILED);
496 return std::string(ST_OK);
499 std::ostringstream oss; oss << "YACSEvalYFXRunOnlyPattern::getStatusOfRunStr : unrecognized and managed state \"" << YACS::ENGINE::Node::getStateName(st) << "\" !";
500 throw YACS::Exception(oss.str());
505 std::vector<YACSEvalSeqAny *> YACSEvalYFXRunOnlyPattern::getResults() const
507 return _gen->getResults();
511 * This method works if run succeeded (true return) and also if graph has failed. Graph failed means soft error of evaluation due to error in evaluation (example 1/0 or a normal throw from one node)
512 * If a more serious error occured (SIGSEGV of a server or internal error in YACS engine, cluster error, loose of connection...) this method will throw an exception to warn the caller that the results may be
514 std::vector<YACSEvalSeqAny *> YACSEvalYFXRunOnlyPattern::getResultsInCaseOfFailure(std::vector<unsigned int>& passedIds) const
516 YACS::StatesForNode st(getUndergroundGeneratedGraph()->getState());
520 std::vector<YACSEvalSeqAny *> ret(getResults());
524 throw YACS::Exception("YACSEvalYFXRunOnlyPattern::getResultsInCaseOfFailure : internal error ! The returned vector has a null pointer at pos #0 !");
525 std::size_t sz(ret[0]->size());
526 passedIds.resize(sz);
527 for(std::size_t i=0;i<sz;i++)
532 getStatusOfRunStr();// To check that the status is recognized.
533 std::list<YACS::ENGINE::Node *> lns(getUndergroundGeneratedGraph()->edGetDirectDescendants());
534 YACS::ENGINE::ForEachLoop *fe(getUndergroundForEach());
536 YACS::ENGINE::Executor exe;
537 std::vector<YACS::ENGINE::SequenceAny *> outputs;
538 std::vector<std::string> nameOfOutputs;
539 passedIds=fe->getPassedResults(&exe,outputs,nameOfOutputs);//<- the key invokation is here.
540 std::size_t sz(passedIds.size()),ii(0);
541 std::vector<YACSEvalSeqAny *> ret(_outputsOfInterest.size());
542 for(std::vector<YACSEvalOutputPort *>::const_iterator it1=_outputsOfInterest.begin();it1!=_outputsOfInterest.end();it1++,ii++)
544 YACS::ENGINE::OutputPort *p((*it1)->getUndergroundPtr());
545 std::string st(_runNode->getOutPortName(p));
546 std::ostringstream oss; oss << YACSEvalYFXGraphGen::FIRST_FE_SUBNODE_NAME << '.' << _runNode->getName() << '.' << st;
548 YACS::ENGINE::ForEachLoop::InterceptorizeNameOfPort(st);
549 std::vector<std::string>::iterator it2(std::find(nameOfOutputs.begin(),nameOfOutputs.end(),st));
550 if(it2==nameOfOutputs.end())
552 std::ostringstream oss; oss << "YACSEvalYFXRunOnlyPattern::getResultsInCaseOfFailure : internal error 3 ! Unable to locate interceptor with name " << st << " ! Possibilities are : ";
553 std::copy(nameOfOutputs.begin(),nameOfOutputs.end(),std::ostream_iterator<std::string>(oss," "));
555 throw YACS::Exception(oss.str());
557 std::size_t pos(std::distance(nameOfOutputs.begin(),it2));
558 ret[ii]=BuildValueFromEngineFrmt(outputs[pos]);
563 void YACSEvalYFXRunOnlyPattern::emitStart() const
565 YACSEvalObserver *obs(getObserver());
568 obs->startComputation(getBoss());
571 bool YACSEvalYFXRunOnlyPattern::go(const YACSEvalExecParams& params, YACSEvalSession *session) const
574 YACS::ENGINE::Dispatcher *disp(YACS::ENGINE::Dispatcher::getDispatcher());
575 disp->addObserver(_obs,getUndergroundForEach(),"progress_ok");
576 disp->addObserver(_obs,getUndergroundForEach(),"progress_ko");
577 bool ret(getGenerator()->go(params,session));
578 disp->removeObserver(_obs,getUndergroundForEach(),"progress_ok");
579 disp->removeObserver(_obs,getUndergroundForEach(),"progress_ko");
583 YACS::ENGINE::ForEachLoop *YACSEvalYFXRunOnlyPattern::getUndergroundForEach() const
585 return getGenerator()->getUndergroundForEach();
588 bool YACSEvalYFXRunOnlyPattern::IsMatching(YACS::ENGINE::Proc *scheme, YACS::ENGINE::ComposedNode *& runNode)
590 std::list<YACS::ENGINE::Node *> nodes(scheme->getChildren());
593 bool areAllElementary(true);
594 for(std::list<YACS::ENGINE::Node *>::const_iterator it=nodes.begin();it!=nodes.end() && areAllElementary;it++)
595 if(!dynamic_cast<YACS::ENGINE::ElementaryNode *>(*it))
596 areAllElementary=false;
600 CheckNodeIsOK(scheme);
606 YACS::ENGINE::ComposedNode *candidate(dynamic_cast<YACS::ENGINE::ComposedNode *>(nodes.front()));
609 CheckNodeIsOK(candidate);
613 void YACSEvalYFXRunOnlyPattern::buildInputPorts()
616 std::list< YACS::ENGINE::InputPort *> allInputPorts(_runNode->getSetOfInputPort());
617 std::vector<std::string> allNames;
618 for(std::list< YACS::ENGINE::InputPort *>::const_iterator it=allInputPorts.begin();it!=allInputPorts.end();it++)
620 YACS::ENGINE::InputPort *elt(*it);
622 throw YACS::Exception("YACSEvalYFXRunOnlyPattern::buildInputPorts : presence of null input !");
623 std::set<YACS::ENGINE::OutPort *> bls(elt->edSetOutPort());
626 if(YACSEvalPort::IsInputPortPublishable(elt))
628 std::string inpName(elt->getName());
630 throw YACS::Exception("YACSEvalYFXRunOnlyPattern::buildInputPorts : an input has empty name ! Should not !");
631 _inputs.push_back(YACSEvalInputPort(elt));
632 if(std::find(allNames.begin(),allNames.end(),inpName)!=allNames.end())
634 std::ostringstream oss; oss << "YACSEvalYFXRunOnlyPattern::buildInputPorts : input name \"" << inpName << "\" appears more than once !";
635 throw YACS::Exception(oss.str());
637 allNames.push_back(inpName);
643 void YACSEvalYFXRunOnlyPattern::buildOutputPorts()
646 std::list< YACS::ENGINE::OutputPort *> allOutputPorts(_runNode->getSetOfOutputPort());
647 std::vector<std::string> allNames;
648 for(std::list< YACS::ENGINE::OutputPort *>::const_iterator it=allOutputPorts.begin();it!=allOutputPorts.end();it++)
650 YACS::ENGINE::OutputPort *elt(*it);
651 if(YACSEvalPort::IsOutputPortPublishable(elt))
654 throw YACS::Exception("YACSEvalYFXRunOnlyPattern::buildOutputPorts : presence of null output !");
655 std::string outpName(elt->getName());
657 throw YACS::Exception("YACSEvalYFXRunOnlyPattern::buildOutputPorts : an output has empty name ! Should not !");
658 if(std::find(allNames.begin(),allNames.end(),outpName)!=allNames.end())
660 std::ostringstream oss; oss << "YACSEvalYFXRunOnlyPattern::buildOutputPorts : output name \"" << outpName << "\" appears more than once !";
661 throw YACS::Exception(oss.str());
663 _outputs.push_back(YACSEvalOutputPort(*it));
668 YACSEvalYFXGraphGen *YACSEvalYFXRunOnlyPattern::getGenerator() const
671 throw YACS::Exception("getGenerator : generator is NULL !");
675 /////////////////////
677 YACSEvalYFXGraphGen::YACSEvalYFXGraphGen(YACSEvalYFXRunOnlyPattern *boss):_boss(boss),_generatedGraph(0),_FEInGeneratedGraph(0)
680 throw YACS::Exception("YACSEvalYFXGraphGen constructor : boss is NULL !");
683 YACSEvalYFXGraphGen::~YACSEvalYFXGraphGen()
685 //delete _generatedGraph;// -> TODO : AGY why ?
688 void YACSEvalYFXGraphGen::resetGeneratedGraph()
690 delete _generatedGraph;
691 _generatedGraph=0; _FEInGeneratedGraph=0;
694 bool YACSEvalYFXGraphGen::isLocked() const
696 return _generatedGraph!=0;
699 int YACSEvalYFXGraphGen::assignNbOfBranches()
702 throw YACS::Exception("YACSEvalYFXGraphGen::assignNbOfBranches : the generated graph has not been created !");
703 std::list<YACS::ENGINE::Node *> nodes(_generatedGraph->getChildren());
704 YACS::ENGINE::ForEachLoop *zeMainNode(0);
705 for(std::list<YACS::ENGINE::Node *>::const_iterator it=nodes.begin();it!=nodes.end();it++)
707 YACS::ENGINE::ForEachLoop *isZeMainNode(dynamic_cast<YACS::ENGINE::ForEachLoop *>(*it));
711 zeMainNode=isZeMainNode;
713 throw YACS::Exception("YACSEvalYFXGraphGen::assignNbOfBranches : internal error 1 !");
717 throw YACS::Exception("YACSEvalYFXGraphGen::assignNbOfBranches : internal error 2 !");
718 unsigned int nbProcsDeclared(getBoss()->getResourcesInternal()->getNumberOfProcsDeclared());
719 nbProcsDeclared=std::max(nbProcsDeclared,4u);
721 if(getBoss()->getParallelizeStatus())
723 nbOfBranch=(nbProcsDeclared/getBoss()->getResourcesInternal()->getMaxLevelOfParallelism());
724 nbOfBranch=std::max(nbOfBranch,1);
726 YACS::ENGINE::InputPort *zeInputToSet(zeMainNode->edGetNbOfBranchesPort());
727 YACS::ENGINE::AnyInputPort *zeInputToSetC(dynamic_cast<YACS::ENGINE::AnyInputPort *>(zeInputToSet));
729 throw YACS::Exception("YACSEvalYFXGraphGen::assignNbOfBranches : internal error 3 !");
730 YACS::ENGINE::Any *a(YACS::ENGINE::AtomAny::New(nbOfBranch));
731 zeInputToSetC->put(a);
732 zeInputToSetC->exSaveInit();
737 void YACSEvalYFXGraphGenInteractive::generateGraph()
740 { delete _generatedGraph; _generatedGraph=0; _FEInGeneratedGraph=0; }
741 static const char LISTPYOBJ_STR[]="list[pyobj]";
742 if(getBoss()->getOutputsOfInterest().empty())
744 YACS::ENGINE::RuntimeSALOME::setRuntime();
745 YACS::ENGINE::RuntimeSALOME *r(YACS::ENGINE::getSALOMERuntime());
746 _generatedGraph=r->createProc(DFT_PROC_NAME);
747 YACS::ENGINE::TypeCode *pyobjTC(_generatedGraph->createInterfaceTc("python:obj:1.0","pyobj",std::list<YACS::ENGINE::TypeCodeObjref *>()));
748 std::ostringstream oss; oss << "Loop_" << getBoss()->getRunNode()->getName();
749 _generatedGraph->createType(YACSEvalAnyDouble::TYPE_REPR,"double");
750 _generatedGraph->createType(YACSEvalAnyInt::TYPE_REPR,"int");
752 YACS::ENGINE::InlineNode *n0(r->createScriptNode(YACS::ENGINE::PythonNode::KIND,"__initializer__"));
753 _generatedGraph->edAddChild(n0);
754 YACS::ENGINE::TypeCode *listPyobjTC(_generatedGraph->createSequenceTc(LISTPYOBJ_STR,LISTPYOBJ_STR,pyobjTC));
755 YACS::ENGINE::OutputPort *sender(n0->edAddOutputPort("sender",listPyobjTC));
756 std::ostringstream var0;
757 const std::vector< YACSEvalInputPort >& inputs(getBoss()->getInputs());
758 for(std::vector< YACSEvalInputPort >::const_iterator it=inputs.begin();it!=inputs.end();it++)
760 if((*it).isRandomVar())
762 var0 << (*it).getName() << ",";
763 YACS::ENGINE::TypeCode *tc(YACSEvalYFXPattern::CreateSeqTypeCodeFrom(_generatedGraph,(*it).getTypeOfData()));
764 YACS::ENGINE::InputPort *inp(n0->edAddInputPort((*it).getName(),tc));
765 YACS::ENGINE::InputPyPort *inpc(dynamic_cast<YACS::ENGINE::InputPyPort *>(inp));
767 throw YACS::Exception("YACSEvalYFXRunOnlyPattern::generateGraph : internal error 1 !");
768 (*it).setUndergroundPortToBeSet(inpc);
771 std::ostringstream n0Script; n0Script << "sender=zip(" << var0.str() << ")\n";
772 n0->setScript(n0Script.str());
774 YACS::ENGINE::ForEachLoop *n1(r->createForEachLoop(oss.str(),pyobjTC));
775 _FEInGeneratedGraph=n1;
776 _generatedGraph->edAddChild(n1);
777 _generatedGraph->edAddCFLink(n0,n1);
778 _generatedGraph->edAddDFLink(sender,n1->edGetSeqOfSamplesPort());
779 YACS::ENGINE::InlineNode *n2(r->createScriptNode(YACS::ENGINE::PythonNode::KIND,GATHER_NODE_NAME));
780 _generatedGraph->edAddChild(n2);
781 _generatedGraph->edAddCFLink(n1,n2);
783 YACS::ENGINE::Bloc *n10(r->createBloc(FIRST_FE_SUBNODE_NAME));
785 YACS::ENGINE::InlineNode *n100(r->createScriptNode(YACS::ENGINE::PythonNode::KIND,"__dispatch__"));
786 YACS::ENGINE::ComposedNode *runNode(getBoss()->getRunNode());
787 YACS::ENGINE::Node *n101(runNode->cloneWithoutCompAndContDeepCpy(0,true));
788 n10->edAddChild(n100);
789 n10->edAddChild(n101);
790 YACS::ENGINE::InputPort *dispatchIn(n100->edAddInputPort("i0",pyobjTC));
791 n10->edAddCFLink(n100,n101);
792 n1->edAddDFLink(n1->edGetSamplePort(),dispatchIn);
793 std::ostringstream var1;
794 for(std::vector< YACSEvalInputPort >::const_iterator it=inputs.begin();it!=inputs.end();it++)
796 if((*it).isRandomVar())
798 var1 << (*it).getName() << ",";
799 YACS::ENGINE::OutputPort *myOut(n100->edAddOutputPort((*it).getName(),_generatedGraph->getTypeCode((*it).getTypeOfData())));
800 std::string tmpPortName(runNode->getInPortName((*it).getUndergroundPtr()));
801 YACS::ENGINE::InputPort *myIn(n101->getInputPort(tmpPortName));
802 n10->edAddDFLink(myOut,myIn);
805 std::ostringstream n100Script; n100Script << var1.str() << "=i0\n";
806 n100->setScript(n100Script.str());
807 const std::vector<YACSEvalOutputPort *>& outputsOfInt(getBoss()->getOutputsOfInterest());
808 for(std::vector< YACSEvalOutputPort * >::const_iterator it=outputsOfInt.begin();it!=outputsOfInt.end();it++)
810 YACS::ENGINE::TypeCode *tc(YACSEvalYFXPattern::CreateSeqTypeCodeFrom(_generatedGraph,(*it)->getTypeOfData()));
811 YACS::ENGINE::InputPort *myIn(n2->edAddInputPort((*it)->getName(),tc));
812 std::string tmpPortName(runNode->getOutPortName((*it)->getUndergroundPtr()));
813 YACS::ENGINE::OutputPort *myOut(n101->getOutputPort(tmpPortName));
814 _generatedGraph->edAddDFLink(myOut,myIn);
816 _generatedGraph->updateContainersAndComponents();
819 bool YACSEvalYFXGraphGenInteractive::go(const YACSEvalExecParams& params, YACSEvalSession *session) const
821 YACS::ENGINE::Executor exe;
822 exe.setKeepGoingProperty(!params.getStopASAPAfterErrorStatus());
824 MyAutoThreadSaver locker(!session->isAlreadyPyThreadSaved());
825 exe.RunW(getUndergroundGeneratedGraph());
827 return getUndergroundGeneratedGraph()->getState()==YACS::DONE;
830 std::string YACSEvalYFXGraphGenInteractive::getErrors()const
835 std::vector<YACSEvalSeqAny *> YACSEvalYFXGraphGenInteractive::getResults() const
837 if(getUndergroundGeneratedGraph()->getState()!=YACS::DONE)
838 throw YACS::Exception("YACSEvalYFXRunOnlyPattern::getResults : the execution did not finished correctly ! getResults should not be called !");
839 const std::vector<YACSEvalOutputPort *>& outputsOfInt(getBoss()->getOutputsOfInterest());
840 std::vector<YACSEvalSeqAny *> ret(outputsOfInt.size());
841 YACS::ENGINE::Node *node(getUndergroundGeneratedGraph()->getChildByName(YACSEvalYFXGraphGen::GATHER_NODE_NAME));
842 YACS::ENGINE::PythonNode *nodeC(dynamic_cast<YACS::ENGINE::PythonNode *>(node));
844 throw YACS::Exception("YACSEvalYFXRunOnlyPattern::getResults : internal error !");
846 for(std::vector< YACSEvalOutputPort * >::const_iterator it=outputsOfInt.begin();it!=outputsOfInt.end();it++,ii++)
848 YACS::ENGINE::InPort *input(nodeC->getInPort((*it)->getName()));
849 YACS::ENGINE::InputPyPort *inputC(dynamic_cast<YACS::ENGINE::InputPyPort *>(input));
852 std::ostringstream oss; oss << "YACSEvalYFXRunOnlyPattern::getResults : internal error for input \"" << (*it)->getName() << "\"";
853 throw YACS::Exception(oss.str());
855 ret[ii]=YACSEvalYFXPattern::BuildValueInPort(inputC);
862 void YACSEvalYFXGraphGenCluster::generateGraph()
864 YACS::ENGINE::AutoGIL agil;
866 { delete _generatedGraph; _generatedGraph=0; _FEInGeneratedGraph=0; }
868 const char EFXGenFileName[]="EFXGenFileName";
869 const char EFXGenContent[]="import getpass,datetime,os\nn=datetime.datetime.now()\nreturn os.path.join(os.path.sep,\"tmp\",\"EvalYFX_%s_%s_%s.xml\"%(getpass.getuser(),n.strftime(\"%d%m%y\"),n.strftime(\"%H%M%S\")))";
870 const char EFXGenContent2[]="import getpass,datetime\nn=datetime.datetime.now()\nreturn \"EvalYFX_%s_%s_%s\"%(getpass.getuser(),n.strftime(\"%d%m%y\"),n.strftime(\"%H%M%S\"))";
872 YACS::ENGINE::AutoPyRef func(YACS::ENGINE::evalPy(EFXGenFileName,EFXGenContent));
873 YACS::ENGINE::AutoPyRef val(YACS::ENGINE::evalFuncPyWithNoParams(func));
874 _locSchemaFile=PyString_AsString(val);
875 func=YACS::ENGINE::evalPy(EFXGenFileName,EFXGenContent2);
876 val=YACS::ENGINE::evalFuncPyWithNoParams(func);
877 _jobName=PyString_AsString(val);
879 static const char LISTPYOBJ_STR[]="list[pyobj]";
880 if(getBoss()->getOutputsOfInterest().empty())
882 YACS::ENGINE::RuntimeSALOME::setRuntime();
883 YACS::ENGINE::RuntimeSALOME *r(YACS::ENGINE::getSALOMERuntime());
884 _generatedGraph=r->createProc(DFT_PROC_NAME);
885 YACS::ENGINE::TypeCode *pyobjTC(_generatedGraph->createInterfaceTc("python:obj:1.0","pyobj",std::list<YACS::ENGINE::TypeCodeObjref *>()));
886 std::ostringstream oss; oss << "Loop_" << getBoss()->getRunNode()->getName();
887 _generatedGraph->createType(YACSEvalAnyDouble::TYPE_REPR,"double");
888 _generatedGraph->createType(YACSEvalAnyInt::TYPE_REPR,"int");
890 YACS::ENGINE::InlineNode *n0(r->createScriptNode(YACS::ENGINE::PythonNode::KIND,"__initializer__"));
891 _generatedGraph->edAddChild(n0);
892 YACS::ENGINE::TypeCode *listPyobjTC(_generatedGraph->createSequenceTc(LISTPYOBJ_STR,LISTPYOBJ_STR,pyobjTC));
893 YACS::ENGINE::OutputPort *sender(n0->edAddOutputPort("sender",listPyobjTC));
894 std::ostringstream var0;
895 const std::vector< YACSEvalInputPort >& inputs(getBoss()->getInputs());
896 for(std::vector< YACSEvalInputPort >::const_iterator it=inputs.begin();it!=inputs.end();it++)
898 if((*it).isRandomVar())
900 var0 << (*it).getName() << ",";
901 YACS::ENGINE::TypeCode *tc(YACSEvalYFXPattern::CreateSeqTypeCodeFrom(_generatedGraph,(*it).getTypeOfData()));
902 YACS::ENGINE::InputPort *inp(n0->edAddInputPort((*it).getName(),tc));
903 YACS::ENGINE::InputPyPort *inpc(dynamic_cast<YACS::ENGINE::InputPyPort *>(inp));
905 throw YACS::Exception("YACSEvalYFXRunOnlyPattern::generateGraph : internal error 1 !");
906 (*it).setUndergroundPortToBeSet(inpc);
909 std::ostringstream n0Script; n0Script << "sender=zip(" << var0.str() << ")\n";
910 n0->setScript(n0Script.str());
912 YACS::ENGINE::ForEachLoop *n1(r->createForEachLoop(oss.str(),pyobjTC));
913 _FEInGeneratedGraph=n1;
914 _generatedGraph->edAddChild(n1);
915 _generatedGraph->edAddCFLink(n0,n1);
916 _generatedGraph->edAddDFLink(sender,n1->edGetSeqOfSamplesPort());
917 YACS::ENGINE::InlineNode *n2(r->createScriptNode(YACS::ENGINE::PythonNode::KIND,GATHER_NODE_NAME));
918 _generatedGraph->edAddChild(n2);
919 _generatedGraph->edAddCFLink(n1,n2);
921 YACS::ENGINE::Bloc *n10(r->createBloc(FIRST_FE_SUBNODE_NAME));
923 YACS::ENGINE::InlineNode *n100(r->createScriptNode(YACS::ENGINE::PythonNode::KIND,"__dispatch__"));
924 YACS::ENGINE::ComposedNode *runNode(getBoss()->getRunNode());
925 YACS::ENGINE::Node *n101(runNode->cloneWithoutCompAndContDeepCpy(0,true));
926 n10->edAddChild(n100);
927 n10->edAddChild(n101);
928 YACS::ENGINE::InputPort *dispatchIn(n100->edAddInputPort("i0",pyobjTC));
929 n10->edAddCFLink(n100,n101);
930 n1->edAddDFLink(n1->edGetSamplePort(),dispatchIn);
931 std::ostringstream var1;
932 for(std::vector< YACSEvalInputPort >::const_iterator it=inputs.begin();it!=inputs.end();it++)
934 if((*it).isRandomVar())
936 var1 << (*it).getName() << ",";
937 YACS::ENGINE::OutputPort *myOut(n100->edAddOutputPort((*it).getName(),_generatedGraph->getTypeCode((*it).getTypeOfData())));
938 std::string tmpPortName(runNode->getInPortName((*it).getUndergroundPtr()));
939 YACS::ENGINE::InputPort *myIn(n101->getInputPort(tmpPortName));
940 n10->edAddDFLink(myOut,myIn);
943 std::ostringstream n100Script; n100Script << var1.str() << "=i0\n";
944 n100->setScript(n100Script.str());
945 const std::vector<YACSEvalOutputPort *>& outputsOfInt(getBoss()->getOutputsOfInterest());
946 std::ostringstream n2Script; n2Script << "zeRes=[";
947 for(std::vector< YACSEvalOutputPort * >::const_iterator it=outputsOfInt.begin();it!=outputsOfInt.end();it++)
949 YACS::ENGINE::TypeCode *tc(YACSEvalYFXPattern::CreateSeqTypeCodeFrom(_generatedGraph,(*it)->getTypeOfData()));
950 YACS::ENGINE::InputPort *myIn(n2->edAddInputPort((*it)->getName(),tc));
951 n2Script << (*it)->getName() << ", ";
952 std::string tmpPortName(runNode->getOutPortName((*it)->getUndergroundPtr()));
953 YACS::ENGINE::OutputPort *myOut(n101->getOutputPort(tmpPortName));
954 _generatedGraph->edAddDFLink(myOut,myIn);
956 n2Script << "]\nf=file(\"" << _jobName << "\",\"w\") ; f.write(str(zeRes)) ; del f";
957 n2->setScript(n2Script.str());
958 _generatedGraph->updateContainersAndComponents();
961 bool YACSEvalYFXGraphGenCluster::go(const YACSEvalExecParams& params, YACSEvalSession *session) const
963 YACS::ENGINE::AutoGIL agil;
965 getUndergroundGeneratedGraph()->saveSchema(_locSchemaFile);
966 YACSEvalListOfResources *rss(getBoss()->getResourcesInternal());
967 const YACSEvalParamsForCluster& cli(rss->getAddParamsForCluster());
968 std::vector<std::string> machines(rss->getAllChosenMachines());
969 if(machines.size()!=1)
970 throw YACS::Exception("YACSEvalYFXGraphGenCluster::go : internal error ! In batch mode and not exactly one machine !");
971 Engines::SalomeLauncher_var sl(session->getInternal()->goFetchingSalomeLauncherInNS());
972 Engines::ResourceParameters rr;
973 rr.name=CORBA::string_dup(machines[0].c_str());
974 rr.hostname=CORBA::string_dup("");
975 rr.can_launch_batch_jobs=true;
976 rr.can_run_containers=true;
977 rr.OS=CORBA::string_dup("Linux");
978 rr.componentList.length(0);
979 rr.nb_proc=rss->getNumberOfProcsDeclared();// <- important
982 rr.nb_node=1;// useless only nb_proc used.
983 rr.nb_proc_per_node=1;// useless only nb_proc used.
984 rr.policy=CORBA::string_dup("cycl");
985 rr.resList.length(0);
986 Engines::JobParameters jp;
987 jp.job_name=CORBA::string_dup(_jobName.c_str());
988 jp.job_type=CORBA::string_dup("yacs_file");
989 jp.job_file=CORBA::string_dup(_locSchemaFile.c_str());
990 jp.env_file=CORBA::string_dup("");
991 jp.in_files.length(cli.getInFiles().size());
992 std::list<std::string>::const_iterator it;
994 for (it = cli.getInFiles().begin(), i=0 ;
995 it != cli.getInFiles().end();
998 jp.in_files[i] = CORBA::string_dup((*it).c_str());
1000 jp.out_files.length(1);
1001 jp.out_files[0]=CORBA::string_dup(_jobName.c_str());
1002 jp.work_directory=CORBA::string_dup(cli.getRemoteWorkingDir().c_str());
1003 jp.local_directory=CORBA::string_dup(cli.getLocalWorkingDir().c_str());
1004 jp.result_directory=CORBA::string_dup(cli.getLocalWorkingDir().c_str());
1005 jp.maximum_duration=CORBA::string_dup(cli.getMaxDuration().c_str());
1006 jp.resource_required=rr;
1007 jp.queue=CORBA::string_dup("");
1009 jp.mem_per_cpu=rr.mem_mb;
1010 jp.wckey=CORBA::string_dup(cli.getWCKey().c_str());
1011 jp.extra_params=CORBA::string_dup("");
1012 jp.specific_parameters.length(0);
1013 jp.launcher_file=CORBA::string_dup("");
1014 jp.launcher_args=CORBA::string_dup("");
1015 _jobid=sl->createJob(jp);
1018 sl->launchJob(_jobid);
1020 catch (const SALOME::SALOME_Exception & ex)
1022 _errors = ex.details.text.in();
1025 catch (const CORBA::SystemException& ex)
1027 _errors = "Receive CORBA SystemException.";
1034 PyRun_SimpleString("import time ; time.sleep(10)");
1035 char *state(sl->getJobState(_jobid));//"CREATED", "IN_PROCESS", "QUEUED", "RUNNING", "PAUSED", "FINISHED" or "FAILED"
1036 std::string sstate(state);
1037 CORBA::string_free(state);
1038 if(sstate=="FINISHED" || sstate=="FAILED")
1040 ret=sstate=="FINISHED";
1044 sl->getJobResults(_jobid,cli.getLocalWorkingDir().c_str());
1048 std::ostringstream oss; oss << "import os" << std::endl << "p=os.path.join(\"" << cli.getLocalWorkingDir() << "\",\"" << _jobName << "\")" << std::endl;
1049 oss << "if not os.path.exists(p):\n return None\n";
1050 oss << "f=file(p,\"r\")" << std::endl;
1051 oss << "return eval(f.read())";
1052 std::string zeInput(oss.str());
1053 YACS::ENGINE::AutoPyRef func(YACS::ENGINE::evalPy("fetch",zeInput));
1054 YACS::ENGINE::AutoPyRef val(YACS::ENGINE::evalFuncPyWithNoParams(func));
1055 if(!PyList_Check(val))
1056 throw YACS::Exception("Fetched file does not contain a list !");
1057 Py_ssize_t sz(PyList_Size(val));
1059 for(Py_ssize_t i=0;i<sz;i++)
1061 std::vector<double>& res0(_res[i]);
1062 PyObject *elt0(PyList_GetItem(val,i));
1063 if(!PyList_Check(elt0))
1064 throw YACS::Exception("Fetched file does contain a list of list !");
1065 Py_ssize_t sz0(PyList_Size(elt0)); res0.resize(sz0);
1066 for(Py_ssize_t j=0;j<sz0;j++)
1068 PyObject *elt1(PyList_GetItem(elt0,j));
1069 res0[j]=PyFloat_AsDouble(elt1);
1073 std::ostringstream oss1; oss1 << "import os" << std::endl << "p=os.path.join(\"" << cli.getLocalWorkingDir() << "\",\"" << _jobName << "\") ; os.remove(p)" << std::endl;
1074 std::string s1(oss1.str());
1075 PyRun_SimpleString(s1.c_str());
1076 if(!params.getFetchRemoteDirForClusterStatus())
1078 std::ostringstream oss2; oss2 << "import os,shutil" << std::endl << "p=os.path.join(\"" << cli.getLocalWorkingDir() << "\",\"logs\") ; shutil.rmtree(p)" << std::endl;
1079 std::string s2(oss2.str());
1080 PyRun_SimpleString(s2.c_str());
1083 catch(YACS::Exception& e)
1092 std::string YACSEvalYFXGraphGenCluster::getErrors()const
1097 std::vector<YACSEvalSeqAny *> YACSEvalYFXGraphGenCluster::getResults() const
1099 std::size_t sz(_res.size());
1100 std::vector<YACSEvalSeqAny *> ret(sz);
1101 for(std::size_t i=0;i<sz;i++)
1103 YACS::AutoCppPtr<YACSEvalSeqAnyDouble> elt(new YACSEvalSeqAnyDouble(_res[i]));
1104 ret[i]=elt.dettach();