Salome HOME
yfr : Merge with v1.2
[modules/smesh.git] / src / DriverMED / DriverMED_W_SMESHDS_Mesh.cxx
1 //  SMESH DriverMED : driver to read and write 'med' files
2 //
3 //  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 //  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
5 // 
6 //  This library is free software; you can redistribute it and/or 
7 //  modify it under the terms of the GNU Lesser General Public 
8 //  License as published by the Free Software Foundation; either 
9 //  version 2.1 of the License. 
10 // 
11 //  This library is distributed in the hope that it will be useful, 
12 //  but WITHOUT ANY WARRANTY; without even the implied warranty of 
13 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
14 //  Lesser General Public License for more details. 
15 // 
16 //  You should have received a copy of the GNU Lesser General Public 
17 //  License along with this library; if not, write to the Free Software 
18 //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
19 // 
20 //  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
21 //
22 //
23 //
24 //  File   : DriverMED_W_SMESHDS_Mesh.cxx
25 //  Module : SMESH
26
27 using namespace std;
28 #include "DriverMED_W_SMESHDS_Mesh.h"
29 #include "DriverMED_W_SMDS_Mesh.h"
30
31 #include "SMDS_MeshElement.hxx"
32 #include "SMDS_MeshNode.hxx"
33 #include "SMDS_MeshFacesIterator.hxx"
34 #include "SMDS_MeshEdgesIterator.hxx"
35 #include "SMDS_MeshNodesIterator.hxx"
36 #include "SMDS_MeshVolumesIterator.hxx"
37 #include "SMESHDS_SubMesh.hxx"
38 #include "SMDS_MapIteratorOfExtendedMap.hxx"
39 #include "SMDS_MapOfMeshElement.hxx"
40 #include "SMDS_Position.hxx"
41
42 #include <TopExp.hxx>
43 #include <TopExp_Explorer.hxx>
44 #include <TopoDS.hxx>
45 #include <TopoDS_Iterator.hxx>
46 #include <TopoDS_Compound.hxx>
47 #include <TopoDS_CompSolid.hxx>
48 #include <TopoDS_Solid.hxx>
49 #include <TopoDS_Shell.hxx>
50 #include <TopoDS_Face.hxx>
51 #include <TopoDS_Wire.hxx>
52 #include <TopoDS_Edge.hxx>
53 #include <TopoDS_Vertex.hxx>
54 #include <TopoDS_Shape.hxx>
55 #include <TopTools_MapOfShape.hxx>
56 #include <TColStd_ListIteratorOfListOfInteger.hxx>
57
58
59 #include <map>
60 #include <set>
61 #include <vector>
62 #include "utilities.h"
63
64 DriverMED_W_SMESHDS_Mesh::DriverMED_W_SMESHDS_Mesh() {
65   ;
66 }
67
68 DriverMED_W_SMESHDS_Mesh::~DriverMED_W_SMESHDS_Mesh() {
69   ;
70 }
71
72 void DriverMED_W_SMESHDS_Mesh::SetMesh(Handle(SMDS_Mesh)& aMesh) {
73   myMesh = aMesh;
74 }
75
76 void DriverMED_W_SMESHDS_Mesh::SetFile(string aFile) {
77   myFile = aFile;
78 }
79
80 void DriverMED_W_SMESHDS_Mesh::SetFileId(med_idt aFileId) {
81   myFileId = aFileId;
82 }
83
84 void DriverMED_W_SMESHDS_Mesh::SetMeshId(int aMeshId) {
85   myMeshId = aMeshId;
86 }
87
88 void DriverMED_W_SMESHDS_Mesh::Write() {
89
90   string myClass = string("SMDS_Mesh");
91   string myExtension = string("MED");
92
93   DriverMED_W_SMDS_Mesh* myWriter = new DriverMED_W_SMDS_Mesh;
94
95   myWriter->SetMesh(myMesh);
96   //  myWriter->SetFile(myFile);
97   myWriter->SetMeshId(myMeshId);
98   myWriter->SetFileId(myFileId);
99
100   myWriter->Write();
101
102
103 }
104
105 void DriverMED_W_SMESHDS_Mesh::Add() {
106
107   med_err ret = 0;
108   int i,j,k,l;
109   int numero;
110   char message[200];
111   Standard_Boolean ok;
112   /* nombre d'objets MED */
113   char nom_universel[MED_TAILLE_LNOM+1];
114   med_int long_fichier_en_tete;
115   char *fichier_en_tete;
116   char version_hdf[10];
117   char version_med[10];
118   med_int nmaa,mdim,nnoe;
119   med_int nmai[MED_NBR_GEOMETRIE_MAILLE],nfac[MED_NBR_GEOMETRIE_FACE];
120   med_int nare[MED_NBR_GEOMETRIE_ARETE];
121   /* nom du maillage */
122   char nommaa[MED_TAILLE_NOM+1];
123   /* noeuds */
124   med_float *coo;
125   // PN : Initilialisation de nomcoo et unicoo pour lisibilite du maillage
126   char nomcoo[3*MED_TAILLE_PNOM+1]="x       y        z      ";
127   char unicoo[3*MED_TAILLE_PNOM+1]="m       m        m     ";
128   char *nomnoe;
129   med_int *numnoe;
130   med_int *nufano;
131   med_repere rep;
132   med_booleen inonoe,inunoe;
133   med_mode_switch mode_coo;
134   char str[MED_TAILLE_PNOM+1];
135   med_int nbNodes;
136   /* elements */
137   med_int nsup;
138   med_int edim;
139   med_int taille;
140   med_int elem_id,myId;
141   med_int *connectivite;
142   char *nomele;
143   med_int *numele;
144   med_int *nufael;
145   med_booleen inoele, inuele;
146   med_connectivite typ_con;
147   med_geometrie_element typgeo;
148   med_geometrie_element typmai[MED_NBR_GEOMETRIE_MAILLE] = {MED_POINT1,MED_SEG2,
149                                                             MED_SEG3,MED_TRIA3,
150                                                             MED_TRIA6,MED_QUAD4,
151                                                             MED_QUAD8,MED_TETRA4,
152                                                             MED_TETRA10,MED_HEXA8,
153                                                             MED_HEXA20,MED_PENTA6,
154                                                             MED_PENTA15,MED_PYRA5,
155                                                             MED_PYRA13};
156   med_int desmai[MED_NBR_GEOMETRIE_MAILLE] = {0,2,3,3,3,4,4,4,4,6,6,5,5,5,5};
157   med_int nmailles[MED_NBR_GEOMETRIE_MAILLE];
158   char nommai[MED_NBR_GEOMETRIE_MAILLE] [MED_TAILLE_NOM+1] = {"MED_POINT1",
159                                                               "MED_SEG2",
160                                                               "MED_SEG3",
161                                                               "MED_TRIA3",
162                                                               "MED_TRIA6",
163                                                               "MED_QUAD4",
164                                                               "MED_QUAD8",
165                                                               "MED_TETRA4",
166                                                               "MED_TETRA10",
167                                                               "MED_HEXA8",
168                                                               "MED_HEXA20",
169                                                               "MED_PENTA6",
170                                                               "MED_PENTA15",
171                                                               "MED_PYRA5",
172                                                               "MED_PYRA13"};
173   med_geometrie_element typfac[MED_NBR_GEOMETRIE_FACE] = {MED_TRIA3,MED_TRIA6,
174                                                           MED_QUAD4,MED_QUAD8};
175   med_int desfac[MED_NBR_GEOMETRIE_FACE] = {3,3,4,4};
176   med_int nfaces[MED_NBR_GEOMETRIE_FACE];
177   char nomfac[MED_NBR_GEOMETRIE_FACE][MED_TAILLE_NOM+1] = {"MED_TRIA3","MED_TRIA6",
178                                                            "MED_QUAD4","MED_QUAD8"};
179   med_geometrie_element typare[MED_NBR_GEOMETRIE_ARETE] = {MED_SEG2,MED_SEG3};
180   med_int desare[MED_NBR_GEOMETRIE_ARETE] = {2,3};
181   med_int naretes[MED_NBR_GEOMETRIE_ARETE];
182   char nomare[MED_NBR_GEOMETRIE_ARETE] [MED_TAILLE_NOM+1] = {"MED_SEG2","MED_SEG3"};
183
184   typ_con = MED_NOD;
185   mode_coo = MED_FULL_INTERLACE;
186   numero = myMeshId;
187
188   //---- provisoire : switch pour ecrire les familles de mailles
189   int besoinfamilledemaille=1;
190   //---- provisoire : switch pour ecrire les familles de mailles
191
192   /****************************************************************************
193    *                      OUVERTURE DU FICHIER EN ECRITURE                    *
194    ****************************************************************************/
195   char* file2Read = (char*)myFile.c_str();
196
197   MESSAGE ( " file2Read " << file2Read )
198
199     myFileId = MEDouvrir(file2Read,MED_REMP);
200   if (myFileId < 0)
201     {
202       fprintf(stderr,">> ERREUR : ouverture du fichier %s \n",file2Read);
203       exit(EXIT_FAILURE);
204     }
205
206   /****************************************************************************
207    *                       NOMBRES D'OBJETS MED                               *
208    ****************************************************************************/
209   MESSAGE("(****************************)");
210   MESSAGE("(* INFORMATIONS GENERALES : *)");
211   MESSAGE("(****************************)");
212
213   /* calcul de la dimension */
214   mdim=2;
215   double epsilon=0.00001;
216   double nodeRefX;
217   double nodeRefY;
218   double nodeRefZ;
219
220   bool dimX = true;
221   bool dimY = true;
222   bool dimZ = true;
223
224   SMDS_MeshNodesIterator myItNodes(myMesh);
225   int inode = 0;
226   for (;myItNodes.More();myItNodes.Next()) {
227     const Handle(SMDS_MeshElement)& elem = myItNodes.Value();
228     const Handle(SMDS_MeshNode)& node = myMesh->GetNode(1,elem);
229     if ( inode == 0 ) {
230       nodeRefX = fabs(node->X());
231       nodeRefY = fabs(node->Y());
232       nodeRefZ = fabs(node->Z());
233     }
234     SCRUTE( inode );
235     SCRUTE( nodeRefX );
236     SCRUTE( nodeRefY );
237     SCRUTE( nodeRefZ );
238
239     if ( inode !=0 ) {
240       if ( (fabs(fabs(node->X()) - nodeRefX) > epsilon ) && dimX )
241         dimX = false;
242       if ( (fabs(fabs(node->Y()) - nodeRefY) > epsilon ) && dimY )
243         dimY = false;
244       if ( (fabs(fabs(node->Z()) - nodeRefZ) > epsilon ) && dimZ )
245         dimZ = false;
246     }
247     if ( !dimX && !dimY && !dimZ ) {
248       mdim = 3;
249       break;
250     }
251     inode++;
252   }
253
254   if ( mdim != 3 ) {
255     if ( dimX && dimY && dimZ )
256       mdim = 0;
257     else if ( !dimX ) {
258       if ( dimY && dimZ )
259         mdim = 1;
260       else if (( dimY && !dimZ ) || ( !dimY && dimZ ) )
261         mdim = 2;
262     } else if ( !dimY ) {
263       if ( dimX && dimZ )
264         mdim = 1;
265       else if (( dimX && !dimZ ) || ( !dimX && dimZ ) )
266         mdim = 2;
267     } else if ( !dimZ ) {
268       if ( dimY && dimX )
269         mdim = 1;
270       else if (( dimY && !dimX ) || ( !dimY && dimX ) )
271         mdim = 2;
272     }
273   }
274
275   MESSAGE ( " mdim " << mdim );
276
277   /* creation du maillage */
278   //mdim=3;
279   sprintf(nommaa,"Mesh %d",numero);
280   SCRUTE(nommaa);
281   ret = MEDmaaCr(myFileId,nommaa,mdim);
282
283   ASSERT(ret == 0);
284   SCRUTE( ret );
285
286   /* Combien de noeuds ? */
287   nnoe = myMesh->NbNodes();
288   //SCRUTE(nnoe);
289   /* Combien de mailles, faces ou aretes ? */
290   for (i=0;i<MED_NBR_GEOMETRIE_MAILLE;i++)
291     nmailles[i]=0;
292
293   Standard_Integer nb_of_nodes, nb_of_faces, nb_of_edges;
294   vector<int> elem_Id[MED_NBR_GEOMETRIE_MAILLE];
295
296   SMDS_MeshEdgesIterator itEdges(myMesh);
297   nb_of_edges = myMesh->NbEdges();
298   for (;itEdges.More();itEdges.Next()) {
299     const Handle(SMDS_MeshElement)& elem = itEdges.Value();
300
301     nb_of_nodes = elem->NbNodes();
302
303     switch (nb_of_nodes) {
304     case 2 : {
305       elem_Id[1].push_back(elem->GetID());
306       nmailles[1]++;
307       break;
308     }
309     case 3 : {
310       elem_Id[2].push_back(elem->GetID());
311       nmailles[2]++;
312       break;
313     }
314     }
315   }
316
317
318   SMDS_MeshFacesIterator itFaces(myMesh);
319   nb_of_faces = myMesh->NbFaces();
320   for (;itFaces.More();itFaces.Next()) {
321     const Handle(SMDS_MeshElement)& elem = itFaces.Value();
322
323     nb_of_nodes = elem->NbNodes();
324
325     switch (nb_of_nodes) {
326     case 3 : {
327       elem_Id[3].push_back(elem->GetID());
328       nmailles[3]++;
329       break;
330     }
331     case 4 : {
332       elem_Id[5].push_back(elem->GetID());
333       nmailles[5]++;
334       break;
335     }
336     case 6 : {
337       elem_Id[4].push_back(elem->GetID());
338       nmailles[4]++;
339       break;
340     }
341     }
342
343   }
344
345   SMDS_MeshVolumesIterator itVolumes(myMesh);
346   for (;itVolumes.More();itVolumes.Next()) {
347     const Handle(SMDS_MeshElement)& elem = itVolumes.Value();
348
349     nb_of_nodes = elem->NbNodes();
350     switch (nb_of_nodes) {
351     case 8 : {
352       elem_Id[9].push_back(elem->GetID());
353       nmailles[9]++;
354       break;
355     }
356     }
357   }
358
359
360
361   /****************************************************************************
362    *                       ECRITURE DES NOEUDS                                *
363    ****************************************************************************/
364   MESSAGE("(************************)");
365   MESSAGE("(* NOEUDS DU MAILLAGE : *)");
366   MESSAGE("(************************)");
367
368   /* Allocations memoires */
369   /* table des coordonnees
370      profil : (dimension * nombre de noeuds ) */
371   coo = (med_float*) malloc(sizeof(med_float)*nnoe*mdim);
372   /* table  des numeros, des numeros de familles des noeuds
373      profil : (nombre de noeuds) */
374   numnoe = (med_int*) malloc(sizeof(med_int)*nnoe);
375   nufano = (med_int*) malloc(sizeof(med_int)*nnoe);
376   /* table des noms des noeuds
377      profil : (nnoe*MED_TAILLE_PNOM+1) */
378   nomnoe ="";
379
380   /* PN  pour aster, il faut une famille 0 pour les noeuds et une autre pour les elements*/
381   /* PN : Creation de la famille 0 */
382   char * nomfam="FAMILLE_0";
383   char *attdes="";
384   char *gro=0;
385   med_int ngro=0;
386   med_int natt=1;
387   med_int attide = 0;
388   med_int attval=0;
389   med_int numfam = 0;
390   med_int attvalabs=1;
391   ret = MEDfamCr(myFileId,nommaa,nomfam,numfam, &attide,&attval,attdes,natt,gro,ngro);
392   ASSERT(ret == 0);
393
394
395   /* PN : FIN Creation de la famille 0 */
396
397   map < int, int > mapNoeud;
398   typedef pair<set<int>::iterator, bool> IsFamily;
399   int nbFamillesNoeud;
400
401
402   i = 0;
403   set<int> FamilySet;
404   nbFamillesNoeud = 0;
405   int verifienbnoeuds = 0;
406   med_int* rien=0;
407
408   SMDS_MeshNodesIterator itNodes(myMesh);
409   for (;itNodes.More();itNodes.Next())
410     {
411       const Handle(SMDS_MeshElement)& elem = itNodes.Value();
412       const Handle(SMDS_MeshNode)& node = myMesh->GetNode(1,elem);
413
414       if(mdim==3){
415         coo[i*3]=node->X();
416         coo[i*3+1]=node->Y();
417         coo[i*3+2]=node->Z();
418       } else if(mdim==2) {
419         if ( dimX ) {
420           coo[i*2]=node->Y();
421           coo[i*2+1]=node->Z();
422         } 
423         if ( dimY ) {
424           coo[i*2]=node->X();
425           coo[i*2+1]=node->Z();
426         } 
427         if ( dimZ ) {
428           coo[i*2]=node->X();
429           coo[i*2+1]=node->Y();
430         } 
431       } else {
432         if ( dimX ) {
433           coo[i*2]=node->Y();
434           coo[i*2+1]=node->Z();
435         } 
436         if ( dimY ) {
437           coo[i*2]=node->X();
438           coo[i*2+1]=node->Z();
439         } 
440         if ( dimZ ) {
441           coo[i*2]=node->X();
442           coo[i*2+1]=node->Y();
443         } 
444       }
445       mapNoeud[node->GetID()] = i+1;
446
447       // renvoie 0 pour les noeuds internes du volume
448       int numfamille=node->GetPosition()->GetShapeId();
449       nufano[i]=numfamille;
450
451       //SCRUTE(i);
452       //SCRUTE(nufano[i]);
453       //SCRUTE(coo[i*3]);
454       //SCRUTE(coo[i*3+1]);
455       //SCRUTE(coo[i*3+2]);
456       if ( nufano[i] != 0 )
457         {
458           IsFamily deja = FamilySet.insert(nufano[i]); // insert if new, or gives existant
459           if (deja.second)                                    // actually inserted
460             {
461               char famille[MED_TAILLE_NOM+1];
462               sprintf(famille,"F%d",nufano[i]);
463               //              CreateFamily(strdup(nommaa),strdup(famille),nufano[i],attvalabs++);
464               attvalabs++;
465               CreateFamily(strdup(nommaa),strdup(famille),nufano[i],numfamille);
466               //MESSAGE("---famille-noeud--- "<<nbFamillesNoeud<<" "<<nufano[i]);
467               nbFamillesNoeud++;
468             }
469         }
470
471       i++;
472       verifienbnoeuds ++;
473     }
474   ret = MEDnoeudsEcr(myFileId,nommaa,mdim,coo,mode_coo,MED_CART,
475                      nomcoo,unicoo,nomnoe,MED_FAUX,rien,MED_FAUX,
476                      nufano,nnoe,MED_REMP);
477   ASSERT(ret == 0);
478   MESSAGE("--- Creation de " << verifienbnoeuds << " noeuds");
479   ASSERT(verifienbnoeuds == nnoe);
480   MESSAGE("--- Creation de " << nbFamillesNoeud << " familles de noeuds");
481
482   /* liberation memoire */
483   free(coo);
484   free(numnoe);
485   free(nufano);
486
487   /****************************************************************************
488    *                       ECRITURE DES ELEMENTS                              *
489    ****************************************************************************/
490   MESSAGE("(**************************)");
491   MESSAGE("(* ELEMENTS DU MAILLAGE : *)");
492   MESSAGE("(**************************)");
493   
494   /* Ecriture des connectivites, noms, numeros des mailles */
495
496   if (ret == 0)
497     {
498       int nbFamillesElts =0;
499       Handle(SMESHDS_Mesh) mySMESHDSMesh = Handle(SMESHDS_Mesh)::DownCast(myMesh);
500       TopTools_IndexedMapOfShape myIndexToShape;
501       TopExp::MapShapes(mySMESHDSMesh->ShapeToMesh(),myIndexToShape);
502
503       map < int, int > mapFamille;
504
505       if (besoinfamilledemaille == 1)
506         {
507           int t;
508           for (t =1; t <= myIndexToShape.Extent(); t++)
509             {
510               const TopoDS_Shape S = myIndexToShape(t);
511               if (mySMESHDSMesh->HasMeshElements(S))
512                 {
513                   //MESSAGE ("********* Traitement de la Famille "<<-t);
514                 
515                   Handle(SMESHDS_SubMesh) SM = mySMESHDSMesh->MeshElements(S);
516                   const TColStd_ListOfInteger& indElt = SM->GetIDElements();
517                   TColStd_ListIteratorOfListOfInteger ite(indElt);
518                 
519                   bool plein=false;
520                   for (; ite.More(); ite.Next())
521                     {
522                       int eltId = ite.Value();
523                       mapFamille [eltId] = - t;
524                       plein=true;
525                     }
526                   if (plein)
527                     {
528                       nbFamillesElts++;
529                       char famille[MED_TAILLE_NOM+1];
530                       sprintf(famille,"E%d",t);
531                       CreateFamily(strdup(nommaa),strdup(famille),-t,attvalabs++);
532                     }
533                 }
534             }
535         }
536
537       int indice=1;
538       for (i=0;i<MED_NBR_GEOMETRIE_MAILLE;i++)
539         {
540           if (nmailles[i] > 0 && ret == 0)
541             {
542               MESSAGE ( " Start "<<typmai[i]);
543         
544               /* dimension de la maille */
545               edim = typmai[i] / 100;
546               nsup = 0;
547               if (mdim  == 2 || mdim == 3)
548                 if (edim == 1) nsup = 1;
549               if (mdim == 3)
550                 if (edim == 2) nsup = 1;
551               //SCRUTE(nsup);
552         
553               taille = nsup+typmai[i]%100;
554               //SCRUTE(taille);
555         
556               /* allocation memoire */
557               connectivite = (med_int*)malloc(sizeof(med_int)* taille*nmailles[i]);
558               nomele = (char*)malloc(sizeof(char)*MED_TAILLE_PNOM* nmailles[i]+1);
559               numele = (med_int*)malloc(sizeof(med_int)* nmailles[i]);
560               nufael = (med_int*)malloc(sizeof(med_int)* nmailles[i]);
561               nomele="";
562               nbNodes=typmai[i]%100;
563         
564               for (j=0;j<nmailles[i];j++)
565                 {
566                   myId = elem_Id[i][j];
567                   const Handle(SMDS_MeshElement)& elem = myMesh->FindElement(myId);
568                   //*(numele+j) = myId;
569                   *(numele+j) = indice ++;
570                 
571                   for (k=0; k<nbNodes; k++)
572                     {
573                       *(connectivite+j*taille+k) = mapNoeud[elem->GetConnection(k+1)];
574                       //SCRUTE(*(connectivite+j*taille+k));
575                     }
576                   if (nsup) *(connectivite+j*taille + nbNodes) = 0;
577                 
578                   if (besoinfamilledemaille == 1)
579                     {
580                       if (mapFamille.find(myId)!=mapFamille.end())
581                         {
582                           nufael[j]=mapFamille[myId];
583                         }
584                       else
585                         {
586                           nufael[j]=0;
587                         }
588                     }
589                   else
590                     {
591                       nufael[j]=0;
592                     }
593                 
594                   //SCRUTE(myId);
595                   //SCRUTE(j);
596                   //SCRUTE(nufael[j]);
597                 }
598         
599               /* ecriture des donnĂ©es */
600                 
601                     med_int* rien=0;
602                     ret=MEDelementsEcr( myFileId,nommaa,mdim,connectivite,mode_coo,nomele,MED_FAUX,numele,
603                                         MED_VRAI,nufael,nmailles[i],MED_MAILLE,typmai[i],typ_con,MED_REMP);
604                     ASSERT(ret == 0);
605                     //SCRUTE(ret);
606                 
607                     if (ret < 0) MESSAGE(">> ERREUR : ecriture des mailles \n");
608                 
609                     /* liberation memoire */
610                     free(connectivite);
611                     free(numele);
612                     free(nufael);
613                     MESSAGE ( " End "<<typmai[i]);
614             }
615       };
616           MESSAGE("--- Creation de " << nbFamillesElts << " familles d elements");
617
618     }
619
620       /****************************************************************************
621       *                      FERMETURE DU FICHIER                                *
622       ****************************************************************************/
623
624       ret = MEDfermer(myFileId);
625
626       if (ret != 0)
627         fprintf(stderr,">> ERREUR : erreur a la fermeture du fichier %s\n",file2Read);
628       MESSAGE ("fichier ferme");
629
630
631 }
632
633 void DriverMED_W_SMESHDS_Mesh::CreateFamily(char* nommaa, char* famille, int i,med_int k) {
634
635   med_int ngro=0;
636   med_int natt;
637
638   natt=1;
639   char attdes[MED_TAILLE_DESC+1];
640   char gro[MED_TAILLE_LNOM+1];
641   char fam2[MED_TAILLE_LNOM+1];
642
643   strcpy(attdes,"");
644   strcpy(gro,"");
645   strcpy(fam2,famille);
646
647   med_int * attide=new med_int[1];
648   med_int * attval=new med_int[1];
649   attide[0] = k;
650   attval[0] = k;
651
652
653   //MESSAGE("-------- Creation de la Famille : "<< famille << "numero " << i << " --------------");
654   med_int ret = MEDfamCr(myFileId, nommaa, fam2, i, attide, attval, attdes, natt, gro, ngro);
655   ASSERT(ret==0);
656   delete [] attide;
657   delete [] attval;
658
659 }
660
661
662