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