X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2Fengine%2FSwitch.cxx;h=314c619271386912d805c9f8e7fb2a6569913ff9;hb=fbc4862b8d9d3803c5058c2d77e341b0cc3b1313;hp=2c6fb63442f86ba696ae6adeee5156476d1d7ff8;hpb=802458daad8b198beabbb058dc87437bdc63b1a3;p=modules%2Fyacs.git diff --git a/src/engine/Switch.cxx b/src/engine/Switch.cxx index 2c6fb6344..314c61927 100644 --- a/src/engine/Switch.cxx +++ b/src/engine/Switch.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2006-2015 CEA/DEN, EDF R&D +// Copyright (C) 2006-2019 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 @@ -400,6 +400,31 @@ int Switch::getNumberOfInputPorts() const return StaticDefinedComposedNode::getNumberOfInputPorts()+1; } +int Switch::getMaxLevelOfParallelism() const +{ + int ret(0); + for(std::map< int , Node * >::const_iterator it=_mapOfNode.begin();it!=_mapOfNode.end();it++) + ret=std::max(ret,((*it).second)->getMaxLevelOfParallelism()); + return ret; +} + +void Switch::getWeightRegardingDPL(ComplexWeight *weight) +{ + ComplexWeight localWeight; + for(std::map< int , Node * >::const_iterator it=_mapOfNode.begin();it!=_mapOfNode.end();it++) + { + ((*it).second)->getWeightRegardingDPL(&localWeight); + weight->max(localWeight); + localWeight.setToZero(); + } +} + +void Switch::partitionRegardingDPL(const PartDefinition *pd, std::map >& zeMap) +{ + for(std::map< int , Node * >::const_iterator it=_mapOfNode.begin();it!=_mapOfNode.end();it++) + (*it).second->partitionRegardingDPL(pd,zeMap); +} + void Switch::edRemoveChild(Node *node) throw(YACS::Exception) { map< int , Node * >::iterator iter=_mapOfNode.begin(); @@ -572,6 +597,34 @@ int Switch::getMaxCase() return aCase; } +//! Get the progress weight of the graph +/*! + * Only elementary nodes have weight. If the switch node is not done, we add the weight of all his descendants, + * otherwise only the weight of the used case count. + */ +list Switch::getProgressWeight() const +{ + list ret; + list setOfNode=edGetDirectDescendants(); + if (getState() == YACS::DONE) + { + for(list::const_iterator iter=setOfNode.begin();iter!=setOfNode.end();iter++) + { + if (getEffectiveState(*iter) == YACS::DONE) + ret=(*iter)->getProgressWeight(); + } + } + else + { + for(list::const_iterator iter=setOfNode.begin();iter!=setOfNode.end();iter++) + { + list myCurrentSet=(*iter)->getProgressWeight(); + ret.insert(ret.end(),myCurrentSet.begin(),myCurrentSet.end()); + } + } + return ret; +} + bool Switch::edAddChild(Node *node) throw(YACS::Exception) { int aCase = getMaxCase() + 1;