1 // Copyright (C) 2015-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
20 #include "LinkedBlocPoint.hxx"
21 #include "PointVisitor.hxx"
22 #include "Exception.hxx"
29 using namespace YACS::ENGINE;
31 LinkedBlocPoint::LinkedBlocPoint(const std::list<AbstractPoint *>& nodes, AbstractPoint *father):BlocPoint(nodes,father)
35 Node *LinkedBlocPoint::getFirstNode()
38 throw Exception("LinkedBlocPoint::getFirstNode : error no branches !");
39 return _nodes.front()->getFirstNode();
42 Node *LinkedBlocPoint::getLastNode()
45 throw Exception("LinkedBlocPoint::getFirstNode : error no branches !");
46 return _nodes.back()->getLastNode();
49 int LinkedBlocPoint::getMaxLevelOfParallelism() const
52 for(std::list<AbstractPoint *>::const_iterator it=_nodes.begin();it!=_nodes.end();it++)
53 ret=std::max(ret,(*it)->getMaxLevelOfParallelism());
57 void LinkedBlocPoint::getWeightRegardingDPL(ComplexWeight *weight)
59 ComplexWeight localWeight;
60 for(std::list<AbstractPoint *>::const_iterator it=_nodes.begin();it!=_nodes.end();it++)
62 (*it)->getWeightRegardingDPL(&localWeight);
63 weight->addWeight(&localWeight);
64 localWeight.setToZero();
68 void LinkedBlocPoint::partitionRegardingDPL(const PartDefinition *pd, std::map<ComposedNode *, YACS::BASES::AutoRefCnt<PartDefinition> >& zeMap) const
70 for(std::list<AbstractPoint *>::const_iterator it=_nodes.begin();it!=_nodes.end();it++)
71 (*it)->partitionRegardingDPL(pd,zeMap);
74 std::string LinkedBlocPoint::getRepr() const
76 std::size_t sz(_nodes.size()),ii(0);
78 for(std::list<AbstractPoint *>::const_iterator it=_nodes.begin();it!=_nodes.end();it++,ii++)
80 ret+=(*it)->getRepr();
88 void LinkedBlocPoint::accept(PointVisitor *pv)
90 pv->beginLinkedBlocPoint(this);
93 pv->endLinkedBlocPoint(this);
96 LinkedBlocPoint::~LinkedBlocPoint()