]> SALOME platform Git repositories - modules/med.git/blob - src/MEDMEM/MEDMEM_CellModel.hxx
Salome HOME
Version ok de MED avec MEDGUI.
[modules/med.git] / src / MEDMEM / MEDMEM_CellModel.hxx
1 /*
2  File 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 MED_EN;
17
18 class CELLMODEL
19 {
20
21 protected :
22
23   string _name ;
24   medGeometryElement _type ;
25   int _dimension ;     // Cell _dimension (!= space _dimension)
26   int _numberOfNodes ;
27   int _numberOfVertexes ;
28   vector< vector< vector<int> > > _constituents ; 
29                        // define local connectivity for each constituents 
30                        // composing it ( 
31                        // first vector : for each cell _dimension 
32                        // (first : dim-1, second if any : dim-2)
33                        // second vector : for each constituents of this _dimension,
34                        // third vector : list of local nodes
35   vector< vector<medGeometryElement> > _constituentsType ;
36
37 public :
38
39   CELLMODEL(){
40     _type=MED_NONE ;
41     _dimension = 0 ;
42     _numberOfNodes = 0 ;
43     _numberOfVertexes = 0 ;
44   }
45   CELLMODEL(medGeometryElement t) ;
46   CELLMODEL(const CELLMODEL &m){
47     _name= m._name ;
48     _type= m._type ;
49     _dimension = m._dimension ;
50     _numberOfNodes = m._numberOfNodes ;
51     _numberOfVertexes = m._numberOfVertexes ;
52     _constituents = m._constituents ;
53     _constituentsType = m._constituentsType ;
54   }
55   ~CELLMODEL() {
56   };
57
58   CELLMODEL & operator=(const CELLMODEL &m) {
59     _name=m._name ;
60     _type= m._type ;
61     _dimension = m._dimension ;
62     _numberOfNodes = m._numberOfNodes ;
63     _numberOfVertexes = m._numberOfVertexes ;
64     _constituents = m._constituents ;
65     _constituentsType = m._constituentsType ;
66     return *this ;
67   }
68   friend ostream & operator<<(ostream &os,const CELLMODEL &my);
69
70   inline string                 getName() const ;
71   inline int                    getNumberOfVertexes() const;
72   inline int                    getNumberOfNodes() const;
73   inline int                    getDimension() const;
74   inline medGeometryElement  getType() const;
75
76   // Return all constituents which dimension is _dimension-dim.
77   vector< vector<int> > getConstituents(int dim) const; 
78
79   // Return number of constituents which dimension is _dimension-dim.
80   int getNumberOfConstituents(int dim) const;
81
82   // Return local nodes numbers vector for num-th constituent which dimension is _dimension-dim.
83   vector<int> getNodesConstituent(int dim,int num) const; 
84
85   // Return local node number of nodes_index-th node for num-th constituent which dimension is _dimension-dim.
86   int getNodeConstituent(int dim,int num,int nodes_index); 
87
88   // Return types of each constituents which dimension is _dimension-dim.
89   vector <medGeometryElement>  getConstituentsType(int dim) const; 
90
91   // Return type of num-th constituent which dimension is _dimension-dim.
92   medGeometryElement getConstituentType(int dim,int num) const;
93
94
95   // Return number of constituents type (which dimension is _dimension-1).
96   int getNumberOfConstituentsType() const;
97
98   // Return all types of constituents which dimension is (_dimension-1).
99   set <medGeometryElement>  getAllConstituentsType() const; 
100
101   // Return number of constituents foreach type (which dimension is _dimension-1).
102   map <medGeometryElement,int>  getNumberOfConstituentsForeachType() const; 
103
104
105 };
106
107 // ------------------------------------------
108 //      Methodes Inline
109 // ------------------------------------------
110
111 inline string CELLMODEL::getName() const
112 {
113         return _name ;
114 }
115 inline int CELLMODEL::getNumberOfVertexes() const
116 {
117         return _numberOfVertexes;
118 }
119 inline int CELLMODEL::getNumberOfNodes() const
120 {
121         return _numberOfNodes;
122 }
123 inline int CELLMODEL::getDimension() const
124 {
125         return _dimension;
126 }
127 inline medGeometryElement CELLMODEL::getType() const
128 {
129         return _type;
130 }
131 inline vector< vector<int> > CELLMODEL::getConstituents(int dim) const
132 {
133   return _constituents[dim-1] ;
134 }
135 inline int CELLMODEL::getNumberOfConstituents(int dim) const
136 {
137   return _constituents[dim-1].size() ;
138 }
139 inline vector<int> CELLMODEL::getNodesConstituent(int dim,int num) const
140 {
141   return _constituents[dim-1][num-1];
142 }
143 inline int CELLMODEL::getNodeConstituent(int dim,int num,int nodesNumber)
144 {
145   return _constituents[dim-1][num-1][nodesNumber-1] ;
146 }
147 inline vector<medGeometryElement> CELLMODEL::getConstituentsType(int dim) const
148 {
149   return _constituentsType[dim-1];
150 }
151 inline medGeometryElement CELLMODEL::getConstituentType(int dim,int num) const
152 {
153   return _constituentsType[dim-1][num-1];
154 }
155
156 #endif /* CELLMODEL_HXX */