2 File MEDMEM_CellModel.hxx
13 #include "utilities.h"
14 #include "MEDMEM_define.hxx"
17 using namespace MED_EN;
20 This class is an internal class and should not be used by the end-user.
21 This class describes all possible cell models and is used in order
22 to acces informations about geometric type of the cell :
23 Each object (if instancied), contains generic informations about
24 the cell model it describes as cell dimensions, number of nodes...
32 /*! private method : /n
33 used by constructor and operator= */
34 void init(const CELLMODEL &m);
36 /*! private method : /n */
41 /*! explicit name (as MED_POINT1) */
43 /*! type of cell (cf define.h) */
44 medGeometryElement _type;
45 /*! Cell dimension (not space dimension) */
47 /*! number of nodes forming this type of a cell */
49 /*! number of vertexes forming this type of a cell */
50 int _numberOfVertexes;
51 /*! 2 for a 3D Cell and 1 for a 2DCell */
52 int _numberOfConstituentsDimension;
53 /*! Array of size numberOfConstituentsDimension */
54 int* _numberOfConstituents ;
55 /*! Array of size _numberOfConstituentsDimension
56 x_numberOfConstituents[i] */
57 int** _numberOfNodeOfEachConstituent ;
58 /*! defines nodal local connectivity for each
59 constituents of each dimension:
60 should be seen as a vector<vector<vector>> \n
61 - first vector : for each cell dimension
62 (first : dim-1, second if any : dim-2)\n
63 - second vector : for each constituent of
65 - third vector : list of local nodes */
66 int*** _constituents ;
67 medGeometryElement** _constituentsType ;
74 CELLMODEL(medGeometryElement t);
75 /*! Copy constructor. */
76 inline CELLMODEL(const CELLMODEL &m);
80 /*! Operator = : duplicate CELLMODEL. */
81 inline CELLMODEL & operator=(const CELLMODEL &m);
83 /*! Operator << : print CELLMODEL to the given stream. */
84 friend ostream & operator<<(ostream &os,const CELLMODEL &my);
86 /*! returns _name attribute (ie: MED_PENTA15).\n
87 see med.h (in med/include) */
88 inline string getName() const;
90 /*! returns number of vertexes forming this type of cell */
91 inline int getNumberOfVertexes() const;
93 /*! returns number of nodes forming this type of cell */
94 inline int getNumberOfNodes() const;
96 /*! returns the dimension of this type of cell./n
97 it can be different from mesh dimension */
98 inline int getDimension() const;
100 /*! returns the geometric type of the cell. \n
101 see med.h (in med/include) */
102 inline medGeometryElement getType() const;
104 /*! returns all constituents which dimension is _dimension-dim.*/
105 int** getConstituents(int dim) const;
107 /*! returns number of constituents which dimension is _dimension-dim.*/
108 int getNumberOfConstituents(int dim) const;
110 /*! returns local nodes numbers vector for num-th constituent
111 which dimension is _dimension-dim.*/
112 int* getNodesConstituent(int dim,int num) const;
114 /*! returns local node number of nodes_index-th node for
115 num-th constituent which dimension is _dimension-dim.*/
116 int getNodeConstituent(int dim,int num,int nodes_index) const;
118 /*! returns types of each constituents which dimension
120 medGeometryElement* getConstituentsType(int dim) const;
122 /*! returns type of num-th constituent which dimension
124 medGeometryElement getConstituentType(int dim,int num) const;
126 /*! returns number of constituents type
127 (which dimension is _dimension-1).*/
128 int getNumberOfConstituentsType() const;
130 /*! returns all types of constituents which dimension
132 set<medGeometryElement> getAllConstituentsType() const;
134 /*! returns number of constituents foreach type (which dimension
136 map<medGeometryElement,int> getNumberOfConstituentsForeachType() const;
142 // ------------------------------------------
144 // ------------------------------------------
146 using namespace MEDMEM;
147 inline CELLMODEL::CELLMODEL():
151 _numberOfVertexes(0),
152 _numberOfConstituentsDimension(0),
153 _numberOfConstituents((int*)NULL),
154 _numberOfNodeOfEachConstituent((int**)NULL),
155 _constituents((int***)NULL),
156 _constituentsType((medGeometryElement**)NULL)
159 inline CELLMODEL::CELLMODEL(const CELLMODEL &m)
163 inline CELLMODEL::~CELLMODEL()
165 MESSAGE("CELLMODEL::~CELLMODEL() destroying the cell");
168 inline CELLMODEL & CELLMODEL::operator=(const CELLMODEL &m)
174 inline string CELLMODEL::getName() const
178 inline int CELLMODEL::getNumberOfVertexes() const
180 return _numberOfVertexes;
182 inline int CELLMODEL::getNumberOfNodes() const
184 return _numberOfNodes;
186 inline int CELLMODEL::getDimension() const
190 inline medGeometryElement CELLMODEL::getType() const
194 inline int** CELLMODEL::getConstituents(int dim) const
196 return _constituents[dim-1] ;
198 inline int CELLMODEL::getNumberOfConstituents(int dim) const
200 return _numberOfConstituents[dim-1] ;
202 inline int* CELLMODEL::getNodesConstituent(int dim,int num) const
204 return _constituents[dim-1][num-1];
206 inline int CELLMODEL::getNodeConstituent(int dim,int num,int nodesNumber) const
208 return _constituents[dim-1][num-1][nodesNumber-1] ;
210 inline medGeometryElement* CELLMODEL::getConstituentsType(int dim) const
212 return _constituentsType[dim-1];
214 inline medGeometryElement CELLMODEL::getConstituentType(int dim,int num) const
216 return _constituentsType[dim-1][num-1];
219 #endif /* CELLMODEL_HXX */