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