1 // MED MEDMEM : MED files in memory
3 // Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
24 // File : MEDMEM_CellModel.hxx
28 File MEDMEM_CellModel.hxx
39 #include "utilities.h"
40 #include "MEDMEM_define.hxx"
43 using namespace MED_EN;
46 This class is an internal class and should not be used by the end-user.
47 This class describes all possible cell models and is used in order
48 to acces informations about geometric type of the cell :
49 Each object (if instancied), contains generic informations about
50 the cell model it describes as cell dimensions, number of nodes...
57 /*! private method : /n
58 used by constructor and operator= */
59 void init(const CELLMODEL &m);
61 /*! private method : /n */
66 /*! explicit name (as MED_POINT1) */
68 /*! type of cell (cf define.h) */
69 medGeometryElement _type;
70 /*! Cell dimension (not space dimension) */
72 /*! number of nodes forming this type of a cell */
74 /*! number of vertexes forming this type of a cell */
75 int _numberOfVertexes;
76 /*! 2 for a 3D Cell and 1 for a 2DCell */
77 int _numberOfConstituentsDimension;
78 /*! Array of size numberOfConstituentsDimension */
79 int* _numberOfConstituents ;
80 /*! Array of size _numberOfConstituentsDimension
81 x_numberOfConstituents[i] */
82 int** _numberOfNodeOfEachConstituent ;
83 /*! defines nodal local connectivity for each
84 constituents of each dimension:
85 should be seen as a vector<vector<vector>> \n
86 - first vector : for each cell dimension
87 (first : dim-1, second if any : dim-2)\n
88 - second vector : for each constituent of
90 - third vector : list of local nodes */
91 int*** _constituents ;
92 medGeometryElement** _constituentsType ;
99 CELLMODEL(medGeometryElement t);
100 /*! Copy constructor. */
101 inline CELLMODEL(const CELLMODEL &m);
105 /*! Operator = : duplicate CELLMODEL. */
106 inline CELLMODEL & operator=(const CELLMODEL &m);
108 /*! Operator << : print CELLMODEL to the given stream. */
109 friend ostream & operator<<(ostream &os,const CELLMODEL &my);
111 /*! returns _name attribute (ie: MED_PENTA15).\n
112 see med.h (in med/include) */
113 inline string getName() const;
115 /*! returns number of vertexes forming this type of cell */
116 inline int getNumberOfVertexes() const;
118 /*! returns number of nodes forming this type of cell */
119 inline int getNumberOfNodes() const;
121 /*! returns the dimension of this type of cell./n
122 it can be different from mesh dimension */
123 inline int getDimension() const;
125 /*! returns the geometric type of the cell. \n
126 see med.h (in med/include) */
127 inline medGeometryElement getType() const;
129 /*! returns all constituents which dimension is _dimension-dim.*/
130 int** getConstituents(int dim) const;
132 /*! returns number of constituents which dimension is _dimension-dim.*/
133 int getNumberOfConstituents(int dim) const;
135 /*! returns local nodes numbers vector for num-th constituent
136 which dimension is _dimension-dim.*/
137 int* getNodesConstituent(int dim,int num) const;
139 /*! returns local node number of nodes_index-th node for
140 num-th constituent which dimension is _dimension-dim.*/
141 int getNodeConstituent(int dim,int num,int nodes_index) const;
143 /*! returns types of each constituents which dimension
145 medGeometryElement* getConstituentsType(int dim) const;
147 /*! returns type of num-th constituent which dimension
149 medGeometryElement getConstituentType(int dim,int num) const;
151 /*! returns number of constituents type
152 (which dimension is _dimension-1).*/
153 int getNumberOfConstituentsType() const;
155 /*! returns all types of constituents which dimension
157 set<medGeometryElement> getAllConstituentsType() const;
159 /*! returns number of constituents foreach type (which dimension
161 map<medGeometryElement,int> getNumberOfConstituentsForeachType() const;
166 // ------------------------------------------
168 // ------------------------------------------
170 inline CELLMODEL::CELLMODEL():
174 _numberOfVertexes(0),
175 _numberOfConstituentsDimension(0),
176 _numberOfConstituents((int*)NULL),
177 _numberOfNodeOfEachConstituent((int**)NULL),
178 _constituents((int***)NULL),
179 _constituentsType((medGeometryElement**)NULL)
182 inline CELLMODEL::CELLMODEL(const CELLMODEL &m)
186 inline CELLMODEL::~CELLMODEL()
188 MESSAGE("CELLMODEL::~CELLMODEL() destroying the cell");
191 inline CELLMODEL & CELLMODEL::operator=(const CELLMODEL &m)
197 inline string CELLMODEL::getName() const
201 inline int CELLMODEL::getNumberOfVertexes() const
203 return _numberOfVertexes;
205 inline int CELLMODEL::getNumberOfNodes() const
207 return _numberOfNodes;
209 inline int CELLMODEL::getDimension() const
213 inline medGeometryElement CELLMODEL::getType() const
217 inline int** CELLMODEL::getConstituents(int dim) const
219 return _constituents[dim-1] ;
221 inline int CELLMODEL::getNumberOfConstituents(int dim) const
223 return _numberOfConstituents[dim-1] ;
225 inline int* CELLMODEL::getNodesConstituent(int dim,int num) const
227 return _constituents[dim-1][num-1];
229 inline int CELLMODEL::getNodeConstituent(int dim,int num,int nodesNumber) const
231 return _constituents[dim-1][num-1][nodesNumber-1] ;
233 inline medGeometryElement* CELLMODEL::getConstituentsType(int dim) const
235 return _constituentsType[dim-1];
237 inline medGeometryElement CELLMODEL::getConstituentType(int dim,int num) const
239 return _constituentsType[dim-1][num-1];
242 #endif /* CELLMODEL_HXX */