9 #include "MEDMEM_STRING.hxx"
10 #include "MEDMEM_Exception.hxx"
11 #include "MEDMEM_define.hxx"
13 //#include "MEDMEM_Support.hxx"
14 #include "MEDMEM_Coordinate.hxx"
15 #include "MEDMEM_Connectivity.hxx"
16 #include "MEDMEM_GenDriver.hxx"
18 /*! This class contains all the informations related with a MESH :
26 NOTE: A Family is only on one type of entity (MED_CELL, MED_FACE, MED_EDGE, MED_NODE).
27 You can't have a family on MED_CELL and MED_FACE
33 template <class T> class FIELD;
42 //-----------------------//
44 //-----------------------//
48 string _name; // A POSITIONNER EN FCT DES IOS ?
50 mutable COORDINATE * _coordinate;
51 mutable CONNECTIVITY * _connectivity;
58 //////////////////////////////////////////////////////////////////////////////////////
59 /// Modification pour prise en compte de la numérotation optionnelle des noeuds ///
60 //////////////////////////////////////////////////////////////////////////////////////
62 /// La map suivante donne le lien numérotation optionnelle => numérotation cannonique
63 /// Elle sera calculée apres l'appel de MEDnumLire(...)
64 /// Et sera utilisée avant chaque appel a MEDconnLire(...) pour renuméroter toutes les mailles de façon canonique [1...n]
65 /// _coordinate->NodeNumber sera utilisé avant chaque appel à MEDconnEcri pour démunéroter les mailles en leur numérotation originelle
66 /// Ce traitement devrait prévenir tout plantage du aux numérotations optionnelles DES NOEUDS
67 /// Et ne ralentira que tres peu les traitements sans numéros optionnels
69 int _arePresentOptionnalNodesNumbers;
70 map<int,int> _optionnalToCanonicNodesNumbers;
72 vector<FAMILY*> _familyNode;
73 vector<FAMILY*> _familyCell;
74 vector<FAMILY*> _familyFace;
75 vector<FAMILY*> _familyEdge;
77 vector<GROUP*> _groupNode;
78 vector<GROUP*> _groupCell;
79 vector<GROUP*> _groupFace;
80 vector<GROUP*> _groupEdge;
83 vector<GENDRIVER *> _drivers; // Storage of the drivers currently in use
85 bool _isAGrid; // am I a GRID or not
87 //-----------------------//
89 //-----------------------//
91 // inline void checkGridFillCoords() const;
92 // inline void checkGridFillConnectivity() const;
94 // if this->_isAGrid, assure that _coordinate and _connectivity are filled
98 // Add your personnal driver line (step 2)
99 friend class MED_MESH_RDONLY_DRIVER;
100 friend class MED_MESH_WRONLY_DRIVER;
102 friend class MED_MED_RDONLY_DRIVER;
103 friend class MED_MED_WRONLY_DRIVER;
104 friend class MED_MED_RDWR_DRIVER;
106 friend class GIBI_MESH_RDONLY_DRIVER;
107 friend class GIBI_MESH_WRONLY_DRIVER;
108 friend class GIBI_MESH_RDWR_DRIVER;
110 friend class PORFLOW_MESH_RDONLY_DRIVER;
111 friend class PORFLOW_MESH_WRONLY_DRIVER;
112 friend class PORFLOW_MESH_RDWR_DRIVER;
114 friend class VTK_MESH_DRIVER;
119 MESH & operator=(const MESH &m);
120 MESH( driverTypes driverType, const string & fileName="",
121 const string & meshName="") throw (MEDEXCEPTION);
123 friend ostream & operator<<(ostream &os, const MESH &my);
125 int addDriver(driverTypes driverType,
126 const string & fileName ="Default File Name.med",
127 const string & driverName="Default Mesh Name",
128 MED_EN::med_mode_acces access=MED_EN::MED_REMP);
129 int addDriver(GENDRIVER & driver);
130 void rmDriver(int index=0);
132 virtual void read(int index=0);
133 inline void read(const GENDRIVER & genDriver);
134 inline void write(int index=0, const string & driverName = "");
135 inline void write(const GENDRIVER & genDriver);
137 // void calculateReverseConnectivity();
138 // void createFaces(); //Faces creation => full constituent informations
139 // void buildConstituent(); // calculate descendent connectivity + face-cell connectivity
142 inline void setName(string name);
144 inline string getName() const;
145 inline int getSpaceDimension() const;
146 inline int getMeshDimension() const;
147 inline bool getIsAGrid();
149 inline int getNumberOfNodes() const;
150 virtual inline const COORDINATE * getCoordinateptr() const;
151 inline string getCoordinatesSystem() const;
152 virtual inline const double * getCoordinates(MED_EN::medModeSwitch Mode) const;
153 virtual inline const double getCoordinate(int Number,int Axis) const;
154 inline const string * getCoordinatesNames() const;
155 inline const string * getCoordinatesUnits() const;
156 //inline int * getNodesNumbers();
158 virtual inline int getNumberOfTypes(MED_EN::medEntityMesh Entity) const;
159 virtual inline const MED_EN::medGeometryElement * getTypes(MED_EN::medEntityMesh Entity) const;
160 virtual inline const CELLMODEL * getCellsTypes(MED_EN::medEntityMesh Entity) const;
161 virtual const int * getGlobalNumberingIndex(MED_EN::medEntityMesh Entity) const;
162 virtual inline int getNumberOfElements(MED_EN::medEntityMesh Entity,
163 MED_EN::medGeometryElement Type) const;
164 virtual inline bool existConnectivity(MED_EN::medConnectivity ConnectivityType,
165 MED_EN::medEntityMesh Entity) const;
167 virtual inline MED_EN::medGeometryElement getElementType(MED_EN::medEntityMesh Entity,
169 virtual inline void calculateConnectivity(MED_EN::medModeSwitch Mode,
170 MED_EN::medConnectivity ConnectivityType,
171 MED_EN::medEntityMesh Entity) const ;
172 virtual inline int getConnectivityLength(MED_EN::medModeSwitch Mode,
173 MED_EN::medConnectivity ConnectivityType,
174 MED_EN::medEntityMesh Entity,
175 MED_EN::medGeometryElement Type) const;
176 virtual inline const int * getConnectivity(MED_EN::medModeSwitch Mode,
177 MED_EN::medConnectivity ConnectivityType,
178 MED_EN::medEntityMesh Entity,
179 MED_EN::medGeometryElement Type) const;
180 virtual inline const int * getConnectivityIndex(MED_EN::medConnectivity ConnectivityType,
181 MED_EN::medEntityMesh Entity) const;
182 virtual int getElementNumber(MED_EN::medConnectivity ConnectivityType,
183 MED_EN::medEntityMesh Entity,
184 MED_EN::medGeometryElement Type,
185 int * connectivity) const;
186 virtual inline int getReverseConnectivityLength(MED_EN::medConnectivity ConnectivityType,
187 MED_EN::medEntityMesh Entity=MED_EN::MED_CELL) const;
188 virtual inline const int * getReverseConnectivity(MED_EN::medConnectivity ConnectivityType,
189 MED_EN::medEntityMesh Entity=MED_EN::MED_CELL) const;
190 virtual inline int getReverseConnectivityIndexLength(MED_EN::medConnectivity ConnectivityType,
191 MED_EN::medEntityMesh Entity=MED_EN::MED_CELL) const;
192 virtual inline const int * getReverseConnectivityIndex(MED_EN::medConnectivity ConnectivityType,
193 MED_EN::medEntityMesh Entity=MED_EN::MED_CELL) const;
195 virtual int getNumberOfFamilies(MED_EN::medEntityMesh Entity) const;
196 virtual inline const vector<FAMILY*> getFamilies(MED_EN::medEntityMesh Entity) const;
197 virtual inline const FAMILY* getFamily(MED_EN::medEntityMesh Entity,int i) const;
198 virtual int getNumberOfGroups(MED_EN::medEntityMesh Entity) const;
199 virtual inline const vector<GROUP*> getGroups(MED_EN::medEntityMesh Entity) const;
200 virtual inline const GROUP* getGroup(MED_EN::medEntityMesh Entity,int i) const;
201 virtual inline const CONNECTIVITY* getConnectivityptr() const;
202 virtual SUPPORT * getBoundaryElements(MED_EN::medEntityMesh Entity)
203 throw (MEDEXCEPTION);
204 // problème avec le maillage dans le support :
205 // le pointeur n'est pas const, mais sa valeur oui. A voir !!! PG
207 SUPPORT * getSkin(const SUPPORT * Support3D)
208 throw (MEDEXCEPTION);
210 // Node DonneBarycentre(const Cell &m) const;
211 virtual FIELD<double>* getVolume (const SUPPORT * Support) const
212 throw (MEDEXCEPTION);
213 // Support must be on 3D elements
214 virtual FIELD<double>* getArea (const SUPPORT * Support) const
215 throw (MEDEXCEPTION);
216 // Support must be on 2D elements
217 virtual FIELD<double>* getLength (const SUPPORT * Support) const
218 throw (MEDEXCEPTION);
219 // Support must be on 1D elements
220 virtual FIELD<double>* getNormal (const SUPPORT * Support) const
221 throw (MEDEXCEPTION);
222 // Support must be on 2D elements
223 virtual FIELD<double>* getBarycenter (const SUPPORT * Support) const
224 throw (MEDEXCEPTION);
225 // FIELD<int>* getNeighbourhood(SUPPORT * Support) const
226 // throw (MEDEXCEPTION); // Il faut preciser !
229 return a SUPPORT pointer on the union of all SUPPORTs in Supports.
230 You should delete this pointer after use to avois memory leaks.
232 SUPPORT * mergeSupports(const vector<SUPPORT *> Supports) const throw (MEDEXCEPTION) ;
235 return a SUPPORT pointer on the intersection of all SUPPORTs in Supports.
236 The (SUPPORT *) NULL pointer is returned if the intersection is empty.
237 You should delete this pointer after use to avois memory leaks.
239 SUPPORT * intersectSupports(const vector<SUPPORT *> Supports) const throw (MEDEXCEPTION) ;
242 * Create families from groups.
243 * This function is automaticaly called whenever we ask for families that are not up-to-date.
244 * (The creation of families is delayed to the need of user.)
245 * If a new created family hapen to already exist, we keep the old one.
246 * (There is no way to know which family has change.)
248 void createFamilies();
251 // ---------------------------------------
253 // ---------------------------------------
255 inline const CONNECTIVITY* MESH::getConnectivityptr() const
257 // checkGridFillConnectivity();
258 return _connectivity;
261 // inline void MESH::read(int index/*=0*/)
263 // const char * LOC = "MESH::read(int index=0) : ";
266 // if (_drivers[index]) {
267 // _drivers[index]->open();
268 // _drivers[index]->read();
269 // _drivers[index]->close();
272 // throw MED_EXCEPTION ( LOCALIZED( STRING(LOC)
273 // << "The index given is invalid, index must be between 0 and |"
274 // << _drivers.size()
280 /*! Write all the content of the MESH using driver referenced by the integer handler index.*/
281 inline void MESH::write(int index/*=0*/, const string & driverName/* = ""*/)
283 const char * LOC = "MESH::write(int index=0, const string & driverName = \"\") : ";
286 if ( _drivers[index] ) {
287 _drivers[index]->open();
288 if (driverName != "") _drivers[index]->setMeshName(driverName);
289 _drivers[index]->write();
290 _drivers[index]->close();
293 throw MED_EXCEPTION ( LOCALIZED( STRING(LOC)
294 << "The index given is invalid, index must be between 0 and |"
301 // This method is MED specific : don't use it
303 inline void MESH::write(const GENDRIVER & genDriver)
305 const char * LOC = "MESH::write(const MED_MED_DRIVER & genDriver): ";
308 for (unsigned int index=0; index < _drivers.size(); index++ )
309 if ( *_drivers[index] == genDriver ) {
310 _drivers[index]->open();
311 _drivers[index]->write();
312 _drivers[index]->close();
313 // ? FINALEMENT PAS BESOIN DE L'EXCEPTION ?
320 // This method is MED specific : don't use it
322 inline void MESH::read(const GENDRIVER & genDriver)
324 const char * LOC = "MESH::read(const MED_MED_DRIVER & genDriver): ";
327 for (unsigned int index=0; index < _drivers.size(); index++ )
328 if ( *_drivers[index] == genDriver ) {
329 _drivers[index]->open();
330 _drivers[index]->read();
331 _drivers[index]->close();
332 // ? FINALEMENT PAS BESOIN DE L'EXCEPTION ?
339 /*! Set the MESH name */
340 inline void MESH::setName(string name)
342 _name=name; //NOM interne à la classe
345 /*! Get the MESH name */
346 inline string MESH::getName() const
351 /*! Get the dimension of the space */
352 inline int MESH::getSpaceDimension() const
354 return _spaceDimension;
357 /*! Get the dimension of the MESH */
358 inline int MESH::getMeshDimension() const
360 return _meshDimension;
363 /*! Get the number of nodes used in the MESH */
364 inline int MESH::getNumberOfNodes() const
366 return _numberOfNodes;
369 /*! Get the COORDINATES object. Use it only if you need COORDINATES informations not provided by the MESH class.*/
370 inline const COORDINATE * MESH::getCoordinateptr() const
372 // checkGridFillCoords();
376 /*! Get the system in which coordinates are given (CARTESIAN,CYLINDRICAL,SPHERICAL) __??MED_CART??__. */
377 inline string MESH::getCoordinatesSystem() const
379 return _coordinate->getCoordinatesSystem();
382 /*! Get the whole coordinates array in a given interlacing mode. The interlacing mode are :
383 - MED_NO_INTERLACE : X1 X2 Y1 Y2 Z1 Z2
384 - MED_FULL_INTERLACE : X1 Y1 Z1 X2 Y2 Z2
386 inline const double * MESH::getCoordinates(MED_EN::medModeSwitch Mode) const
388 // checkGridFillCoords();
389 return _coordinate->getCoordinates(Mode);
392 /*! Get the coordinate n° number on axis n°axis*/
393 inline const double MESH::getCoordinate(int number, int axis) const
395 // checkGridFillCoords();
396 return _coordinate->getCoordinate(number,axis);
399 /*! Get the coordinate names array ("x ","y ","z ")
400 of size n*MED_TAILLE_PNOM
402 inline const string * MESH::getCoordinatesNames() const
404 return _coordinate->getCoordinatesNames();
407 /*! Get the coordinate unit names array ("cm ","cm ","cm ")
408 of size n*MED_TAILLE_PNOM
410 inline const string * MESH::getCoordinatesUnits() const
412 return _coordinate->getCoordinatesUnits();
414 // int * MESH::getNodesNumbers() const
416 // return nodesNumbers;
419 /*! Get the number of different geometric types for a given entity type.
421 For exemple getNumberOfTypes(MED_CELL) would return 3 if the MESH
422 have some MED_TETRA4, MED_PYRA5 and MED_HEXA6 in it.
424 medEntityMesh entity : MED_CELL, MED_FACE, MED_EDGE, MED_NODE, MED_ALL_ENTITIES
426 If entity is not defined, return 0.
428 If there is no connectivity, return an exception.
430 inline int MESH::getNumberOfTypes(MED_EN::medEntityMesh entity) const
432 MESSAGE("MESH::getNumberOfTypes(medEntityMesh entity) : "<<entity);
433 if (entity == MED_EN::MED_NODE)
435 // checkGridFillConnectivity();
436 if (_connectivity != NULL)
437 return _connectivity->getNumberOfTypes(entity);
438 throw MEDEXCEPTION(LOCALIZED("MESH::getNumberOfTypes( medEntityMesh ) : Connectivity not defined !"));
442 Get the list of geometric types used by a given entity.
443 medEntityMesh entity : MED_CELL, MED_FACE, MED_EDGE, MED_ALL_ENTITIES
445 REM : Don't use MED_NODE
447 If entity is not defined, return an exception.
449 inline const MED_EN::medGeometryElement * MESH::getTypes(MED_EN::medEntityMesh entity) const
451 if (entity == MED_EN::MED_NODE)
452 throw MEDEXCEPTION(LOCALIZED("MESH::getTypes( medEntityMesh ) : No medGeometryElement with MED_NODE entity !"));
453 // return un tableau de taille 1 contenant MED_NONE, comme les supports pour etre coherent avec getNumberOfTypes ???? PG
455 // checkGridFillConnectivity();
456 if (_connectivity != NULL)
457 return _connectivity->getGeometricTypes(entity);
458 throw MEDEXCEPTION(LOCALIZED("MESH::getTypes( medEntityMesh ) : Connectivity not defined !"));
462 Get the whole list of CELLMODEL used by cells of given type (medEntityMesh).
464 REMARK : Don't use MED_NODE as medEntityMesh
466 inline const CELLMODEL * MESH::getCellsTypes(MED_EN::medEntityMesh Entity) const
468 // checkGridFillConnectivity();
469 if (_connectivity != NULL)
470 return _connectivity->getCellsTypes(Entity);
471 throw MEDEXCEPTION(LOCALIZED("MESH::getCellsTypes( medEntityMesh ) : Connectivity not defined !"));
474 /*! Return an array of size NumbreOfTypes+1 which contains, for each
475 geometric type of the given entity, the first global element number
478 For exemple, if we have a mesh with 5 triangles and 4 quadrangle :
479 - size of GlobalNumberingIndex is 3
480 - GlobalNumberingIndex[0]=1 (the first type)
481 - GlobalNumberingIndex[1]=6 (the second type)
482 - GlobalNumberingIndex[2]=10
484 inline const int * MESH::getGlobalNumberingIndex(MED_EN::medEntityMesh entity) const
486 // checkGridFillConnectivity();
487 if (_connectivity != NULL)
488 return _connectivity->getGlobalNumberingIndex(entity);
489 throw MEDEXCEPTION(LOCALIZED("MESH::getNumberOfTypes( medEntityMesh ) : Connectivity not defined !"));
492 Return the number of element of given geometric type of given entity. Return 0 if query is not defined.
495 - getNumberOfElements(MED_NODE,MED_NONE) : number of node
496 - getNumberOfElements(MED_NODE,MED_TRIA3) : return 0 (not defined)
497 - getNumberOfElements(MED_FACE,MED_TRIA3) : return number of triangles
498 elements defined in face entity (0 if not defined)
499 - getNumberOfElements(MED_CELL,MED_ALL_ELEMENTS) : return total number
500 of elements defined in cell entity
502 inline int MESH::getNumberOfElements(MED_EN::medEntityMesh entity, MED_EN::medGeometryElement Type) const
504 // const char * LOC = "MESH::getNumberOfElements(medEntityMesh,medGeometryElement) : ";
505 if (entity==MED_EN::MED_NODE)
506 if ((Type==MED_EN::MED_NONE)|(Type==MED_EN::MED_ALL_ELEMENTS))
507 return _numberOfNodes;
510 //throw MEDEXCEPTION(LOCALIZED(STRING(LOC)<<"wrong medGeometryElement with MED_NODE"));
513 // checkGridFillConnectivity();
514 if (_connectivity != (CONNECTIVITY*)NULL)
515 return _connectivity->getNumberOf(entity,Type);
518 //throw MEDEXCEPTION(LOCALIZED(STRING(LOC)<<"connectivity not defined !"));
522 Return true if the wanted connectivity exist, else return false
523 (to use before a getSomething method).
525 inline bool MESH::existConnectivity(MED_EN::medConnectivity connectivityType, MED_EN::medEntityMesh entity) const
527 // checkGridFillConnectivity();
528 if (_connectivity==(CONNECTIVITY*)NULL)
529 throw MEDEXCEPTION("MESH::existConnectivity(medConnectivity,medEntityMesh) : no connectivity defined !");
530 return _connectivity->existConnectivity(connectivityType,entity);
533 Return the geometric type of global element Number of entity Entity.
535 Throw an exception if Entity is not defined or Number are wrong (too big).
537 inline MED_EN::medGeometryElement MESH::getElementType(MED_EN::medEntityMesh Entity,int Number) const
539 // checkGridFillConnectivity();
540 if (_connectivity==(CONNECTIVITY*)NULL)
541 throw MEDEXCEPTION("MESH::getElementType(medEntityMesh,int) : no connectivity defined !");
542 return _connectivity->getElementType(Entity,Number);
545 Calculate the ask connectivity. Return an exception if this could not be
546 done. Do nothing if connectivity already exist.
549 inline void MESH::calculateConnectivity(MED_EN::medModeSwitch Mode,MED_EN::medConnectivity ConnectivityType,MED_EN::medEntityMesh entity) const
551 // checkGridFillConnectivity();
552 if (Mode==MED_EN::MED_FULL_INTERLACE)
553 _connectivity->calculateConnectivity(ConnectivityType,entity);
555 throw MEDEXCEPTION(LOCALIZED("MESH::calculateConnectivity : only for MED_FULL_INTERLACE mode"));
558 Return the corresponding length of the array returned by MESH::getConnectivity with exactly the same arguments.
559 Used particulary for wrapping CORBA and python.
561 inline int MESH::getConnectivityLength(MED_EN::medModeSwitch Mode,MED_EN::medConnectivity ConnectivityType,MED_EN::medEntityMesh entity, MED_EN::medGeometryElement Type) const
563 int nbOfElm = getNumberOfElements(entity,Type);
566 if (Type == MED_EN::MED_ALL_ELEMENTS)
568 size = getConnectivityIndex(ConnectivityType,entity)[nbOfElm]-1;
572 size = nbOfElm*(((int) Type)%100);
577 Return the required connectivity in the right mode for the given
578 geometric type of the given entity.
580 To get connectivity for all geometric type, use Mode=MED_FULL_INTERLACE
581 and Type=MED_ALL_ELEMENTS.
582 You must also get the corresponding index array.
584 inline const int * MESH::getConnectivity(MED_EN::medModeSwitch Mode,MED_EN::medConnectivity ConnectivityType,MED_EN::medEntityMesh entity, MED_EN::medGeometryElement Type) const
586 // checkGridFillConnectivity();
587 if (Mode==MED_EN::MED_FULL_INTERLACE)
588 return _connectivity->getConnectivity(ConnectivityType,entity,Type);
589 throw MEDEXCEPTION(LOCALIZED("MESH::getConnectivity : only for MED_FULL_INTERLACE mode"));
592 Return the required index array for a connectivity received in
593 MED_FULL_ENTERLACE mode and MED_ALL_ELEMENTS type.
595 This array allow to find connectivity of each elements.
597 Example : Connectivity of i^{th} elements (1<=i<=NumberOfElement) begin
598 at index ConnectivityIndex[i-1] and end at index ConnectivityIndex[i]-1
599 in Connectivity array (Connectivity[ConnectivityIndex[i-1]-1] is the
602 inline const int * MESH::getConnectivityIndex(MED_EN::medConnectivity ConnectivityType,MED_EN::medEntityMesh entity) const
604 // checkGridFillConnectivity();
605 return _connectivity->getConnectivityIndex(ConnectivityType, entity);
608 Return the corresponding length of the array returned by MESH::getReverseConnectivity with exactly the same arguments.
609 Used particulary for wrapping CORBA and python.
612 inline int MESH::getReverseConnectivityLength(MED_EN::medConnectivity ConnectivityType,
613 MED_EN::medEntityMesh Entity) const
615 int spaceDim = getSpaceDimension();
618 if (ConnectivityType == MED_EN::MED_NODAL)
620 nb = getNumberOfNodes();
625 nb = getNumberOfElements(MED_EN::MED_EDGE,
626 MED_EN::MED_ALL_ELEMENTS);
627 else if (spaceDim == 3)
628 nb = getNumberOfElements(MED_EN::MED_FACE,
629 MED_EN::MED_ALL_ELEMENTS);
631 return getReverseConnectivityIndex(ConnectivityType)[nb]-1;
634 Return the reverse connectivity required by ConnectivityType :
635 - If ConnectivityType=MED_NODAL : return connectivity node-cell
636 - If ConnectivityType=MED_DESCENDING : return connectivity face-cell
638 You must get ReverseConnectivityIndex array to use it.
641 inline const int * MESH::getReverseConnectivity(MED_EN::medConnectivity ConnectivityType,MED_EN::medEntityMesh Entity/*=MED_CELL*/) const
643 // checkGridFillConnectivity();
644 if (NULL==_connectivity)
645 throw MEDEXCEPTION("MESH::getReverseConnectivity : no connectivity defined in MESH !");
647 return _connectivity->getReverseConnectivity(ConnectivityType,Entity);
650 Return the corresponding length of the array returned by MESH::getReverseConnectivityIndex with exactly the same arguments.
651 Used particulary for wrapping CORBA and python.
653 inline int MESH::getReverseConnectivityIndexLength(MED_EN::medConnectivity ConnectivityType,
654 MED_EN::medEntityMesh Entity) const
656 int spaceDim = getSpaceDimension();
658 if (ConnectivityType == MED_EN::MED_NODAL)
660 return getNumberOfNodes()+1;
665 return getNumberOfElements(MED_EN::MED_EDGE,MED_EN::MED_ALL_ELEMENTS)+1;
666 else if (spaceDim == 3)
667 return getNumberOfElements(MED_EN::MED_FACE,MED_EN::MED_ALL_ELEMENTS)+1;
669 throw MEDEXCEPTION("Invalid dimension");
673 Return the index array required by ConnectivityType.
675 This array allow to find reverse connectivity of each elements.
677 Example : Reverse connectivity of i^{th} elements (1<=i<=NumberOfElement)
678 begin at index ReverseConnectivityIndex[i-1] and end at index
679 ReverseConnectivityIndex[i]-1
680 in ReverseConnectivity array (
681 ReverseConnectivity[ReverseConnectivityIndex[i-1]-1]
684 inline const int * MESH::getReverseConnectivityIndex(MED_EN::medConnectivity ConnectivityType,MED_EN::medEntityMesh Entity/*=MED_CELL*/) const
686 // checkGridFillConnectivity();
687 if (NULL==_connectivity)
688 throw MEDEXCEPTION("MESH::getReverseConnectivityIndex : no connectivity defined in MESH !");
690 return _connectivity->getReverseConnectivityIndex(ConnectivityType,Entity);
694 inline int MESH::getNumberOfFamilies (MED_EN::medEntityMesh entity) const
697 case MED_EN::MED_NODE :
698 return _familyNode.size();
699 case MED_EN::MED_CELL :
700 return _familyCell.size();
701 case MED_EN::MED_FACE :
702 return _familyFace.size();
703 case MED_EN::MED_EDGE :
704 return _familyEdge.size();
706 throw MEDEXCEPTION("MESH::getNumberOfFamilies : Unknown entity");
709 inline int MESH::getNumberOfGroups (MED_EN::medEntityMesh entity) const
712 case MED_EN::MED_NODE :
713 return _groupNode.size();
714 case MED_EN::MED_CELL :
715 return _groupCell.size();
716 case MED_EN::MED_FACE :
717 return _groupFace.size();
718 case MED_EN::MED_EDGE :
719 return _groupEdge.size();
721 throw MEDEXCEPTION("MESH::getNumberOfGroups : Unknown entity");
724 const vector<MEDMEM::FAMILY*> MESH::getFamilies(MED_EN::medEntityMesh entity) const
727 case MED_EN::MED_NODE :
729 case MED_EN::MED_CELL :
731 case MED_EN::MED_FACE :
733 case MED_EN::MED_EDGE :
736 throw MEDEXCEPTION("MESH::getFamilies : Unknown entity");
740 const vector<GROUP*> MESH::getGroups(MED_EN::medEntityMesh entity) const
743 case MED_EN::MED_NODE :
745 case MED_EN::MED_CELL :
747 case MED_EN::MED_FACE :
749 case MED_EN::MED_EDGE :
752 throw MEDEXCEPTION("MESH::getGroups : Unknown entity");
756 const MEDMEM::FAMILY* MESH::getFamily(MED_EN::medEntityMesh entity, int i) const
759 throw MEDEXCEPTION("MESH::getFamily(i) : argument i must be > 0");
760 vector<FAMILY*> Family;
762 case MED_EN::MED_NODE : {
763 Family = _familyNode;
766 case MED_EN::MED_CELL : {
767 Family = _familyCell;
770 case MED_EN::MED_FACE : {
771 Family = _familyFace;
774 case MED_EN::MED_EDGE : {
775 Family = _familyEdge;
779 throw MEDEXCEPTION("MESH::getFamilies : Unknown entity");
782 throw MEDEXCEPTION("MESH::getFamily(entity,i) : argument i must be <= _numberOfFamilies");
786 const GROUP* MESH::getGroup(MED_EN::medEntityMesh entity, int i) const
788 const char * LOC = "MESH::getGroup(medEntityMesh entity, int i) : ";
790 throw MEDEXCEPTION(LOCALIZED(STRING(LOC)<<"argument i must be > 0"));
791 vector<GROUP*> Group;
793 case MED_EN::MED_NODE : {
797 case MED_EN::MED_CELL : {
801 case MED_EN::MED_FACE : {
805 case MED_EN::MED_EDGE : {
810 throw MEDEXCEPTION(LOCALIZED(STRING(LOC)<<"Unknown entity"));
813 throw MEDEXCEPTION(LOCALIZED(STRING(LOC)<<"argument i="<<i<<" must be <= _numberOfGroups="<<Group.size()));
822 //inline void MESH::write(const string & driverName) {
823 // write(0,driverName);
826 inline bool MESH::getIsAGrid()
835 #endif /* MESH_HXX */