]> SALOME platform Git repositories - modules/med.git/blob - src/INTERPOLATION/create_mesh_interpolation.c
Salome HOME
updating the main trunk with the CEA debug devellopment from the branch
[modules/med.git] / src / INTERPOLATION / create_mesh_interpolation.c
1 #include <med.h>
2 #include <string.h>
3
4
5 /*****************************************************************************************************/
6
7 void affiche_noeuds(med_float * nodes,int nnpl)
8         {
9         int nbr_nodes=nnpl*nnpl*nnpl;
10         int i;
11
12         for (i=0;i<nbr_nodes;i++) printf("Noeud %d : ( %4.5f ; %4.5f ; %4.5f )\n",i,nodes[3*i],nodes[3*i+1],nodes[3*i+2]);
13         
14         }
15
16
17 void cree_nodes(med_float * coord_nodes,int nnpl, int flag)
18         {
19         int i,j,k;
20         int nbr_nodes=nnpl*nnpl*nnpl;
21         int num_noeud;
22         int diviseur=nnpl-1+flag;
23         
24         /*coord_nodes=(med_float *) malloc(3*nbr_nodes*sizeof(med_float));*/
25         
26         for (i=0;i<nnpl;i++) for (j=0;j<nnpl;j++) for (k=0;k<nnpl;k++) 
27                 {
28                 num_noeud=i+nnpl*j+nnpl*nnpl*k;
29                 
30                 if (3*num_noeud  >=3*nbr_nodes) {printf("%d : OUT OF RANGE REQUEST\n",num_noeud);exit(-1);}
31                 if (3*num_noeud+1>=3*nbr_nodes) {printf("%d : OUT OF RANGE REQUEST\n",num_noeud);exit(-1);}
32                 if (3*num_noeud+2>=3*nbr_nodes) {printf("%d : OUT OF RANGE REQUEST\n",num_noeud);exit(-1);}
33                 
34                 coord_nodes[3*num_noeud  ]= (double) (i+flag)/diviseur;
35                 coord_nodes[3*num_noeud+1]= (double) (j+flag)/diviseur;
36                 coord_nodes[3*num_noeud+2]= (double) (k+flag)/diviseur;
37                 }
38                 
39         affiche_noeuds(coord_nodes,nnpl);
40         
41         }
42 void cree_num_nodes(med_int * num_nodes,int nnpl)
43         {
44         int nbr_nodes=nnpl*nnpl*nnpl;
45         int i;
46         /*num_nodes=(med_int *) malloc(nbr_nodes*sizeof(med_int));*/
47         for (i=0;i<nbr_nodes;i++) num_nodes[i]=i+1;//nbr_nodes+i;
48         }
49 void cree_Hexa8(med_int * conn_hexa8, int nnpl,med_int * num_nodes)
50         {
51         int i,j,k;
52         int i0,j0,k0,i1,j1,k1;
53         int nbr_nodes=nnpl*nnpl*nnpl;
54         int nbr_hexa8=(nnpl-1)*(nnpl-1)*(nnpl-1);
55         int num_hexa8;
56         
57         /*conn_hexa8=(med_int *) malloc(8*nbr_hexa8*sizeof(med_int));*/
58         
59         for (i=0;i<nnpl-1;i++) for (j=0;j<nnpl-1;j++) for (k=0;k<nnpl-1;k++) 
60                 {
61                 i0=i;j0=j;k0=k;
62                 i1=i+1;j1=j+1;k1=k+1;
63                 
64                 num_hexa8=i+(nnpl-1)*j+(nnpl-1)*(nnpl-1)*k;
65                 
66                 if (8*num_hexa8  >=8*nbr_hexa8) {printf("%d : OUT OF RANGE REQUEST\n",num_hexa8);exit(-1);}
67                 if (8*num_hexa8+1>=8*nbr_hexa8) {printf("%d : OUT OF RANGE REQUEST\n",num_hexa8);exit(-1);}
68                 if (8*num_hexa8+2>=8*nbr_hexa8) {printf("%d : OUT OF RANGE REQUEST\n",num_hexa8);exit(-1);}
69                 if (8*num_hexa8+3>=8*nbr_hexa8) {printf("%d : OUT OF RANGE REQUEST\n",num_hexa8);exit(-1);}
70                 if (8*num_hexa8+4>=8*nbr_hexa8) {printf("%d : OUT OF RANGE REQUEST\n",num_hexa8);exit(-1);}
71                 if (8*num_hexa8+5>=8*nbr_hexa8) {printf("%d : OUT OF RANGE REQUEST\n",num_hexa8);exit(-1);}
72                 if (8*num_hexa8+6>=8*nbr_hexa8) {printf("%d : OUT OF RANGE REQUEST\n",num_hexa8);exit(-1);}
73                 if (8*num_hexa8+7>=8*nbr_hexa8) {printf("%d : OUT OF RANGE REQUEST\n",num_hexa8);exit(-1);}
74                 
75                 conn_hexa8[8*num_hexa8  ] = num_nodes[ i0+nnpl*j1+nnpl*nnpl*k1 ]; 
76                 conn_hexa8[8*num_hexa8+1] = num_nodes[ i0+nnpl*j0+nnpl*nnpl*k1 ]; 
77                 conn_hexa8[8*num_hexa8+2] = num_nodes[ i1+nnpl*j0+nnpl*nnpl*k1 ]; 
78                 conn_hexa8[8*num_hexa8+3] = num_nodes[ i1+nnpl*j1+nnpl*nnpl*k1 ]; 
79                 conn_hexa8[8*num_hexa8+4] = num_nodes[ i0+nnpl*j1+nnpl*nnpl*k0 ]; 
80                 conn_hexa8[8*num_hexa8+5] = num_nodes[ i0+nnpl*j0+nnpl*nnpl*k0 ]; 
81                 conn_hexa8[8*num_hexa8+6] = num_nodes[ i1+nnpl*j0+nnpl*nnpl*k0 ]; 
82                 conn_hexa8[8*num_hexa8+7] = num_nodes[ i1+nnpl*j1+nnpl*nnpl*k0 ]; 
83                 
84                 
85                 }
86                 
87         for (num_hexa8=0;num_hexa8<nbr_hexa8;num_hexa8++)
88                 {               
89                 printf("Maille numéro %4d :",num_hexa8);                
90                 printf("%4d ",conn_hexa8[8*num_hexa8  ]);
91                 printf("%4d ",conn_hexa8[8*num_hexa8+1]);
92                 printf("%4d ",conn_hexa8[8*num_hexa8+2]);
93                 printf("%4d ",conn_hexa8[8*num_hexa8+3]);
94                 printf("%4d ",conn_hexa8[8*num_hexa8+4]);
95                 printf("%4d ",conn_hexa8[8*num_hexa8+5]);
96                 printf("%4d ",conn_hexa8[8*num_hexa8+6]);
97                 printf("%4d ",conn_hexa8[8*num_hexa8+7]);
98                 printf("\n");
99                 }
100         }       
101 void cree_noms_mailles(char * noms, int nnpl)
102         {
103         int nbr_hexa8=(nnpl-1)*(nnpl-1)*(nnpl-1);       
104         int i;
105         char pnom[MED_TAILLE_PNOM+1]="hexa    ";
106         
107         /*noms=(char *) malloc((nbr_hexa8*MED_TAILLE_PNOM+1)*sizeof(char));*/
108         
109         for (i=0;i<nbr_hexa8;i++) strncpy(&noms[i*MED_TAILLE_PNOM],pnom,MED_TAILLE_PNOM);
110         
111         noms[nbr_hexa8*MED_TAILLE_PNOM]='\n';
112         
113         }
114 void cree_num_mailles(med_int * num_mailles,int nnpl)
115         {
116         int nbr_hexa8=(nnpl-1)*(nnpl-1)*(nnpl-1);       
117         int i;
118         
119         /*num_mailles=(med_int *) malloc(nbr_hexa8*sizeof(med_int));*/
120         
121         for (i=0;i<nbr_hexa8;i++) num_mailles[i]=i+1;
122         }
123 void cree_fam_nodes(med_int * fam,int nnpl)
124         {
125         int nbr_nodes=nnpl*nnpl*nnpl;
126         int i;
127         
128         /*fam=(med_int *) malloc(nbr_nodes*sizeof(med_int));*/
129         
130         for (i=0;i<nbr_nodes;i++) fam[i]=0;
131         }
132 void cree_fam_mailles(med_int * fam,int nnpl)
133         {
134         int nbr_hexa8=(nnpl-1)*(nnpl-1)*(nnpl-1);       
135         int i;
136         
137         /*fam=(med_int *) malloc(nbr_hexa8*sizeof(med_int));*/
138         
139         for (i=0;i<nbr_hexa8;i++) fam[i]=0;
140         }
141 void cree_valeurs_champ_node(med_float * val,int nnpl)
142         {
143         int i,j,k;
144         int nbr_nodes=nnpl*nnpl*nnpl;
145         int num_noeud;
146         int diviseur=3*(nnpl-1);
147         
148         /*val=(med_float *) malloc(nbr_nodes*sizeof(med_float));*/
149         
150         for (i=0;i<nnpl;i++) for (j=0;j<nnpl;j++) for (k=0;k<nnpl;k++) 
151                 {
152                 num_noeud=i+nnpl*j+nnpl*nnpl*k;
153                 val[num_noeud] = (med_float) (i+j+k)/diviseur;
154                 }
155         for (num_noeud=0;num_noeud<nbr_nodes;num_noeud++) printf("Valeur Scalaire noeud %5d : %4.5f\n",num_noeud,val[num_noeud]);
156         }
157 void cree_valeurs_champ_vector_node(med_float * val,int nnpl)
158         {
159         int i,j,k;
160         int nbr_nodes=nnpl*nnpl*nnpl;
161         int num_noeud;
162         
163         /*val=(med_float *) malloc(nbr_nodes*sizeof(med_float));*/
164         
165         for (i=0;i<nnpl;i++) for (j=0;j<nnpl;j++) for (k=0;k<nnpl;k++) 
166                 {
167                 num_noeud=i+nnpl*j+nnpl*nnpl*k;
168                 val[3*num_noeud  ] = (med_float) 0;
169                 val[3*num_noeud+1] = (med_float) 1;
170                 val[3*num_noeud+2] = (med_float) 2;
171                 }
172         for (num_noeud=0;num_noeud<nbr_nodes;num_noeud++) printf("Valeur Vectorielle noeud %5d : %4.5f %4.5f %4.5f \n ",num_noeud,val[3*num_noeud],val[3*num_noeud+1],val[3*num_noeud+2]);
173         }
174 void cree_valeurs_champ_cell(med_float * val,int nnpl)
175         {
176         int i,j,k;
177         int nbr_cells=(nnpl-1)*(nnpl-1)*(nnpl-1);       
178         int num_cell;
179         
180         med_float diviseur=3*(nnpl-2);
181         
182         /*val=(med_float *) malloc(3*nbr_cells*sizeof(med_float));*/
183         
184         for (i=0;i<nnpl-1;i++) for (j=0;j<nnpl-1;j++) for (k=0;k<nnpl-1;k++) 
185                 {
186                 num_cell=i+(nnpl-1)*j+(nnpl-1)*(nnpl-1)*k;
187                 val[num_cell  ] =  (med_float) (i+j+k)/diviseur;
188                 }
189         for (num_cell=0;num_cell<nbr_cells;num_cell++) printf("Valeur scalaire maille %5d : %4.5f\n ",num_cell,val[num_cell]);
190         }       
191 void cree_valeurs_champ_vector_cell(med_float * val,int nnpl)
192         {
193         int i,j,k;
194         int nbr_cells=(nnpl-1)*(nnpl-1)*(nnpl-1);       
195         int num_cell;
196         
197         /*val=(med_float *) malloc(3*nbr_cells*sizeof(med_float));*/
198         
199         for (i=0;i<nnpl-1;i++) for (j=0;j<nnpl-1;j++) for (k=0;k<nnpl-1;k++) 
200                 {
201                 num_cell=i+(nnpl-1)*j+(nnpl-1)*(nnpl-1)*k;
202                 val[3*num_cell  ] = (med_float) 0;
203                 val[3*num_cell+1] = (med_float) 1;
204                 val[3*num_cell+2] = (med_float) 2;         
205                 }
206         for (num_cell=0;num_cell<nbr_cells;num_cell++) printf("Valeur Vectorielle maille %5d : %4.5f %4.5f %4.5f \n ",num_cell,val[3*num_cell],val[3*num_cell+1],val[3*num_cell+2]);
207         }
208
209         
210 /*****************************************************************************************************/
211         
212 int main (int argc, char **argv)
213         {
214                 
215         int i,j,k;
216         
217         int nnpl;
218         
219         int nbr_nodes, nbr_hexa8;
220
221         med_err ret;
222         med_idt fromfid;
223         med_idt tofid;
224         char frommaa[MED_TAILLE_NOM+1] = "fromMesh";
225         char tomaa[MED_TAILLE_NOM+1]   = "toMesh";
226         char frommaadesc[MED_TAILLE_DESC+1] = "Initial Mesh description";
227         char tomaadesc[MED_TAILLE_DESC+1] = "Target Mesh description";
228         med_maillage type = MED_NON_STRUCTURE;
229         const med_int mdim = 3;
230         med_int fromnnoe;
231         med_int   tonnoe;
232         
233         med_float * tocoo;                   
234         med_float * fromcoo;                 
235         
236         char nomcoo[3*MED_TAILLE_PNOM+1] = "x       y       z       ";
237         char unicoo[3*MED_TAILLE_PNOM+1] = "cm      cm      cm      ";
238
239         char * nomnoe = NULL ;
240         
241         med_int  * fromnumnoe;              
242         med_int  * fromnufano;              
243
244         med_int  * tonumnoe;                
245         med_int  * tonufano;                
246
247         med_int fromnhexa8;
248         med_int  * fromhexa8;                                          
249                              
250         med_int tonhexa8;
251         med_int  * tohexa8;                                          
252                              
253                              
254         char  * fromnomhexa8;             
255         med_int * fromnumhexa8;                                              
256         med_int * fromnufahexa8;                                             
257
258         char  * tonomhexa8;             
259         med_int * tonumhexa8;                                              
260         med_int * tonufahexa8;                                             
261
262 /*****************************************************************************************************/
263
264         char nomfam[MED_TAILLE_NOM+1];
265         med_int numfam;
266         char attdes[MED_TAILLE_DESC+1];
267         med_int natt;
268         med_int attide;
269         med_int attval;
270         med_int ngro;
271         char gro[MED_TAILLE_LNOM+1];
272         char gro2[MED_TAILLE_LNOM*2+1];
273         char gro3[MED_TAILLE_LNOM*3+1];
274         int nfame = 1; 
275         int nfamn = 1;
276
277 /*****************************************************************************************************/
278
279         /* Some fields : one on nodes : double , one on cells : double */
280
281         char champnode[MED_TAILLE_NOM+1]="fieldnodedouble" ;
282         char champnode_comp[MED_TAILLE_PNOM+1]="X+Y+Z   " ;
283         char champnode_unit[MED_TAILLE_PNOM+1]="X+Y+Z   " ;
284         med_float   * fieldnodedouble;
285
286         char champnodevector[MED_TAILLE_NOM+1]="fieldnodedoublevector" ;
287         char champnodevector_comp[MED_TAILLE_PNOM*3+1]="0       1       2       " ;
288         char champnodevector_unit[MED_TAILLE_PNOM*3+1]="O       1       2       " ;
289         med_float   * fieldnodedoublevector;
290
291         char champcellscalar[MED_TAILLE_NOM+1]="fieldcelldouble" ;
292         char champcellscalar_comp[MED_TAILLE_PNOM+1]="X+Y+Z   " ;
293         char champcellscalar_unit[MED_TAILLE_PNOM+1]="X+Y+Z   " ;
294         med_float   * fieldcelldouble;
295
296         char champcell[MED_TAILLE_NOM+1]="fieldcelldoublevector" ;
297         char champcell_comp[MED_TAILLE_PNOM*3+1]="0       1       2       " ;
298         char champcell_unit[MED_TAILLE_PNOM*3+1]="0       1       2       " ;
299         med_float   * fieldcelldoublevector;
300
301 /*****************************************************************************************************/
302
303         
304         if (argc!=2) 
305                 {
306                 printf("Il manque un paramètre : le nombre de point par ligne\n");
307                 exit(-1);
308                 }
309
310         sscanf(argv[1],"%d",&nnpl);
311         
312         printf("VERSION 2.0\n");
313         printf("Traitement avec %d noeuds par ligne\n",nnpl);
314
315         fromnnoe   = nnpl*nnpl*nnpl             ;
316         fromnhexa8 = (nnpl-1)*(nnpl-1)*(nnpl-1) ;
317         tonnoe     = (nnpl-1)*(nnpl-1)*(nnpl-1) ;
318         tonhexa8   = (nnpl-2)*(nnpl-2)*(nnpl-2) ;
319
320
321
322         nbr_nodes=nnpl*nnpl*nnpl;
323         nbr_hexa8=(nnpl-1)*(nnpl-1)*(nnpl-1);
324
325         fromcoo       = (med_float *) malloc(3*nbr_nodes*sizeof(med_float));              cree_nodes        ( fromcoo       , nnpl, 0 );
326         fromnumnoe    = (med_int *)   malloc(nbr_nodes*sizeof(med_int));                  cree_num_nodes    ( fromnumnoe    , nnpl );
327         fromnufano    = (med_int *)   malloc(nbr_nodes*sizeof(med_int));                  cree_fam_nodes    ( fromnufano    , nnpl );
328         fromhexa8     = (med_int *)   malloc(8*nbr_hexa8*sizeof(med_int));                cree_Hexa8        ( fromhexa8     , nnpl ,fromnumnoe);
329         fromnomhexa8  = (char *)      malloc((nbr_hexa8*MED_TAILLE_PNOM+1)*sizeof(char)); cree_noms_mailles ( fromnomhexa8  , nnpl );
330         fromnumhexa8  = (med_int *)   malloc(nbr_hexa8*sizeof(med_int));                  cree_num_mailles  ( fromnumhexa8  , nnpl );
331         fromnufahexa8 = (med_int *)   malloc(nbr_hexa8*sizeof(med_int));                  cree_fam_mailles  ( fromnufahexa8 , nnpl );
332
333         fieldnodedouble       = (med_float *) malloc(nbr_nodes*sizeof(med_float));          cree_valeurs_champ_node        ( fieldnodedouble       , nnpl );
334         fieldnodedoublevector = (med_float *) malloc(3*nbr_nodes*sizeof(med_float));        cree_valeurs_champ_vector_node ( fieldnodedoublevector , nnpl );
335         fieldcelldouble       = (med_float *) malloc(nbr_hexa8*sizeof(med_float));          cree_valeurs_champ_cell        ( fieldcelldouble       , nnpl );
336         fieldcelldoublevector = (med_float *) malloc(3*nbr_hexa8*sizeof(med_float));        cree_valeurs_champ_vector_cell ( fieldcelldoublevector , nnpl );
337         
338
339         nbr_nodes=(nnpl-1)*(nnpl-1)*(nnpl-1);
340         nbr_hexa8=(nnpl-2)*(nnpl-2)*(nnpl-2);
341
342         tocoo       = (med_float *) malloc(3*nbr_nodes*sizeof(med_float));              cree_nodes        ( tocoo       , nnpl-1, 1 );
343         tonumnoe    = (med_int *)   malloc(nbr_nodes*sizeof(med_int));                  cree_num_nodes    ( tonumnoe    , nnpl-1 );
344         tonufano    = (med_int *)   malloc(nbr_nodes*sizeof(med_int));                  cree_fam_nodes    ( tonufano    , nnpl-1 );
345         tohexa8     = (med_int *)   malloc(8*nbr_hexa8*sizeof(med_int));                cree_Hexa8        ( tohexa8     , nnpl-1 ,tonumnoe);
346         tonomhexa8  = (char *)      malloc((nbr_hexa8*MED_TAILLE_PNOM+1)*sizeof(char)); cree_noms_mailles ( tonomhexa8  , nnpl-1 );
347         tonumhexa8  = (med_int *)   malloc(nbr_hexa8*sizeof(med_int));                  cree_num_mailles  ( tonumhexa8  , nnpl-1 );
348         tonufahexa8 = (med_int *)   malloc(nbr_hexa8*sizeof(med_int));                  cree_fam_mailles  ( tonufahexa8 , nnpl-1 );
349
350         
351 /*****************************************************************************************************/
352         fromfid = MEDouvrir("fromMesh.med",MED_LECTURE_AJOUT);
353         if (fromfid < 0)
354                 ret = -1;
355         else
356                 ret = 0;
357         printf("MEDouvrir : %d\n",ret);
358
359 /*****************************************************************************************************/
360         tofid = MEDouvrir("toMesh.med",MED_LECTURE_AJOUT);
361         if (tofid < 0)
362                 ret = -1;
363         else
364                 ret = 0;
365         printf("MEDouvrir : %d\n",ret);
366 /*****************************************************************************************************/
367         if (ret == 0)
368                 ret = MEDmaaCr(fromfid,frommaa,mdim,type,frommaadesc);
369         printf("MEDmaaCr : %d\n",ret);
370
371 /*****************************************************************************************************/
372
373         if (ret == 0)
374                 ret = MEDmaaCr(tofid,tomaa,mdim,type,tomaadesc);
375         printf("MEDmaaCr : %d\n",ret);
376
377 /*****************************************************************************************************/
378         if (ret == 0)
379                 ret = MEDnoeudsEcr(fromfid,frommaa,mdim,fromcoo,MED_FULL_INTERLACE,MED_CART,
380                                      // nomcoo,unicoo,nomnoe,MED_FAUX,fromnumnoe,MED_VRAI,
381                                      nomcoo,unicoo,nomnoe,MED_FAUX,fromnumnoe,MED_FAUX,
382                                      fromnufano,fromnnoe);
383         printf("MEDnoeudsEcr : %d\n",ret);
384 /*****************************************************************************************************/
385
386         if (ret == 0)
387                 ret = MEDnoeudsEcr(tofid,tomaa,mdim,tocoo,MED_FULL_INTERLACE,MED_CART,
388                                      //nomcoo,unicoo,nomnoe,MED_FAUX,tonumnoe,MED_VRAI,
389                                      nomcoo,unicoo,nomnoe,MED_FAUX,tonumnoe,MED_FAUX,
390                                      tonufano,tonnoe);
391         printf("MEDnoeudsEcr : %d\n",ret);
392
393
394 /*****************************************************************************************************/
395 /* ecriture des mailles MED_HEXA8 :
396    - connectivite
397    - noms (optionnel) 
398    - numeros (optionnel)
399    - numeros des familles */
400         if (ret == 0) 
401                 ret = MEDelementsEcr(fromfid,frommaa,mdim,fromhexa8,MED_FULL_INTERLACE,
402                                         fromnomhexa8,MED_FAUX,fromnumhexa8,MED_VRAI,fromnufahexa8,fromnhexa8,
403                                         MED_MAILLE,MED_HEXA8,MED_NOD);
404         printf("MEDelementsEcr : %d \n",ret);
405
406 /*****************************************************************************************************/
407 /* ecriture des mailles MED_HEXA8 :
408    - connectivite
409    - noms (optionnel) 
410    - numeros (optionnel)
411    - numeros des familles */
412
413         if (ret == 0) 
414                 ret = MEDelementsEcr(tofid,tomaa,mdim,tohexa8,MED_FULL_INTERLACE,
415                                         tonomhexa8,MED_FAUX,tonumhexa8,MED_VRAI,tonufahexa8,tonhexa8,
416                                         MED_MAILLE,MED_HEXA8,MED_NOD);
417         printf("MEDelementsEcr : %d \n",ret);
418
419 /*****************************************************************************************************/
420 /* ecriture des familles */
421 /* Conventions :
422    - toujours creer une famille de numero 0 ne comportant aucun attribut
423      ni groupe (famille de reference pour les noeuds ou les elements
424      qui ne sont rattaches a aucun groupe ni attribut)
425    - les numeros de familles de noeuds sont > 0
426    - les numeros de familles des elements sont < 0
427    - rien d'imposer sur les noms de familles
428  */ 
429
430 /* la famille 0 */
431         if (ret == 0)
432                 {
433                 strcpy(nomfam,"FAMILLE_0");
434                 numfam = 0;
435                 ret = MEDfamCr(fromfid,frommaa,nomfam,numfam,&attide,&attval,attdes,0,gro,0);
436                 }
437         printf("MEDfamCr : %d \n",ret);
438 /*****************************************************************************************************/
439
440         if (ret == 0)
441                 {
442                 strcpy(nomfam,"FAMILLE_0");
443                 numfam = 0;
444                 ret = MEDfamCr(tofid,tomaa,nomfam,numfam,&attide,&attval,attdes,0,gro,0);
445                 }
446         printf("MEDfamCr : %d \n",ret);
447
448 /*****************************************************************************************************/
449 /* Les champs */
450
451         if (ret == 0)
452                 {
453                 ret = MEDchampCr(fromfid,champnode,MED_FLOAT64,champnode_comp,champnode_unit,1); 
454                 printf("MEDchampCr : %d \n",ret); 
455                 if (ret == 0) 
456                         {
457                         ret = MEDchampEcr(fromfid, frommaa, champnode, (unsigned char *)fieldnodedouble,
458                                                 MED_FULL_INTERLACE, fromnnoe,
459                                                 MED_NOGAUSS, MED_ALL, MED_NOPFL, MED_NO_PFLMOD, MED_NOEUD, 
460                                                 0, MED_NOPDT,"        ", 0. , MED_NONOR);
461                         printf("MEDchampEcr : %d \n",ret);
462                         }
463                 }
464
465         if (ret == 0)
466                 {
467                 ret = MEDchampCr(fromfid,champcell,MED_FLOAT64,champcell_comp,champcell_unit,3);
468                 printf("MEDchampCr : %d \n",ret);
469                 if (ret == 0) 
470                         {
471                         ret = MEDchampEcr(fromfid, frommaa, champcell, (unsigned char *)fieldcelldoublevector,
472                                                 MED_FULL_INTERLACE, fromnhexa8,
473                                                 MED_NOGAUSS, MED_ALL, MED_NOPFL, MED_NO_PFLMOD, MED_MAILLE, 
474                                                 MED_HEXA8, MED_NOPDT,"        ", 0., MED_NONOR);
475                         printf("MEDchampEcr : %d \n",ret);
476                         }
477                 }
478
479         if (ret == 0)
480                 {
481                 ret = MEDchampCr(fromfid,champcellscalar,MED_FLOAT64,champcellscalar_comp,champcellscalar_unit,1); 
482                 printf("MEDchampCr : %d \n",ret); 
483                 if (ret == 0) 
484                         {
485                         ret = MEDchampEcr(fromfid, frommaa, champcellscalar, (unsigned char *)fieldcelldouble,
486                                                 MED_FULL_INTERLACE, fromnhexa8,
487                                                 MED_NOGAUSS, MED_ALL, MED_NOPFL, MED_NO_PFLMOD, MED_MAILLE, 
488                                                 MED_HEXA8, MED_NOPDT,"        ", 0., MED_NONOR);
489                         printf("MEDchampEcr : %d \n",ret);
490                         }
491                 }
492
493         if (ret == 0)
494                 {
495                 ret = MEDchampCr(fromfid,champnodevector,MED_FLOAT64,champnodevector_comp,champnodevector_unit,3);
496                 printf("MEDchampCr : %d \n",ret);
497                 if (ret == 0) 
498                         {
499                         ret = MEDchampEcr(fromfid, frommaa, champnodevector, (unsigned char *)fieldnodedoublevector,
500                                                 MED_FULL_INTERLACE, fromnnoe,
501                                                 MED_NOGAUSS, MED_ALL, MED_NOPFL, MED_NO_PFLMOD, MED_NOEUD, 
502                                                 0, MED_NOPDT,"        ", 0. , MED_NONOR);
503                         printf("MEDchampEcr : %d \n",ret);
504                         }
505                 }
506
507
508 /***************************************************************************/
509 ret = MEDfermer(fromfid);
510 printf("MEDfermer : %d\n",ret);
511 /***************************************************************************/
512 ret = MEDfermer(tofid);
513 printf("MEDfermer : %d\n",ret);
514
515 return 0;
516 }