]> SALOME platform Git repositories - modules/med.git/blob - src/MEDMEM/MEDMEM_Grid.hxx
Salome HOME
Merge from BR_V5_DEV 16Feb09
[modules/med.git] / src / MEDMEM / MEDMEM_Grid.hxx
1 //  Copyright (C) 2007-2008  CEA/DEN, EDF R&D, OPEN CASCADE
2 //
3 //  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 //  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5 //
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.
10 //
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.
15 //
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
19 //
20 //  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22 // File      : MEDMEM_Grid.hxx
23 // Created   : Wed Dec 18 08:35:26 2002
24 // Descr     : class containing structured mesh data
25 // Author    : Edward AGAPOV (eap)
26 // Project   : SALOME Pro
27 // Module    : MED 
28
29 #ifndef MEDMEM_Grid_HeaderFile
30 #define MEDMEM_Grid_HeaderFile
31
32 #include <MEDMEM.hxx>
33
34 #include "MEDMEM_Mesh.hxx"
35
36 // class containing structured mesh data
37
38 namespace MEDMEM {
39 class MEDMEM_EXPORT GRID: public MESH
40 {
41  protected:
42   //-----------------------//
43   //   Fields
44   //-----------------------//
45   
46   // 1. grid type: MED_CARTESIAN, MED_POLAR, MED_BODY_FITTED
47   MED_EN::med_grid_type     _gridType;
48   
49   // 2. node coordinates
50   // For MED_BODY_FITTED MESH::_coordinate is used
51   
52   // 2.1. i component array: X for MED_CARTESIAN, R for MED_POLAR
53   int               _iArrayLength;
54   double*           _iArray;
55   // 2.2. j component array: Y for MED_CARTESIAN, Theta for MED_POLAR
56   int               _jArrayLength;
57   double*           _jArray;
58   // 2.3. k component array: Z for both MED_CARTESIAN and MED_POLAR
59   int               _kArrayLength;
60   double*           _kArray;
61
62   // 3. flags to know that _coordinates and _connectivity of MESH are filled
63   bool              _is_coordinates_filled;
64   bool              _is_connectivity_filled;
65
66   // 4. is _gridType a true value or just a default one
67   bool              _is_default_gridType;
68
69   //-----------------------//
70   //   Protected Methods
71   //-----------------------//
72
73   CONNECTIVITY * makeConnectivity (const MED_EN::medEntityMesh Entity, const MED_EN::medGeometryElement Geometry,
74                                    const int NbEntities, int NbNodes, int nbMeshNodes,
75                                    const int * NodeNumbers) const ;
76   // creates nodal connectivity
77
78   
79   // Suppose a READ Driver to do the following except filling _[ijk]Array's
80   // 1) fill MESH fields:
81   //    * _name
82   //    * _spaceDimension
83   //    * _meshDimension
84   //    * _numberOfNodesFamilies, _numberOfCellsFamilies, ect
85   //    * _familyNode, _familyCell, etc
86   //    * _numberOfNodesGroups, _numberOfCellsGroups, etc
87   //    * _groupNode, _groupCell, etc
88   //    * _
89   // 2) create MESH::_coordinate without setting _coordinate->_coordinate and set: 
90   //    * _coordinate->_coordinateSystem
91   //    * _coordinate->_coordinateName
92   //    * _coordinate->_coordinateUnit
93   
94
95  public:
96   //-----------------------//
97   //   Methods
98   //-----------------------//
99
100   GRID();
101   GRID(const MED_EN::med_grid_type type);
102   GRID(const GRID &m);
103   GRID( driverTypes driverType, const string & fileName="",const string & meshName="");
104   GRID(const std::vector<std::vector<double> >& xyz_array,
105        const std::vector<std::string>&          coord_name,
106        const std::vector<std::string>&          coord_unit,
107        const MED_EN::med_grid_type              type=MED_EN::MED_CARTESIAN);
108   GRID & operator=(const GRID &m);
109   virtual ~GRID();
110   virtual void init();
111
112   void fillCoordinates() const ;
113   void fillConnectivity() const ;
114   // fill _coordinates and _connectivity of MESH if not yet done
115
116   inline void makeUnstructured();
117   // fill both coordinates and connectivity of MESH
118
119   void fillMeshAfterRead();
120   // fill some fields (_numberOfNodes, etc.) after reading
121
122   void writeUnstructured(int index=0, const string & driverName = "");
123   // write a Grid as an Unstructured mesh
124
125   void read(int index=0);
126
127   //   API Methods returning fields of MESH that are filled while reading.
128   //   So they need not to be redefined
129
130 //   string                getName() const;
131 //   int                   getSpaceDimension();
132 //   int                   getMeshDimension();
133 //   string                getCoordinatesSystem();
134 //   int                   getNumberOfNodes();
135 //   string *              getCoordinatesNames();
136 //   string *              getCoordinatesUnits();
137 //   int                   getNumberOfFamilies(medEntityMesh Entity);
138 //   vector<FAMILY*>       getFamilies(medEntityMesh Entity);
139 //   FAMILY*               getFamily(medEntityMesh Entity,int i);
140 //   int                   getNumberOfGroups(medEntityMesh Entity);
141 //   vector<GROUP*>        getGroups(medEntityMesh Entity);
142 //   GROUP*                getGroup(medEntityMesh Entity,int i);
143
144
145 // Since a MESH itself knows if it is a GRID, it calls fillConnectivity()
146 // or fillCoordinates() whenever needed. So no redifinition of the following methods
147
148 //   const double *        getCoordinates(medModeSwitch Mode);
149 //   COORDINATE *          getCoordinateptr();
150 //   const double          getCoordinate(int Number,int Axis);
151 //   int                   getNumberOfTypes(medEntityMesh Entity);
152 //   medGeometryElement *  getTypes(medEntityMesh Entity);
153 //   CELLMODEL *           getCellsTypes(medEntityMesh Entity);
154 //   medGeometryElement    getElementType(medEntityMesh Entity,int Number) ;
155 //   int                   getNumberOfElements(medEntityMesh Entity,medGeometryElement Type);
156 //   int                   getElementNumber(medConnectivity ConnectivityType, medEntityMesh Entity, medGeometryElement Type, int * connectivity) ;
157 //   int *                 getGlobalNumberingIndex(medEntityMesh Entity);
158 //   int *                 getConnectivity(medModeSwitch Mode,medConnectivity ConnectivityType,medEntityMesh Entity, medGeometryElement Type);
159 //   int *                 getConnectivityIndex(medConnectivity ConnectivityType,medEntityMesh Entity);
160 //   int *                 getReverseConnectivity(medConnectivity ConnectivityType);
161 //   int *                 getReverseConnectivityIndex(medConnectivity ConnectivityType);
162 //   bool                  existConnectivity(medConnectivity ConnectivityType,medEntityMesh Entity);
163 //   void                  calculateConnectivity(medModeSwitch Mode,medConnectivity ConnectivityType,medEntityMesh Entity);
164 //   FIELD<double>*        getVolume(const SUPPORT * Support) throw (MEDEXCEPTION) ;
165 //   FIELD<double>*        getArea(const SUPPORT * Support) throw (MEDEXCEPTION) ;
166 //   FIELD<double>*        getLength(const SUPPORT * Support) throw (MEDEXCEPTION) ;
167 //   FIELD<double>*        getNormal(const SUPPORT * Support) throw (MEDEXCEPTION) ;
168 //   FIELD<double>*        getBarycenter(const SUPPORT * Support) throw (MEDEXCEPTION) ;
169
170
171   // Specific GRID methods
172
173   inline int getNodeNumber(const int i, const int j=0, const int k=0) const;
174   // return a NODE number by its position in the grid.
175   // WARNING: be carefull, there is no check that i,j,k are within a good range
176   // A good range is: 0 <= X < getArrayLength( X_Axis )
177   inline int getCellNumber(const int i, const int j=0, const int k=0) const ;
178   // return a CELL number by its position in the grid.
179   // WARNING: be carefull, there is no check that i,j,k are within a good range
180   // A good range is: 0 <= X < (getArrayLength( X_Axis )-1)
181
182   int getEdgeNumber(const int Axis, const int i, const int j=0, const int k=0) const throw (MEDEXCEPTION) ;
183   // return an EDGE number by its position in the grid.
184   // Axis [1,2,3] means one of directions: along i, j or k.
185   // It selects an edge of ones having same (i,j,k):
186   //  * an EDGE going along given Axis.
187   // Exception for Axis out of range or when there is no edges in the grid (1D)
188   // WARNING: be carefull, there is no check that i,j,k are within a good range
189   // A good range is:
190   // 0 <= X < (getArrayLength( X_Axis )-1)
191   // 0 <= X < getArrayLength( NOT_X_Axis )
192
193   int getFaceNumber(const int Axis, const int i, const int j=0, const int k=0) const throw (MEDEXCEPTION) ;
194   // return a FACE number by its position in the grid.
195   // Axis [1,2,3] means one of directions: along i, j or k.
196   // It selects a face of ones having same (i,j,k):
197   //  * a FACE which is normal to given Axis
198   // Exception for Axis out of range or when there is no faces in the grid (1,2D)
199   // WARNING: be carefull, there is no check that i,j,k are within a good range
200   // A good range is:
201   // 0 <= X < (getArrayLength( NOT_X_Axis )-1)
202   // 0 <= X < getArrayLength( X_Axis )
203   
204
205   void getNodePosition(const int Number, int& i, int& j, int& k) const throw (MEDEXCEPTION) ;
206   void getCellPosition(const int Number, int& i, int& j, int& k) const throw (MEDEXCEPTION) ;
207   void getEdgePosition(const int Number, int& Axis, int& i, int& j, int& k) const throw (MEDEXCEPTION) ;
208   void getFacePosition(const int Number, int& Axis, int& i, int& j, int& k) const throw (MEDEXCEPTION) ;
209   // return position (i,j,k) of an entity #Number
210   // Axis: [1,2,3], see get*Number for details
211   // Exception for Number out of range
212
213
214   //  Access to fields
215
216   inline MED_EN::med_grid_type getGridType() const;
217   // return MED_CARTESIAN, MED_POLAR or MED_BODY_FITTED
218
219   int getArrayLength( const int Axis ) const throw (MEDEXCEPTION);
220   // return array length. Axis = [1,2,3] meaning [i,j,k],
221   // exception if Axis out of [1-3] range
222
223   const double getArrayValue (const int Axis, const int i) const throw (MEDEXCEPTION) ;
224   // return i-th array component. Axis = [1,2,3] meaning [i,j,k],
225   // exception if Axis out of [1 - 3] range
226   // exception if i is out of range [0 - (getArrayLength(Axis)-1)];
227
228   inline const COORDINATE * getCoordinateptr() const;
229
230   inline const double * getCoordinates(MED_EN::medModeSwitch Mode) const;
231
232   inline const double getCoordinate(int Number,int Axis) const;
233
234   inline int getNumberOfTypes(MED_EN::medEntityMesh Entity) const;
235
236   inline int getNumberOfTypesWithPoly(MED_EN::medEntityMesh Entity) const;
237
238   const MED_EN::medGeometryElement * getTypes(MED_EN::medEntityMesh Entity) const;
239
240   MED_EN::medGeometryElement * getTypesWithPoly(MED_EN::medEntityMesh Entity) const;
241
242   inline const CELLMODEL * getCellsTypes(MED_EN::medEntityMesh Entity) const;
243
244   const int * getGlobalNumberingIndex(MED_EN::medEntityMesh Entity) const;
245
246   inline int getNumberOfElements(MED_EN::medEntityMesh Entity,
247                                  MED_EN::medGeometryElement Type) const;
248
249   inline int getNumberOfElementsWithPoly(MED_EN::medEntityMesh Entity,
250                                          MED_EN::medGeometryElement Type) const;
251
252   inline bool existConnectivity(MED_EN::medConnectivity ConnectivityType,
253                                 MED_EN::medEntityMesh Entity) const;
254
255   inline MED_EN::medGeometryElement getElementType(MED_EN::medEntityMesh Entity,
256                                            int Number) const;
257
258   inline MED_EN::medGeometryElement getElementTypeWithPoly(MED_EN::medEntityMesh Entity,
259                                                            int Number) const;
260
261   inline void calculateConnectivity(MED_EN::medModeSwitch Mode,
262                                     MED_EN::medConnectivity ConnectivityType,
263                                     MED_EN::medEntityMesh Entity) const ;
264
265   inline const CONNECTIVITY* getConnectivityptr() const;
266
267   inline const int * getConnectivity(MED_EN::medModeSwitch Mode,
268                                      MED_EN::medConnectivity ConnectivityType,
269                                      MED_EN::medEntityMesh Entity, 
270                                      MED_EN::medGeometryElement Type) const;
271
272   inline const int * getConnectivityIndex(MED_EN::medConnectivity ConnectivityType,
273                                           MED_EN::medEntityMesh Entity) const;
274
275   inline const int * getReverseConnectivity(MED_EN::medConnectivity ConnectivityType,
276                                             MED_EN::medEntityMesh Entity=MED_EN::MED_CELL) const;
277
278   inline const int * getReverseConnectivityIndex(MED_EN::medConnectivity ConnectivityType,
279                                                  MED_EN::medEntityMesh Entity=MED_EN::MED_CELL) const;
280
281   //  Setting fields
282
283   inline void setGridType(MED_EN::med_grid_type gridType);
284
285   friend class IMED_MESH_RDONLY_DRIVER;
286   friend class IMED_MESH_WRONLY_DRIVER;
287   friend class MED_MESH_RDONLY_DRIVER21;
288   friend class MED_MESH_WRONLY_DRIVER21;
289   friend class MED_MESH_RDONLY_DRIVER22;
290   friend class MED_MESH_WRONLY_DRIVER22;
291   friend class ENSIGHT_MESH_RDONLY_DRIVER;
292 };
293
294
295   //----------------------------------//
296   //   Inline Methods Implementation
297   //----------------------------------//
298
299 inline MED_EN::med_grid_type GRID::getGridType() const
300 {
301   return _gridType;
302 }
303 //=======================================================================
304 //function : getNodeNumber
305 //purpose  : 
306 //=======================================================================
307
308 inline int GRID::getNodeNumber(const int i, const int j, const int k) const
309 {
310   return 1 + i + _iArrayLength * j + _iArrayLength * _jArrayLength * k;
311 }
312
313 //=======================================================================
314 //function : getCellNumber
315 //purpose  : 
316 //=======================================================================
317
318 inline int GRID::getCellNumber(const int i, const int j, const int k) const
319 {
320   return 1 + i + (_iArrayLength-1) * j + (_iArrayLength-1) * (_jArrayLength-1) * k;
321 }
322
323 //=======================================================================
324 //function : makeUnstructured
325 //purpose : fill coordinates and connectivity of MESH
326 //=======================================================================
327
328 inline void GRID::makeUnstructured()
329 {
330   fillCoordinates();
331   fillConnectivity();
332 }
333
334 //=======================================================================
335 //function : setGridType
336 //purpose : set the _gridType field od the class GRID
337 //=======================================================================
338
339 inline void GRID::setGridType(MED_EN::med_grid_type gridType)
340 {
341   _gridType = gridType;
342 }
343
344 /*! Get the COORDINATES object. Use it only if you need COORDINATES informations not provided by the GRID class via the MESH class.*/
345 inline const COORDINATE * GRID::getCoordinateptr() const
346 {
347   fillCoordinates();
348   return _coordinate;
349 }
350
351 /*! Get the whole coordinates array in a given interlacing mode. The interlacing mode are :
352   - MED_NO_INTERLACE   :  X1 X2 Y1 Y2 Z1 Z2
353   - MED_FULL_INTERLACE :  X1 Y1 Z1 X2 Y2 Z2
354  */
355 inline const double * GRID::getCoordinates(MED_EN::medModeSwitch Mode) const
356 {
357   fillCoordinates();
358   return _coordinate->getCoordinates(Mode);
359 }
360
361 /*! Get the coordinate n° number on axis n°axis*/
362 inline const double GRID::getCoordinate(int number, int axis) const
363 {
364   fillCoordinates();
365   return _coordinate->getCoordinate(number,axis);
366 }
367
368 /*! Get the number of different geometric types for a given entity type.
369
370     medEntityMesh entity : MED_CELL, MED_FACE, MED_EDGE, MED_NODE,
371     MED_ALL_ENTITIES
372
373 */
374 inline int GRID::getNumberOfTypes(MED_EN::medEntityMesh entity) const
375 {
376   MESSAGE_MED("GRID::getNumberOfTypes(medEntityMesh entity) : "<<entity);
377     return 1; // a grid has one type
378 }
379
380
381 inline int GRID::getNumberOfTypesWithPoly(MED_EN::medEntityMesh entity) const
382 {
383   MESSAGE_MED("GRID::getNumberOfTypes(medEntityMesh entity) : "<<entity);
384     return 1; // a grid has one type
385 }
386
387 /*!
388   Get the whole list of CELLMODEL used by cells of given type (medEntityMesh).
389
390   REMARK : Don't use MED_NODE as medEntityMesh
391 */
392 inline const CELLMODEL * GRID::getCellsTypes(MED_EN::medEntityMesh Entity) const
393 {
394   fillConnectivity();
395
396   if (_connectivity != NULL)
397     return _connectivity->getCellsTypes(Entity);
398   throw MEDEXCEPTION(LOCALIZED("GRID::getCellsTypes( medEntityMesh ) : Connectivity not defined !"));
399 }
400
401 /*! Return an array of size NumbreOfTypes+1 which contains, for each
402     geometric type of the given entity, the first global element number
403     of this type.
404
405     For exemple, if we have a mesh with 5 triangles and 4 quadrangle :
406     - size of GlobalNumberingIndex is 3
407     - GlobalNumberingIndex[0]=1 (the first type)
408     - GlobalNumberingIndex[1]=6 (the second type)
409     - GlobalNumberingIndex[2]=10
410 */
411 inline const int * GRID::getGlobalNumberingIndex(MED_EN::medEntityMesh entity) const
412 {
413   fillConnectivity();
414
415   if (_connectivity != NULL)
416     return _connectivity->getGlobalNumberingIndex(entity);
417   throw MEDEXCEPTION(LOCALIZED("GRID::getNumberOfTypes( medEntityMesh ) : Connectivity not defined !"));
418 }
419
420 /*!
421   Return the number of element of given geometric type of given entity. Return 0 if query is not defined.
422 */
423 inline int GRID::getNumberOfElements(MED_EN::medEntityMesh entity, MED_EN::medGeometryElement Type) const
424 {
425   int numberOfElements=0;
426     
427     // Cas où le nombre d'éléments n'est pas nul
428     if (entity==MED_EN::MED_FACE && (Type==MED_EN::MED_QUAD4 || Type==MED_EN::MED_ALL_ELEMENTS) && _spaceDimension>2)
429         numberOfElements=(_iArrayLength-1)*(_jArrayLength-1);
430
431     else if (entity==MED_EN::MED_EDGE && (Type==MED_EN::MED_SEG2 || Type==MED_EN::MED_ALL_ELEMENTS) && _spaceDimension>1)
432         numberOfElements=_iArrayLength-1;
433
434     else if (entity==MED_EN::MED_NODE && (Type==MED_EN::MED_NONE || Type==MED_EN::MED_ALL_ELEMENTS) && _spaceDimension>0)
435         numberOfElements=_numberOfNodes;
436     
437     else if (entity==MED_EN::MED_CELL && _spaceDimension==3 && (Type==MED_EN::MED_HEXA8 || Type==MED_EN::MED_ALL_ELEMENTS) )
438         numberOfElements=(_iArrayLength-1)*(_jArrayLength-1)*(_kArrayLength-1);
439     
440     else if (entity==MED_EN::MED_CELL && _spaceDimension==2 && (Type==MED_EN::MED_QUAD4 || Type==MED_EN::MED_ALL_ELEMENTS))
441         numberOfElements=(_iArrayLength-1)*(_jArrayLength-1);
442     
443     else if (entity==MED_EN::MED_CELL && _spaceDimension==1 && (Type==MED_EN::MED_SEG2 || Type==MED_EN::MED_ALL_ELEMENTS) )
444         numberOfElements=_iArrayLength-1;
445
446     MESSAGE_MED("GRID::getNumberOfElements - entity=" << entity << " Type=" << Type);
447     MESSAGE_MED("_spaceDimension=" << _spaceDimension << "  numberOfElements=" << numberOfElements);
448
449     return numberOfElements;
450 }
451
452 int GRID::getNumberOfElementsWithPoly(MED_EN::medEntityMesh entity, MED_EN::medGeometryElement Type) const
453 {
454   return getNumberOfElements(entity,Type);
455 }
456
457
458 /*!
459   Return true if the wanted connectivity exist, else return false
460   (to use before a getSomething method).
461  */
462 inline bool GRID::existConnectivity(MED_EN::medConnectivity connectivityType, MED_EN::medEntityMesh entity) const
463 {
464   fillConnectivity();
465
466   if (_connectivity==(CONNECTIVITY*)NULL)
467     throw MEDEXCEPTION("GRID::existConnectivity(medConnectivity,medEntityMesh) : no connectivity defined !");
468   return _connectivity->existConnectivity(connectivityType,entity);
469 }
470
471 /*!
472   Return the geometric type of global element Number of entity Entity.
473
474   Throw an exception if Entity is not defined or Number are wrong (too big).
475  */
476 inline MED_EN::medGeometryElement GRID::getElementType(MED_EN::medEntityMesh Entity,int Number) const
477 {
478   fillConnectivity();
479
480   if (_connectivity==(CONNECTIVITY*)NULL)
481     throw MEDEXCEPTION("GRID::getElementType(medEntityMesh,int) : no connectivity defined !");
482   return _connectivity->getElementType(Entity,Number);
483 }
484
485 inline MED_EN::medGeometryElement GRID::getElementTypeWithPoly(MED_EN::medEntityMesh Entity,int Number) const
486 {
487   return getElementType(Entity,Number);
488 }
489
490 /*!
491   Calculate the ask connectivity. Return an exception if this could not be
492   done. Do nothing if connectivity already exist.
493  */
494
495 inline void GRID::calculateConnectivity(MED_EN::medModeSwitch Mode,MED_EN::medConnectivity ConnectivityType,MED_EN::medEntityMesh entity) const
496 {
497   fillConnectivity();
498
499   if (Mode==MED_EN::MED_FULL_INTERLACE)
500     _connectivity->calculateConnectivity(ConnectivityType,entity);
501   else
502     throw MEDEXCEPTION(LOCALIZED("GRID::calculateConnectivity : only for MED_FULL_INTERLACE mode"));
503 }
504
505 inline const CONNECTIVITY* GRID::getConnectivityptr() const
506 {
507   fillConnectivity();
508
509   return _connectivity;
510 }
511
512 /*!
513   Return the required connectivity in the right mode for the given
514   geometric type of the given entity.
515
516   To get connectivity for all geometric type, use Mode=MED_FULL_INTERLACE
517   and Type=MED_ALL_ELEMENTS.
518   You must also get the corresponding index array.
519  */
520 inline const int * GRID::getConnectivity(MED_EN::medModeSwitch Mode,MED_EN::medConnectivity ConnectivityType,MED_EN::medEntityMesh entity, MED_EN::medGeometryElement Type) const
521 {
522   fillConnectivity();
523
524   if (Mode==MED_EN::MED_FULL_INTERLACE)
525     return _connectivity->getConnectivity(ConnectivityType,entity,Type);
526   throw MEDEXCEPTION(LOCALIZED("GRID::getConnectivity : only for MED_FULL_INTERLACE mode"));
527 }
528
529 /*!
530   Return the required index array for a connectivity received in
531   MED_FULL_ENTERLACE mode and MED_ALL_ELEMENTS type.
532
533   This array allow to find connectivity of each elements.
534
535   Example : Connectivity of i^{th} elements (1<=i<=NumberOfElement) begin
536   at index ConnectivityIndex[i-1] and end at index ConnectivityIndex[i]-1
537   in Connectivity array (Connectivity[ConnectivityIndex[i-1]-1] is the
538   first value)
539  */
540 inline const int * GRID::getConnectivityIndex(MED_EN::medConnectivity ConnectivityType,MED_EN::medEntityMesh entity) const
541 {
542   fillConnectivity();
543
544   return _connectivity->getConnectivityIndex(ConnectivityType, entity);
545 }
546
547 /*!
548   Return the reverse connectivity required by ConnectivityType :
549   - If ConnectivityType=MED_NODAL : return connectivity node-cell
550   - If ConnectivityType=MED_DESCENDING : return connectivity face-cell
551
552   You must get ReverseConnectivityIndex array to use it.
553  */
554 inline const int * GRID::getReverseConnectivity(MED_EN::medConnectivity ConnectivityType,MED_EN::medEntityMesh Entity/*=MED_CELL*/) const
555 {
556   fillConnectivity();
557
558   if (NULL==_connectivity)
559     throw MEDEXCEPTION("GRID::getReverseConnectivity : no connectivity defined in MESH !");
560
561   return _connectivity->getReverseConnectivity(ConnectivityType,Entity);
562 }
563
564 /*!
565   Return the index array required by ConnectivityType.
566
567   This array allow to find reverse connectivity of each elements.
568
569   Example : Reverse connectivity of i^{th} elements (1<=i<=NumberOfElement)
570   begin at index ReverseConnectivityIndex[i-1] and end at index
571   ReverseConnectivityIndex[i]-1
572   in ReverseConnectivity array (
573   ReverseConnectivity[ReverseConnectivityIndex[i-1]-1]
574   is the first value)
575  */
576 inline const int * GRID::getReverseConnectivityIndex(MED_EN::medConnectivity ConnectivityType,MED_EN::medEntityMesh Entity/*=MED_CELL*/) const
577 {
578   fillConnectivity();
579
580   if (NULL==_connectivity)
581     throw MEDEXCEPTION("GRID::getReverseConnectivityIndex : no connectivity defined in MESH !");
582
583   return _connectivity->getReverseConnectivityIndex(ConnectivityType,Entity);
584 }
585
586 }
587
588 #endif