]> SALOME platform Git repositories - modules/med.git/blob - src/MEDMEM/MEDMEM_CellModel.hxx
Salome HOME
NRI : Update 1.1a and New organisation.
[modules/med.git] / src / MEDMEM / MEDMEM_CellModel.hxx
1 /*
2  File MEDMEM_CellModel.hxx
3  $Header$
4 */
5
6 #ifndef CELLMODEL_HXX
7 #define CELLMODEL_HXX
8
9 //#include <vector>
10 #include <set>
11 #include <map>
12 #include <string>
13
14 #include "MEDMEM_define.hxx"
15
16 using namespace std ;
17
18 using namespace MED_EN;
19
20 class CELLMODEL {
21
22 private:
23   // use in constructor and operator=
24   void init(const CELLMODEL &m) ;
25   // use in operator= and destructor
26   void clean() ;
27
28 protected:
29
30   string _name ;
31   medGeometryElement _type ;
32   int _dimension ;     // Cell _dimension (!= space _dimension)
33   int _numberOfNodes ;
34   int _numberOfVertexes ;
35   int    _numberOfConstituentsDimension ; // 2 in 3D, 1 in 2D
36   // Array of size _numberOfConstituentsDimension
37   int*   _numberOfConstituents ; 
38   // Array of size _numberOfConstituentsDimensionx_numberOfConstituents[i]
39   int**  _numberOfNodeOfEachConstituent ;
40   // Define nodal local connectivity for each constituent for each dimension
41   int*** _constituents ; 
42   // define local connectivity for each constituents 
43   // composing it ( 
44   // first vector : for each cell _dimension 
45   // (first : dim-1, second if any : dim-2)
46   // second vector : for each constituents of this _dimension,
47   // third vector : list of local nodes
48   medGeometryElement** _constituentsType ;
49
50 public :
51
52   CELLMODEL():
53     _type(MED_NONE),
54     _dimension(0),
55     _numberOfNodes(0),
56     _numberOfVertexes(0),
57     _numberOfConstituentsDimension(0),
58     _numberOfConstituents((int*)NULL),
59     _numberOfNodeOfEachConstituent((int**)NULL),
60     _constituents((int***)NULL),
61     _constituentsType((medGeometryElement**)NULL)
62   {
63   }
64   CELLMODEL(medGeometryElement t) ;
65   CELLMODEL(const CELLMODEL &m){
66     init(m) ;
67   }
68   ~CELLMODEL() {
69     clean() ;
70   };
71
72   CELLMODEL & operator=(const CELLMODEL &m) {
73     clean() ;
74     init(m) ;
75     return *this ;
76   }
77   friend ostream & operator<<(ostream &os,const CELLMODEL &my);
78
79   inline string                 getName() const ;
80   inline int                    getNumberOfVertexes() const;
81   inline int                    getNumberOfNodes() const;
82   inline int                    getDimension() const;
83   inline medGeometryElement  getType() const;
84
85   // Return all constituents which dimension is _dimension-dim.
86   //  vector< vector<int> > getConstituents(int dim) const; 
87   int** getConstituents(int dim) const; 
88
89   // Return number of constituents which dimension is _dimension-dim.
90   int getNumberOfConstituents(int dim) const;
91
92   // Return local nodes numbers vector for num-th constituent which dimension is _dimension-dim.
93   int* getNodesConstituent(int dim,int num) const; 
94
95   // Return local node number of nodes_index-th node for num-th constituent which dimension is _dimension-dim.
96   int getNodeConstituent(int dim,int num,int nodes_index); 
97
98   // Return types of each constituents which dimension is _dimension-dim.
99   medGeometryElement*  getConstituentsType(int dim) const; 
100
101   // Return type of num-th constituent which dimension is _dimension-dim.
102   medGeometryElement getConstituentType(int dim,int num) const;
103
104
105   // Return number of constituents type (which dimension is _dimension-1).
106   int getNumberOfConstituentsType() const;
107
108   // Return all types of constituents which dimension is (_dimension-1).
109   set<medGeometryElement>  getAllConstituentsType() const; 
110
111   // Return number of constituents foreach type (which dimension is _dimension-1).
112   map<medGeometryElement,int>  getNumberOfConstituentsForeachType() const; 
113
114
115 };
116
117 // ------------------------------------------
118 //      Methodes Inline
119 // ------------------------------------------
120
121 inline string CELLMODEL::getName() const
122 {
123   return _name ;
124 }
125 inline int CELLMODEL::getNumberOfVertexes() const
126 {
127   return _numberOfVertexes;
128 }
129 inline int CELLMODEL::getNumberOfNodes() const
130 {
131   return _numberOfNodes;
132 }
133 inline int CELLMODEL::getDimension() const
134 {
135   return _dimension;
136 }
137 inline medGeometryElement CELLMODEL::getType() const
138 {
139   return _type;
140 }
141 //inline vector< vector<int> > CELLMODEL::getConstituents(int dim) const
142 inline int** CELLMODEL::getConstituents(int dim) const
143 {
144   return _constituents[dim-1] ;
145 }
146 inline int CELLMODEL::getNumberOfConstituents(int dim) const
147 {
148   return _numberOfConstituents[dim-1] ;
149   //return _constituents[dim-1].size() ;
150 }
151 //inline vector<int> CELLMODEL::getNodesConstituent(int dim,int num) const
152 inline int* CELLMODEL::getNodesConstituent(int dim,int num) const
153 {
154   return _constituents[dim-1][num-1];
155 }
156 inline int CELLMODEL::getNodeConstituent(int dim,int num,int nodesNumber)
157 {
158   return _constituents[dim-1][num-1][nodesNumber-1] ;
159 }
160 //inline vector<medGeometryElement> CELLMODEL::getConstituentsType(int dim) const
161 inline medGeometryElement* CELLMODEL::getConstituentsType(int dim) const
162 {
163   return _constituentsType[dim-1];
164 }
165 inline medGeometryElement CELLMODEL::getConstituentType(int dim,int num) const
166 {
167   return _constituentsType[dim-1][num-1];
168 }
169
170 #endif /* CELLMODEL_HXX */