]> SALOME platform Git repositories - tools/solverlab.git/blob - CDMATH/mesh/inc/Node.hxx
Salome HOME
update CDMATH
[tools/solverlab.git] / CDMATH / mesh / inc / Node.hxx
1 /*
2  * node.hxx
3  *
4  *  Created on: 23 janv. 2012
5  *      Authors: CDMAT
6  */
7
8 #ifndef NODE_HXX_
9 #define NODE_HXX_
10
11 /**
12  * Node class is defined by
13  * - The coordinate of the node
14  * - number of faces allocated for this node
15  * - number of cells allocated for this node
16  */
17
18 #include "Point.hxx"
19
20 #include <vector>
21 #include <string>
22
23 class Node
24 {
25     public: //----------------------------------------------------------------
26     /**
27     * default constructor
28     */
29     Node ( void ) ;
30
31     /**
32      * constructor with data
33      * @param numberOfCells : The number of cells allocated for this node
34      * @param numberOfFaces : The number of faces allocated for this node
35      * @param p : The barycenter of this node
36      */
37     Node ( const int numberOfCells, const int numberOfFaces, const int numberOfEdges, const Point p) ;
38
39     /**
40      * constructor by copy
41      * @param node : The object to be copied
42      */
43     Node ( const Node & node ) ;
44
45     /**
46      * destructor
47      */
48     ~Node ( void ) ;
49
50     /**
51      * return number of cells in this node
52      * @return _numberOfCells
53      */
54     int getNumberOfCells ( void ) const ;
55
56     /**
57      * return number of faces in this node
58      * @return _numberOfFaces
59      */
60     int getNumberOfFaces ( void ) const ;
61
62     /**
63      * return number of edges in this node
64      * @return _numberOfEdges
65      */
66     int getNumberOfEdges ( void ) const ;
67
68     /**
69      * return The coordinate of the Node
70      * @return _point
71      */
72     Point getPoint ( void ) const ;
73
74     /**
75      * return cordinate x of this node
76      */
77     double x ( void ) const ;
78
79     /**
80      * return cordinate x of this node
81      */
82     double y ( void ) const ;
83
84     /**
85      * return cordinate x of this node
86      */
87     double z ( void ) const ;
88
89     /**
90      * return the list of group names of this node
91      */
92     std::vector<std::string> getGroupNames(void) const;
93
94     /**
95      * return a specific group name of this node
96      */
97     std::string getGroupName(int igroup=0) const;
98
99     /**
100      *  set a groupe name for this node
101      */
102     void setGroupName(const std::string groupName);
103
104
105     /**
106      * return 0 if the node is on the border of domain
107      * else -1
108      */
109     int getRegion(void) const ;
110
111     /**
112      * return True if the node is on the border of domain
113      * else False
114      */
115     bool isBorder(void) const ;
116
117     /**
118      * @param numFace : index local of face to add in this node
119      * @param faceId : index global of face to add in this node
120      */
121     void addFaceId (const int numFace, const int faceId, const bool isBorder=false  ) ;
122
123     /**
124      * @param numCell : local index of cell to add in this node
125      * @param cellId : global index of cell to add in this node
126      */
127     void addCellId (const int numCell, const int cellId ) ;
128
129     /**
130      * @param numNode : local index of node to add in this node neighbours
131      * @param nodeId : global index of node to add in this node neighbours
132      */
133     void addNeighbourNodeId (const int numNode, const int nodeId ) ;
134
135     /**
136      * surcharge opertor =
137      * @param node : The node object to be copied
138      */
139     const Node& operator= ( const Node& node ) ;
140
141     /**
142      * return Compute distance to given node
143      * @param n : Node
144      * @return The distance
145      */
146     double distance( const Node& n ) const ;
147
148     /**
149      * The cells ID that this Node belongs to
150      * @return _cellsId
151      */
152     std::vector< int > getCellsId ( void ) const ;
153
154     /**
155      * The faces ID that this Node belongs to
156      * @return _facesId
157      */
158     std::vector< int > getFacesId ( void ) const ;
159
160     int getFaceId(int localId) const ;
161
162     /**
163      * The neighbour nodes ID : nodes connected to this node by an edge
164      * @return _neighbourNodeId
165      */
166     std::vector< int > getNeighbourNodesId ( void ) const ;
167
168     int getNeighbourNodeId(int localId) const ;
169
170     private: //----------------------------------------------------------------
171
172     /*
173      * The coordinate of the Node.
174      */
175     Point _point ;
176
177     /*
178      * The cells ID that this Node belongs to.
179      */
180     std::vector< int > _cellsId ;
181
182     /*
183      * The faces ID that this Node belongs to.
184      */
185     std::vector< int > _facesId ;
186
187     /*
188      * The neighbour nodes ID that this Node belongs to.
189      */
190     std::vector< int > _neighbourNodesId ;
191
192     /*
193      * The number of cells allocated for this Node.
194      */
195     int _numberOfCells ;
196
197     /*
198      * The number of faces allocated for this Node.
199      */
200     int _numberOfFaces ;
201
202     /*
203      * The number of edges allocated for this Node.
204      */
205     int _numberOfEdges ;
206
207     /*
208      * The region of this face. -1 internal or number of edge that this face belongs to
209      */
210     int _region ;
211
212     /*
213      * The group names of the Node.
214      */
215     std::vector<std::string> _groupNames ;
216     
217     /* Is the node a border node ? */
218     bool _isBorder;
219 };
220
221 #endif /* NODE_HXX_ */