Salome HOME
Merge br_enable_import_mesh. Enable import mesh and save/load SMESH study.
[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 extern "C"
37 {
38 /**
39  * Factory function which will be called by SMESHDriver
40  */
41 void * SMESH_createMEDMeshWriter()
42 {
43         return new DriverMED_W_SMESHDS_Mesh();
44 }
45
46 }
47
48 DriverMED_W_SMESHDS_Mesh::DriverMED_W_SMESHDS_Mesh()
49 {
50         ;
51 }
52
53 DriverMED_W_SMESHDS_Mesh::~DriverMED_W_SMESHDS_Mesh()
54 {
55         ;
56 }
57
58 void DriverMED_W_SMESHDS_Mesh::SetMesh(SMDS_Mesh * aMesh)
59 {
60         myMesh = aMesh;
61 }
62
63 void DriverMED_W_SMESHDS_Mesh::SetFile(string aFile)
64 {
65         myFile = aFile;
66 }
67
68 void DriverMED_W_SMESHDS_Mesh::SetFileId(med_idt aFileId)
69 {
70         myFileId = aFileId;
71 }
72
73 void DriverMED_W_SMESHDS_Mesh::SetMeshId(int aMeshId)
74 {
75         myMeshId = aMeshId;
76 }
77
78 void DriverMED_W_SMESHDS_Mesh::Write()
79 {
80         Add();
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                 case 4 :
365                 {
366                         elem_Id[7].push_back(elem->GetID());
367                         nmailles[7]++;
368                         break;
369                 }
370                 }
371         }
372
373   /****************************************************************************
374    *                       ECRITURE DES NOEUDS                                *
375    ****************************************************************************/
376         MESSAGE("(************************)");
377         MESSAGE("(* NOEUDS DU MAILLAGE : *)");
378         MESSAGE("(************************)");
379
380         /* Allocations memoires */
381         /* table des coordonnees
382          * profil : (dimension * nombre de noeuds ) */
383         coo = (med_float *) malloc(sizeof(med_float) * nnoe * mdim);
384         /* table  des numeros, des numeros de familles des noeuds
385          * profil : (nombre de noeuds) */
386         numnoe = (med_int *) malloc(sizeof(med_int) * nnoe);
387         nufano = (med_int *) malloc(sizeof(med_int) * nnoe);
388         /* table des noms des noeuds
389          * profil : (nnoe*MED_TAILLE_PNOM+1) */
390         nomnoe = "";
391
392         /* PN  pour aster, il faut une famille 0 pour les noeuds et une autre pour les elements */
393         /* PN : Creation de la famille 0 */
394         char *nomfam = "FAMILLE_0";
395         char *attdes = "";
396         char *gro = 0;
397         med_int ngro = 0;
398         med_int natt = 1;
399         med_int attide = 0;
400         med_int attval = 0;
401         med_int numfam = 0;
402         med_int attvalabs = 1;
403         ret =
404                 MEDfamCr(myFileId, nommaa, nomfam, numfam, &attide, &attval, attdes,
405                 natt, gro, ngro);
406         ASSERT(ret == 0);
407
408         /* PN : FIN Creation de la famille 0 */
409
410         map < int, int >mapNoeud;
411         typedef pair < set < int >::iterator, bool > IsFamily;
412         int nbFamillesNoeud;
413
414         i = 0;
415         set < int >FamilySet;
416         nbFamillesNoeud = 0;
417         int verifienbnoeuds = 0;
418         med_int *rien = 0;
419
420         SMDS_Iterator<const SMDS_MeshNode *> * itNodes=myMesh->nodesIterator();
421         while(itNodes->more())
422         {
423                 const SMDS_MeshNode * node = itNodes->next();
424
425                 if (mdim == 3)
426                 {
427                         coo[i * 3] = node->X();
428                         coo[i * 3 + 1] = node->Y();
429                         coo[i * 3 + 2] = node->Z();
430                 }
431                 else if (mdim == 2)
432                 {
433                         if (dimX)
434                         {
435                                 coo[i * 2] = node->Y();
436                                 coo[i * 2 + 1] = node->Z();
437                         }
438                         if (dimY)
439                         {
440                                 coo[i * 2] = node->X();
441                                 coo[i * 2 + 1] = node->Z();
442                         }
443                         if (dimZ)
444                         {
445                                 coo[i * 2] = node->X();
446                                 coo[i * 2 + 1] = node->Y();
447                         }
448                 }
449                 else
450                 {
451                         if (dimX)
452                         {
453                                 coo[i * 2] = node->Y();
454                                 coo[i * 2 + 1] = node->Z();
455                         }
456                         if (dimY)
457                         {
458                                 coo[i * 2] = node->X();
459                                 coo[i * 2 + 1] = node->Z();
460                         }
461                         if (dimZ)
462                         {
463                                 coo[i * 2] = node->X();
464                                 coo[i * 2 + 1] = node->Y();
465                         }
466                 }
467                 mapNoeud[node->GetID()] = i + 1;
468
469                 // renvoie 0 pour les noeuds internes du volume
470                 int numfamille = node->GetPosition()->GetShapeId();
471                 nufano[i] = numfamille;
472
473                 //SCRUTE(i);
474                 //SCRUTE(nufano[i]);
475                 //SCRUTE(coo[i*3]);
476                 //SCRUTE(coo[i*3+1]);
477                 //SCRUTE(coo[i*3+2]);
478                 if (nufano[i] != 0)
479                 {
480                         IsFamily deja = FamilySet.insert(nufano[i]);    // insert if new, or gives existant
481                         if (deja.second)        // actually inserted
482                         {
483                                 char famille[MED_TAILLE_NOM + 1];
484                                 sprintf(famille, "F%d", nufano[i]);
485                                 //          CreateFamily(strdup(nommaa),strdup(famille),nufano[i],attvalabs++);
486                                 attvalabs++;
487                                 CreateFamily(strdup(nommaa), strdup(famille), nufano[i],
488                                         numfamille);
489                                 //MESSAGE("---famille-noeud--- "<<nbFamillesNoeud<<" "<<nufano[i]);
490                                 nbFamillesNoeud++;
491                         }
492                 }
493
494                 i++;
495                 verifienbnoeuds++;
496         }
497         ret = MEDnoeudsEcr(myFileId, nommaa, mdim, coo, mode_coo, MED_CART,
498                 nomcoo, unicoo, nomnoe, MED_FAUX, rien, MED_FAUX,
499                 nufano, nnoe, MED_REMP);
500         ASSERT(ret == 0);
501         MESSAGE("--- Creation de " << verifienbnoeuds << " noeuds");
502         ASSERT(verifienbnoeuds == nnoe);
503         MESSAGE("--- Creation de " << nbFamillesNoeud << " familles de noeuds");
504
505         /* liberation memoire */
506         free(coo);
507         free(numnoe);
508         free(nufano);
509
510   /****************************************************************************
511    *                       ECRITURE DES ELEMENTS                              *
512    ****************************************************************************/
513         MESSAGE("(**************************)");
514         MESSAGE("(* ELEMENTS DU MAILLAGE : *)");
515         MESSAGE("(**************************)");
516
517         /* Ecriture des connectivites, noms, numeros des mailles */
518
519         if (ret == 0)
520         {
521                 int nbFamillesElts = 0;
522                 SMESHDS_Mesh * mySMESHDSMesh = dynamic_cast<SMESHDS_Mesh *>(myMesh);
523                 map<int,int> mapFamille;
524
525                 if(!mySMESHDSMesh->ShapeToMesh().IsNull())
526                 {
527                         TopTools_IndexedMapOfShape myIndexToShape;
528                         TopExp::MapShapes(mySMESHDSMesh->ShapeToMesh(), myIndexToShape);
529
530
531                         if (besoinfamilledemaille == 1)
532                         {
533                                 int t;
534                                 for (t = 1; t <= myIndexToShape.Extent(); t++)
535                                 {
536                                         const TopoDS_Shape S = myIndexToShape(t);
537                                         if (mySMESHDSMesh->HasMeshElements(S))
538                                         {
539                                                 //MESSAGE ("********* Traitement de la Famille "<<-t);
540         
541                                                 SMESHDS_SubMesh * SM = mySMESHDSMesh->MeshElements(S);
542                                                 SMDS_Iterator<const SMDS_MeshElement*> * ite=SM->GetElements();
543                                                 bool plein = false;
544                                                 while(ite->more())
545                                                 {
546                                                         mapFamille[ite->next()->GetID()] = -t;
547                                                         plein = true;
548                                                 }
549                                                 if (plein)
550                                                 {
551                                                         nbFamillesElts++;
552                                                         char famille[MED_TAILLE_NOM + 1];
553                                                         sprintf(famille, "E%d", t);
554                                                         CreateFamily(strdup(nommaa), strdup(famille), -t,
555                                                                 attvalabs++);
556                                                 }
557                                         }
558                                 }
559                         }
560                 }
561                 else besoinfamilledemaille = 0;
562
563                 int indice = 1;
564                 for (i = 0; i < MED_NBR_GEOMETRIE_MAILLE; i++)
565                 {
566                         if (nmailles[i] > 0 && ret == 0)
567                         {
568                                 MESSAGE(" Start " << typmai[i]);
569
570                                 /* dimension de la maille */
571                                 edim = typmai[i] / 100;
572                                 nsup = 0;
573                                 if (mdim == 2 || mdim == 3)
574                                         if (edim == 1)
575                                                 nsup = 1;
576                                 if (mdim == 3)
577                                         if (edim == 2)
578                                                 nsup = 1;
579                                 //SCRUTE(nsup);
580
581                                 taille = nsup + typmai[i] % 100;
582                                 //SCRUTE(taille);
583
584                                 /* allocation memoire */
585                                 connectivite =
586                                         (med_int *) malloc(sizeof(med_int) * taille * nmailles[i]);
587                                 /* nomele =
588                                         (char *)malloc(sizeof(char) * MED_TAILLE_PNOM *
589                                         nmailles[i] + 1);*/
590                                 nomele = "";
591                                 numele = (med_int *) malloc(sizeof(med_int) * nmailles[i]);
592                                 nufael = (med_int *) malloc(sizeof(med_int) * nmailles[i]);
593                                 nbNodes = typmai[i] % 100;
594
595                                 for (j = 0; j < nmailles[i]; j++)
596                                 {
597                                         myId = elem_Id[i][j];
598                                         const SMDS_MeshElement * elem =
599                                                 myMesh->FindElement(myId);
600                                         //*(numele+j) = myId;
601                                         *(numele + j) = indice++;
602
603                                         SMDS_Iterator<const SMDS_MeshElement *> * itk=elem->nodesIterator();
604                                         for (k = 0; itk->more(); k++)
605                                         {
606                                                 *(connectivite + j * taille + k) =
607                                                         mapNoeud[itk->next()->GetID()];
608                                         }
609                                         delete itk;
610
611                                         if (nsup)
612                                                 *(connectivite + j * taille + nbNodes) = 0;
613
614                                         if (besoinfamilledemaille == 1)
615                                         {
616                                                 if (mapFamille.find(myId) != mapFamille.end())
617                                                 {
618                                                         nufael[j] = mapFamille[myId];
619                                                 }
620                                                 else
621                                                 {
622                                                         nufael[j] = 0;
623                                                 }
624                                         }
625                                         else
626                                         {
627                                                 nufael[j] = 0;
628                                         }
629
630                                         //SCRUTE(myId);
631                                         //SCRUTE(j);
632                                         //SCRUTE(nufael[j]);
633                                 }
634
635                                 /* ecriture des donnĂ©es */
636
637                                 med_int *rien = 0;
638                                 ret =
639                                         MEDelementsEcr(myFileId, nommaa, mdim, connectivite,
640                                         mode_coo, nomele, MED_FAUX, numele, MED_VRAI, nufael,
641                                         nmailles[i], MED_MAILLE, typmai[i], typ_con, MED_REMP);
642                                 ASSERT(ret == 0);
643                                 //SCRUTE(ret);
644
645                                 if (ret < 0)
646                                         MESSAGE(">> ERREUR : ecriture des mailles \n");
647
648                                 /* liberation memoire */
649                                 free(connectivite);
650                                 free(numele);
651                                 free(nufael);
652                                 MESSAGE(" End " << typmai[i]);
653                         }
654                 };
655                 MESSAGE("--- Creation de " << nbFamillesElts << " familles d elements");
656
657         }
658
659           /****************************************************************************
660       *                      FERMETURE DU FICHIER                                *
661       ****************************************************************************/
662
663         ret = MEDfermer(myFileId);
664
665         if (ret != 0)
666                 fprintf(stderr, ">> ERREUR : erreur a la fermeture du fichier %s\n",
667                         file2Read);
668         MESSAGE("fichier ferme");
669
670 }
671
672 void DriverMED_W_SMESHDS_Mesh::CreateFamily(char *nommaa, char *famille, int i,
673         med_int k)
674 {
675
676         med_int ngro = 0;
677         med_int natt;
678
679         natt = 1;
680         char attdes[MED_TAILLE_DESC + 1];
681         char gro[MED_TAILLE_LNOM + 1];
682         char fam2[MED_TAILLE_LNOM + 1];
683
684         strcpy(attdes, "");
685         strcpy(gro, "");
686         strcpy(fam2, famille);
687
688         med_int *attide = new med_int[1];
689         med_int *attval = new med_int[1];
690         attide[0] = k;
691         attval[0] = k;
692
693         //MESSAGE("-------- Creation de la Famille : "<< famille << "numero " << i << " --------------");
694         med_int ret =
695                 MEDfamCr(myFileId, nommaa, fam2, i, attide, attval, attdes, natt, gro,
696                 ngro);
697         ASSERT(ret == 0);
698         delete[]attide;
699         delete[]attval;
700
701 }