Salome HOME
update CDMATH
[tools/solverlab.git] / CDMATH / mesh / inc / Cell.hxx
1 /*
2  * cell.hxx
3  *
4  *  Created on: 23 January. 2012
5  *      Authors: CDMATH
6  */
7
8 #ifndef CELL_HXX_
9 #define CELL_HXX_
10
11 /**
12  * Cell class is defined by
13  * - indices of nodes surounding this cell
14  * - indices of faces surounding this cell
15  * - measure of this cell
16  * - barycenter of this cell
17  */
18
19 #include <vector>
20 #include "Point.hxx"
21 #include "Vector.hxx"
22
23 class Cell
24 {
25     public: //----------------------------------------------------------------
26         /**
27          * default constructor
28          */
29         Cell ( void ) ;
30
31         /**
32          * constructor with data
33          * @param numberOfNodes : The number of nodes allocated for this cell
34          * @param numberOfFaces : The number of faces allocated for this cell
35          * @param measure : The measure of this cell
36          * @param p : The barycenter of this cell
37          */
38         Cell ( int numberOfNodes, int numberOfFaces, double measure, const Point p ) ;
39
40         /**
41          * constructor by copy
42          * @param cell : The cell object to be copied
43          */
44         Cell ( const Cell& cell ) ;
45
46         /**
47          * destructor
48          */
49         ~Cell ( void ) ;
50
51         /**
52          * return number of nodes in this cell
53          * @return _numberOfNodes
54          */
55         int getNumberOfNodes ( void ) const ;
56
57         /**
58          * return number of faces in this cell
59          * @return _countFace
60          */
61         int getNumberOfFaces ( void ) const ;
62
63         /**
64          * return nodes ID in this cell
65          * @return _nodes
66          */
67         std::vector< int > getNodesId ( void ) const ;
68
69         /**
70          * return faces ID in this cell
71          * @return _faces
72          */
73         std::vector< int > getFacesId ( void ) const ;
74
75         /**
76          * return cordinate numComposant of the normal vector in this cell
77          */
78         double getNormalVector ( const int numNormalVector, const int numComposant ) const ;
79
80         /**
81          * return normal vectors in this cell
82          */
83         Vector getNormalVectors (void) const ;
84
85         /**
86          * return the measure of this cell (length in 1D, surface in 2D or
87          * or volume in 3D
88          * @return _measure
89          */
90         double getMeasure ( void ) const ;
91
92         /**
93          * return barrycenter in this cell
94          * @return _point
95          */
96         Point getBarryCenter ( void ) const ;
97
98         /**
99          * return cordinate x of the barycenter in this cell
100          */
101         double x ( void ) const ;
102
103         /**
104          * return cordinate y of the barycenter in this cell
105          */
106         double y ( void ) const ;
107
108         /**
109          * return cordinate z of the barycenter in this cell
110          */
111         double z ( void ) const ;
112
113         /**
114          * add a face faceId in this cell
115          */
116         void addFaceId ( int numFace, int faceId ) ;
117
118         /**
119          * add a node nodeId in this cell
120          */
121         void addNodeId ( int numNode, int nodeId ) ;
122
123         /**
124          * surcharge opertor =
125          * @param cell : The cell object to be copied
126          */
127         const Cell& operator= ( const Cell& cell ) ;
128
129         /**
130          * add a normal vector numNormalVector in this cell
131          */
132         void addNormalVector ( int numNormalVector, double x, double y, double z ) ;
133
134         int getFaceId(int localId) const ;
135
136         int getNodeId(int localId) const ;
137
138    private: //----------------------------------------------------------------
139
140         /*
141          * The nodes ID in this cell.
142          */
143         std::vector< int > _nodesId ;
144
145         /*
146          * The number of nodes in this cell.
147          */
148         int _numberOfNodes ;
149
150         /*
151          * The faces ID in this cell.
152          */
153         std::vector< int > _facesId ;
154
155         /*
156          * The number of faces in this cell.
157          */
158         int _numberOfFaces ;
159
160         /*
161          * The length or surface or volume of the cell.
162          */
163         double _measure ;
164
165         /*
166          * The coordinate of barycenter the cell.
167          */
168         Point _point ;
169
170         /*
171          * The coordinate of normal vector the cell.
172          */
173         Vector _normalVectors ;
174 };
175
176 #endif /* CELL_HXX_ */