Version: 9.15.0
SetOfPoints.cxx
Go to the documentation of this file.
1 // Copyright (C) 2015-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 "SetOfPoints.hxx"
21 #include "BagPoint.hxx"
22 #include "LinkedBlocPoint.hxx"
23 #include "ForkBlocPoint.hxx"
24 #include "ElementaryPoint.hxx"
25 #include "Exception.hxx"
26 
27 #include <algorithm>
28 
29 using namespace YACS::ENGINE;
30 
31 SetOfPoints::SetOfPoints(const std::list<Node *>& nodes):_bp(0)
32 {
33  std::list<AbstractPoint *> nodes2;
34  for(std::list<Node *>::const_iterator it=nodes.begin();it!=nodes.end();it++)
35  {
36  nodes2.push_back(new ElementaryPoint(*it));
37  }
38  _bp=new BagPoint(nodes2,0);
39 }
40 
42 {
43  delete _bp;
44 }
45 
47 {
48  while(_bp->size()>1)
49  {
50  bool somethingDone(false);
51  _bp->deal1(somethingDone);
52  if(somethingDone)
53  continue;
54  _bp->deal2(somethingDone);
55  if(somethingDone)
56  continue;
57  _bp->deal2Bis(somethingDone);
58  if(somethingDone)
59  continue;
60  _bp->deal2Ter(somethingDone);
61  if(somethingDone)
62  continue;
63  _bp->deal2Quatro(somethingDone);
64  if(!somethingDone)
65  throw Exception("SetOfPoints::simplify : not implemented yet !\nPlease check if there are any recursively redundant links (can be removed by removeRecursivelyRedundantCL method).");
66  }
67 }
68 
70 {
72  {
73  bool somethingDone(false);
74  _bp->deal1(somethingDone);
75  if(somethingDone)
76  continue;
77  _bp->deal2(somethingDone);
78  if(somethingDone)
79  continue;
80  _bp->deal2Bis(somethingDone);
81  if(somethingDone)
82  continue;
83  _bp->deal2Ter(somethingDone);
84  if(somethingDone)
85  continue;
86  _bp->deal2Quatro(somethingDone);
87  if(somethingDone)
88  continue;
89  _bp->dealNotSimpleCase(somethingDone);
90  if(!somethingDone)
91  throw Exception("SetOfPoints::simplify : not implemented yet !\nPlease check if there are any recursively redundant links (can be removed by removeRecursivelyRedundantCL method).");
92  }
94  {
96  }
97 }
98 
99 std::string SetOfPoints::getRepr() const
100 {
101  return _bp->getRepr();
102 }
103 
105 {
106  if(node==0)
107  return 0;
108  return _bp->findPointWithNode(node);
109 }
110 
111 const std::list<AbstractPoint *>& SetOfPoints::getListOfPoints() const
112 {
113  return _bp->getListOfPoints();
114 }
115 
117 {
118  return _bp->getMaxLevelOfParallelism();
119 }
120 
122 {
123  _bp->getWeightRegardingDPL(weight);
124 }
125 
127 {
128  _bp->partitionRegardingDPL(pd,zeMap);
129 }
130 
132 {
133  return _bp->getUniqueAndReleaseIt();
134 }
135 
137 {
138  _bp->accept(pv);
139 }
void deal2Quatro(bool &somethingDone)
Definition: BagPoint.cxx:178
void deal2Bis(bool &somethingDone)
Definition: BagPoint.cxx:144
void accept(PointVisitor *pv) override
Definition: BagPoint.cxx:38
void partitionRegardingDPL(const PartDefinition *pd, std::map< ComposedNode *, YACS::BASES::AutoRefCnt< PartDefinition > > &zeMap) const
Definition: BagPoint.cxx:81
void deal1(bool &somethingDone)
Definition: BagPoint.cxx:109
int getMaxLevelOfParallelism() const
Definition: BagPoint.cxx:71
void dealNotSimpleCase(bool &somethingDone)
Definition: BagPoint.cxx:199
std::string getRepr() const
Definition: BagPoint.cxx:86
void deal2(bool &somethingDone)
Definition: BagPoint.cxx:127
void getWeightRegardingDPL(ComplexWeight *weight)
Definition: BagPoint.cxx:76
void deal2Ter(bool &somethingDone)
Definition: BagPoint.cxx:161
AbstractPoint * getUniqueAndReleaseIt()
Definition: BlocPoint.cxx:137
const std::list< AbstractPoint * > & getListOfPoints() const
Definition: BlocPoint.hxx:46
bool presenceOfNonSimpleCase() const
Definition: BlocPoint.cxx:165
AbstractPoint * findPointWithNode(Node *node)
Definition: BlocPoint.cxx:52
bool internalContinueForSimplify() const
Definition: BlocPoint.cxx:158
Base class for all composed nodes.
Base class for all nodes.
Definition: Node.hxx:70
AbstractPoint * getUniqueAndReleaseIt() const
void getWeightRegardingDPL(ComplexWeight *weight)
void accept(PointVisitor *pv)
int getMaxLevelOfParallelism() const
void partitionRegardingDPL(const PartDefinition *pd, std::map< ComposedNode *, YACS::BASES::AutoRefCnt< PartDefinition > > &zeMap) const
SetOfPoints(const std::list< Node * > &nodes)
Definition: SetOfPoints.cxx:31
std::string getRepr() const
Definition: SetOfPoints.cxx:99
const std::list< AbstractPoint * > & getListOfPoints() const
AbstractPoint * findPointWithNode(Node *node)