]> SALOME platform Git repositories - modules/med.git/blob - src/MEDMEM_I/MEDMEM_Field_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_Field_i.cxx
1 //=============================================================================
2 // File      : MEDMEM_Field_i.cxx
3 // Created   : mer fév 20 15:47:57 CET 2002
4 // Author    : EDF
5 // Project   : SALOME
6 // Copyright : EDF 2002
7 // $Header: /export/home/PAL/MED_SRC/src/MEDMEM_I/MEDMEM_Field_i.cxx
8 //=============================================================================
9 #include "MEDMEM_Field_i.hxx"
10
11 using namespace MEDMEM;
12 using namespace MED_EN;
13
14 map < int, ::FIELD_ * > FIELD_i::fieldMap ;
15 int  FIELD_i::fieldIndex = 0;
16 //=============================================================================
17 /*!
18  * Default constructor
19  */
20 //=============================================================================
21
22 //FIELD_i::FIELD_i():_fieldTptr(FIELD_i::constructConstField())
23 FIELD_i::FIELD_i():_fieldTptr(constructConstField()),_corbaIndex(FIELD_i::fieldIndex++)
24 {
25         BEGIN_OF("Default Constructor Field_i");
26         END_OF(" Default Constructor Field_i");
27 }
28 //=============================================================================
29 /*!
30  * Destructor
31  */
32 //=============================================================================
33 FIELD_i::~FIELD_i()
34 {
35   if (_ownCppPtr) delete _fieldTptr;
36 }
37 //=============================================================================
38 /*!
39  * Constructor
40  */
41 //=============================================================================
42 FIELD_i::FIELD_i(::FIELD_ * const field, bool ownCppPtr):
43   _fieldTptr(field),
44   _corbaIndex(FIELD_i::fieldIndex++),
45   _FieldId(""),
46   _ownCppPtr(ownCppPtr)
47 {
48   BEGIN_OF("Constructor FIELD_i(SALOME_MED::SUPPORT_ptr support,::FIELD<T> * const field)");
49   FIELD_i::fieldMap[_corbaIndex]=_fieldTptr;
50
51   MESSAGE("FIELD_i::FIELD_i  Checking of pointeurs !!!");
52
53   SCRUTE(_fieldTptr);
54
55   END_OF("Constructor FIELD_i(SALOME_MED::SUPPORT_ptr support,::FIELD<T> * const field)");
56 }
57
58 //=============================================================================
59 /*!
60  * Constructor par recopie
61  */
62 //=============================================================================
63 FIELD_i::FIELD_i( FIELD_i & f):_fieldTptr(f._fieldTptr),
64                                _corbaIndex(FIELD_i::fieldIndex++),
65                                _FieldId(""), _ownCppPtr(false)
66 {
67         BEGIN_OF("Constructor Field_i");
68         FIELD_i::fieldMap[_corbaIndex]=_fieldTptr;
69         END_OF("Constructor Field_i");
70 }
71 //=============================================================================
72 /*!
73  * Constructor d un pointeur constant 
74  */
75 //=============================================================================
76  ::FIELD_ * FIELD_i::constructConstField() const
77 {
78         ::FIELD_ * const ptrField =new ::FIELD_();
79         return ptrField;
80 }
81 //=============================================================================
82 /*!
83  * CORBA: Accessor for Fields's Name
84  */
85 //=============================================================================
86 char * FIELD_i::getName()
87 throw (SALOME::SALOME_Exception)
88 {
89         if (_fieldTptr==NULL)
90                 THROW_SALOME_CORBA_EXCEPTION("No associated Field", \
91                                              SALOME::INTERNAL_ERROR);
92         try
93         {
94                 return CORBA::string_dup(_fieldTptr->getName().c_str());
95         }
96         catch (MEDEXCEPTION &ex)
97         {
98                 MESSAGE("Exception en accedant au nom");
99                 THROW_SALOME_CORBA_EXCEPTION(ex.what(), SALOME::INTERNAL_ERROR);
100         }
101 }
102 //=============================================================================
103 /*!
104  * CORBA: Accessor for Fields's Description
105  */
106 //=============================================================================
107 char * FIELD_i::getDescription()
108 throw (SALOME::SALOME_Exception)
109 {
110         if (_fieldTptr==NULL)
111                 THROW_SALOME_CORBA_EXCEPTION("No associated Field", \
112                                              SALOME::INTERNAL_ERROR);
113         try
114         {
115                 return CORBA::string_dup(_fieldTptr->getDescription().c_str());
116         }
117         catch (MEDEXCEPTION &ex)
118         {
119                 MESSAGE("Exception en accedant a la description");
120                 THROW_SALOME_CORBA_EXCEPTION(ex.what(), SALOME::INTERNAL_ERROR);
121         }
122 }
123 //=============================================================================
124 /*!
125  * CORBA: Accessor for Fields's Support
126  */
127 //=============================================================================
128
129 SALOME_MED::SUPPORT_ptr FIELD_i::getSupport()
130   throw (SALOME::SALOME_Exception)
131 {
132   BEGIN_OF("SALOME_MED::SUPPORT_ptr FIELD_i::getSupport()");
133
134   if (_fieldTptr==NULL)
135     THROW_SALOME_CORBA_EXCEPTION("No associated Field",
136                                  SALOME::INTERNAL_ERROR);
137   
138   SUPPORT_i* servant = new SUPPORT_i(_fieldTptr->getSupport());
139
140   SALOME_MED::SUPPORT_ptr support=servant->_this();
141
142   SCRUTE(_fieldTptr);
143
144   END_OF("SALOME_MED::SUPPORT_ptr FIELD_i::getSupport()");
145
146   return support ;
147 }
148 //=============================================================================
149 /*!
150  * CORBA: Accessor for Fields's Number of components
151  */
152 //=============================================================================
153 CORBA::Long FIELD_i::getNumberOfComponents()
154 throw (SALOME::SALOME_Exception)
155 {
156         if (_fieldTptr==NULL)
157                 THROW_SALOME_CORBA_EXCEPTION("No associated Field", \
158                                              SALOME::INTERNAL_ERROR);
159         try
160         {
161                 return _fieldTptr->getNumberOfComponents();
162         }
163         catch (MEDEXCEPTION &ex)
164         {
165                 MESSAGE("Exception en accedant au support");
166                 THROW_SALOME_CORBA_EXCEPTION(ex.what(), SALOME::INTERNAL_ERROR);
167         }
168 }
169 //=============================================================================
170 /*!
171  * CORBA: Accessor for names of component I
172  */
173 //=============================================================================
174 char * FIELD_i::getComponentName(CORBA::Long i)
175 throw (SALOME::SALOME_Exception)
176 {
177         if (_fieldTptr==NULL)
178                 THROW_SALOME_CORBA_EXCEPTION("No associated Field", \
179                                              SALOME::INTERNAL_ERROR);
180         try
181         {
182                 return CORBA::string_dup(_fieldTptr->getComponentName(i).c_str());
183         }
184         catch (MEDEXCEPTION &ex)
185         {
186                 MESSAGE("Exception en accedant au nom d un component");
187                 THROW_SALOME_CORBA_EXCEPTION(ex.what(), SALOME::INTERNAL_ERROR);
188         }
189 }
190 //=============================================================================
191 /*!
192  * CORBA: Accessor for unit of component I
193  */
194 //=============================================================================
195 char * FIELD_i::getComponentUnit(CORBA::Long i)
196 throw (SALOME::SALOME_Exception)
197 {
198         if (_fieldTptr==NULL)
199                 THROW_SALOME_CORBA_EXCEPTION("No associated Field", \
200                                              SALOME::INTERNAL_ERROR);
201         try
202         {
203                 return CORBA::string_dup(_fieldTptr->getMEDComponentUnit(i).c_str());
204         }
205         catch (MEDEXCEPTION &ex)
206         {
207                 MESSAGE("Exception en accedant au nom d un component");
208                 THROW_SALOME_CORBA_EXCEPTION(ex.what(), SALOME::INTERNAL_ERROR);
209         }
210 }
211 //=============================================================================
212 /*!
213  * CORBA: Accessor for description of component I
214  */
215 //=============================================================================
216 char * FIELD_i::getComponentDescription(CORBA::Long i)
217 throw (SALOME::SALOME_Exception)
218 {
219         if (_fieldTptr==NULL)
220                 THROW_SALOME_CORBA_EXCEPTION("No associated Field", \
221                                              SALOME::INTERNAL_ERROR);
222         try
223         {
224                 return CORBA::string_dup(_fieldTptr->getComponentDescription(i).c_str());
225         }
226         catch (MEDEXCEPTION &ex)
227         {
228                 MESSAGE("Exception en accedant a la description d un component");
229                 THROW_SALOME_CORBA_EXCEPTION(ex.what(), SALOME::INTERNAL_ERROR);
230         }
231 }
232 //=============================================================================
233 /*!
234  * CORBA: Accessor for iteration number 
235  */
236 //=============================================================================
237 CORBA::Long FIELD_i::getIterationNumber()
238 throw (SALOME::SALOME_Exception)
239 {
240         if (_fieldTptr==NULL)
241                 THROW_SALOME_CORBA_EXCEPTION("No associated Field", \
242                                              SALOME::INTERNAL_ERROR);
243         try
244         {
245                 return _fieldTptr->getIterationNumber();
246         }
247         catch (MEDEXCEPTION &ex)
248         {
249                 MESSAGE("Exception en accedant au champ");
250                 THROW_SALOME_CORBA_EXCEPTION(ex.what(), SALOME::INTERNAL_ERROR);
251         }
252 }
253 //=============================================================================
254 /*!
255  * CORBA: Accessor for Corba Number 
256  */
257 //=============================================================================
258 CORBA::Long FIELD_i::getCorbaIndex()
259 throw (SALOME::SALOME_Exception)
260 {
261         if (_fieldTptr==NULL)
262                 THROW_SALOME_CORBA_EXCEPTION("No associated Field", \
263                                              SALOME::INTERNAL_ERROR);
264         return _corbaIndex;
265         
266 }
267 //=============================================================================
268 /*!
269  * CORBA: Accessor for iteration number 
270  */
271 //=============================================================================
272 CORBA::Long FIELD_i::getOrderNumber()
273 throw (SALOME::SALOME_Exception)
274 {
275         if (_fieldTptr==NULL)
276                 THROW_SALOME_CORBA_EXCEPTION("No associated Field", \
277                                              SALOME::INTERNAL_ERROR);
278         try
279         {
280                 return _fieldTptr->getOrderNumber();
281         }
282         catch (MEDEXCEPTION &ex)
283         {
284                 MESSAGE("Exception en accedant au champ");
285                 THROW_SALOME_CORBA_EXCEPTION(ex.what(), SALOME::INTERNAL_ERROR);
286         }
287 }
288 //=============================================================================
289 /*!
290  * CORBA: Accessor  
291  */
292 //=============================================================================
293 CORBA::Double FIELD_i::getTime()
294 throw (SALOME::SALOME_Exception)
295 {
296         if (_fieldTptr==NULL)
297                 THROW_SALOME_CORBA_EXCEPTION("No associated Field", \
298                                              SALOME::INTERNAL_ERROR);
299         try
300         {
301                 return _fieldTptr->getTime();
302         }
303         catch (MEDEXCEPTION &ex)
304         {
305                 MESSAGE("Exception en accedant au champ");
306                 THROW_SALOME_CORBA_EXCEPTION(ex.what(), SALOME::INTERNAL_ERROR);
307         }
308 }
309 //=============================================================================
310 /*!
311  * CORBA: Accessor for Fields's Components names
312  */
313 //=============================================================================
314 SALOME_MED::string_array * FIELD_i::getComponentsNames()
315 throw (SALOME::SALOME_Exception)    
316 {
317         if (_fieldTptr==NULL)
318                 THROW_SALOME_CORBA_EXCEPTION("No associated Field", \
319                                              SALOME::INTERNAL_ERROR);
320         SALOME_MED::string_array_var myseq = new SALOME_MED::string_array;
321         try
322         {
323                 int nbcom = _fieldTptr->getNumberOfComponents();
324                 myseq->length(nbcom);
325                 const string * namecom=_fieldTptr->getComponentsNames();
326                 for (int i=0;i<nbcom;i++)
327                 {
328                         myseq[i]=CORBA::string_dup(namecom[i].c_str());
329                 }
330         }
331         catch (MEDEXCEPTION &ex)
332         {
333                 MESSAGE("Exception en accedant au champ");
334                 THROW_SALOME_CORBA_EXCEPTION(ex.what(), SALOME::INTERNAL_ERROR);
335         }
336         return myseq._retn();
337 }
338 //=============================================================================
339 /*!
340  * CORBA: Accessor for Fields's Components units
341  */
342 //=============================================================================
343 SALOME_MED::string_array * FIELD_i::getComponentsUnits()
344 throw (SALOME::SALOME_Exception)
345 {
346         if (_fieldTptr==NULL)
347                 THROW_SALOME_CORBA_EXCEPTION("No associated Field", \
348                                              SALOME::INTERNAL_ERROR);
349         SALOME_MED::string_array_var myseq = new SALOME_MED::string_array;
350         try
351         {
352                 int nbcom = _fieldTptr->getNumberOfComponents();
353                 myseq->length(nbcom);
354                 const string * unitcom=_fieldTptr->getMEDComponentsUnits();
355                 for (int i=0;i<nbcom;i++)
356                 {
357                         myseq[i]=CORBA::string_dup(unitcom[i].c_str());
358                 }
359         }
360         catch (MEDEXCEPTION &ex)
361         {
362                 MESSAGE("Exception en accedant au champ");
363                 THROW_SALOME_CORBA_EXCEPTION(ex.what(), SALOME::INTERNAL_ERROR);
364         }
365         return myseq._retn();
366 }
367 //=============================================================================
368 /*!
369  * CORBA: Accessor for Fields's Components descriptions
370  */
371 //=============================================================================
372 SALOME_MED::string_array * FIELD_i::getComponentsDescriptions()
373 throw (SALOME::SALOME_Exception)    
374 {
375         if (_fieldTptr==NULL)
376                 THROW_SALOME_CORBA_EXCEPTION("No associated Field", \
377                                              SALOME::INTERNAL_ERROR);
378         SALOME_MED::string_array_var myseq = new SALOME_MED::string_array;
379         try
380         {
381                 int nbcom = _fieldTptr->getNumberOfComponents();
382                 myseq->length(nbcom);
383                 const string * namecom=_fieldTptr->getComponentsDescriptions();
384                 for (int i=0;i<nbcom;i++)
385                 {
386                         myseq[i]=CORBA::string_dup(namecom[i].c_str());
387                 }
388         }
389         catch (MEDEXCEPTION &ex)
390         {
391                 MESSAGE("Exception en accedant au champ");
392                 THROW_SALOME_CORBA_EXCEPTION(ex.what(), SALOME::INTERNAL_ERROR);
393         }
394         return myseq._retn();
395 }
396 //=============================================================================
397 /*!
398  * CORBA: Add in Study
399  */
400 //=============================================================================
401 void FIELD_i::addInStudy(SALOMEDS::Study_ptr myStudy, 
402                                                  SALOME_MED::FIELD_ptr myIor )
403                     throw (SALOME::SALOME_Exception, SALOMEDS::StudyBuilder::LockProtection)
404 {
405         BEGIN_OF(" FIELD_i::addInStudy");
406         if (_fieldTptr==NULL)
407                 THROW_SALOME_CORBA_EXCEPTION("No associated Field", \
408                                              SALOME::INTERNAL_ERROR);
409         if ( _FieldId != "" )
410         {
411                 MESSAGE("Field already in Study");
412                     THROW_SALOME_CORBA_EXCEPTION("Field already in Study", \
413                                  SALOME::BAD_PARAM);
414         };
415
416
417         SALOMEDS::StudyBuilder_var myBuilder = myStudy->NewBuilder();
418         SALOMEDS::GenericAttribute_var anAttr;
419         SALOMEDS::AttributeName_var    aName;
420         SALOMEDS::AttributeIOR_var     aIOR;
421
422         // Create SComponent labelled 'Med'
423         SALOMEDS::SComponent_var medfather = myStudy->FindComponent("MED");
424         if ( CORBA::is_nil(medfather) )
425           THROW_SALOME_CORBA_EXCEPTION("SComponent labelled 'MED' not Found",SALOME::INTERNAL_ERROR);
426
427         // Create SObject labelled 'MEDFIELD' if it doesn't already exit
428         SALOMEDS::SObject_var medfieldfather = myStudy->FindObject("MEDFIELD");
429         if ( CORBA::is_nil(medfieldfather) ) 
430         {
431           MESSAGE("Add Object 'MEDFIELD'");
432           medfieldfather = myBuilder->NewObject(medfather);
433           anAttr = myBuilder->FindOrCreateAttribute(medfieldfather, "AttributeName");
434           aName = SALOMEDS::AttributeName::_narrow(anAttr);
435           aName->SetValue("MEDFIELD");
436           
437         } ;
438
439         string fieldName = _fieldTptr->getName();
440
441         // Create SObject labelled 'FIELDNAME' if it doesn't already exit
442         SALOMEDS::SObject_var medfieldnamefather = myStudy->FindObject(fieldName.c_str());
443         if ( CORBA::is_nil(medfieldnamefather) ) 
444         {
445           MESSAGE("Add Object "<<fieldName);
446           medfieldnamefather = myBuilder->NewObject(medfieldfather);
447           anAttr = myBuilder->FindOrCreateAttribute(medfieldnamefather, "AttributeName");
448           aName = SALOMEDS::AttributeName::_narrow(anAttr);
449           aName->SetValue(fieldName.c_str());
450
451         } ;
452
453         // Create object labelled according to Field's Name
454
455         MESSAGE("Add a Field Object under "<<fieldName);
456         myBuilder->NewCommand();
457         SALOMEDS::SObject_var newObj = myBuilder->NewObject(medfieldnamefather);
458
459         ORB_INIT &init = *SINGLETON_<ORB_INIT>::Instance() ;
460         ASSERT(SINGLETON_<ORB_INIT>::IsAlreadyExisting()) ;
461         CORBA::ORB_var &orb = init(0,0);
462
463         int iterationNumber = _fieldTptr->getIterationNumber();
464         SCRUTE(iterationNumber);
465
466         int orderNumber = _fieldTptr->getOrderNumber();
467         SCRUTE(orderNumber);
468
469         ostringstream iterationName ;
470         iterationName<<"(" << iterationNumber << "," << orderNumber << ")";
471         //      string supportName = _support->getName();
472         string supportName = (_fieldTptr->getSupport())->getName();
473         //      string meshName = (_support->getMesh())->getName();
474         string meshName = ((_fieldTptr->getSupport())->getMesh())->getName();
475         string meshNameStudy = meshName;
476
477         char * fieldEntryName;
478         int lenName = strlen(iterationName.str().c_str()) + 4 +
479           strlen(supportName.c_str()) + 4 + strlen(meshName.c_str()) + 1;
480
481         fieldEntryName = new char[lenName];
482         fieldEntryName = strcpy(fieldEntryName,iterationName.str().c_str());
483         fieldEntryName = strcat(fieldEntryName,"_ON_");
484         fieldEntryName = strcat(fieldEntryName,supportName.c_str());
485         fieldEntryName = strcat(fieldEntryName,"_OF_");
486
487         for (string::size_type pos=0; pos<meshNameStudy.size();++pos)
488           {
489             if (isspace(meshNameStudy[pos])) meshNameStudy[pos] = '_';
490           }
491
492         SCRUTE(meshNameStudy);
493
494         fieldEntryName = strcat(fieldEntryName,meshNameStudy.c_str());
495
496         SCRUTE(fieldEntryName);
497
498         anAttr = myBuilder->FindOrCreateAttribute(newObj, "AttributeName");
499         aName = SALOMEDS::AttributeName::_narrow(anAttr);
500 //         aName->SetValue(iterationName.str().c_str());
501         aName->SetValue(fieldEntryName);
502
503         string iorStr = orb->object_to_string(myIor);
504         anAttr = myBuilder->FindOrCreateAttribute(newObj, "AttributeIOR");
505         aIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
506         aIOR->SetValue(iorStr.c_str());
507         myBuilder->CommitCommand();
508         _FieldId = newObj->GetID();
509
510         MESSAGE("Computing path to Support");
511
512         char * supportEntryPath;
513         lenName = 28 + 15 + strlen(meshName.c_str()) + 1 +
514           strlen(supportName.c_str()) + 1;
515         supportEntryPath = new char[lenName];
516         supportEntryPath = strcpy(supportEntryPath,"/Med/MEDMESH/MEDSUPPORTS_OF_");
517         supportEntryPath = strcat(supportEntryPath,meshNameStudy.c_str());
518         supportEntryPath = strcat(supportEntryPath,"/");
519         supportEntryPath = strcat(supportEntryPath,supportName.c_str());
520
521         SCRUTE(supportEntryPath);
522
523         MESSAGE("supportEntryPath in field " << supportEntryPath << " length " << lenName);
524
525 //      SALOMEDS::SObject_var supportObject = myStudy->FindObject(supportName.c_str());
526         SALOMEDS::SObject_var supportObject = myStudy->FindObjectByPath(supportEntryPath);
527
528         SCRUTE(supportObject);
529
530         if ( CORBA::is_nil(supportObject) ) 
531         {
532           MESSAGE("supportObject is a nil corba object");
533           MESSAGE("FIELD_i::addInStudy : SUPPORT not found") ;
534         } 
535         else 
536         {
537           MESSAGE("supportObject is OK and is now going to be referenced !");
538           SALOMEDS::SObject_var newObjSupport = myBuilder->NewObject(newObj);
539           myBuilder->Addreference(newObjSupport,supportObject);
540           MESSAGE(" OUF !!!");
541         }
542
543         myBuilder->CommitCommand();
544
545         delete [] supportEntryPath;
546         delete [] fieldEntryName;
547
548         // register the Corba pointer: increase the referrence count
549         MESSAGE("Registering of the Corba Field pointer");
550         Register();
551
552         MESSAGE("FIELD_i::addInStudy");
553
554         //END_OF("FIELD_i::addInStudy");
555 }
556 //=============================================================================
557 /*!
558  * CORBA: write
559  */
560 //=============================================================================
561 void FIELD_i::write (CORBA::Long i, const char* driverFieldName)
562 throw (SALOME::SALOME_Exception)
563 {
564         if (_fieldTptr==NULL)
565                 THROW_SALOME_CORBA_EXCEPTION("No associated Field", \
566                                              SALOME::INTERNAL_ERROR);
567         try
568         {
569                 _fieldTptr->write(i,driverFieldName);
570         }
571         catch (MEDEXCEPTION &ex)
572         {
573                 MESSAGE("Exception en accedant au champ");
574                 THROW_SALOME_CORBA_EXCEPTION("Unable to acces Field C++ Object"\
575                                                 ,SALOME::INTERNAL_ERROR);
576         }
577 }
578 //=============================================================================
579 /*!
580  * CORBA: read
581  */
582 //=============================================================================
583 void FIELD_i::read (CORBA::Long i)
584 throw (SALOME::SALOME_Exception)
585 {
586         if (_fieldTptr==NULL)
587                 THROW_SALOME_CORBA_EXCEPTION("No associated Field", \
588                                              SALOME::INTERNAL_ERROR);
589         try
590         {
591                 _fieldTptr->read(i);
592         }
593         catch (MEDEXCEPTION &ex)
594         {
595                 MESSAGE("Exception en accedant au champ");
596                 THROW_SALOME_CORBA_EXCEPTION(ex.what(), SALOME::INTERNAL_ERROR);
597         }
598 }
599 //=============================================================================
600 /*!
601  * CORBA: rmDriver
602  */
603 //=============================================================================
604 void FIELD_i::rmDriver (CORBA::Long i)
605 throw (SALOME::SALOME_Exception)
606 {
607         if (_fieldTptr==NULL)
608                 THROW_SALOME_CORBA_EXCEPTION("No associated Field", \
609                                              SALOME::INTERNAL_ERROR);
610         try
611         {
612                 _fieldTptr->rmDriver(i);
613         }
614         catch (MEDEXCEPTION &ex)
615         {
616                 MESSAGE("Exception en accedant au champ");
617                 THROW_SALOME_CORBA_EXCEPTION(ex.what(), SALOME::INTERNAL_ERROR);
618         }
619 }
620 //=============================================================================
621 /*!
622  * CORBA: addDriver
623  */
624 //=============================================================================
625 CORBA::Long FIELD_i::addDriver (SALOME_MED::medDriverTypes driverType, 
626                         const char* fileName, const char* fieldName) throw (SALOME::SALOME_Exception)
627 {
628         if (_fieldTptr==NULL)
629                 THROW_SALOME_CORBA_EXCEPTION("No associated Field", \
630                                              SALOME::INTERNAL_ERROR);
631         try
632         {
633                 int drivernum=_fieldTptr->addDriver(
634                                         convertIdlDriverToMedDriver(driverType),
635                                         fileName,
636                                         fieldName);
637                 return drivernum;
638         }
639         catch (MEDEXCEPTION &ex)
640         {
641                 MESSAGE("Exception en accedant au champ");
642                 THROW_SALOME_CORBA_EXCEPTION(ex.what(), SALOME::INTERNAL_ERROR);
643         }
644 }
645