Version: 9.15.0
AbstractPoint.hxx
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 #ifndef __ABSTRACTPOINT_HXX__
21 #define __ABSTRACTPOINT_HXX__
22 
23 #include "YACSlibEngineExport.hxx"
24 #include "PlayGround.hxx"
25 #include "AutoRefCnt.hxx"
26 
27 #include <map>
28 #include <set>
29 #include <list>
30 #include <vector>
31 #include <string>
32 #include <memory>
33 
34 namespace YACS
35 {
36  namespace ENGINE
37  {
38  class Node;
39  class Bloc;
40  class InGate;
41  class OutGate;
42  class BlocPoint;
43  class ComposedNode;
44  class ForkBlocPoint;
45  class PointVisitor;
46  class LinkedBlocPoint;
47  class NotSimpleCasePoint;
48  class ElementaryPoint;
49 
51  {
52  public:
53  AbstractPoint() = default;
54  AbstractPoint(AbstractPoint *father):_father(father) { }
55  AbstractPoint *getFather() const { return _father; }
56  AbstractPoint *getGodFather();
57  bool amIGod() { return getGodFather()==nullptr; }
58  void setFather(AbstractPoint *father) { _father=father; }
59  //
60  bool isBegin();
61  bool isLast();
62  bool isSimplyLinkedBeforeAfter(BlocPoint *sop);
63  bool isSimplyLinkedAfterNullBefore(BlocPoint *sop);
64  bool isSimplyLinkedBeforeNullAfter(BlocPoint *sop);
65  bool isNullBeforeNullAfter(BlocPoint *sop);
66  //
67  LinkedBlocPoint *tryAsLink(BlocPoint *sop);
68  ForkBlocPoint *tryAsFork(BlocPoint *sop);
69  ForkBlocPoint *tryAsForkBis(BlocPoint *sop);
70  ForkBlocPoint *tryAsForkTer(BlocPoint *sop);
71  ForkBlocPoint *tryAsForkQuatro(BlocPoint *sop);
72  //void tryAsNotSimpleCase(BlocPoint *sop, std::list<AbstractPoint *>& nodes, bool& somethingDone);
73  static void TryAsNotSimpleCase(AbstractPoint *father, const std::vector<AbstractPoint *>& ptsToKill, std::list<AbstractPoint *>& nodes, bool& somethingDone);
74  //
75  virtual AbstractPoint *deepCopy(AbstractPoint *father) const = 0;
76  //
77  virtual Node *getFirstNode() = 0;
78  virtual Node *getLastNode() = 0;
79  virtual AbstractPoint *findPointWithNode(Node *node) = 0;
80  virtual bool contains(Node *node) const = 0;
81  virtual bool anyOf(const std::set<Node *>& nodes) const = 0;
82  virtual int getNumberOfNodes() const = 0;
83  virtual int getMaxLevelOfParallelism() const = 0;
84  virtual void getWeightRegardingDPL(ComplexWeight *weight) = 0;
85  virtual void partitionRegardingDPL(const PartDefinition *pd, std::map<ComposedNode *, YACS::BASES::AutoRefCnt<PartDefinition> >& zeMap) const = 0;
86  virtual std::string getRepr() const = 0;
87  virtual void accept(PointVisitor *pv) = 0;
88  virtual AbstractPoint *expandNonSimpleCaseOn(NotSimpleCasePoint *pathologicalPt, const std::set<Node *>& uncatchedNodes) = 0;
89  virtual ~AbstractPoint();
90  public:
91  static bool IsGatherB4Ext(Node *node);
92  bool isSimplyLinkedAfter(BlocPoint *sop, Node *node);
93  static bool IsSimplyLinkedAfterExt(Node *node);
94  static bool IsScatterAfterExt(Node *node);
95  bool isSimplyLinkedBefore(BlocPoint *sop, Node *node);
96  static bool IsSimplyLinkedBeforeExt(Node *node);
97  static bool IsNoLinksBefore(Node *node);
98  static bool IsNoLinksAfter(Node *node);
99  static Node *GetNodeB4(Node *node);
100  static Node *GetNodeAfter(Node *node);
101  static AbstractPoint *GetDirectSonOf(AbstractPoint *refFather, AbstractPoint *sonOrLittleSon);
102  static bool IsCommonDirectSonOf(AbstractPoint *refFather, const std::list<OutGate *>& outgs, AbstractPoint *&ret);
103  static bool IsCommonDirectSonOf(AbstractPoint *refFather, const std::list<InGate *>& ings, AbstractPoint *&ret);
104  static void FeedData(AbstractPoint *ptToBeRewired, std::map< std::string, std::tuple< ElementaryPoint *, Node *, std::shared_ptr<Bloc> > > *m);
105  static void FeedData(const std::list<AbstractPoint *>& ptsToBeRewired, std::map< std::string, std::tuple< ElementaryPoint *, Node *, std::shared_ptr<Bloc> > > *m);
106  static void Rewire(const std::vector<AbstractPoint *>& ptsToKill, std::map< std::string, std::tuple< ElementaryPoint *, Node *, std::shared_ptr<Bloc> > > *m);
107  static void UnRewire(std::map< std::string, std::tuple< ElementaryPoint *, Node *, std::shared_ptr<Bloc> > >& m);
108  static void Display(std::map< std::string, std::tuple< ElementaryPoint *, Node *, std::shared_ptr<Bloc> > > *m);
109  protected:
110  AbstractPoint *_father = nullptr;
111  };
112  }
113 }
114 
115 
116 #endif
#define YACSLIBENGINE_EXPORT
virtual Node * getLastNode()=0
virtual AbstractPoint * deepCopy(AbstractPoint *father) const =0
virtual void getWeightRegardingDPL(ComplexWeight *weight)=0
virtual AbstractPoint * findPointWithNode(Node *node)=0
virtual int getNumberOfNodes() const =0
virtual std::string getRepr() const =0
virtual AbstractPoint * expandNonSimpleCaseOn(NotSimpleCasePoint *pathologicalPt, const std::set< Node * > &uncatchedNodes)=0
virtual void accept(PointVisitor *pv)=0
AbstractPoint * getFather() const
AbstractPoint(AbstractPoint *father)
virtual bool anyOf(const std::set< Node * > &nodes) const =0
virtual bool contains(Node *node) const =0
void setFather(AbstractPoint *father)
virtual Node * getFirstNode()=0
virtual int getMaxLevelOfParallelism() const =0
virtual void partitionRegardingDPL(const PartDefinition *pd, std::map< ComposedNode *, YACS::BASES::AutoRefCnt< PartDefinition > > &zeMap) const =0
Composed node to group elementary and composed nodes.
Definition: Bloc.hxx:36
Base class for all composed nodes.
Base class for all nodes.
Definition: Node.hxx:70