X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2Fengine%2FBloc.cxx;h=6fc3240abfa88716d1fb14d9d23e3654f04aaa64;hb=53629c53c7f47f2d86aa47e31206e836290f055a;hp=e7fa7f74cb26696ff6ec0f535eb9ca069f5cfe27;hpb=c971f99371af3cdbe21daa611ebc89806d0e26c1;p=modules%2Fyacs.git diff --git a/src/engine/Bloc.cxx b/src/engine/Bloc.cxx index e7fa7f74c..6fc3240ab 100644 --- a/src/engine/Bloc.cxx +++ b/src/engine/Bloc.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2006-2015 CEA/DEN, EDF R&D +// Copyright (C) 2006-2016 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 @@ -25,7 +25,9 @@ #include "OutputDataStreamPort.hxx" #include "ElementaryNode.hxx" #include "Visitor.hxx" +#include "ForkBlocPoint.hxx" #include "SetOfPoints.hxx" +#include "PlayGround.hxx" #include #include @@ -452,33 +454,55 @@ void Bloc::accept(Visitor* visitor) * for all concurrent branches in \a this. */ int Bloc::getMaxLevelOfParallelism() const +{ + std::list< AbstractPoint * > pts(analyzeParallelism()); + ForkBlocPoint fbp(pts,NULL); + return fbp.getMaxLevelOfParallelism(); +} + +std::list< AbstractPoint * > Bloc::analyzeParallelism() const { std::vector< std::list > r(splitIntoIndependantGraph()); - int ret(0); + std::list< AbstractPoint * > pts; for(std::vector< std::list >::const_iterator it=r.begin();it!=r.end();it++) { SetOfPoints sop(*it); sop.simplify(); - ret+=sop.getMaxLevelOfParallelism(); + pts.push_back(sop.getUniqueAndReleaseIt()); } - return ret; + return pts; } -/*! - * Updates mutable structures _fwLinks and _bwLinks with the result of computation (CPU consuming method). - * _fwLinks is a map with a Node* as key and a set as value. The set gives - * all nodes that are forwardly connected to the key node - * _bwLinks is a map for backward dependencies - * The method is : for all CF link (n1->n2) - * add n2 and _fwLinks[n2] in forward dependencies of n1 and _bwLinks[n1] - * add n1 and _bwLinks[n1] in backward dependencies of n2 and _fwLinks[n2] - * For useless links - * If a node is already in a forward dependency when adding and the direct link - * already exists so it's a useless link (see the code !) - */ -void Bloc::performCFComputations(LinkInfo& info) const +double Bloc::getWeightRegardingDPL() const +{ + std::list< AbstractPoint * > pts(analyzeParallelism()); + ForkBlocPoint fbp(pts,NULL); + return fbp.getWeightRegardingDPL(); +} + +void Bloc::removeRecursivelyRedundantCL() +{ + StaticDefinedComposedNode::removeRecursivelyRedundantCL(); + LinkInfo info(I_CF_USELESS); + initComputation(); + performCFComputationsOnlyOneLevel(info); + std::set< std::pair > linksToKill(info.getInfoUselessLinks()); + for(std::set< std::pair >::const_iterator it=linksToKill.begin();it!=linksToKill.end();it++) + edRemoveCFLink((*it).first,(*it).second); + destructCFComputations(info); +} + +void Bloc::partitionRegardingDPL(const PartDefinition *pd, std::map >& zeMap) +{ + if(!pd) + throw Exception("Bloc::partitionRegardingDPL : NULL pointer !"); + std::list< AbstractPoint * > pts(analyzeParallelism()); + ForkBlocPoint fbp(pts,NULL); + fbp.partitionRegardingDPL(pd,zeMap); +} + +void Bloc::performCFComputationsOnlyOneLevel(LinkInfo& info) const { - StaticDefinedComposedNode::performCFComputations(info); delete _fwLinks;//Normally useless delete _bwLinks;//Normally useless _fwLinks=new map >; @@ -549,6 +573,24 @@ void Bloc::performCFComputations(LinkInfo& info) const } } +/*! + * Updates mutable structures _fwLinks and _bwLinks with the result of computation (CPU consuming method). + * _fwLinks is a map with a Node* as key and a set as value. The set gives + * all nodes that are forwardly connected to the key node + * _bwLinks is a map for backward dependencies + * The method is : for all CF link (n1->n2) + * add n2 and _fwLinks[n2] in forward dependencies of n1 and _bwLinks[n1] + * add n1 and _bwLinks[n1] in backward dependencies of n2 and _fwLinks[n2] + * For useless links + * If a node is already in a forward dependency when adding and the direct link + * already exists so it's a useless link (see the code !) + */ +void Bloc::performCFComputations(LinkInfo& info) const +{ + StaticDefinedComposedNode::performCFComputations(info); + performCFComputationsOnlyOneLevel(info); +} + void Bloc::destructCFComputations(LinkInfo& info) const { StaticDefinedComposedNode::destructCFComputations(info);