Version: 9.15.0
NotSimpleCasePoint.cxx
Go to the documentation of this file.
1 // Copyright (C) 2019-2025 CEA, EDF
2 //
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.
7 //
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.
12 //
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
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19 
20 #include "NotSimpleCasePoint.hxx"
21 #include "PointVisitor.hxx"
22 #include "Exception.hxx"
23 
24 #include <algorithm>
25 
26 
27 using namespace YACS::ENGINE;
28 
29 NotSimpleCasePoint::NotSimpleCasePoint(const std::list<AbstractPoint *>& nodes, AbstractPoint *father):BlocPoint(nodes,father)
30 {
31 }
32 
34 {
36  ret->deepCopyFrom(*this);
37  ret->setFather(father);
38  return ret;
39 }
40 
42 {
43  if(_nodes.empty())
44  throw Exception("NotSimpleCasePoint::getFirstNode : error no branches !");
45  return _nodes.front()->getFirstNode();
46 }
47 
49 {
50  if(_nodes.empty())
51  throw Exception("NotSimpleCasePoint::getFirstNode : error no branches !");
52  return _nodes.back()->getLastNode();
53 }
54 
56 {
57  int ret(0);
58  for(std::list<AbstractPoint *>::const_iterator it=_nodes.begin();it!=_nodes.end();it++)
59  ret=std::max(ret,(*it)->getMaxLevelOfParallelism());
60  return ret;
61 }
62 
64 {
65  ComplexWeight localWeight;
66  for(std::list<AbstractPoint *>::const_iterator it=_nodes.begin();it!=_nodes.end();it++)
67  {
68  (*it)->getWeightRegardingDPL(&localWeight);
69  weight->addWeight(&localWeight);
70  localWeight.setToZero();
71  }
72 }
73 
75 {
76  for(std::list<AbstractPoint *>::const_iterator it=_nodes.begin();it!=_nodes.end();it++)
77  (*it)->partitionRegardingDPL(pd,zeMap);
78 }
79 
80 std::string NotSimpleCasePoint::getRepr() const
81 {
82  std::size_t sz(_nodes.size()),ii(0);
83  std::string ret("|");
84  for(std::list<AbstractPoint *>::const_iterator it=_nodes.begin();it!=_nodes.end();it++,ii++)
85  {
86  ret+=(*it)->getRepr();
87  if(ii!=sz-1)
88  ret+="^";
89  }
90  ret+="|";
91  return ret;
92 }
93 
95 {
96  pv->beginNotSimpleCasePoint(this);
97  for(auto it:_nodes)
98  it->accept(pv);
99  pv->endNotSimpleCasePoint(this);
100 }
101 
102 AbstractPoint *NotSimpleCasePoint::expandNonSimpleCaseOn(NotSimpleCasePoint *pathologicalPt, const std::set<Node *>& uncatchedNodes)
103 {
104  throw YACS::Exception("NotSimpleCasePoint::expandNonSimpleCaseOn : ooops !");
105 }
void setFather(AbstractPoint *father)
void deepCopyFrom(const BlocPoint &other)
Definition: BlocPoint.cxx:34
std::list< AbstractPoint * > _nodes
Definition: BlocPoint.hxx:35
void addWeight(const ComplexWeight *other)
Base class for all composed nodes.
Base class for all nodes.
Definition: Node.hxx:70
int getMaxLevelOfParallelism() const override
void getWeightRegardingDPL(ComplexWeight *weight) override
AbstractPoint * expandNonSimpleCaseOn(NotSimpleCasePoint *pathologicalPt, const std::set< Node * > &uncatchedNodes) override
void accept(PointVisitor *pv) override
void partitionRegardingDPL(const PartDefinition *pd, std::map< ComposedNode *, YACS::BASES::AutoRefCnt< PartDefinition > > &zeMap) const override
std::string getRepr() const override
AbstractPoint * deepCopy(AbstractPoint *father) const override
virtual void endNotSimpleCasePoint(NotSimpleCasePoint *pt)=0
virtual void beginNotSimpleCasePoint(NotSimpleCasePoint *pt)=0