]> SALOME platform Git repositories - modules/med.git/blob - src/MEDMEM_I/MEDMEM_Mesh_i.cxx
Salome HOME
update after merging trhe branches CEA_V3_0_x, OCC_V3_1_0_a1_x, and the main
[modules/med.git] / src / MEDMEM_I / MEDMEM_Mesh_i.cxx
1 //=============================================================================
2 // File      : MEDMEM_Mesh_i.cxx
3 // Project   : SALOME
4 // Author    : EDF 
5 // Copyright : EDF 2002
6 // $Header: /export/home/PAL/MED_SRC/src/MEDMEM_I/MEDMEM_Mesh_i.cxx
7 //=============================================================================
8
9 #include <vector>
10
11 #include "utilities.h"
12 #include "Utils_CorbaException.hxx"
13 #include "Utils_ORB_INIT.hxx"
14 #include "Utils_SINGLETON.hxx"
15
16 #include "MEDMEM_convert.hxx"
17 #include "MEDMEM_Mesh_i.hxx"
18 #include "MEDMEM_Support_i.hxx"
19 #include "MEDMEM_Family_i.hxx"
20 #include "MEDMEM_Group_i.hxx"
21 #include "MEDMEM_FieldDouble_i.hxx"
22
23 #include "MEDMEM_Mesh.hxx"
24 #include "MEDMEM_Family.hxx"
25 #include "MEDMEM_Group.hxx"
26 #include "MEDMEM_CellModel.hxx"
27
28 #include "SenderFactory.hxx"
29 #include "MultiCommException.hxx"
30 using namespace MEDMEM;
31
32 // Initialisation des variables statiques
33 map < int, ::MESH *> MESH_i::meshMap ;
34 int MESH_i::meshIndex = 0 ;
35
36
37
38 //=============================================================================
39 /*!
40  * Default constructor
41  */
42 //=============================================================================
43 MESH_i::MESH_i(): _mesh(constructConstMesh()),
44                   _corbaIndex(MESH_i::meshIndex++),
45                   _meshId("") 
46 {
47         BEGIN_OF("Default Constructor MESH_i");
48         MESH_i::meshMap[_corbaIndex]=_mesh;
49         END_OF("Default Constructor MESH_i");
50 }
51 //=============================================================================
52 /*!
53  * Destructor
54  */
55 //=============================================================================
56 MESH_i::~MESH_i()
57 {
58 }
59 //=============================================================================
60 /*!
61  * Constructor
62  */
63 //=============================================================================
64 MESH_i::MESH_i(::MESH * const m ) :_mesh(m),
65                         _corbaIndex(MESH_i::meshIndex++),
66                         _meshId("") 
67 {
68         BEGIN_OF("Constructor MESH_i(::MESH * const m )");
69         MESH_i::meshMap[_corbaIndex]=_mesh;
70         SCRUTE(_mesh);
71
72         END_OF("Constructor MESH_i(::MESH * const m )");
73 }
74 //=============================================================================
75 /*!
76  * Copy Constructor 
77  */
78 //=============================================================================
79 //MESH_i::MESH_i(const MESH_i & m) :_mesh(m._mesh),
80 MESH_i::MESH_i( MESH_i & m) :_mesh(m._mesh),
81                              _corbaIndex(MESH_i::meshIndex++),
82                              _meshId("") 
83 {
84         BEGIN_OF("Constructor MESH_i");
85         MESH_i::meshMap[_corbaIndex]=_mesh;
86         END_OF("Constructor MESH_i");
87 }
88 //=============================================================================
89 /*!
90  * Internal Method in order to have a const ptr
91  */
92 //=============================================================================
93 ::MESH * MESH_i::constructConstMesh() const
94 {
95         ::MESH * const ptrMesh =new ::MESH();
96         return ptrMesh;
97 }
98 //=============================================================================
99 /*!
100  * CORBA: Accessor for Name
101  */
102 //=============================================================================
103 char * MESH_i::getName()        
104 throw (SALOME::SALOME_Exception)
105 {
106         if (_mesh==NULL)
107                 THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", \
108                                              SALOME::INTERNAL_ERROR);
109
110         try
111         {
112                 return CORBA::string_dup(_mesh->getName().c_str());
113         }
114         catch (MEDEXCEPTION &ex)
115         {
116                 MESSAGE("Unable to acces the mesh name");
117                 THROW_SALOME_CORBA_EXCEPTION(ex.what(), SALOME::INTERNAL_ERROR);
118         }
119 }
120 //=============================================================================
121 /*!
122  * CORBA: Accessor for corbaindex cuisine interne 
123  */
124 //=============================================================================
125 CORBA::Long MESH_i::getCorbaIndex() 
126 throw (SALOME::SALOME_Exception)
127 {
128         if (_mesh==NULL)
129                 THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", \
130                                              SALOME::INTERNAL_ERROR);
131         return _corbaIndex;
132 }
133 //=============================================================================
134 /*!
135  * CORBA: Accessor for Space Dimension
136  */
137 //=============================================================================
138 CORBA::Long MESH_i::getSpaceDimension() 
139 throw (SALOME::SALOME_Exception)
140 {
141         if (_mesh==NULL)
142                 THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", \
143                                              SALOME::INTERNAL_ERROR);
144         try
145         {
146                 return _mesh->getSpaceDimension();
147         }
148         catch (MEDEXCEPTION &ex)
149         {
150                 MESSAGE("Unable to acces the space dimension ");
151                 THROW_SALOME_CORBA_EXCEPTION(ex.what(), SALOME::INTERNAL_ERROR);
152         }
153 }
154 //=============================================================================
155 /*!
156  * CORBA: Accessor for Mesh Dimension
157  */
158 //=============================================================================
159 CORBA::Long MESH_i::getMeshDimension()
160 throw (SALOME::SALOME_Exception)
161 {
162         if (_mesh==NULL)
163                 THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", \
164                                              SALOME::INTERNAL_ERROR);
165         try
166         {
167                 return _mesh->getMeshDimension();
168         }
169         catch (MEDEXCEPTION &ex)
170         {
171                 MESSAGE("Unable to acces the mesh dimension ");
172                 THROW_SALOME_CORBA_EXCEPTION(ex.what(), SALOME::INTERNAL_ERROR);
173         }
174 }
175 //=============================================================================
176 /*!
177  * CORBA: boolean indicating if mesh is a Grid
178  */
179 //=============================================================================
180 CORBA::Boolean MESH_i::getIsAGrid()
181 throw (SALOME::SALOME_Exception)
182 {
183         if (_mesh==NULL)
184                 THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", \
185                                              SALOME::INTERNAL_ERROR);
186         try
187         {
188                 return _mesh->getIsAGrid();
189         }
190         catch (MEDEXCEPTION &ex)
191         {
192                 MESSAGE("Unable to acces mesh flag isAGrid");
193                 THROW_SALOME_CORBA_EXCEPTION(ex.what(), SALOME::INTERNAL_ERROR);
194         }
195 }
196 //=============================================================================
197 /*!
198  * CORBA: boolean indicating if connectivity exists
199  */
200 //=============================================================================
201 CORBA::Boolean MESH_i::existConnectivity
202                        (SALOME_MED::medConnectivity connectivityType,
203                         SALOME_MED::medEntityMesh entity)
204 throw (SALOME::SALOME_Exception)
205 {
206         if (_mesh==NULL)
207                 THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", \
208                                              SALOME::INTERNAL_ERROR);
209         try
210         {
211                 return _mesh->existConnectivity(connectivityType,
212                                                 convertIdlEntToMedEnt(entity));        }
213         catch (MEDEXCEPTION &ex)
214         {
215                 MESSAGE("Unable to acces mesh flag existConnectivity");
216                 THROW_SALOME_CORBA_EXCEPTION(ex.what(), SALOME::INTERNAL_ERROR);
217         }
218 }
219
220 //=============================================================================
221 /*!
222  * CORBA: Accessor for Coordinates System
223  */
224 //=============================================================================
225 char * MESH_i::getCoordinatesSystem()
226 throw (SALOME::SALOME_Exception)
227 {
228         if (_mesh==NULL)
229                 THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", \
230                                              SALOME::INTERNAL_ERROR);
231
232         try
233         {
234                 return CORBA::string_dup(_mesh->getCoordinatesSystem().c_str());
235         }
236         catch (MEDEXCEPTION &ex)
237         {
238                 MESSAGE("Unable to acces the type of CoordinatesSystem");
239                 THROW_SALOME_CORBA_EXCEPTION(ex.what(), SALOME::INTERNAL_ERROR);
240         }
241 }
242 //=============================================================================
243 /*!
244  * CORBA: Accessor for a specific coordinate
245  */
246 //=============================================================================
247 CORBA::Double MESH_i::getCoordinate(CORBA::Long Number, CORBA::Long Axis)
248 throw (SALOME::SALOME_Exception)
249 {
250         if (_mesh==NULL)
251                 THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", \
252                                              SALOME::INTERNAL_ERROR);
253         try
254         {
255                  return _mesh->getCoordinate(Number,Axis);
256         }
257         catch (MEDEXCEPTION &ex)
258         {
259                 MESSAGE("Unable to acces this coordinate");
260                 THROW_SALOME_CORBA_EXCEPTION(ex.what(), SALOME::INTERNAL_ERROR);
261         }
262 }
263 //=============================================================================
264 /*!
265  * CORBA: Accessor for Coordinates
266  */
267 //=============================================================================
268 SALOME_MED::double_array * MESH_i::getCoordinates(SALOME_MED::medModeSwitch typeSwitch)
269 throw (SALOME::SALOME_Exception)
270 {
271         if (_mesh==NULL)
272                 THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", \
273                                              SALOME::INTERNAL_ERROR);
274         SALOME_MED::double_array_var myseq = new SALOME_MED::double_array;
275         try
276         {
277                 int spaceDimension=_mesh->getSpaceDimension();
278                 int nbNodes=_mesh->getNumberOfNodes();
279                 const double * coordinates =_mesh->getCoordinates(
280                                        convertIdlModeToMedMode(typeSwitch));
281
282                 myseq->length(nbNodes*spaceDimension);
283                 for (int i=0; i<nbNodes*spaceDimension; i++)
284                 {
285                         myseq[i]=coordinates[i];
286                 };
287         }
288         catch (MEDEXCEPTION &ex)
289         {       
290                 MESSAGE("Unable to acces the coordinates");
291                 THROW_SALOME_CORBA_EXCEPTION(ex.what(), SALOME::INTERNAL_ERROR);
292         }
293         return myseq._retn();
294 }
295 //=============================================================================
296 /*!
297  * CORBA: 2nd Accessor for Coordinates
298  */
299 //=============================================================================
300 SALOME::SenderDouble_ptr MESH_i::getSenderForCoordinates(SALOME_MED::medModeSwitch typeSwitch)
301     throw (SALOME::SALOME_Exception)
302 {
303   if (_mesh==NULL)
304     THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", \
305                                  SALOME::INTERNAL_ERROR);
306   SALOME::SenderDouble_ptr ret;
307   try
308     {
309       int spaceDimension=_mesh->getSpaceDimension();
310       int nbNodes=_mesh->getNumberOfNodes();
311       const double * coordinates =_mesh->getCoordinates(convertIdlModeToMedMode(typeSwitch));
312       ret=SenderFactory::buildSender(*this,coordinates,nbNodes*spaceDimension);
313     }
314   catch (MEDEXCEPTION &ex)
315     {       
316       MESSAGE("Unable to acces the coordinates");
317       THROW_SALOME_CORBA_EXCEPTION(ex.what(), SALOME::INTERNAL_ERROR);
318     }
319   catch(MultiCommException &ex2)
320     THROW_SALOME_CORBA_EXCEPTION(ex2.what(),SALOME::INTERNAL_ERROR);
321   return ret;
322 }
323 //=============================================================================
324 /*!
325  * CORBA: Accessor for Coordinates Names
326  */
327 //=============================================================================
328 SALOME_MED::string_array  * MESH_i::getCoordinatesNames() 
329 throw (SALOME::SALOME_Exception)
330 {
331         if (_mesh==NULL)
332                 THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", \
333                                              SALOME::INTERNAL_ERROR);
334         SALOME_MED::string_array_var myseq = new SALOME_MED::string_array;
335         try
336         {
337                 int spaceDimension=_mesh->getSpaceDimension();
338                 const string * coordinatesName =_mesh->getCoordinatesNames();
339                 myseq->length(spaceDimension);
340                 for (int i=0; i<spaceDimension; i++)
341                 {
342                         myseq[i]=CORBA::string_dup(coordinatesName[i].c_str());
343                 }
344         }
345         catch (MEDEXCEPTION &ex)
346         {       
347                 MESSAGE("Unable to acces the coordinates names");
348                 THROW_SALOME_CORBA_EXCEPTION(ex.what(), SALOME::INTERNAL_ERROR);
349         }
350         return myseq._retn();
351
352 }
353 //=============================================================================
354 /*!
355  * CORBA: Accessor for Coordinates Units
356  */
357 //=============================================================================
358 SALOME_MED::string_array *  MESH_i::getCoordinatesUnits()
359 throw (SALOME::SALOME_Exception)
360 {
361         if (_mesh==NULL)
362                 THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", \
363                                              SALOME::INTERNAL_ERROR);
364         SALOME_MED::string_array_var myseq = new SALOME_MED::string_array;
365         try
366         {
367                 int spaceDimension=_mesh->getSpaceDimension();
368                 const string * coordinatesUnits =_mesh->getCoordinatesUnits();
369                 myseq->length(spaceDimension);
370                 for (int i=0; i<spaceDimension; i++)
371                 {
372                          myseq[i]=CORBA::string_dup(coordinatesUnits[i].c_str());
373                 };
374         }
375         catch (MEDEXCEPTION &ex)
376         {       
377                 MESSAGE("Unable to acces the coordinates units");
378                 THROW_SALOME_CORBA_EXCEPTION(ex.what(), SALOME::INTERNAL_ERROR);
379         }
380         return myseq._retn();
381 }
382 //=============================================================================
383 /*!
384  * CORBA: Accessor for Number of Nodes
385  */
386 //=============================================================================
387 CORBA::Long  MESH_i::getNumberOfNodes() 
388 throw (SALOME::SALOME_Exception)
389 {
390         if (_mesh==NULL)
391                 THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", \
392                                              SALOME::INTERNAL_ERROR);
393         try
394         {
395                 return _mesh->getNumberOfNodes();
396         }
397         catch (MEDEXCEPTION &ex)
398         {       
399                 MESSAGE("Unable to acces number of nodes");
400                 THROW_SALOME_CORBA_EXCEPTION(ex.what(), SALOME::INTERNAL_ERROR);
401         }
402 }
403 //=============================================================================
404 /*!
405  * CORBA: Accessor for number of Types
406  */
407 //=============================================================================
408 CORBA::Long MESH_i::getNumberOfTypes(SALOME_MED::medEntityMesh entity) 
409 throw (SALOME::SALOME_Exception)
410 {
411         if (_mesh==NULL)
412                 THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", \
413                                              SALOME::INTERNAL_ERROR);
414         try
415         {
416                 return _mesh->getNumberOfTypes(convertIdlEntToMedEnt(entity));
417         }
418         catch (MEDEXCEPTION &ex)
419         {       
420                 MESSAGE("Unable to acces number of differents types");
421                 THROW_SALOME_CORBA_EXCEPTION(ex.what(), SALOME::INTERNAL_ERROR);
422         }
423 }
424 //=============================================================================
425 /*!
426  * CORBA: Accessor for existing geometry element types
427  */
428 //=============================================================================
429 SALOME_MED::medGeometryElement MESH_i::getElementType (SALOME_MED::medEntityMesh entity,
430                                                        CORBA::Long number)
431 throw (SALOME::SALOME_Exception)
432 {
433         if (_mesh==NULL)
434                 THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", \
435                                              SALOME::INTERNAL_ERROR);
436         try
437         {
438                 return _mesh->getElementType(convertIdlEntToMedEnt(entity),number);
439         }
440         catch (MEDEXCEPTION &ex)
441         {
442                 MESSAGE("Unable to acces number of differents element types");
443                 THROW_SALOME_CORBA_EXCEPTION(ex.what(), SALOME::INTERNAL_ERROR);
444         }
445 }
446
447 //=============================================================================
448 /*!
449  * CORBA: Accessor for existing geometry element types 
450  *        Not implemented for MED_ALL_ENTITIES
451  */
452 //=============================================================================
453 SALOME_MED::medGeometryElement_array * MESH_i::getTypes (SALOME_MED::medEntityMesh entity) 
454 throw (SALOME::SALOME_Exception)
455 {
456         if (_mesh==NULL)
457                 THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", \
458                                              SALOME::INTERNAL_ERROR);
459         if (entity ==SALOME_MED::MED_ALL_ENTITIES)
460                 THROW_SALOME_CORBA_EXCEPTION("Not implemented for MED_ALL_ENTITIES",\
461                                              SALOME::BAD_PARAM);
462         SALOME_MED::medGeometryElement_array_var myseq = 
463                                         new SALOME_MED::medGeometryElement_array;
464         try
465         {
466                 int nbTypes=_mesh->getNumberOfTypes(convertIdlEntToMedEnt(entity));
467                 const medGeometryElement * elemts  =_mesh->getTypes(
468                                        convertIdlEntToMedEnt(entity));
469                 myseq->length(nbTypes);
470                 for (int i=0; i<nbTypes; i++)
471                 {
472                         myseq[i]=convertMedEltToIdlElt(elemts[i]);
473                 };
474         }
475         catch (MEDEXCEPTION &ex)
476         {       
477                 MESSAGE("Unable to acces coordinates");
478                 THROW_SALOME_CORBA_EXCEPTION(ex.what(), SALOME::INTERNAL_ERROR);
479         }
480         return myseq._retn();
481 }
482 //=============================================================================
483 /*!
484  * CORBA: Returns number of elements of type medGeometryElement
485  *        Not implemented for MED_ALL_ELEMENTS 
486 *         implemented for MED_ALL_ENTITIES
487  */
488 //=============================================================================
489 CORBA::Long MESH_i::getNumberOfElements(SALOME_MED::medEntityMesh entity, 
490                                         SALOME_MED::medGeometryElement geomElement)
491 throw (SALOME::SALOME_Exception)
492 {
493         if (_mesh==NULL)
494                 THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", \
495                                              SALOME::INTERNAL_ERROR);
496         if (verifieParam(entity,geomElement)==false)
497                 THROW_SALOME_CORBA_EXCEPTION("parameters don't match",\
498                                              SALOME::BAD_PARAM);
499         
500         try
501         {
502                 return _mesh->getNumberOfElements(convertIdlEntToMedEnt(entity),
503                                                   convertIdlEltToMedElt(geomElement));
504         }
505         catch (MEDEXCEPTION &ex)
506         {
507                 MESSAGE("Unable to acces number of elements");
508                 THROW_SALOME_CORBA_EXCEPTION(ex.what(), SALOME::INTERNAL_ERROR);
509         }
510 }
511 //=============================================================================
512 /*!
513  * CORBA: Accessor for connectivities
514  */
515 //=============================================================================
516 SALOME_MED::long_array *  MESH_i::getConnectivity(SALOME_MED::medModeSwitch typeSwitch,
517                                                SALOME_MED::medConnectivity mode, 
518                                                SALOME_MED::medEntityMesh entity, 
519                                                SALOME_MED::medGeometryElement geomElement)
520 throw (SALOME::SALOME_Exception)
521 {
522         if (_mesh==NULL)
523                 THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", \
524                                              SALOME::INTERNAL_ERROR);
525         if (verifieParam(entity,geomElement)==false)
526                 THROW_SALOME_CORBA_EXCEPTION("parameters don't match",\
527                                              SALOME::BAD_PARAM);
528         SALOME_MED::long_array_var myseq= new SALOME_MED::long_array;
529         try
530         {
531                 int nbelements; 
532                 int elt1 = _mesh->getNumberOfElements(
533                                         convertIdlEntToMedEnt(entity),
534                                         convertIdlEltToMedElt(geomElement));
535 SCRUTE(elt1);
536                 if ( mode == SALOME_MED::MED_DESCENDING)
537                 {
538 MESSAGE("MED_DESCENDING");
539                   int elt2 =(_mesh->getCellsTypes(MED_CELL))->getNumberOfConstituents(1);
540                    //int elt2 =(_mesh->getTypes(convertIdlEltToMedElt(geomElement)))->getNumberOfConstituents(1);
541                    nbelements= elt2 * elt1;
542 SCRUTE(elt2);
543                 }
544                 else
545                 {
546 MESSAGE("MED_NODAL");
547                         const int * tab=_mesh->getConnectivityIndex(
548                                 convertIdlConnToMedConn(mode),
549                                 convertIdlEntToMedEnt(entity));
550                         nbelements = elt1*(convertIdlEltToMedElt(geomElement)%100);
551                         //                      nbelements = tab[elt1 ] - 1 ;
552                 }
553 SCRUTE(entity);
554 SCRUTE(geomElement);
555 SCRUTE(nbelements);
556                 myseq->length(nbelements);
557                 const int * numbers=_mesh->getConnectivity(convertIdlModeToMedMode(typeSwitch),
558                                                      convertIdlConnToMedConn(mode),
559                                                      convertIdlEntToMedEnt(entity),
560                                                      convertIdlEltToMedElt(geomElement));
561                 for (int i=0;i<nbelements;i++)
562                 {
563                         myseq[i]=numbers[i];
564                 }
565         }
566         catch (MEDEXCEPTION &ex)
567         {
568                 MESSAGE("Unable to acces connectivities");
569                 THROW_SALOME_CORBA_EXCEPTION(ex.what(), SALOME::INTERNAL_ERROR);
570         }
571         return myseq._retn();
572 }
573 //=============================================================================
574 /*!
575  * CORBA: 2nd Accessor for connectivities
576  */
577 //=============================================================================
578 SALOME::SenderInt_ptr MESH_i::getSenderForConnectivity(SALOME_MED::medModeSwitch typeSwitch,
579                                                SALOME_MED::medConnectivity mode, 
580                                                SALOME_MED::medEntityMesh entity, 
581                                                SALOME_MED::medGeometryElement geomElement)
582 throw (SALOME::SALOME_Exception)
583 {
584   if (_mesh==NULL)
585     THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", \
586                                  SALOME::INTERNAL_ERROR);
587   if (verifieParam(entity,geomElement)==false)
588     THROW_SALOME_CORBA_EXCEPTION("parameters don't match",\
589                                  SALOME::BAD_PARAM);
590   SALOME::SenderInt_ptr ret;
591   try
592     {
593       int nbelements=_mesh->getConnectivityLength(convertIdlModeToMedMode(typeSwitch),
594                                                  convertIdlConnToMedConn(mode),
595                                                  convertIdlEntToMedEnt(entity),
596                                                  convertIdlEltToMedElt(geomElement));
597       const int * numbers=_mesh->getConnectivity(convertIdlModeToMedMode(typeSwitch),
598                                                  convertIdlConnToMedConn(mode),
599                                                  convertIdlEntToMedEnt(entity),
600                                                  convertIdlEltToMedElt(geomElement));
601       ret=SenderFactory::buildSender(*this,numbers,nbelements);
602     }
603   catch (MEDEXCEPTION &ex)
604     {
605       MESSAGE("Unable to acces connectivities");
606       THROW_SALOME_CORBA_EXCEPTION(ex.what(), SALOME::INTERNAL_ERROR);
607     }
608   catch(MultiCommException &ex2)
609     THROW_SALOME_CORBA_EXCEPTION(ex2.what(),SALOME::INTERNAL_ERROR);
610   return ret;
611 }
612
613 //=======================================================================
614 //function : getSenderForPolygonsConnectivity
615 //purpose  : 
616 //=======================================================================
617
618 SALOME::SenderInt_ptr MESH_i::getSenderForPolygonsConnectivity(SALOME_MED::medConnectivity mode,
619                                                                SALOME_MED::medEntityMesh entity)
620   throw (SALOME::SALOME_Exception)
621 {
622   if (_mesh==NULL)
623     THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", \
624                                  SALOME::INTERNAL_ERROR);
625   if (verifieParam(entity,SALOME_MED::MED_POLYGON)==false)
626     THROW_SALOME_CORBA_EXCEPTION("parameters don't match",\
627                                  SALOME::BAD_PARAM);
628   SALOME::SenderInt_ptr ret;
629   try
630     {
631       int nbelements = _mesh->getPolygonsConnectivityLength(convertIdlConnToMedConn(mode),
632                                                             convertIdlEntToMedEnt(entity));
633       const int * numbers=_mesh->getPolygonsConnectivity (convertIdlConnToMedConn(mode),
634                                                           convertIdlEntToMedEnt(entity));
635       ret=SenderFactory::buildSender(*this,numbers,nbelements);
636     }
637   catch (MEDEXCEPTION &ex)
638     {
639       MESSAGE("Unable to acces connectivities");
640       THROW_SALOME_CORBA_EXCEPTION(ex.what(), SALOME::INTERNAL_ERROR);
641     }
642   catch(MultiCommException &ex2)
643     THROW_SALOME_CORBA_EXCEPTION(ex2.what(),SALOME::INTERNAL_ERROR);
644   return ret;
645 }
646
647 //=======================================================================
648 //function : getSenderForPolygonsConnectivityIndex
649 //purpose  : 
650 //=======================================================================
651
652 SALOME::SenderInt_ptr MESH_i::getSenderForPolygonsConnectivityIndex(SALOME_MED::medConnectivity mode,
653                                                             SALOME_MED::medEntityMesh entity)
654       throw (SALOME::SALOME_Exception)
655 {
656   if (_mesh==NULL)
657     THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", \
658                                  SALOME::INTERNAL_ERROR);
659   if (verifieParam(entity,SALOME_MED::MED_POLYGON)==false)
660     THROW_SALOME_CORBA_EXCEPTION("parameters don't match",\
661                                  SALOME::BAD_PARAM);
662   SALOME::SenderInt_ptr ret;
663   try
664     {
665       int nbelements = _mesh->getNumberOfPolygons() + 1;
666       const int * numbers=_mesh->getPolygonsConnectivityIndex (convertIdlConnToMedConn(mode),
667                                                                convertIdlEntToMedEnt(entity));
668       ret=SenderFactory::buildSender(*this,numbers,nbelements);
669     }
670   catch (MEDEXCEPTION &ex)
671     {
672       MESSAGE("Unable to acces connectivities");
673       THROW_SALOME_CORBA_EXCEPTION(ex.what(), SALOME::INTERNAL_ERROR);
674     }
675   catch(MultiCommException &ex2)
676     THROW_SALOME_CORBA_EXCEPTION(ex2.what(),SALOME::INTERNAL_ERROR);
677   return ret;
678 }
679
680 //=======================================================================
681 //function : getSenderForPolyhedronConnectivity
682 //purpose  : 
683 //=======================================================================
684
685 SALOME::SenderInt_ptr MESH_i::getSenderForPolyhedronConnectivity(SALOME_MED::medConnectivity mode)
686     throw (SALOME::SALOME_Exception)
687 {
688   if (_mesh==NULL)
689     THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", \
690                                  SALOME::INTERNAL_ERROR);
691   SALOME::SenderInt_ptr ret;
692   try
693     {
694       int nbelements = _mesh->getPolyhedronConnectivityLength(convertIdlConnToMedConn(mode));
695       const int * numbers=_mesh->getPolyhedronConnectivity( convertIdlConnToMedConn(mode) );
696       ret=SenderFactory::buildSender(*this,numbers,nbelements);
697     }
698   catch (MEDEXCEPTION &ex)
699     {
700       MESSAGE("Unable to acces connectivities");
701       THROW_SALOME_CORBA_EXCEPTION(ex.what(), SALOME::INTERNAL_ERROR);
702     }
703   catch(MultiCommException &ex2)
704     THROW_SALOME_CORBA_EXCEPTION(ex2.what(),SALOME::INTERNAL_ERROR);
705   return ret;
706 }
707
708 //=======================================================================
709 //function : getSenderForPolyhedronIndex
710 //purpose  : 
711 //=======================================================================
712
713 SALOME::SenderInt_ptr MESH_i::getSenderForPolyhedronIndex(SALOME_MED::medConnectivity mode)
714     throw (SALOME::SALOME_Exception)
715 {
716   if (_mesh==NULL)
717     THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", \
718                                  SALOME::INTERNAL_ERROR);
719   SALOME::SenderInt_ptr ret;
720   try
721     {
722       int nbelements = _mesh->getNumberOfPolyhedron() + 1;
723       const int * numbers = _mesh->getPolyhedronIndex( convertIdlConnToMedConn( mode ) );
724       ret=SenderFactory::buildSender(*this,numbers,nbelements);
725     }
726   catch (MEDEXCEPTION &ex)
727     {
728       MESSAGE("Unable to acces connectivities");
729       THROW_SALOME_CORBA_EXCEPTION(ex.what(), SALOME::INTERNAL_ERROR);
730     }
731   catch(MultiCommException &ex2)
732     THROW_SALOME_CORBA_EXCEPTION(ex2.what(),SALOME::INTERNAL_ERROR);
733   return ret;
734 }
735
736 //=======================================================================
737 //function : getSenderForPolyhedronFacesIndex
738 //purpose  : 
739 //=======================================================================
740
741 SALOME::SenderInt_ptr MESH_i::getSenderForPolyhedronFacesIndex()
742     throw (SALOME::SALOME_Exception)
743 {
744   if (_mesh==NULL)
745     THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", \
746                                  SALOME::INTERNAL_ERROR);
747   SALOME::SenderInt_ptr ret;
748   try
749     {
750       int nbelements = _mesh->getNumberOfPolyhedronFaces() + 1;
751       const int * numbers=_mesh->getPolyhedronFacesIndex();
752       ret=SenderFactory::buildSender(*this,numbers,nbelements);
753     }
754   catch (MEDEXCEPTION &ex)
755     {
756       MESSAGE("Unable to acces connectivities");
757       THROW_SALOME_CORBA_EXCEPTION(ex.what(), SALOME::INTERNAL_ERROR);
758     }
759   catch(MultiCommException &ex2)
760     THROW_SALOME_CORBA_EXCEPTION(ex2.what(),SALOME::INTERNAL_ERROR);
761   return ret;
762 }
763
764 //=============================================================================
765 /*!
766  * CORBA: Accessor for connectivities
767  */
768 //=============================================================================
769 SALOME_MED::long_array* MESH_i::getConnectivityIndex(SALOME_MED::medConnectivity mode, 
770                                                   SALOME_MED::medEntityMesh entity) 
771 throw (SALOME::SALOME_Exception)
772 {
773         if (_mesh==NULL)
774                 THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", \
775                                              SALOME::INTERNAL_ERROR);
776         SALOME_MED::long_array_var myseq= new SALOME_MED::long_array;
777         try
778         {
779                 int nbelements = _mesh->getNumberOfElements(
780                                         convertIdlEntToMedEnt(entity),
781                                         MED_ALL_ELEMENTS);
782                 myseq->length(nbelements);
783                 const int * numbers=_mesh->getConnectivityIndex(convertIdlConnToMedConn(mode),
784                                                           convertIdlEntToMedEnt(entity));
785                 for (int i=0;i<nbelements;i++)
786                 {
787                         myseq[i]=numbers[i];
788                 }
789         }
790         catch (MEDEXCEPTION &ex)
791         {
792                 MESSAGE("Unable to acces connectivities index");
793                 THROW_SALOME_CORBA_EXCEPTION(ex.what(), SALOME::INTERNAL_ERROR);
794         }
795         return myseq._retn();
796 }
797 //=============================================================================
798 /*!
799  * CORBA: Accessor for connectivities
800  */
801 //=============================================================================
802 SALOME_MED::long_array* MESH_i::getGlobalNumberingIndex( SALOME_MED::medEntityMesh entity)
803 throw (SALOME::SALOME_Exception)
804 {
805         if (_mesh==NULL)
806                 THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", \
807                                              SALOME::INTERNAL_ERROR);
808         SALOME_MED::long_array_var myseq= new SALOME_MED::long_array;
809         try
810         {
811                 int nbelements = _mesh->getNumberOfTypes( convertIdlEntToMedEnt(entity)) + 1;
812                 myseq->length(nbelements);
813                 const int * numbers=_mesh->getGlobalNumberingIndex( convertIdlEntToMedEnt(entity));
814                 for (int i=0;i<nbelements;i++)
815                 {
816                         myseq[i]=numbers[i];
817                 }
818         }
819         catch (MEDEXCEPTION &ex)
820         {
821                 MESSAGE("Unable to acces global index");
822                 THROW_SALOME_CORBA_EXCEPTION(ex.what(), SALOME::INTERNAL_ERROR);
823         }
824         return myseq._retn();
825 }
826
827 //=============================================================================
828 /*!
829  * CORBA: get global element number in connectivity array
830  * not implemented for MED_NODE and MED_ALL_ENTITIES,
831  * MED_NONE and MED_ALL_ELEMENTS.
832  */
833 //=============================================================================
834 CORBA::Long MESH_i::getElementNumber(SALOME_MED::medConnectivity mode,
835                                      SALOME_MED::medEntityMesh entity,
836                                      SALOME_MED::medGeometryElement type,
837                                      const SALOME_MED::long_array& connectivity)
838   throw (SALOME::SALOME_Exception)
839 {
840   if (_mesh==NULL)
841     THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", SALOME::INTERNAL_ERROR);
842   int numberOfValue = connectivity.length() ;
843   int * myConnectivity = new int[numberOfValue] ;
844   for (int i=0; i<numberOfValue; i++)
845     myConnectivity[i]=connectivity[i] ;
846
847   int result ;
848   try {
849     result = _mesh->getElementNumber(convertIdlConnToMedConn(mode),
850                                      convertIdlEntToMedEnt(entity),
851                                      convertIdlEltToMedElt(type),
852                                      myConnectivity) ;
853   }
854   catch (MEDEXCEPTION &ex) {
855     THROW_SALOME_CORBA_EXCEPTION(ex.what(), SALOME::INTERNAL_ERROR);
856   }
857   return result ;
858 }
859 //=============================================================================
860 /*!
861  * CORBA: Accessor for Ascendant connectivities
862  * not implemented for MED_ALL_ENTITIES and MED_MAILLE
863  */
864 //=============================================================================
865 SALOME_MED::long_array* MESH_i::getReverseConnectivity(SALOME_MED::medConnectivity mode)
866 throw (SALOME::SALOME_Exception)
867 {
868         if (_mesh==NULL)
869                 THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", \
870                                              SALOME::INTERNAL_ERROR);
871         SALOME_MED::long_array_var myseq= new SALOME_MED::long_array;
872         try
873         {
874                 int nbelements=_mesh->getReverseConnectivityLength(convertIdlConnToMedConn(mode));
875                 SCRUTE(nbelements);
876                 myseq->length(nbelements);
877                 const int * numbers=_mesh->getReverseConnectivity(convertIdlConnToMedConn(mode));
878                 for (int i=0;i<nbelements;i++)
879                 {
880                         myseq[i]=numbers[i];
881                 }
882         }
883         catch (MEDEXCEPTION &ex)
884         {
885                 MESSAGE("Unable to acces reverse connectivities");
886                 THROW_SALOME_CORBA_EXCEPTION(ex.what(), SALOME::INTERNAL_ERROR);
887         }
888         return myseq._retn();
889 }
890 //=============================================================================
891 /*!
892  * CORBA: Accessor for connectivities
893  */
894 //=============================================================================
895 SALOME_MED::long_array* MESH_i::getReverseConnectivityIndex(SALOME_MED::medConnectivity mode)
896 throw (SALOME::SALOME_Exception)
897 {
898         if (_mesh==NULL)
899                 THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", \
900                                              SALOME::INTERNAL_ERROR);
901         SALOME_MED::long_array_var myseq= new SALOME_MED::long_array;
902         try
903         {
904                 int nbelements=_mesh->getReverseConnectivityIndexLength(convertIdlConnToMedConn(mode));
905                 myseq->length(nbelements);
906                 const int * numbers=_mesh->getReverseConnectivityIndex(convertIdlConnToMedConn(mode));
907                 for (int i=0;i<nbelements;i++)
908                 {
909                         myseq[i]=numbers[i];
910                 }
911         }
912         catch (MEDEXCEPTION &ex)
913         {
914                 MESSAGE("Unable to acces reverse connectivities index");
915                 THROW_SALOME_CORBA_EXCEPTION(ex.what(), SALOME::INTERNAL_ERROR);
916         }
917         return myseq._retn();
918 }
919 //=============================================================================
920 /*!
921  * CORBA: Returns number of families within the mesh
922  */
923 //=============================================================================
924 CORBA::Long MESH_i::getNumberOfFamilies(SALOME_MED::medEntityMesh entity)
925 throw (SALOME::SALOME_Exception)
926 {
927         if (_mesh==NULL)
928                 THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", \
929                                              SALOME::INTERNAL_ERROR);
930         try
931         {
932                 return _mesh->getNumberOfFamilies(convertIdlEntToMedEnt(entity));
933         }
934         catch (MEDEXCEPTION &ex)
935         {
936                 MESSAGE("Unable to acces number of families of the mesh");
937                 THROW_SALOME_CORBA_EXCEPTION(ex.what(), SALOME::INTERNAL_ERROR);
938         }
939 }
940 //=============================================================================
941 /*!
942  * CORBA: Returns number of groups within the mesh
943  */
944 //=============================================================================
945 CORBA::Long MESH_i::getNumberOfGroups(SALOME_MED::medEntityMesh entity) 
946 throw (SALOME::SALOME_Exception)
947 {
948         if (_mesh==NULL)
949                 THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", \
950                                              SALOME::INTERNAL_ERROR);
951         try
952         {
953                 return _mesh->getNumberOfGroups(convertIdlEntToMedEnt(entity));
954         }
955         catch (MEDEXCEPTION &ex)
956         {
957                 MESSAGE("Unable to acces number of groups of the mesh");
958                 THROW_SALOME_CORBA_EXCEPTION(ex.what(), SALOME::INTERNAL_ERROR);
959         }
960 }
961 //=============================================================================
962 /*!
963  * CORBA: Returns references for families within the mesh
964  */
965 //=============================================================================
966 SALOME_MED::Family_array * MESH_i::getFamilies(SALOME_MED::medEntityMesh entity) 
967 throw (SALOME::SALOME_Exception)
968 {
969         if (_mesh==NULL)
970                 THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", \
971                                              SALOME::INTERNAL_ERROR);
972         SALOME_MED::Family_array_var myseq = new SALOME_MED::Family_array;
973         try
974         {
975                 int nbfam= _mesh->getNumberOfFamilies(convertIdlEntToMedEnt(entity));
976                 myseq->length(nbfam);
977                 vector<FAMILY*> fam(nbfam);
978                 fam = _mesh->getFamilies(convertIdlEntToMedEnt(entity));
979                 for (int i=0;i<nbfam;i++)
980                 {
981                         FAMILY_i * f1=new FAMILY_i(fam[i]);
982                         myseq[i] = f1->POA_SALOME_MED::FAMILY::_this();
983                 }
984         }
985         catch (MEDEXCEPTION &ex)
986         {
987                 MESSAGE("Unable to acces families of the mesh");
988                 THROW_SALOME_CORBA_EXCEPTION(ex.what(), SALOME::INTERNAL_ERROR);
989         }
990         return myseq._retn();
991 }
992 //=============================================================================
993 /*!
994  * CORBA: Returns Coordinates global informations
995  */
996 //=============================================================================
997 SALOME_MED::MESH::coordinateInfos *  MESH_i::getCoordGlobal()
998 throw (SALOME::SALOME_Exception)
999 {
1000         if (_mesh==NULL)
1001                 THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", \
1002                                              SALOME::INTERNAL_ERROR);
1003         SALOME_MED::MESH::coordinateInfos_var all = new SALOME_MED::MESH::coordinateInfos;
1004         try
1005         {
1006                 all->coordSystem = CORBA::string_dup(_mesh->getCoordinatesSystem().c_str());
1007
1008                 int spaceDimension=_mesh->getSpaceDimension();
1009                 const string * coordinatesUnits =_mesh->getCoordinatesUnits();
1010                 const string * coordinatesName =_mesh->getCoordinatesNames();
1011
1012                 all->coordUnits.length(spaceDimension);
1013                 all->coordNames.length(spaceDimension);
1014                 for (int i=0; i<spaceDimension; i++)
1015                 {
1016                          all->coordUnits[i]=CORBA::string_dup(coordinatesUnits[i].c_str());
1017                          all->coordNames[i]=CORBA::string_dup(coordinatesName[i].c_str());
1018                 }
1019         }
1020         catch (MEDEXCEPTION &ex)
1021         {
1022                 MESSAGE("Unable to acces coordinate information ");
1023                 THROW_SALOME_CORBA_EXCEPTION(ex.what(), SALOME::INTERNAL_ERROR);
1024         }
1025         return all._retn();
1026 }
1027 //=============================================================================
1028 /*!
1029  * CORBA: Returns connectivity global informations
1030  */
1031 //=============================================================================
1032 SALOME_MED::MESH::connectivityInfos * MESH_i::getConnectGlobal
1033                         (SALOME_MED::medEntityMesh entity)
1034 throw (SALOME::SALOME_Exception)
1035 {
1036         if (_mesh==NULL)
1037                 THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", \
1038                                              SALOME::INTERNAL_ERROR);
1039         SALOME_MED::MESH::connectivityInfos_var all=new SALOME_MED::MESH::connectivityInfos;
1040         try
1041         {
1042                 all->numberOfNodes  = _mesh->getNumberOfNodes();
1043
1044                 int nbTypes=_mesh->getNumberOfTypesWithPoly(convertIdlEntToMedEnt(entity));
1045                 const medGeometryElement * elemts  =_mesh->getTypesWithPoly(
1046                                        convertIdlEntToMedEnt(entity));
1047                 all->meshTypes.length(nbTypes);
1048                 all->numberOfElements.length(nbTypes);
1049                 all->entityDimension=_mesh->getConnectivityptr()->getEntityDimension();
1050                 for (int i=0; i<nbTypes; i++)
1051                 {
1052                         all->meshTypes[i]=convertMedEltToIdlElt(elemts[i]);
1053                         all->numberOfElements[i]=_mesh->getNumberOfElementsWithPoly(
1054                                        convertIdlEntToMedEnt(entity),elemts[i]);
1055                 }
1056         }
1057         catch (MEDEXCEPTION &ex)
1058         {
1059                 MESSAGE("Unable to acces connectivities informations");
1060                 THROW_SALOME_CORBA_EXCEPTION(ex.what(), SALOME::INTERNAL_ERROR);
1061         }
1062         return all._retn();
1063 }
1064
1065 //=============================================================================
1066 /*!
1067  * CORBA: Returns references for family i within the mesh
1068  */
1069 //=============================================================================
1070 SALOME_MED::FAMILY_ptr MESH_i::getFamily(SALOME_MED::medEntityMesh entity,
1071                                          CORBA::Long i) 
1072 throw (SALOME::SALOME_Exception)
1073 {
1074         if (_mesh==NULL)
1075                 THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", \
1076                                              SALOME::INTERNAL_ERROR);
1077         try
1078         {
1079                 const FAMILY * fam = _mesh->getFamily(convertIdlEntToMedEnt(entity),i);
1080                 FAMILY_i * f1=new FAMILY_i(fam);
1081                 return f1->POA_SALOME_MED::FAMILY::_this();
1082         }
1083         catch (MEDEXCEPTION &ex)
1084         {
1085                 MESSAGE("Unable to acces specified family of the mesh");
1086                 THROW_SALOME_CORBA_EXCEPTION(ex.what(), SALOME::INTERNAL_ERROR);
1087         }
1088
1089 }
1090 //=============================================================================
1091 /*
1092  * CORBA: Returns Mesh global informations
1093  */
1094 //=============================================================================
1095 SALOME_MED::MESH::meshInfos *  MESH_i::getMeshGlobal()
1096 throw (SALOME::SALOME_Exception)
1097 {
1098         if (_mesh==NULL)
1099                 THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", \
1100                                              SALOME::INTERNAL_ERROR);
1101         SALOME_MED::MESH::meshInfos_var all = new SALOME_MED::MESH::meshInfos;
1102         try
1103         {
1104                 all->name = CORBA::string_dup(_mesh->getName().c_str());
1105                 all->spaceDimension = _mesh->getSpaceDimension();
1106                 all->meshDimension  = _mesh->getMeshDimension();
1107                 all->numberOfNodes  = _mesh->getNumberOfNodes();
1108                 all->isAGrid        = _mesh->getIsAGrid();
1109
1110                 int nbFam= _mesh->getNumberOfFamilies(MED_NODE);
1111                 all->famNode.length(nbFam);
1112                 vector<FAMILY*> vNode (nbFam);
1113                 vNode = _mesh->getFamilies(MED_NODE);
1114                 for (int i=0;i<nbFam;i++)
1115                 {
1116                         FAMILY_i * f1=new FAMILY_i(vNode[i]);
1117                         all->famNode[i] = f1->POA_SALOME_MED::FAMILY::_this();
1118                 }
1119
1120                 nbFam = _mesh->getNumberOfFamilies(MED_EDGE);
1121                 all->famEdge.length(nbFam);
1122                 vector<FAMILY*> vEdge (nbFam);
1123                 vEdge = _mesh->getFamilies(MED_EDGE);
1124                 for (int i=0;i<nbFam;i++)
1125                 for (int i=0;i<nbFam;i++)
1126                 {
1127                         FAMILY_i * f1=new FAMILY_i(vEdge[i]);
1128                         all->famEdge[i] = f1->POA_SALOME_MED::FAMILY::_this();
1129                 }
1130
1131                 nbFam = _mesh->getNumberOfFamilies(MED_FACE);
1132                 all->famFace.length(nbFam);
1133                 vector<FAMILY*> vFace (nbFam);
1134                 vFace = _mesh->getFamilies(MED_FACE);
1135                 for (int i=0;i<nbFam;i++)
1136                 {
1137                         FAMILY_i * f1=new FAMILY_i(vFace[i]);
1138                         all->famFace[i] = f1->POA_SALOME_MED::FAMILY::_this();
1139                 }
1140
1141                 nbFam = _mesh->getNumberOfFamilies(MED_CELL);
1142                 all->famCell.length(nbFam);
1143                 vector<FAMILY*> vCell (nbFam);
1144                 vCell = _mesh->getFamilies(MED_CELL);
1145                 for (int i=0;i<nbFam;i++)
1146                 {
1147                         FAMILY_i * f1=new FAMILY_i(vCell[i]);
1148                         all->famCell[i] = f1->POA_SALOME_MED::FAMILY::_this();
1149                 }
1150
1151                 int nbGroup = _mesh->getNumberOfGroups(MED_NODE);
1152                 all->groupNode.length(nbGroup);
1153                 vector<GROUP*> gNode (nbGroup);
1154                 gNode = _mesh->getGroups(MED_NODE);
1155                 for (int i=0;i<nbGroup;i++)
1156                 {
1157                         GROUP_i * f1=new GROUP_i(gNode[i]);
1158                         all->groupNode[i] = f1->POA_SALOME_MED::GROUP::_this();
1159                 }
1160
1161                 nbGroup = _mesh->getNumberOfGroups(MED_EDGE);
1162                 all->groupEdge.length(nbGroup);
1163                 vector<GROUP*> gEdge (nbGroup);
1164                 gEdge = _mesh->getGroups(MED_EDGE);
1165                 for (int i=0;i<nbGroup;i++)
1166                 {
1167                         GROUP_i * f1=new GROUP_i(gEdge[i]);
1168                         all->groupEdge[i] = f1->POA_SALOME_MED::GROUP::_this();
1169                 }
1170                 nbGroup = _mesh->getNumberOfGroups(MED_FACE);
1171                 all->groupFace.length(nbGroup);
1172                 vector<GROUP*> gFace (nbGroup);
1173                 gFace = _mesh->getGroups(MED_FACE);
1174                 for (int i=0;i<nbGroup;i++)
1175                 {
1176                         GROUP_i * f1=new GROUP_i(gFace[i]);
1177                         all->groupFace[i] = f1->POA_SALOME_MED::GROUP::_this();
1178                 }
1179
1180                 nbGroup = _mesh->getNumberOfGroups(MED_CELL);
1181                 all->groupCell.length(nbGroup);
1182                 vector<GROUP*> gCell (nbGroup);
1183                 gCell = _mesh->getGroups(MED_CELL);
1184                 for (int i=0;i<nbGroup;i++)
1185                 {
1186                         GROUP_i * f1=new GROUP_i(gCell[i]);
1187                         all->groupCell[i] = f1->POA_SALOME_MED::GROUP::_this();
1188                 }
1189
1190         }
1191         catch (MEDEXCEPTION &ex)
1192         {
1193                 MESSAGE("Unable to acces mesh");
1194                 THROW_SALOME_CORBA_EXCEPTION(ex.what(), SALOME::INTERNAL_ERROR);
1195         }
1196         return all._retn();
1197 }
1198 //=============================================================================
1199  /*
1200  * CORBA: Returns references for groups within the mesh
1201  */
1202 //=============================================================================
1203 SALOME_MED::Group_array *  MESH_i::getGroups(SALOME_MED::medEntityMesh entity) 
1204 throw (SALOME::SALOME_Exception)
1205 {
1206         if (_mesh==NULL)
1207                 THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", \
1208                                              SALOME::INTERNAL_ERROR);
1209         SALOME_MED::Group_array_var myseq = new SALOME_MED::Group_array;
1210         try
1211         {
1212                 int nbgroups = _mesh->getNumberOfGroups(convertIdlEntToMedEnt(entity));
1213                 myseq->length(nbgroups);
1214                 vector<GROUP*> groups(nbgroups);
1215                 groups = _mesh->getGroups(convertIdlEntToMedEnt(entity));
1216                 for (int i=0;i<nbgroups;i++)
1217                 {
1218                         GROUP_i * f1=new GROUP_i(groups[i]);
1219                         myseq[i] = f1->POA_SALOME_MED::GROUP::_this();
1220                 }
1221         }
1222         catch (MEDEXCEPTION &ex)
1223         {
1224                 MESSAGE("Unable to acces number of groups of the mesh");
1225                 THROW_SALOME_CORBA_EXCEPTION(ex.what(), SALOME::INTERNAL_ERROR);
1226         }
1227         return myseq._retn();
1228 }
1229 //=============================================================================
1230 /*!
1231  * CORBA: Returns references for group i within the mesh
1232  */
1233 //=============================================================================
1234 SALOME_MED::GROUP_ptr MESH_i::getGroup(SALOME_MED::medEntityMesh entity,
1235                                        CORBA::Long i) 
1236 throw (SALOME::SALOME_Exception)
1237 {
1238         if (_mesh==NULL)
1239                 THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", \
1240                                               SALOME::INTERNAL_ERROR);
1241         try
1242         {
1243                 const GROUP * grou = _mesh->getGroup(convertIdlEntToMedEnt(entity),i);
1244                 GROUP_i * f1=new GROUP_i(grou);
1245                 return f1->POA_SALOME_MED::GROUP::_this();
1246         }
1247         catch (MEDEXCEPTION &ex)
1248         {
1249                 MESSAGE("Unable to acces specified group of the mesh");
1250                 THROW_SALOME_CORBA_EXCEPTION(ex.what(), SALOME::INTERNAL_ERROR);
1251         }
1252 }
1253 //=============================================================================
1254 /*!
1255  * CORBA:
1256  */
1257 //=============================================================================
1258 SALOME_MED::SUPPORT_ptr MESH_i::getBoundaryElements(SALOME_MED::medEntityMesh entity)
1259 throw (SALOME::SALOME_Exception)
1260 {
1261         if (_mesh==NULL)
1262                 THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", \
1263                                               SALOME::INTERNAL_ERROR);
1264         try
1265         {
1266                 SUPPORT * myNewSupport = _mesh->getBoundaryElements(convertIdlEntToMedEnt(entity));
1267                 SUPPORT_i * mySupportI = new SUPPORT_i(myNewSupport);
1268                 return mySupportI->_this();
1269         }
1270         catch (MEDEXCEPTION &ex)
1271         {
1272                 MESSAGE("Unable to get the volume ");
1273                 THROW_SALOME_CORBA_EXCEPTION(ex.what(), SALOME::INTERNAL_ERROR);
1274         }
1275 }
1276 //=============================================================================
1277 /*!
1278  * CORBA: 
1279  */
1280 //=============================================================================
1281 SALOME_MED::FIELD_ptr MESH_i::getVolume(SALOME_MED::SUPPORT_ptr mySupport)
1282 throw (SALOME::SALOME_Exception)
1283 {
1284         if (_mesh==NULL)
1285                 THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", \
1286                                               SALOME::INTERNAL_ERROR); try
1287         {
1288                 int sup = mySupport->getCorbaIndex();
1289                 ASSERT(SUPPORT_i::supportMap.find(sup)!=SUPPORT_i::supportMap.end());
1290                 const SUPPORT * myCppSupport=SUPPORT_i::supportMap[sup];
1291                 ::FIELD<double>*f=_mesh->getVolume( myCppSupport);
1292                 FIELDDOUBLE_i * medf = new FIELDDOUBLE_i(f);
1293                 return medf->_this();
1294         }
1295         catch (MEDEXCEPTION &ex)
1296         {
1297                 MESSAGE("Unable to get the volume ");
1298                 THROW_SALOME_CORBA_EXCEPTION(ex.what(), SALOME::INTERNAL_ERROR);
1299         }
1300 }
1301 //=============================================================================
1302 /*!
1303  * CORBA:
1304  */
1305 //=============================================================================
1306 SALOME_MED::SUPPORT_ptr MESH_i::getSkin(SALOME_MED::SUPPORT_ptr mySupport3D)
1307 throw (SALOME::SALOME_Exception)
1308 {
1309         if (_mesh==NULL)
1310                 THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", \
1311                                               SALOME::INTERNAL_ERROR);
1312         try
1313         {
1314                 int sup = mySupport3D->getCorbaIndex();
1315                 ASSERT(SUPPORT_i::supportMap.find(sup)!=SUPPORT_i::supportMap.end());
1316                 const SUPPORT * myCppSupport=SUPPORT_i::supportMap[sup];
1317                 SUPPORT * myNewSupport = _mesh->getSkin(myCppSupport);
1318                 SUPPORT_i * mySupportI = new SUPPORT_i(myNewSupport);
1319                 return mySupportI->_this() ;
1320         }
1321         catch (MEDEXCEPTION &ex)
1322         {
1323                 MESSAGE("Unable to get the volume ");
1324                 THROW_SALOME_CORBA_EXCEPTION(ex.what(), SALOME::INTERNAL_ERROR);
1325         }
1326 }
1327 //=============================================================================
1328 /*!
1329  * CORBA: 
1330  */
1331 //=============================================================================
1332 SALOME_MED::FIELD_ptr MESH_i::getArea(SALOME_MED::SUPPORT_ptr mySupport)
1333 throw (SALOME::SALOME_Exception)
1334 {
1335         if (_mesh==NULL)
1336                 THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", \
1337                                               SALOME::INTERNAL_ERROR);
1338         try
1339         {
1340                 int sup = mySupport->getCorbaIndex();
1341                 ASSERT(SUPPORT_i::supportMap.find(sup)!=SUPPORT_i::supportMap.end());
1342                 const SUPPORT * myCppSupport=SUPPORT_i::supportMap[sup];
1343                 ::FIELD<double>*f=_mesh->getArea( myCppSupport);
1344                 FIELDDOUBLE_i * medf = new FIELDDOUBLE_i(f);
1345                 return medf->_this();
1346         }
1347         catch (MEDEXCEPTION &ex)
1348         {
1349                 MESSAGE("Unable to get the area ");
1350                 THROW_SALOME_CORBA_EXCEPTION(ex.what(), SALOME::INTERNAL_ERROR);
1351         }
1352 }
1353 //=============================================================================
1354 /*!
1355  * CORBA: 
1356  */
1357 //=============================================================================
1358 SALOME_MED::FIELD_ptr MESH_i::getLength(SALOME_MED::SUPPORT_ptr mySupport)
1359 throw (SALOME::SALOME_Exception)
1360 {
1361         if (_mesh==NULL)
1362                 THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", \
1363                                               SALOME::INTERNAL_ERROR);
1364         try
1365         {
1366                 int sup = mySupport->getCorbaIndex();
1367                 ASSERT(SUPPORT_i::supportMap.find(sup)!=SUPPORT_i::supportMap.end());
1368                 const SUPPORT * myCppSupport=SUPPORT_i::supportMap[sup];
1369                 ::FIELD<double>*f=_mesh->getLength( myCppSupport);
1370                 FIELDDOUBLE_i * medf = new FIELDDOUBLE_i(f);
1371                 return medf->_this();
1372         }
1373         catch (MEDEXCEPTION &ex)
1374         {
1375                 MESSAGE("Unable to get the length ");
1376                 THROW_SALOME_CORBA_EXCEPTION(ex.what(), SALOME::INTERNAL_ERROR);
1377         }
1378 }
1379 //=============================================================================
1380 /*!
1381  * CORBA: 
1382  */
1383 //=============================================================================
1384 SALOME_MED::FIELD_ptr MESH_i::getNormal(SALOME_MED::SUPPORT_ptr mySupport)
1385 throw (SALOME::SALOME_Exception)
1386 {
1387         if (_mesh==NULL)
1388                 THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", \
1389                                               SALOME::INTERNAL_ERROR);
1390         try
1391         {
1392                 int sup = mySupport->getCorbaIndex();
1393                 ASSERT(SUPPORT_i::supportMap.find(sup)!=SUPPORT_i::supportMap.end());
1394                 const SUPPORT * myCppSupport=SUPPORT_i::supportMap[sup];
1395                 ::FIELD<double>*f=_mesh->getNormal( myCppSupport);
1396                 FIELDDOUBLE_i * medf = new FIELDDOUBLE_i(f);
1397                 return medf->_this();
1398         }
1399         catch (MEDEXCEPTION &ex)
1400         {
1401                 MESSAGE("Unable to get the normal ");
1402                 THROW_SALOME_CORBA_EXCEPTION(ex.what(), SALOME::INTERNAL_ERROR);
1403         }
1404 }
1405 //=============================================================================
1406 /*!
1407  * CORBA: 
1408  */
1409 //=============================================================================
1410 SALOME_MED::FIELD_ptr MESH_i::getBarycenter(SALOME_MED::SUPPORT_ptr mySupport)
1411 throw (SALOME::SALOME_Exception)
1412 {
1413         if (_mesh==NULL)
1414                 THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", \
1415                                               SALOME::INTERNAL_ERROR);
1416         try
1417         {
1418                 int sup = mySupport->getCorbaIndex();
1419                 ASSERT(SUPPORT_i::supportMap.find(sup)!=SUPPORT_i::supportMap.end());
1420                 const SUPPORT * myCppSupport=SUPPORT_i::supportMap[sup];
1421                 ::FIELD<double>*f=_mesh->getBarycenter( myCppSupport);
1422                 FIELDDOUBLE_i * medf = new FIELDDOUBLE_i(f);
1423                 return medf->_this();
1424         }
1425         catch (MEDEXCEPTION &ex)
1426         {
1427                 MESSAGE("Unable to get the barycenter ");
1428                 THROW_SALOME_CORBA_EXCEPTION(ex.what(), SALOME::INTERNAL_ERROR);
1429         }
1430 }
1431 //=============================================================================
1432 /*!
1433  * CORBA: 
1434  */
1435 //=============================================================================
1436 SALOME_MED::FIELD_ptr MESH_i::getNeighbourhood(SALOME_MED::SUPPORT_ptr mySupport)
1437 throw (SALOME::SALOME_Exception)
1438 {
1439         if (_mesh==NULL)
1440                 THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", \
1441                                               SALOME::INTERNAL_ERROR);
1442         MESSAGE("Not Implemented");
1443 }
1444 //=============================================================================
1445 /*!
1446  * CORBA: add the Mesh in the StudyManager 
1447  */
1448 //=============================================================================
1449 void MESH_i::addInStudy(SALOMEDS::Study_ptr myStudy,SALOME_MED::MESH_ptr myIor )
1450 throw (SALOME::SALOME_Exception,SALOMEDS::StudyBuilder::LockProtection)
1451 {
1452         BEGIN_OF("MED_Mesh_i::addInStudy");
1453         if ( _meshId != "" )
1454         {
1455                 MESSAGE("Mesh already in Study");
1456                     THROW_SALOME_CORBA_EXCEPTION("Mesh already in Study", \
1457                                  SALOME::BAD_PARAM);
1458         };
1459
1460         SALOMEDS::StudyBuilder_var     myBuilder = myStudy->NewBuilder();
1461         SALOMEDS::GenericAttribute_var anAttr;
1462         SALOMEDS::AttributeName_var    aName;
1463         SALOMEDS::AttributeIOR_var     aIOR;
1464
1465         // Find SComponent labelled 'MED'
1466         SALOMEDS::SComponent_var medfather = myStudy->FindComponent("MED");
1467         myBuilder->NewCommand();
1468         if ( CORBA::is_nil(medfather) ) 
1469           THROW_SALOME_CORBA_EXCEPTION("SComponent labelled 'Med' not Found",SALOME::INTERNAL_ERROR);
1470
1471         // Create SObject labelled 'MESH' if it doesn't already exit
1472 //      SALOMEDS::SObject_var medmeshfather = myStudy->FindObject("MEDMESH");
1473 //      if ( CORBA::is_nil(medmeshfather) ) 
1474 //      {
1475 //              MESSAGE("Add Object MEDMESH");
1476 //              medmeshfather = myBuilder->NewObject(medfather);
1477 //              //medmeshfather.Name = "MEDMESH" ;
1478 //                 anAttr = myBuilder->FindOrCreateAttribute(medmeshfather, "AttributeName");
1479 //                 aName = SALOMEDS::AttributeName::_narrow(anAttr);
1480 //                 aName->SetValue("MEDMESH");
1481
1482 //      } ;
1483
1484         SALOMEDS::SObject_var medmeshfather = myStudy->FindObjectByPath("/Med/MEDMESH");
1485         if ( CORBA::is_nil(medmeshfather) ) 
1486           {
1487             MESSAGE("Add Object MEDMESH");
1488
1489             myBuilder->AddDirectory("/Med/MEDMESH");
1490             medmeshfather = myStudy->FindObjectByPath("/Med/MEDMESH");
1491           } ;
1492
1493         MESSAGE("Add a mesh Object under MED/MEDMESH");
1494         SALOMEDS::SObject_var newObj = myBuilder->NewObject(medmeshfather);
1495
1496         ORB_INIT &init = *SINGLETON_<ORB_INIT>::Instance() ;
1497         ASSERT(SINGLETON_<ORB_INIT>::IsAlreadyExisting()) ;
1498         CORBA::ORB_var &orb = init(0,0);
1499         string iorStr = orb->object_to_string(myIor);
1500         anAttr = myBuilder->FindOrCreateAttribute(newObj, "AttributeIOR");
1501         aIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
1502         aIOR->SetValue(iorStr.c_str());
1503         anAttr = myBuilder->FindOrCreateAttribute(newObj, "AttributeName");
1504         aName = SALOMEDS::AttributeName::_narrow(anAttr);
1505         aName->SetValue(_mesh->getName().c_str());
1506         _meshId = newObj->GetID();
1507         myBuilder->CommitCommand();
1508
1509         // register the Corba pointer: increase the referrence count
1510         MESSAGE("Registering of the Corba Mesh pointer");
1511         Register();
1512
1513         END_OF("Mesh_i::addInStudy(SALOMEDS::Study_ptr myStudy)");
1514 }
1515 //=============================================================================
1516 /*!
1517  * CORBA: add the Mesh in the StudyManager
1518  */
1519 //=============================================================================
1520 void MESH_i::addInStudy(SALOMEDS::Study_ptr myStudy,SALOME_MED::MESH_ptr myIor,const string & fileName )
1521 throw (SALOME::SALOME_Exception,SALOMEDS::StudyBuilder::LockProtection)
1522 {
1523         BEGIN_OF("MED_Mesh_i::addInStudy");
1524         if ( _meshId != "" )
1525         {
1526                 MESSAGE("Mesh already in Study");
1527                     THROW_SALOME_CORBA_EXCEPTION("Mesh already in Study", \
1528                                  SALOME::BAD_PARAM);
1529         };
1530
1531         SALOMEDS::StudyBuilder_var     myBuilder = myStudy->NewBuilder();
1532         SALOMEDS::GenericAttribute_var anAttr;
1533         SALOMEDS::AttributeName_var    aName;
1534         SALOMEDS::AttributeIOR_var     aIOR;
1535         SALOMEDS::AttributeComment_var aComment;
1536
1537         // Find SComponent labelled 'Med'
1538         SALOMEDS::SComponent_var medfather = myStudy->FindComponent("MED");
1539         if ( CORBA::is_nil(medfather) )
1540           THROW_SALOME_CORBA_EXCEPTION("SComponent labelled 'Med' not Found",SALOME::INTERNAL_ERROR);
1541
1542         // Create SObject labelled 'MESH' if it doesn't already exit
1543         SALOMEDS::SObject_var medmeshfather = myStudy->FindObject("MEDMESH");
1544         if ( CORBA::is_nil(medmeshfather) )
1545         {
1546                 MESSAGE("Add Object MEDMESH");
1547                 medmeshfather = myBuilder->NewObject(medfather);
1548                 //medmeshfather.Name = "MEDMESH" ;
1549                 anAttr = myBuilder->FindOrCreateAttribute(medmeshfather, "AttributeName");
1550                 aName = SALOMEDS::AttributeName::_narrow(anAttr);
1551                 aName->SetValue("MEDMESH");
1552
1553         } ;
1554
1555         MESSAGE("Add a mesh Object under MED/MEDMESH");
1556         myBuilder->NewCommand();
1557         SALOMEDS::SObject_var newObj = myBuilder->NewObject(medmeshfather);
1558
1559         ORB_INIT &init = *SINGLETON_<ORB_INIT>::Instance() ;
1560         ASSERT(SINGLETON_<ORB_INIT>::IsAlreadyExisting()) ;
1561         CORBA::ORB_var &orb = init(0,0);
1562         string iorStr = orb->object_to_string(myIor);
1563         anAttr = myBuilder->FindOrCreateAttribute(newObj, "AttributeIOR");
1564         aIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
1565         aIOR->SetValue(iorStr.c_str());
1566         anAttr = myBuilder->FindOrCreateAttribute(newObj, "AttributeName");
1567         aName = SALOMEDS::AttributeName::_narrow(anAttr);
1568         aName->SetValue(_mesh->getName().c_str());
1569         anAttr = myBuilder->FindOrCreateAttribute(newObj, "AttributeComment");
1570         aComment = SALOMEDS::AttributeComment::_narrow(anAttr);
1571         aComment->SetValue(fileName.c_str());
1572         _meshId = newObj->GetID();
1573         myBuilder->CommitCommand();
1574
1575         // register the Corba pointer: increase the referrence count
1576         MESSAGE("Registering of the Corba Mesh pointer");
1577         Register();
1578
1579         END_OF("Mesh_i::addInStudy(SALOMEDS::Study_ptr myStudy)");
1580 }
1581 //=============================================================================
1582
1583 //=============================================================================
1584 /*!
1585  * CORBA: write mesh in a med file
1586  */
1587 //=============================================================================
1588 void MESH_i::write(CORBA::Long i, const char* driverMeshName)        
1589 throw (SALOME::SALOME_Exception)
1590 {
1591         if (_mesh==NULL)
1592                 THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", \
1593                                              SALOME::INTERNAL_ERROR);
1594         try
1595         {
1596                 _mesh->write(i,driverMeshName);
1597         }
1598         catch (MEDEXCEPTION &ex)
1599         {
1600                 MESSAGE("Unable to write the mesh ");
1601                 THROW_SALOME_CORBA_EXCEPTION(ex.what(), SALOME::INTERNAL_ERROR);
1602         }
1603 }
1604 //=============================================================================
1605 /*!
1606  * CORBA: read mesh in a med file
1607  */
1608 //=============================================================================
1609 void MESH_i::read(CORBA::Long i)             
1610 throw (SALOME::SALOME_Exception)
1611 {
1612         if (_mesh==NULL)
1613                 THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", \
1614                                              SALOME::INTERNAL_ERROR);
1615         try
1616         {
1617                 _mesh->read(i);
1618         }
1619         catch (MEDEXCEPTION &ex)
1620         {
1621                 MESSAGE("Unable to read the mesh ");
1622                 THROW_SALOME_CORBA_EXCEPTION(ex.what(), SALOME::INTERNAL_ERROR);
1623         }
1624 }
1625 //=============================================================================
1626 /*!
1627  * CORBA : release driver
1628  */
1629 //=============================================================================
1630 void MESH_i::rmDriver(CORBA::Long i)         
1631 throw (SALOME::SALOME_Exception)
1632 {
1633         if (_mesh==NULL)
1634                 THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", \
1635                                              SALOME::INTERNAL_ERROR);
1636         try
1637         {
1638                 _mesh->rmDriver();
1639         }
1640         catch (MEDEXCEPTION &ex)
1641         {
1642                 MESSAGE("Unable to unlink the mesh from the driver ");
1643                 THROW_SALOME_CORBA_EXCEPTION(ex.what(), SALOME::INTERNAL_ERROR);
1644                 THROW_SALOME_CORBA_EXCEPTION("Unable to acces Support C++ Object"\
1645                                                 ,SALOME::INTERNAL_ERROR);
1646         }
1647 }
1648 //=============================================================================
1649 /*!
1650  * CORBA : attach driver
1651  */
1652 //=============================================================================
1653 CORBA::Long MESH_i::addDriver(SALOME_MED::medDriverTypes driverType, 
1654                               const char* fileName, const char* meshName)
1655 throw (SALOME::SALOME_Exception)
1656 {
1657         if (_mesh==NULL)
1658                 THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", \
1659                                              SALOME::INTERNAL_ERROR);
1660         try
1661         {
1662                 int drivernum=_mesh->addDriver(
1663                                         convertIdlDriverToMedDriver(driverType),
1664                                         fileName,
1665                                         meshName);
1666                 return drivernum;
1667         }
1668         catch (MEDEXCEPTION &ex)
1669         {
1670                 MESSAGE("Unable to link the mesh to the driver ");
1671                 THROW_SALOME_CORBA_EXCEPTION(ex.what(), SALOME::INTERNAL_ERROR);
1672         }
1673 }
1674
1675 //=============================================================================
1676 /*!
1677  * CORBA : Test if this and other aggregate the same MESH using the MESH::operator==
1678  */
1679 //=============================================================================
1680 CORBA::Boolean MESH_i::areEquals(SALOME_MED::MESH_ptr other)
1681 {
1682   PortableServer::ServantBase *baseServ;
1683   try {
1684     baseServ=_default_POA()->reference_to_servant(other);
1685   }
1686   catch(...){
1687     baseServ=0;
1688   }
1689   if(baseServ)
1690     {
1691      baseServ->_remove_ref();
1692      MESH_i *otherServ=dynamic_cast<MESH_i *>(baseServ);
1693      return *_mesh==*otherServ->_mesh;
1694     }
1695   return false;
1696 }