]> SALOME platform Git repositories - modules/yacs.git/blob - src/engine/AbstractPoint.hxx
Salome HOME
First version of alg for max level of parallelism computation.
[modules/yacs.git] / src / engine / AbstractPoint.hxx
1 // Copyright (C) 2015  EDF R&D
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
25 #include <set>
26 #include <list>
27 #include <vector>
28 #include <string>
29
30 namespace YACS
31 {
32   namespace ENGINE
33   {
34     class Node;
35     class InGate;
36     class OutGate;
37     class BlocPoint;
38     class ForkBlocPoint;
39     class LinkedBlocPoint;
40     
41     class YACSLIBENGINE_EXPORT AbstractPoint
42     {
43     public:
44       AbstractPoint(AbstractPoint *father):_father(father) { }
45       AbstractPoint *getFather() const { return _father; }
46       AbstractPoint *getGodFather();
47       bool amIGod() { return getGodFather()==0; }
48       void setFather(AbstractPoint *father) { _father=father; }
49       //
50       bool isBegin();
51       bool isLast();
52       bool isSimplyLinkedBeforeAfter(BlocPoint *sop);
53       bool isSimplyLinkedAfterNullBefore(BlocPoint *sop);
54       bool isSimplyLinkedBeforeNullAfter(BlocPoint *sop);
55       //
56       LinkedBlocPoint *tryAsLink(BlocPoint *sop);
57       ForkBlocPoint *tryAsFork(BlocPoint *sop);
58       ForkBlocPoint *tryAsForkBis(BlocPoint *sop);
59       ForkBlocPoint *tryAsForkTer(BlocPoint *sop);
60       //
61       virtual Node *getFirstNode() = 0;
62       virtual Node *getLastNode() = 0;
63       virtual AbstractPoint *findPointWithNode(Node *node) = 0;
64       virtual bool contains(Node *node) = 0;
65       virtual int getNumberOfNodes() const = 0;
66       virtual int getMaxLevelOfParallelism() const = 0;
67       virtual std::string getRepr() const = 0;
68       virtual ~AbstractPoint();
69     public:
70       static bool IsGatherB4Ext(Node *node);
71       bool isSimplyLinkedAfter(BlocPoint *sop, Node *node);
72       static bool IsSimplyLinkedAfterExt(Node *node);
73       static bool IsScatterAfterExt(Node *node);
74       bool isSimplyLinkedBefore(BlocPoint *sop, Node *node);
75       static bool IsSimplyLinkedBeforeExt(Node *node);
76       static bool IsNoLinksBefore(Node *node);
77       static bool IsNoLinksAfter(Node *node);
78       static Node *GetNodeB4(Node *node);
79       static Node *GetNodeAfter(Node *node);
80       static AbstractPoint *GetDirectSonOf(AbstractPoint *refFather, AbstractPoint *sonOrLittleSon);
81       static bool IsCommonDirectSonOf(AbstractPoint *refFather, const std::list<OutGate *>& outgs, AbstractPoint *&ret);
82       static bool IsCommonDirectSonOf(AbstractPoint *refFather, const std::set<InGate *>& ings, AbstractPoint *&ret);
83     protected:
84       AbstractPoint *_father;
85     };
86   }
87 }
88
89
90 #endif