~ubuntu-branches/ubuntu/wily/freefem++/wily

« back to all changes in this revision

Viewing changes to download/mmg3d/patch-mmg3dv4.diff

  • Committer: Package Import Robot
  • Author(s): Dimitrios Eftaxiopoulos, Dimitrios Eftaxiopoulos, Christophe Trophime
  • Date: 2013-09-12 00:02:58 UTC
  • mfrom: (1.2.1) (11.1.1 experimental)
  • Revision ID: package-import@ubuntu.com-20130912000258-aclq2zfa1svt0p3x
Tags: 3.25-1
[ Dimitrios Eftaxiopoulos ]
* Imported Upstream version 3.25 (Closes: #701161 #706714)
* Change installation directory of header-like *.idp files
  from /usr/lib/freefem++ to /usr/include/freefem++, in order
  to fix a lintian warning
* Update patch to examples++-load/Makefile.am in order to enable
  functioning of load *.so and include *.idp commands in *.edp
  scripts
* Delete patches to src/Graphics/sansgraph.cpp and
  src/Graphics/xglrgraph.cpp because they are not needed any more
* Fix lintian warning about missing LDFLAGS
* Override dh_auto_test in debian/rules, such that in case it is 
  used, it completes executing all *.edp example files, regardless
  of aborting on some of them
* Add libmetis-dev to build-deps in d/control
* Remove libparmetis-dev from build deps
* Add --parallel option to dh $@ in debian/rules
* Add hardening compilation flags to mpic++
* Allow testing of compiling and running the example files after build

[ Christophe Trophime ]
* update C. Trophime email
* add support for nlopt, ipopt - simplify debian/rules
* upload CT changes to 3.20
* add patch for configure
* add patch for examples++-mpi
* fix bamg install
* add corrected scripts to build plugins
* add patch for properly build examples++-load
* add lintian overrides for libfreefem++
* add some missing files
* update patches
* update rules
* reorder BuildDepends - comment out unsupported libs

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
Only in mmg3d4-new/build/sources/: dataff.h
2
 
diff -u mmg3d4/build/sources/inout.c mmg3d4-new/build/sources/inout.c
3
 
--- mmg3d4/build/sources/inout.c        2011-05-12 17:30:16.000000000 +0200
4
 
+++ mmg3d4-new/build/sources/inout.c    2011-09-01 19:22:06.000000000 +0200
5
 
@@ -4,7 +4,7 @@
 
1
>diff -r -u mmg3d4/build/sources/analarcutting.c mmg3d4-new/build/sources/analarcutting.c
 
2
--- mmg3d4/build/sources/analarcutting.c        2012-12-19 16:05:32.000000000 +0100
 
3
+++ mmg3d4-new/build/sources/analarcutting.c    2013-01-18 16:33:45.000000000 +0100
 
4
@@ -307,7 +307,7 @@
 
5
     printf("6 cut : %8d\n",n6);
 
6
     printf("---------------------------\n"); */
 
7
   if ( !na )  return(na);
 
8
-#warning check memory allocation
 
9
+  // #warning check memory allocation
 
10
 
 
11
   //printf("%d cut init --- nb tet %d\n",na,mesh->ne);
 
12
   return(na);
 
13
diff -r -u mmg3d4/build/sources/cutelt.c mmg3d4-new/build/sources/cutelt.c
 
14
--- mmg3d4/build/sources/cutelt.c       2012-12-19 16:05:32.000000000 +0100
 
15
+++ mmg3d4-new/build/sources/cutelt.c   2013-01-18 16:35:41.000000000 +0100
 
16
@@ -305,8 +305,7 @@
 
17
 //      }
 
18
 //      return(1);
 
19
 // }
 
20
-int ddebug=0;
 
21
-
 
22
+extern int ddebug; 
 
23
 int MMG_decouphex(pMesh mesh, pHedge hed,int k,int* p,int ref) {
 
24
   pTetra  pt;
 
25
   int     i,nu1,nu2;
 
26
diff -r -u mmg3d4/build/sources/dataff.h mmg3d4-new/build/sources/dataff.h
 
27
--- mmg3d4/build/sources/dataff.h       2013-01-18 21:52:48.000000000 +0100
 
28
+++ mmg3d4-new/build/sources/dataff.h   2013-01-18 18:50:04.000000000 +0100
 
29
@@ -0,0 +1,60 @@
 
30
+/*
 
31
+ *  dataff.h
 
32
+ *  
 
33
+ *
 
34
+ *  Created by Fr\E9d\E9ric Hecht on 19/06/11.
 
35
+ *  Copyright 2011 UPMC. All rights reserved.
 
36
+ *
 
37
 
38
+ */
 
39
+
 
40
+enum ff_data_type {
 
41
+    ff_id_vertex =0,
 
42
+    ff_id_seg =1,
 
43
+    ff_id_tria=2,
 
44
+    ff_id_tet =3,
 
45
+
 
46
+    ff_id_prism =5,
 
47
+    ff_id_hex =6,
 
48
+    ff_id_quad =7,
 
49
+    ff_id_corner=8
 
50
+} ;
 
51
+
 
52
+
 
53
+typedef struct  DataFF 
 
54
+{
 
55
+  const char  * meshname;
 
56
+  const char  * movename;
 
57
+  const char  * solname;
 
58
+  int imprim;
 
59
+  int memory;
 
60
+  int   np; //  nb of vertices  in/out 
 
61
+  int   typesol; //  1 iso , 6 : m11; m12,m13,m22,m23,m33
 
62
+  void * mesh;
 
63
+  double * sol; /* metric :size typesol*np  */
 
64
+  double * mov; /* displac. size :3*np  */ 
 
65
+  void (*set_mesh)(void *dataff,int *data,int ldata);
 
66
+  void (*end_mesh)(void *dataff);
 
67
+  void (*set_v)(void *dataff,int i,double *xyz,int lab);
 
68
+  void (*set_elmt)(void *dataff,int ff_id,int i,int *k,int lab);
 
69
+  void (*get_mesh)(void *dataff,int *data,int ldata);
 
70
+  void (*get_v3)(void *dataff,int i,double *xyz,int *lab);
 
71
+  void (*get_elmt)(void *dataff,int ff_id,int i,int *k,int *lab);
 
72
+} DataFF;
 
73
+
 
74
+#ifdef __cplusplus
 
75
+extern "C" {
 
76
+#endif  
 
77
+    int mainmmg3d(int argc,char *argv[],DataFF *dataff); 
 
78
+
 
79
+#ifdef __cplusplus
 
80
+}
 
81
+#endif 
 
82
+/*
 
83
+ m11 = met[0] 
 
84
+ m12 = met[1] 
 
85
+ m13 = met[2] 
 
86
+ m22 = met[3]
 
87
+ m23 = met[4] 
 
88
+ m33 = met[5]  
 
89
+*/
 
90
diff -r -u mmg3d4/build/sources/delaunay.c mmg3d4-new/build/sources/delaunay.c
 
91
--- mmg3d4/build/sources/delaunay.c     2012-12-19 16:05:32.000000000 +0100
 
92
+++ mmg3d4-new/build/sources/delaunay.c 2013-01-18 16:32:41.000000000 +0100
 
93
@@ -728,7 +728,7 @@
 
94
   if ( ppt->tag & M_UNUSED )  return(0);
 
95
 
 
96
   tref = mesh->tetra[list->tetra[1]/6].ref;
 
97
-#warning remove this test
 
98
+  // #warning remove this test
 
99
   for (k=1; k<=lon; k++)
 
100
     if(tref!=mesh->tetra[list->tetra[k]/6].ref)
 
101
       printf("pbs coquil %d %d tet %d\n",tref,mesh->tetra[list->tetra[k]/6].ref,list->tetra[k]/6);
 
102
diff -r -u mmg3d4/build/sources/libmmg3d.h mmg3d4-new/build/sources/libmmg3d.h
 
103
--- mmg3d4/build/sources/libmmg3d.h     2012-12-19 16:05:36.000000000 +0100
 
104
+++ mmg3d4-new/build/sources/libmmg3d.h 2013-01-18 16:32:41.000000000 +0100
 
105
@@ -118,12 +118,12 @@
 
106
 typedef MMG_Sol * MMG_pSol;
 
107
 
 
108
 /* inout */
 
109
-int  MMG_loadMesh(MMG_pMesh ,char *);
 
110
-int  MMG_loadSol(MMG_pSol ,char *,int );
 
111
-int  MMG_loadVect(MMG_pMesh ,char *,int );
 
112
-int  MMG_saveMesh(MMG_pMesh ,char *);
 
113
-int  MMG_saveSol(MMG_pMesh ,MMG_pSol ,char *);
 
114
-int  MMG_saveVect(MMG_pMesh ,char *);
 
115
+int  MMG_loadMesh(MMG_pMesh ,char *,void *);
 
116
+int  MMG_loadSol(MMG_pSol ,char *,int ,void *);
 
117
+int  MMG_loadVect(MMG_pMesh ,char *,int ,void *);
 
118
+int  MMG_saveMesh(MMG_pMesh ,char *,void *);
 
119
+int  MMG_saveSol(MMG_pMesh ,MMG_pSol ,char *,void *);
 
120
+int  MMG_saveVect(MMG_pMesh ,char *,void *);
 
121
 
 
122
 #ifdef  __cplusplus
 
123
 namespace mmg3d{
 
124
diff -r -u mmg3d4/build/sources/mesh.h mmg3d4-new/build/sources/mesh.h
 
125
--- mmg3d4/build/sources/mesh.h 2012-12-19 16:05:36.000000000 +0100
 
126
+++ mmg3d4-new/build/sources/mesh.h     2013-01-18 16:32:41.000000000 +0100
 
127
@@ -405,17 +405,17 @@
 
128
 
 
129
 /* function pointers */
 
130
 typedef int (*MMG_Swap)(pMesh ,pSol ,pList );
 
131
-MMG_Swap MMG_swpptr;
 
132
-double (*MMG_length)(double *,double *,double *,double *);
 
133
-double (*MMG_caltet)(pMesh ,pSol ,int );
 
134
-double (*MMG_calte1)(pMesh ,pSol ,int );
 
135
-int    (*MMG_caltet2)(pMesh ,pSol ,int ,int ,double ,double *);
 
136
-int    (*MMG_cavity)(pMesh ,pSol ,int ,int ,pList ,int );
 
137
-int    (*MMG_buckin)(pMesh ,pSol ,pBucket ,int );
 
138
-int    (*MMG_optlen)(pMesh ,pSol ,double ,int );
 
139
-int    (*MMG_interp)(double *,double *,double *,double );
 
140
-int    (*MMG_optlentet)(pMesh ,pSol ,pQueue ,double ,int ,int );
 
141
-int    (*MMG_movevertex)(pMesh ,pSol ,int ,int );
 
142
+extern MMG_Swap MMG_swpptr;
 
143
+extern double (*MMG_length)(double *,double *,double *,double *);
 
144
+extern double (*MMG_caltet)(pMesh ,pSol ,int );
 
145
+extern double (*MMG_calte1)(pMesh ,pSol ,int );
 
146
+extern int    (*MMG_caltet2)(pMesh ,pSol ,int ,int ,double ,double *);
 
147
+extern int    (*MMG_cavity)(pMesh ,pSol ,int ,int ,pList ,int );
 
148
+extern int    (*MMG_buckin)(pMesh ,pSol ,pBucket ,int );
 
149
+extern int    (*MMG_optlen)(pMesh ,pSol ,double ,int );
 
150
+extern int    (*MMG_interp)(double *,double *,double *,double );
 
151
+extern int    (*MMG_optlentet)(pMesh ,pSol ,pQueue ,double ,int ,int );
 
152
+extern int    (*MMG_movevertex)(pMesh ,pSol ,int ,int );
 
153
 
 
154
 
 
155
 #endif
 
156
diff -r -u mmg3d4/build/sources/mmg3d4.c mmg3d4-new/build/sources/mmg3d4.c
 
157
--- mmg3d4/build/sources/mmg3d4.c       2012-12-19 16:05:33.000000000 +0100
 
158
+++ mmg3d4-new/build/sources/mmg3d4.c   2013-01-18 18:28:05.000000000 +0100
 
159
@@ -3,32 +3,32 @@
 
160
 Co-auteurs : Cecile Dobrzynski et Pascal Frey.
6
161
 Propriétaires :IPB - UPMC -INRIA.
7
162
 
8
 
 Copyright © 2004-2005-2006-2007-2008-2009-2010-2011, 
 
163
-Copyright © 2004-2005-2006-2007-2008-2009-2010-2011,
 
164
+Copyright © 2004-2005-2006-2007-2008-2009-2010-2011, 
 
165
 diffusé sous les termes et conditions de la licence publique générale de GNU
 
166
-Version 3 ou toute version ultérieure.
 
167
+Version 3 ou toute version ultérieure.  
 
168
 
 
169
 Ce fichier est une partie de MMG3D.
 
170
 MMG3D est un logiciel libre ; vous pouvez le redistribuer et/ou le modifier
 
171
 suivant les termes de la licence publique générale de GNU
 
172
 Version 3 ou toute version ultérieure.
 
173
-MMG3D est distribué dans l'espoir qu'il sera utile, mais SANS
 
174
-AUCUNE GARANTIE ; sans même garantie de valeur marchande.
 
175
+MMG3D est distribué dans l'espoir qu'il sera utile, mais SANS 
 
176
+AUCUNE GARANTIE ; sans même garantie de valeur marchande.  
 
177
 Voir la licence publique générale de GNU pour plus de détails.
 
178
-MMG3D est diffusé en espérant qu’il sera utile,
 
179
-mais SANS AUCUNE GARANTIE, ni explicite ni implicite,
 
180
-y compris les garanties de commercialisation ou
 
181
-d’adaptation dans un but spécifique.
 
182
+MMG3D est diffusé en espérant qu’il sera utile, 
 
183
+mais SANS AUCUNE GARANTIE, ni explicite ni implicite, 
 
184
+y compris les garanties de commercialisation ou 
 
185
+d’adaptation dans un but spécifique. 
 
186
 Reportez-vous à la licence publique générale de GNU pour plus de détails.
 
187
-Vous devez avoir reçu une copie de la licence publique générale de GNU
 
188
-en même temps que ce document.
 
189
+Vous devez avoir reçu une copie de la licence publique générale de GNU 
 
190
+en même temps que ce document. 
 
191
 Si ce n’est pas le cas, aller voir <http://www.gnu.org/licenses/>.
 
192
 /****************************************************************************
 
193
 Initial software: MMG3D Version 4.0
 
194
 Co-authors: Cecile Dobrzynski et Pascal Frey.
 
195
 Owners: IPB - UPMC -INRIA.
 
196
 
 
197
-Copyright © 2004-2005-2006-2007-2008-2009-2010-2011,
 
198
-spread under the terms and conditions of the license GNU General Public License
 
199
+Copyright © 2004-2005-2006-2007-2008-2009-2010-2011, 
 
200
+spread under the terms and conditions of the license GNU General Public License 
 
201
 as published Version 3, or (at your option) any later version.
 
202
 
 
203
 This file is part of MMG3D
 
204
@@ -41,26 +41,26 @@
 
205
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
206
 GNU General Public License for more details.
 
207
 You should have received a copy of the GNU General Public License
 
208
-along with MMG3D. If not, see <http://www.gnu.org/licenses/>.
 
209
+along with MMG3D. If not, see <http://www.gnu.org/licenses/>.  
 
210
 ****************************************************************************/
 
211
 #include "mesh.h"
 
212
 
 
213
-int MMG_npuiss,MMG_nvol,MMG_npres;
 
214
-int MMG_nlen,MMG_ncal,MMG_ntopo,MMG_nex;
 
215
-int MMG_npuisstot,MMG_nvoltot,MMG_nprestot;
 
216
-int MMG_npdtot;
 
217
-int MMG_nplen,MMG_npref,MMG_bouffe;
 
218
+extern int MMG_npuiss,MMG_nvol,MMG_npres;
 
219
+extern int MMG_nlen,MMG_ncal,MMG_ntopo,MMG_nex;
 
220
+extern int MMG_npuisstot,MMG_nvoltot,MMG_nprestot;
 
221
+extern int MMG_npdtot;
 
222
+extern int MMG_nplen,MMG_npref,MMG_bouffe;
 
223
 
 
224
 int ddebug;
 
225
 
 
226
 int MMG_mmg3d4(pMesh mesh,pSol sol,int *alert) {
 
227
   Hedge    hash;
 
228
-  pBucket        bucket;
 
229
+  pBucket       bucket; 
 
230
   double   declic;
 
231
-  int              base,na,nd,ns,nna,nnd,nns,dd,it,nf,maxtou;
 
232
-  double   lmoy,LLLONG;
 
233
-  int k;
 
234
-  pTetra pt;
 
235
+  int             base,na,nd,ns,nna,nnd,nns,dd,it,nf,maxtou; 
 
236
+  double   lmoy,LLLONG;                      
 
237
+       int k;
 
238
+       pTetra pt;
 
239
   if ( abs(mesh->info.imprim) > 3 )
 
240
     fprintf(stdout,"  ** SIZE OPTIMIZATION\n");
 
241
   if ( mesh->info.imprim < 0 ) {
 
242
@@ -73,82 +73,82 @@
 
243
   maxtou = 10;
 
244
   nna = nns = nnd = 0;
 
245
   it  = 0;
 
246
-  declic = 3. / ALPHAD;
 
247
+  declic = 3. / ALPHAD;  
 
248
   lmoy = 10.;
 
249
   LLLONG = 1.5;
 
250
-
 
251
+  
 
252
   nna = 10;
 
253
-  do {
 
254
-    na  = nd  = ns  = 0;
 
255
+  do { 
 
256
+    na  = nd  = ns  = 0; 
 
257
     if(0) ddebug = 1;
 
258
     else ddebug = 0;
 
259
-
 
260
+    
 
261
     if(it && !(it%2) ) {
 
262
       bucket = MMG_newBucket(mesh,M_MAX(mesh->info.bucksiz,BUCKSIZ));
 
263
       if ( !bucket )  return(0);
 
264
-      //MMG_saveMesh(mesh,"avtana.mesh");
 
265
-      MMG_analar(mesh,sol,bucket,&na,&nd,&nf,alert);
 
266
-      //MMG_saveMesh(mesh,"apresana.mesh");
 
267
-      if ( abs(mesh->info.imprim) > 5 )
 
268
-       fprintf(stdout,"     %7d INSERTED  %7d REMOVED   %7d FILTERED\n",na,nd,nf);
 
269
-
 
270
-      M_free(bucket->head);
 
271
-      M_free(bucket->link);
 
272
-      M_free(bucket);
 
273
-
 
274
+                       //MMG_saveMesh(mesh,"avtana.mesh",0);
 
275
+      MMG_analar(mesh,sol,bucket,&na,&nd,&nf,alert);      
 
276
+                       //MMG_saveMesh(mesh,"apresana.mesh",0);
 
277
+      if ( abs(mesh->info.imprim) > 5 ) 
 
278
+        fprintf(stdout,"     %7d INSERTED  %7d REMOVED   %7d FILTERED\n",na,nd,nf);  
 
279
+
 
280
+           M_free(bucket->head);
 
281
+           M_free(bucket->link);
 
282
+           M_free(bucket);
 
283
+        
 
284
     } else {
 
285
-      ++mesh->flag;
 
286
+        ++mesh->flag;
 
287
     }
 
288
-    //printf("IT %d $$$$$$$$$$$ LLLONG  %9.3f\n",it,LLLONG);
 
289
-    nna = nns = nnd = 0;
 
290
-
 
291
+    //printf("IT %d $$$$$$$$$$$ LLLONG  %9.3f\n",it,LLLONG); 
 
292
+    nna = nns = nnd = 0; 
 
293
+      
 
294
     /*splitting*/
 
295
     if ( !mesh->info.noinsert && (!*alert)  ) {
 
296
       /* store points on edges */
 
297
       if ( !MMG_zaldy4(&hash,mesh->np) ) {
 
298
-       if ( mesh->info.ddebug )  fprintf(stdout,"  ## MEMORY ALLOCATION PROBLEM.\n");
 
299
-       *alert = 2;
 
300
-       break;
 
301
+        if ( mesh->info.ddebug )  fprintf(stdout,"  ## MEMORY ALLOCATION PROBLEM.\n"); 
 
302
+        *alert = 2;
 
303
+        break;
 
304
       }
 
305
-      nna = MMG_analarcutting(mesh,sol,&hash,alert,&lmoy,LLLONG);
 
306
+      nna = MMG_analarcutting(mesh,sol,&hash,alert,&lmoy,LLLONG); 
 
307
       if ( abs(mesh->info.imprim) > 5 ) { printf("lmoy %9.5f\n",lmoy); }
 
308
       /*puts("--------------------------------------");
 
309
-       puts("--------------------------------------");
 
310
-       puts("--------------------------------------");
 
311
-      */
 
312
+      puts("--------------------------------------");
 
313
+      puts("--------------------------------------");
 
314
+      */                             
 
315
       if ( *alert ) {
 
316
-       fprintf(stdout," \n\n ** UNABLE TO CUT (analarcutting)\n");
 
317
-       fprintf(stdout," ** RETRY WITH -m > %6d \n\n",mesh->info.memory);
 
318
-       MMG_saveMesh(mesh,"crash.mesh");
 
319
-       MMG_saveSol(mesh,sol,"crash.sol");
 
320
-       exit(0);
 
321
+        fprintf(stdout," \n\n ** UNABLE TO CUT (analarcutting)\n");
 
322
+        fprintf(stdout," ** RETRY WITH -m > %6d \n\n",mesh->info.memory);
 
323
+        MMG_saveMesh(mesh,"crash.mesh",0);
 
324
+        MMG_saveSol(mesh,sol,"crash.sol",0); 
 
325
+        exit(0);
 
326
       }
 
327
-      M_free(hash.item);
 
328
+      M_free(hash.item);        
 
329
     }
 
330
-    else if ( *alert )  nna = 0;
 
331
-    /* adjacencies */
 
332
+    else if ( *alert )  nna = 0;  
 
333
+    /* adjacencies */ 
 
334
     if ( nna /*|| it == (maxtou-1)*/ ) {
 
335
       mesh->nt = 0;
 
336
       if ( !MMG_hashTetra(mesh) )  return(0);
 
337
       if ( !MMG_markBdry(mesh) )   return(0);
 
338
     }
 
339
-    // printf("chkmsh\n");
 
340
-    // MMG_unscaleMesh(mesh,sol);
 
341
-    //     MMG_saveMesh(mesh,"chk.mesh");
 
342
+    // printf("chkmsh\n");   
 
343
+               // MMG_unscaleMesh(mesh,sol);
 
344
+               //     MMG_saveMesh(mesh,"chk.mesh",0);
 
345
     //MMG_chkmsh(mesh,1,-1);
 
346
-    //if(it==1)exit(0);
 
347
-    /* delaunization */
 
348
-    if ( !mesh->info.noswap && (nna || na) ) {
 
349
+               //if(it==1)exit(0);             
 
350
+     /* delaunization */
 
351
+    if ( !mesh->info.noswap && (nna || na) ) {  
 
352
       nns   =  MMG_cendel(mesh,sol,declic,base);
 
353
     }
 
354
 
 
355
     /* deletion */
 
356
     /*if ( 0 && nna ) {
 
357
       nnd   = MMG_colvert(mesh,sol,base);
 
358
-      } */
 
359
+    } */
 
360
     if ( nna+nnd+nns && abs(mesh->info.imprim) > 3 )
 
361
       fprintf(stdout,"     %7d INSERTED  %7d REMOVED   %7d FLIPPED\n",nna+na,nnd+nd,nns);
 
362
-
 
363
+    
 
364
   }
 
365
   while ( na+nd+nns+nna+nnd > 0 && ++it < maxtou && lmoy > 1.3);
 
366
 
 
367
@@ -161,80 +161,80 @@
 
368
     MMG_prilen(mesh,sol);
 
369
   }
 
370
 
 
371
-  //return(1);
 
372
-  //MMG_saveMesh(mesh,"aprescut.mesh");
 
373
-  fprintf(stdout,"    ---\n");
 
374
-
 
375
+       //return(1);
 
376
+       //MMG_saveMesh(mesh,"aprescut.mesh",0);
 
377
+       fprintf(stdout,"    ---\n");
 
378
+  
 
379
   /*analyze standard*/
 
380
-  base   = mesh->flag;
 
381
-  *alert = 0;
 
382
+    base   = mesh->flag;
 
383
+    *alert = 0;
 
384
 
 
385
-  nna = 0;
 
386
-  nnd = 0;
 
387
-  nf  = 0;
 
388
-  it  = 0;
 
389
-  maxtou = 100;
 
390
-  MMG_npdtot=0;
 
391
-  MMG_npuisstot=0;
 
392
-  MMG_nprestot=0;
 
393
-  MMG_nvoltot=0;
 
394
-
 
395
-  /* 2. field points */
 
396
-  if ( mesh->info.imprim < -4 ) {
 
397
-    MMG_prilen(mesh,sol);
 
398
-    fprintf(stdout,"  -- FIELD POINTS\n");
 
399
-  }
 
400
-
 
401
-  /* create filter */
 
402
-  bucket = MMG_newBucket(mesh,M_MAX(mesh->info.bucksiz,BUCKSIZ));
 
403
-  if ( !bucket )  return(0);
 
404
-
 
405
-  do {
 
406
-    MMG_analar(mesh,sol,bucket,&na,&nd,&nf,alert);
 
407
-    nna += na;
 
408
-    nnd += nd;
 
409
-    if ( *alert ) {
 
410
-      if ( nd < 1000 )  break;
 
411
-      else  *alert = 0;
 
412
-    }
 
413
-    if ( it > 5 ) {
 
414
-      dd = abs(nd-na);
 
415
-      if ( dd < 5 || dd < 0.05*nd )   break;
 
416
-      else if ( it > 12 && nd >= na )  break;
 
417
-    }
 
418
-    if ( na+nd && abs(mesh->info.imprim) > 3 )
 
419
-      fprintf(stdout,"     %7d INSERTED  %7d REMOVED   %7d FILTERED\n",na,nd,nf);
 
420
-    // MMG_saveMesh(mesh,"chk.mesh");
 
421
-    // //if(it==1) exit(0);
 
422
-  }
 
423
-  while ( na+nd > 0 && ++it < maxtou );
 
424
-
 
425
-  if ( nna+nnd && abs(mesh->info.imprim) < 3 ) {
 
426
-    fprintf(stdout,"     %7d INSERTED  %7d REMOVED  %7d FILTERED\n",na,nd,nf);
 
427
-  }
 
428
-
 
429
-  if(MMG_npdtot>0) {
 
430
-    fprintf(stdout,"    REJECTED : %5d\n",MMG_npdtot);
 
431
-    fprintf(stdout,"          VOL      : %6.2f %%    %5d \n",
 
432
-           100*(MMG_nvoltot/(float)
 
433
-                MMG_npdtot),MMG_nvoltot);
 
434
-    fprintf(stdout,"          PUISS    : %6.2f %%    %5d \n",
 
435
-           100*(MMG_npuisstot/(float) MMG_npdtot),MMG_npuisstot);
 
436
-    fprintf(stdout,"         PROCHE    : %6.2f %%    %5d \n",
 
437
-           100*(MMG_nprestot/(float) MMG_npuisstot),MMG_nprestot);
 
438
+    nna = 0;
 
439
+    nnd = 0;
 
440
+    nf  = 0;
 
441
+    it  = 0;
 
442
+    maxtou = 100;
 
443
     MMG_npdtot=0;
 
444
     MMG_npuisstot=0;
 
445
+    MMG_nprestot=0;
 
446
     MMG_nvoltot=0;
 
447
-  }
 
448
-  if ( mesh->info.imprim < 0 ) {
 
449
-    MMG_outqua(mesh,sol);
 
450
-    MMG_prilen(mesh,sol);
 
451
-  }
 
452
 
 
453
-  M_free(bucket->head);
 
454
-  M_free(bucket->link);
 
455
-  M_free(bucket);
 
456
+    /* 2. field points */
 
457
+    if ( mesh->info.imprim < -4 ) {
 
458
+      MMG_prilen(mesh,sol);
 
459
+      fprintf(stdout,"  -- FIELD POINTS\n");
 
460
+    }
 
461
+
 
462
+    /* create filter */
 
463
+    bucket = MMG_newBucket(mesh,M_MAX(mesh->info.bucksiz,BUCKSIZ));
 
464
+    if ( !bucket )  return(0);
 
465
+
 
466
+    do {
 
467
+      MMG_analar(mesh,sol,bucket,&na,&nd,&nf,alert);    
 
468
+      nna += na;
 
469
+      nnd += nd;
 
470
+      if ( *alert ) {
 
471
+        if ( nd < 1000 )  break;
 
472
+        else  *alert = 0;
 
473
+      }
 
474
+      if ( it > 5 ) {
 
475
+        dd = abs(nd-na);
 
476
+        if ( dd < 5 || dd < 0.05*nd )   break;
 
477
+        else if ( it > 12 && nd >= na )  break;
 
478
+      }
 
479
+      if ( na+nd && abs(mesh->info.imprim) > 3 )
 
480
+        fprintf(stdout,"     %7d INSERTED  %7d REMOVED   %7d FILTERED\n",na,nd,nf);    
 
481
+                       // MMG_saveMesh(mesh,"chk.mesh",0);
 
482
+                       // //if(it==1) exit(0);
 
483
+    }
 
484
+    while ( na+nd > 0 && ++it < maxtou );
 
485
+
 
486
+    if ( nna+nnd && abs(mesh->info.imprim) < 3 ) {
 
487
+      fprintf(stdout,"     %7d INSERTED  %7d REMOVED  %7d FILTERED\n",na,nd,nf);
 
488
+    }
 
489
+
 
490
+  if(MMG_npdtot>0) { 
 
491
+  fprintf(stdout,"    REJECTED : %5d\n",MMG_npdtot);
 
492
+  fprintf(stdout,"          VOL      : %6.2f %%    %5d \n",
 
493
+       100*(MMG_nvoltot/(float)
 
494
+  MMG_npdtot),MMG_nvoltot); 
 
495
+  fprintf(stdout,"          PUISS    : %6.2f %%    %5d \n",
 
496
+       100*(MMG_npuisstot/(float) MMG_npdtot),MMG_npuisstot);
 
497
+  fprintf(stdout,"         PROCHE    : %6.2f %%    %5d \n",
 
498
+       100*(MMG_nprestot/(float) MMG_npuisstot),MMG_nprestot); 
 
499
+  MMG_npdtot=0;
 
500
+  MMG_npuisstot=0;
 
501
+  MMG_nvoltot=0;  
 
502
+  } 
 
503
+    if ( mesh->info.imprim < 0 ) {
 
504
+      MMG_outqua(mesh,sol);
 
505
+      MMG_prilen(mesh,sol);
 
506
+    }
 
507
 
 
508
+    M_free(bucket->head);
 
509
+    M_free(bucket->link);
 
510
+    M_free(bucket);
 
511
+  
 
512
 
 
513
   return(1);
 
514
 }
 
515
diff -r -u mmg3d4/build/sources/mmg3dConfig.h mmg3d4-new/build/sources/mmg3dConfig.h
 
516
--- mmg3d4/build/sources/mmg3dConfig.h  2012-12-19 16:05:36.000000000 +0100
 
517
+++ mmg3d4-new/build/sources/mmg3dConfig.h      2013-01-18 16:32:41.000000000 +0100
 
518
@@ -2,4 +2,4 @@
 
519
 #define Tutorial_VERSION_MAJOR 
 
520
 #define Tutorial_VERSION_MINOR 
 
521
 
 
522
-#define USE_SCOTCH
 
523
+/* #undef USE_SCOTCH */
 
524
diff -r -u mmg3d4/build/sources/mmg3dlib/mmg3dlib.c mmg3d4-new/build/sources/mmg3dlib/mmg3dlib.c
 
525
--- mmg3d4/build/sources/mmg3dlib/mmg3dlib.c    2012-12-19 16:06:03.000000000 +0100
 
526
+++ mmg3d4-new/build/sources/mmg3dlib/mmg3dlib.c        2013-01-18 16:32:41.000000000 +0100
 
527
@@ -385,7 +385,7 @@
 
528
   if ( !MMG_hashTetra(mesh) )    return(1);
 
529
   if ( !MMG_markBdry(mesh) )     return(1);
 
530
   if (abs(mesh->info.option)==10) {
 
531
-    MMG_saveMesh(mesh,"tetra.mesh");
 
532
+    MMG_saveMesh(mesh,"tetra.mesh",0);
 
533
     return(0);
 
534
   }           
 
535
   if ( !sol->np) {
 
536
@@ -431,7 +431,7 @@
 
537
     if ( abs(info->option) == 9 ) {  
 
538
       if(!MMG_mmg3d9(mesh,sol,&alert)) {
 
539
         if ( !MMG_unscaleMesh(mesh,sol) )  return(1);
 
540
-        MMG_saveMesh(mesh,"errormoving.mesh");
 
541
+        MMG_saveMesh(mesh,"errormoving.mesh",0);
 
542
              //MMG_saveSol(mesh,sol,mesh->outf);
 
543
              return(1);
 
544
       }
 
545
diff -r -u mmg3d4/build/sources/mmg3dmain/mmg3d.c mmg3d4-new/build/sources/mmg3dmain/mmg3d.c
 
546
--- mmg3d4/build/sources/mmg3dmain/mmg3d.c      2012-12-19 16:05:53.000000000 +0100
 
547
+++ mmg3d4-new/build/sources/mmg3dmain/mmg3d.c  2013-01-18 21:44:08.000000000 +0100
 
548
@@ -46,7 +46,7 @@
 
549
 #include "compil.date"
 
550
 #include "mesh.h"
 
551
 #include "eigenv.h"
 
552
-
 
553
+#include "dataff.h"
 
554
 TIM_mytime         MMG_ctim[TIMEMAX];
 
555
 short               MMG_imprim;
 
556
 
 
557
@@ -397,6 +397,7 @@
 
558
            100.*ttot/ttim[0],call[0],ttot/(float)call[0]);
 
559
   }
 
560
   fprintf(stdout,"\n   ELAPSED TIME  %.2f SEC.  (%.2f)\n",ttim[0],ttot);
 
561
+  fflush(stdout);
 
562
 }
 
563
 
 
564
 
 
565
@@ -433,8 +434,7 @@
 
566
   return(1);
 
567
 }
 
568
 
 
569
-
 
570
-int main(int argc,char *argv[]) {
 
571
+int mainmmg3d(int argc,char *argv[],DataFF *dataff) { 
 
572
   pMesh        mesh;
 
573
   pSol         sol;
 
574
   Info         *info;
 
575
@@ -451,7 +451,7 @@
 
576
   signal(SIGSEGV,excfun);
 
577
   signal(SIGTERM,excfun);
 
578
   signal(SIGINT,excfun);
 
579
-  atexit(endcod);
 
580
+  if(dataff==0) atexit(endcod);
 
581
 
 
582
   TIM_tminit(MMG_ctim,TIMEMAX);
 
583
   TIM_chrono(ON,&MMG_ctim[0]);
 
584
@@ -479,15 +479,27 @@
 
585
   info->dt       = 1.;
 
586
   info->bdry     = 0;
 
587
   info->optles   = 0;
 
588
-
 
589
+   /* modif F. Hecht ..*/
 
590
+   if(dataff)
 
591
+     {
 
592
+       mesh->name=dataff->meshname;
 
593
+       mesh->move=dataff->movename;
 
594
+       sol->name=dataff->solname;
 
595
+       /*      printf(" #### %p %p %p --- \n",mesh->name,mesh->move,sol->name); */
 
596
+       info->imprim=dataff->imprim;
 
597
+       info->memory=dataff->memory;
 
598
+     }
 
599
+   /* end modf */ 
 
600
   if ( !parsar(argc,argv,mesh,sol) )  return(1);
 
601
   MMG_imprim = info->imprim;
 
602
   
 
603
   /* load data */
 
604
   if ( MMG_imprim )   fprintf(stdout,"\n  -- INPUT DATA\n");
 
605
   TIM_chrono(ON,&MMG_ctim[1]);
 
606
-  if ( !MMG_loadMesh(mesh,mesh->name) )  return(1); 
 
607
-  if ( !MMG_loadSol(sol,sol->name,mesh->npmax) )  return(1);
 
608
+  /* modif FH. for interface with ff++ add dataff param     */
 
609
+  if ( !MMG_loadMesh(mesh,mesh->name,dataff) )  return(1); 
 
610
+  if ( !MMG_loadSol(sol,sol->name,mesh->npmax,dataff ) )  return(1);
 
611
+
 
612
   if ( sol->np && sol->np != mesh->np ) {
 
613
     fprintf(stdout,"  ## WARNING: WRONG SOLUTION NUMBER. IGNORED\n");
 
614
     sol->np = 0;
 
615
@@ -495,7 +507,7 @@
 
616
 
 
617
   if ( !parsop(mesh) )  return(1);
 
618
 
 
619
-  if ( abs(info->option) == 9 && !MMG_loadVect(mesh,mesh->move,mesh->np) )  return(0);
 
620
+  if ( abs(info->option) == 9 && !MMG_loadVect(mesh,mesh->move,mesh->np,dataff) )  return(0);
 
621
 
 
622
   if ( !MMG_setfunc(sol->offset) ) return(1);
 
623
   if ( !MMG_scaleMesh(mesh,sol) )  return(1);   
 
624
@@ -527,7 +539,7 @@
 
625
   if ( !MMG_hashTetra(mesh) )    return(1);
 
626
   if ( !MMG_markBdry(mesh) )     return(1);
 
627
   if (abs(mesh->info.option)==10) {
 
628
-    MMG_saveMesh(mesh,"tetra.mesh");
 
629
+    MMG_saveMesh(mesh,"tetra.mesh",dataff);
 
630
     return(0);
 
631
   }           
 
632
 
 
633
@@ -571,8 +583,8 @@
 
634
     if ( abs(info->option) == 9 ) {
 
635
       if(!MMG_mmg3d9(mesh,sol,&alert)) {
 
636
         if ( !MMG_unscaleMesh(mesh,sol) )  return(1);
 
637
-        MMG_saveMesh(mesh,mesh->outf);
 
638
-       MMG_saveSol(mesh,sol,mesh->outf);
 
639
+        MMG_saveMesh(mesh,mesh->outf,dataff);
 
640
+       MMG_saveSol(mesh,sol,mesh->outf,dataff);
 
641
        return(1);
 
642
       }
 
643
       /*puts("appel 1");
 
644
@@ -678,18 +690,18 @@
 
645
     fprintf(stdout,"\n  ## WARNING: INCOMPLETE MESH  %d , %d\n",
 
646
             mesh->np,mesh->ne);
 
647
 
 
648
-  if ( MMG_imprim )  fprintf(stdout,"\n  -- WRITING DATA FILE %s\n",mesh->outf);
 
649
+  if ( MMG_imprim && !dataff)  fprintf(stdout,"\n  -- WRITING DATA FILE %s\n",mesh->outf);
 
650
   TIM_chrono(ON,&MMG_ctim[1]);
 
651
   if ( !MMG_unscaleMesh(mesh,sol) )  return(1);
 
652
-  MMG_saveMesh(mesh,mesh->outf);
 
653
+  MMG_saveMesh(mesh,mesh->outf,dataff);
 
654
   if ( info->option == 9 ) {
 
655
-    MMG_saveSol(mesh,sol,mesh->outf);
 
656
-    MMG_saveVect(mesh,mesh->move);    
 
657
+    MMG_saveSol(mesh,sol,mesh->outf,dataff);
 
658
+    MMG_saveVect(mesh,mesh->move,dataff);    
 
659
   }
 
660
   else
 
661
-    MMG_saveSol(mesh,sol,mesh->outf);
 
662
+    MMG_saveSol(mesh,sol,mesh->outf,dataff);   
 
663
   TIM_chrono(OFF,&MMG_ctim[1]);
 
664
-  if ( MMG_imprim )  fprintf(stdout,"  -- WRITING COMPLETED\n");
 
665
+  if ( MMG_imprim && !dataff)  fprintf(stdout,"  -- WRITING COMPLETED\n");
 
666
 
 
667
   /* free mem */
 
668
   M_free(mesh->point);
 
669
@@ -706,5 +718,24 @@
 
670
 
 
671
   if ( MMG_imprim < -4 || info->ddebug )  M_memDump();
 
672
   M_free(mesh);
 
673
+  if(MMG_imprim && dataff ) endcod();
 
674
   return(0);
 
675
 }
 
676
+
 
677
+int main(int argc,char *argv[])  {
 
678
+    return  mainmmg3d( argc,argv,0);
 
679
+}
 
680
+/*
 
681
+ def 
 
682
+ */
 
683
+ MMG_Swap MMG_swpptr;
 
684
+ double (*MMG_length)(double *,double *,double *,double *);
 
685
+ double (*MMG_caltet)(pMesh ,pSol ,int );
 
686
+ double (*MMG_calte1)(pMesh ,pSol ,int );
 
687
+ int    (*MMG_caltet2)(pMesh ,pSol ,int ,int ,double ,double *);
 
688
+ int    (*MMG_cavity)(pMesh ,pSol ,int ,int ,pList ,int );
 
689
+ int    (*MMG_buckin)(pMesh ,pSol ,pBucket ,int );
 
690
+ int    (*MMG_optlen)(pMesh ,pSol ,double ,int );
 
691
+ int    (*MMG_interp)(double *,double *,double *,double );
 
692
+ int    (*MMG_optlentet)(pMesh ,pSol ,pQueue ,double ,int ,int );
 
693
+ int    (*MMG_movevertex)(pMesh ,pSol ,int ,int );
 
694
diff -r -u mmg3d4/build/sources/optlen.c mmg3d4-new/build/sources/optlen.c
 
695
--- mmg3d4/build/sources/optlen.c       2012-12-19 16:05:33.000000000 +0100
 
696
+++ mmg3d4-new/build/sources/optlen.c   2013-01-18 16:32:41.000000000 +0100
 
697
@@ -48,7 +48,7 @@
 
698
 #define  HQCOEF    0.9 
 
699
 #define  HCRIT     0.98
 
700
 
 
701
-double MMG_rao(pMesh mesh,int k,int inm);
 
702
+double MMG_rao(pMesh mesh,int k,FILE* );
 
703
 int MMG_optlen_ani(pMesh mesh,pSol sol,double declic,int base) {
 
704
   pTetra    pt,pt1;
 
705
   pPoint    ppa,ppb;
 
706
diff -r -u mmg3d4/build/sources/pattern.c mmg3d4-new/build/sources/pattern.c
 
707
--- mmg3d4/build/sources/pattern.c      2012-12-19 16:05:33.000000000 +0100
 
708
+++ mmg3d4-new/build/sources/pattern.c  2013-01-18 18:41:02.000000000 +0100
 
709
@@ -47,7 +47,7 @@
 
710
 
 
711
 
 
712
 unsigned char MMG_arfa[3][4] = { {2,0,1,3}, {1,2,0,3}, {0,1,2,3} };
 
713
-extern int MMG_permar[10][4];
 
714
+extern int MMG_permar[12][4];
 
715
 extern int MMG_pointar[64][2];
 
716
 extern int ddebug;
 
717
 //insert ip on ia-ib
 
718
diff -r -u mmg3d4/build/sources/quality.c mmg3d4-new/build/sources/quality.c
 
719
--- mmg3d4/build/sources/quality.c      2012-12-19 16:05:33.000000000 +0100
 
720
+++ mmg3d4-new/build/sources/quality.c  2013-01-18 16:32:41.000000000 +0100
 
721
@@ -46,7 +46,7 @@
 
722
 #include "mesh.h"  
 
723
 
 
724
 
 
725
-double MMG_rao(pMesh mesh,int k,int inm);
 
726
+double MMG_rao(pMesh mesh,int k,FILE* inm) ;
 
727
 double MMG_caltetrao(pMesh mesh,pSol sol,int iel) {
 
728
        return(MMG_rao(mesh,iel,0));
 
729
 }
 
730
diff -r -u mmg3d4/build/sources/ratio.c mmg3d4-new/build/sources/ratio.c
 
731
--- mmg3d4/build/sources/ratio.c        2012-12-19 16:05:33.000000000 +0100
 
732
+++ mmg3d4-new/build/sources/ratio.c    2013-01-18 16:32:41.000000000 +0100
 
733
@@ -365,7 +365,7 @@
 
734
   fprintf(stdout,"           ELEMENT   %d (%d)   %d %d %d %d\n",
 
735
          iel,ielreal,pt->v[0],pt->v[1],pt->v[2],pt->v[3]);
 
736
 
 
737
-  if ( abs(mesh->info.imprim) < 5 )  return;
 
738
+  if ( abs(mesh->info.imprim) < 5 )  return (1) ;
 
739
 
 
740
   fprintf(stdout,"\n     HISTOGRAMM\n");
 
741
   for (k=1; k<9; k++) {
 
742
diff -r -u mmg3d4/build/sources/sproto.h mmg3d4-new/build/sources/sproto.h
 
743
--- mmg3d4/build/sources/sproto.h       2012-12-19 16:05:36.000000000 +0100
 
744
+++ mmg3d4-new/build/sources/sproto.h   2013-01-18 16:32:41.000000000 +0100
 
745
@@ -67,13 +67,13 @@
 
746
 int  MMG_inEdge(pHedge ,int *,int *,int *);
 
747
 int  MMG_markBdry(pMesh );
 
748
 
 
749
-/* inout */
 
750
-int  MMG_loadMesh(pMesh ,char *);
 
751
-int  MMG_loadSol(pSol ,char *,int );
 
752
-int  MMG_loadVect(pMesh ,char *,int );
 
753
-int  MMG_saveMesh(pMesh ,char *);
 
754
-int  MMG_saveSol(pMesh ,pSol ,char *);
 
755
-int  MMG_saveVect(pMesh ,char *);
 
756
+/* inout add param  F.H. june 2011 (dataff) */
 
757
+int  MMG_loadMesh(pMesh ,char *,void *);
 
758
+int  MMG_loadSol(pSol ,char *,int ,void *);
 
759
+int  MMG_loadVect(pMesh ,char *,int ,void *);
 
760
+int  MMG_saveMesh(pMesh ,char *,void *);
 
761
+int  MMG_saveSol(pMesh ,pSol ,char *,void *);
 
762
+int  MMG_saveVect(pMesh ,char *,void *);
 
763
 
 
764
 int  MMG_loctet(pMesh ,int ,int ,double *,double *);
 
765
 int  MMG_computeMetric(pMesh ,pSol ,int ,double * );
 
766
diff -r -u mmg3d4/build/sources/swapar.c mmg3d4-new/build/sources/swapar.c
 
767
--- mmg3d4/build/sources/swapar.c       2012-12-19 16:05:33.000000000 +0100
 
768
+++ mmg3d4-new/build/sources/swapar.c   2013-01-18 18:43:38.000000000 +0100
 
769
@@ -1,106 +1,107 @@
 
770
-/****************************************************************************
 
771
-Logiciel initial: MMG3D Version 4.0
 
772
-Co-auteurs : Cecile Dobrzynski et Pascal Frey.
 
773
-Propriétaires :IPB - UPMC -INRIA.
 
774
-
 
775
-Copyright © 2004-2005-2006-2007-2008-2009-2010-2011,
9
776
-diffusé sous les termes et conditions de la licence publique générale de GNU
10
 
+diffusé sous les termes et conditions de lag licence publique générale de GNU
11
 
 Version 3 ou toute version ultérieure.  
12
 
 
13
 
 Ce fichier est une partie de MMG3D.
14
 
@@ -44,7 +44,7 @@
15
 
 along with MMG3D. If not, see <http://www.gnu.org/licenses/>.  
 
777
-Version 3 ou toute version ultérieure.
 
778
-
 
779
-Ce fichier est une partie de MMG3D.
 
780
-MMG3D est un logiciel libre ; vous pouvez le redistribuer et/ou le modifier
 
781
-suivant les termes de la licence publique générale de GNU
 
782
-Version 3 ou toute version ultérieure.
 
783
-MMG3D est distribué dans l'espoir qu'il sera utile, mais SANS
 
784
-AUCUNE GARANTIE ; sans même garantie de valeur marchande.
 
785
-Voir la licence publique générale de GNU pour plus de détails.
 
786
-MMG3D est diffusé en espérant qu’il sera utile,
 
787
-mais SANS AUCUNE GARANTIE, ni explicite ni implicite,
 
788
-y compris les garanties de commercialisation ou
 
789
-d’adaptation dans un but spécifique.
 
790
-Reportez-vous à la licence publique générale de GNU pour plus de détails.
 
791
-Vous devez avoir reçu une copie de la licence publique générale de GNU
 
792
-en même temps que ce document.
 
793
-Si ce n’est pas le cas, aller voir <http://www.gnu.org/licenses/>.
 
794
-/****************************************************************************
 
795
-Initial software: MMG3D Version 4.0
 
796
-Co-authors: Cecile Dobrzynski et Pascal Frey.
 
797
-Owners: IPB - UPMC -INRIA.
 
798
-
 
799
-Copyright © 2004-2005-2006-2007-2008-2009-2010-2011,
 
800
-spread under the terms and conditions of the license GNU General Public License
 
801
-as published Version 3, or (at your option) any later version.
 
802
-
 
803
-This file is part of MMG3D
 
804
-MMG3D is free software; you can redistribute it and/or modify
 
805
-it under the terms of the GNU General Public License as published by
 
806
-the Free Software Foundation; either version 3 of the License, or
 
807
-(at your option) any later version.
 
808
-MMG3D is distributed in the hope that it will be useful,
 
809
-but WITHOUT ANY WARRANTY; without even the implied warranty of
 
810
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
811
-GNU General Public License for more details.
 
812
-You should have received a copy of the GNU General Public License
 
813
-along with MMG3D. If not, see <http://www.gnu.org/licenses/>.
 
814
-****************************************************************************/
 
815
-#include "mesh.h"
 
816
-
 
817
-int MMG_swapar(pMesh mesh,pSol sol,pQueue q,List *list,int lon,double crit,double declic) {
 
818
-  pTetra   pt;
 
819
-  int      i,l,jel,ncas,ddebug,iadr;
 
820
-
 
821
-  MMG_swpptr = 0;
 
822
-  ncas   = 0;
 
823
-  if ( !MMG_getnElt(mesh,10) )  return(-1);
 
824
-  if(0 && list->tetra[1]/6==2352) ddebug=1;
 
825
-  else ddebug=0;
 
826
-
 
827
-  switch(lon) {
 
828
-  case 3:
 
829
-    ncas = MMG_simu32(mesh,sol,list,crit);
 
830
-    break;
 
831
-  case 4:
 
832
-    ncas = MMG_simu44(mesh,sol,list,crit);
 
833
-    break;
 
834
-  case 5:
 
835
-    ncas = MMG_simu56(mesh,sol,list,crit);
 
836
-    break;
 
837
-  case 6:
 
838
-    ncas = MMG_simu68(mesh,sol,list,crit);
 
839
-    break;
 
840
-  case 7:
 
841
-    ncas = MMG_simu710(mesh,sol,list,crit);
 
842
-    break;
 
843
-  default:
 
844
-    return(0);
 
845
-  }
 
846
-  if(ddebug) printf("on fait swap %d\n",ncas);
 
847
-  if ( ncas && MMG_swpptr ) {
 
848
-    if(ddebug) MMG_saveMesh(mesh,"avt.mesh");
 
849
-    for (l=1; l<=lon; l++) {
 
850
-      jel = list->tetra[l]/6;
 
851
-      pt  = &mesh->tetra[jel];
 
852
-      if(ddebug) {
 
853
-       printf("tet %d : %d %d %d %d -- %d %d %d %d %d %d\n",jel,pt->v[0],pt->v[1],pt->v[2],pt->v[3],
 
854
-              pt->bdryinfo[0],pt->bdryinfo[1],pt->bdryinfo[2],pt->bdryinfo[3],pt->bdryinfo[4],pt->bdryinfo[5]);
 
855
-
 
856
-      }
 
857
-      MMG_kiudel(q,jel);
 
858
-    }
 
859
-    lon = MMG_swpptr(mesh,sol,list);
 
860
-    assert(lon);
 
861
-    if(!lon) return(0);
 
862
-
 
863
-    for (l=1; l<=lon; l++) {
 
864
-      jel = list->tetra[l];
 
865
-      pt  = &mesh->tetra[jel];
 
866
-      if ( pt->qual >= declic )  MMG_kiuput(q,jel);
 
867
-      for (i=0; i<4; i++)  mesh->point[pt->v[i]].flag = mesh->flag;
 
868
-
 
869
-    }
 
870
-    if(ddebug) {MMG_saveMesh(mesh,"sw.mesh");    exit(0);}
 
871
-    return(1);
 
872
-  }
 
873
-
 
874
-  return(0);
 
875
-}
 
876
+/****************************************************************************
 
877
+Logiciel initial: MMG3D Version 4.0
 
878
+Co-auteurs : Cecile Dobrzynski et Pascal Frey.
 
879
+Propriétaires :IPB - UPMC -INRIA.
 
880
+
 
881
+Copyright © 2004-2005-2006-2007-2008-2009-2010-2011, 
 
882
+diffusé sous les termes et conditions de la licence publique générale de GNU
 
883
+Version 3 ou toute version ultérieure.  
 
884
+
 
885
+Ce fichier est une partie de MMG3D.
 
886
+MMG3D est un logiciel libre ; vous pouvez le redistribuer et/ou le modifier
 
887
+suivant les termes de la licence publique générale de GNU
 
888
+Version 3 ou toute version ultérieure.
 
889
+MMG3D est distribué dans l'espoir qu'il sera utile, mais SANS 
 
890
+AUCUNE GARANTIE ; sans même garantie de valeur marchande.  
 
891
+Voir la licence publique générale de GNU pour plus de détails.
 
892
+MMG3D est diffusé en espérant qu’il sera utile, 
 
893
+mais SANS AUCUNE GARANTIE, ni explicite ni implicite, 
 
894
+y compris les garanties de commercialisation ou 
 
895
+d’adaptation dans un but spécifique. 
 
896
+Reportez-vous à la licence publique générale de GNU pour plus de détails.
 
897
+Vous devez avoir reçu une copie de la licence publique générale de GNU 
 
898
+en même temps que ce document. 
 
899
+Si ce n’est pas le cas, aller voir <http://www.gnu.org/licenses/>.
 
900
+/****************************************************************************
 
901
+Initial software: MMG3D Version 4.0
 
902
+Co-authors: Cecile Dobrzynski et Pascal Frey.
 
903
+Owners: IPB - UPMC -INRIA.
 
904
+
 
905
+Copyright © 2004-2005-2006-2007-2008-2009-2010-2011, 
 
906
+spread under the terms and conditions of the license GNU General Public License 
 
907
+as published Version 3, or (at your option) any later version.
 
908
+
 
909
+This file is part of MMG3D
 
910
+MMG3D is free software; you can redistribute it and/or modify
 
911
+it under the terms of the GNU General Public License as published by
 
912
+the Free Software Foundation; either version 3 of the License, or
 
913
+(at your option) any later version.
 
914
+MMG3D is distributed in the hope that it will be useful,
 
915
+but WITHOUT ANY WARRANTY; without even the implied warranty of
 
916
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
917
+GNU General Public License for more details.
 
918
+You should have received a copy of the GNU General Public License
 
919
+along with MMG3D. If not, see <http://www.gnu.org/licenses/>.  
 
920
+****************************************************************************/
 
921
+#include "mesh.h"
 
922
+
 
923
+int MMG_swapar(pMesh mesh,pSol sol,pQueue q,List *list,int lon,double crit,double declic) {
 
924
+  pTetra   pt;
 
925
+  int      i,l,jel,ncas,ddebug,iadr;
 
926
+
 
927
+  MMG_swpptr = 0;
 
928
+  ncas   = 0;
 
929
+  if ( !MMG_getnElt(mesh,10) )  return(-1);
 
930
+       if(0 && list->tetra[1]/6==2352) ddebug=1;
 
931
+       else ddebug=0;
 
932
+       
 
933
+  switch(lon) {
 
934
+  case 3:
 
935
+         ncas = MMG_simu32(mesh,sol,list,crit);
 
936
+    break;
 
937
+  case 4:
 
938
+         ncas = MMG_simu44(mesh,sol,list,crit); 
 
939
+    break;
 
940
+  case 5:
 
941
+       ncas = MMG_simu56(mesh,sol,list,crit);
 
942
+    break;
 
943
+  case 6:
 
944
+       ncas = MMG_simu68(mesh,sol,list,crit); 
 
945
+    break;
 
946
+  case 7:
 
947
+       ncas = MMG_simu710(mesh,sol,list,crit);   
 
948
+    break;  
 
949
+  default:
 
950
+    return(0);
 
951
+  }
 
952
+       if(ddebug) printf("on fait swap %d\n",ncas);
 
953
+  if ( ncas && MMG_swpptr ) {
 
954
+               if(ddebug) MMG_saveMesh(mesh,"avt.mesh",0);
 
955
+    for (l=1; l<=lon; l++) {
 
956
+      jel = list->tetra[l]/6;
 
957
+      pt  = &mesh->tetra[jel]; 
 
958
+                       if(ddebug) {
 
959
+                               printf("tet %d : %d %d %d %d -- %d %d %d %d %d %d\n",jel,pt->v[0],pt->v[1],pt->v[2],pt->v[3],
 
960
+                                       pt->bdryinfo[0],pt->bdryinfo[1],pt->bdryinfo[2],pt->bdryinfo[3],pt->bdryinfo[4],pt->bdryinfo[5]);  
 
961
+                               
 
962
+                       } 
 
963
+                       MMG_kiudel(q,jel);
 
964
+    }
 
965
+    lon = MMG_swpptr(mesh,sol,list);
 
966
+    assert(lon);
 
967
+    if(!lon) return(0); 
 
968
+    
 
969
+    for (l=1; l<=lon; l++) {
 
970
+      jel = list->tetra[l];
 
971
+      pt  = &mesh->tetra[jel]; 
 
972
+      if ( pt->qual >= declic )  MMG_kiuput(q,jel);
 
973
+      for (i=0; i<4; i++)  mesh->point[pt->v[i]].flag = mesh->flag;             
 
974
+
 
975
+   }
 
976
+    if(ddebug) {MMG_saveMesh(mesh,"sw.mesh",0);    exit(0);}
 
977
+    return(1);
 
978
+  }
 
979
+
 
980
+  return(0);
 
981
+}
 
982
+
 
983
diff -u  mmg3d4/build/sources/inout.c mmg3d4-ok/build/sources/inout.c
 
984
--- mmg3d4/build/sources/inout.c        2012-12-19 16:05:32.000000000 +0100
 
985
+++ mmg3d4-ok/build/sources/inout.c     2013-07-11 11:43:47.000000000 +0200
 
986
@@ -44,6 +44,7 @@
 
987
 along with MMG3D. If not, see <http://www.gnu.org/licenses/>.
16
988
 ****************************************************************************/
17
989
 #include "mesh.h"
18
 
-
19
990
+#include "dataff.h"
20
991
 
21
 
 extern short          MMG_imprim;
22
 
 #define sw 4
23
 
@@ -100,8 +100,395 @@
 
992
 
 
993
 extern short           MMG_imprim;
 
994
@@ -100,35 +101,467 @@
24
995
   return(out);
25
996
 }
26
997
 
344
1315
+    int kn[10];
345
1316
+    np = 0; 
346
1317
+    nc = 0;
 
1318
+    // compress vertex ... fist case ... 
347
1319
+    for (k=1; k<=mesh->np; k++) {
348
1320
+      ppt = &mesh->point[k];
349
1321
+      if ( ppt->tag & M_UNUSED )  continue;  
350
1322
+      ppt->tmp = ++np;  
351
1323
+      /*      if ( ppt->geom & M_CORNER )  cor[nc++] = ppt->tmp; */
352
 
+    } 
 
1324
+    }
 
1325
+   
 
1326
+    /*   seacrch vertex not in tet ???? */
 
1327
+    {
 
1328
+        int kk=0,npp=np;
 
1329
+       for (k=1; k<=mesh->np; k++)
 
1330
+       {
 
1331
+            ppt = &mesh->point[k];
 
1332
+           if ((ppt->tag & M_UNUSED )) ppt->tmp =-2;
 
1333
+           else ppt->tmp =-1;
 
1334
+
 
1335
+       }
 
1336
+       for ( k=1; k<=mesh->ne; k++)
 
1337
+       {
 
1338
+            pt = &mesh->tetra[k];
 
1339
+            if ( !pt->v[0] )  continue;
 
1340
+            k0++;
 
1341
+            for(j=0;j<4;++j)
 
1342
+              mesh->point[pt->v[j]].tmp=0;
 
1343
+       }
 
1344
+        np=0;
 
1345
+        for (k=1; k<=mesh->np; k++)
 
1346
+       {
 
1347
+            ppt = &mesh->point[k];
 
1348
+            
 
1349
+            if ( ppt->tmp ==0) 
 
1350
+               ppt->tmp = ++np; 
 
1351
+            else
 
1352
+            {
 
1353
+                
 
1354
+            if (ppt->tmp==-1)
 
1355
+           {
 
1356
+                kk++;
 
1357
+                ppt->tag  |= M_UNUSED;
 
1358
+           }
 
1359
+                ppt->tmp=0;
 
1360
+            }
 
1361
+       }
 
1362
+        if(kk) printf(" mmg3d: Strange nb of point %d not in tet is not zero (correct by FH)!\n" , kk);
 
1363
+      
 
1364
+    }
 
1365
+    
353
1366
+    mesh->nt=0;
354
1367
+    if(! MMG_markBdry(mesh)) 
355
1368
+      mesh->nt=0;
365
1378
+      }
366
1379
+    
367
1380
+    data[ff_id_tet]=ne  ;
 
1381
+    printf(" mmg3d:  nbp = %d, nb tet %d\n",np,ne);
368
1382
+    //data[ff_id_hex]=nhex;
369
1383
+    //data[ff_id_prism]=npris; 
370
1384
+    //data[ff_id_quad]=nq;
376
1390
+    for ( k=1; k<=mesh->np; k++) 
377
1391
+      {
378
1392
+       ppt = &mesh->point[k];
379
 
+       if ( ppt->tag & M_UNUSED )  continue;  
 
1393
+       if ( ! ppt->tmp   )  continue;
380
1394
+       dataff->set_v(dataff, ppt->tmp,ppt->c,ppt->ref);            
381
1395
+      }
382
1396
+    
412
1426
+   return 1; 
413
1427
+}
414
1428
 /* read mesh data */
415
 
-int MMG_loadMesh(pMesh mesh,char *filename) {  
 
1429
-int MMG_loadMesh(pMesh mesh,char *filename) {
416
1430
+int MMG_loadMesh(pMesh mesh,char *filename,void *dataff) {  
417
1431
   FILE*            inm;
418
 
   Hedge                                 hed,hed2;
419
 
   pPoint                  ppt;
420
 
@@ -118,7 +501,8 @@
421
 
  float            fc; 
422
 
        double           volhex,volref;  
423
 
        int iadr;
424
 
-  
425
 
+  if(dataff) 
 
1432
   Hedge            hed,hed2;
 
1433
   pPoint           ppt;
 
1434
   pTetra           pt;
 
1435
   pHexa            ph,listhexa;
 
1436
   pTria            pt1;
 
1437
-  int              k,dim,ref,bin,bpos,i,tmp;
 
1438
-  int              *adjahex;
 
1439
+  int              k,dim,ref,bin,bpos,i,tmp;  
 
1440
+  int              *adjahex; 
 
1441
   long             posnp,posnt,posne,posnhex,posnpris,posncor,posned,posnq;
 
1442
   char            *ptr,data[128],chaine[128];
 
1443
   int              nhex,npris,netmp,ncor,ned,nq;
 
1444
-  int              p0,p1,p2,p3,p4,p5,p6,p7;
 
1445
-  int              binch,bdim,iswp,nu1,nu2,nimp,ne,nbado;
 
1446
-  float            fc;
 
1447
-  double           volhex,volref;
 
1448
+  int              p0,p1,p2,p3,p4,p5,p6,p7;  
 
1449
+  int              binch,bdim,iswp,nu1,nu2,nimp,ne,nbado;       
 
1450
+  float            fc; 
 
1451
+  double           volhex,volref;  
 
1452
   int              iadr,reorient;
 
1453
-
 
1454
+  if(dataff)
426
1455
+    return MMG_loadMeshff( mesh,filename,(DataFF*) dataff);
 
1456
+  
427
1457
 
428
1458
   posnp = posnt = posne = posnhex = posnpris = 0;
429
1459
   netmp = ncor = ned = 0;
430
 
@@ -322,7 +710,7 @@
 
1460
   bin = 0;
 
1461
   iswp = 0;
 
1462
-  mesh->np = mesh->nt = mesh->ne = mesh->ncor = 0;
 
1463
+  mesh->np = mesh->nt = mesh->ne = mesh->ncor = 0; 
 
1464
   npris = nhex = nq = 0;
 
1465
-
 
1466
+  
 
1467
   strcpy(data,filename);
 
1468
-  ptr = strstr(data,".mesh");
 
1469
+  ptr = strstr(data,".mesh");  
 
1470
   if ( !ptr ) {
 
1471
     strcat(data,".meshb");
 
1472
     if( !(inm = fopen(data,"rb")) ) {
 
1473
@@ -136,8 +569,8 @@
 
1474
       *ptr = '\0';
 
1475
       strcat(data,".mesh");
 
1476
       if( !(inm = fopen(data,"r")) ) {
 
1477
-       fprintf(stderr,"  ** %s  NOT FOUND.\n",data);
 
1478
-       return(0);
 
1479
+        fprintf(stderr,"  ** %s  NOT FOUND.\n",data);
 
1480
+        return(0);
 
1481
       }
 
1482
     } else {
 
1483
       bin = 1;
 
1484
@@ -147,194 +580,194 @@
 
1485
     ptr = strstr(data,".meshb");
 
1486
     if( !ptr ) {
 
1487
       if( !(inm = fopen(data,"r")) ) {
 
1488
-       fprintf(stderr,"  ** %s  NOT FOUND.\n",data);
 
1489
-       return(0);
 
1490
-      }
 
1491
+        fprintf(stderr,"  ** %s  NOT FOUND.\n",data);
 
1492
+        return(0);
 
1493
+      }      
 
1494
     } else {
 
1495
       bin = 1;
 
1496
       if( !(inm = fopen(data,"rb")) ) {
 
1497
-       fprintf(stderr,"  ** %s  NOT FOUND.\n",data);
 
1498
-       return(0);
 
1499
+        fprintf(stderr,"  ** %s  NOT FOUND.\n",data);
 
1500
+        return(0);
 
1501
       }
 
1502
-
 
1503
-    }
 
1504
+      
 
1505
+    }  
 
1506
   }
 
1507
 
 
1508
   fprintf(stdout,"  %%%% %s OPENED\n",data);
 
1509
   if (!bin) {
 
1510
-    strcpy(chaine,"D");
 
1511
-    while(fscanf(inm,"%s",&chaine[0])!=EOF && strncmp(chaine,"End",strlen("End")) ) {
 
1512
+    strcpy(chaine,"D");     
 
1513
+    while(fscanf(inm,"%s",&chaine[0])!=EOF && strncmp(chaine,"End",strlen("End")) ) { 
 
1514
       if(!strncmp(chaine,"MeshVersionFormatted",strlen("MeshVersionFormatted"))) {
 
1515
-       fscanf(inm,"%d",&mesh->ver);
 
1516
-       continue;
 
1517
+          fscanf(inm,"%d",&mesh->ver);
 
1518
+          continue;
 
1519
       } else if(!strncmp(chaine,"Dimension",strlen("Dimension"))) {
 
1520
-       fscanf(inm,"%d",&dim);
 
1521
-       if(dim!=3) {
 
1522
-         fprintf(stdout,"BAD DIMENSION : %d\n",dim);
 
1523
-         return(0);
 
1524
-       }
 
1525
-       continue;
 
1526
+          fscanf(inm,"%d",&dim);
 
1527
+          if(dim!=3) {
 
1528
+            fprintf(stdout,"BAD DIMENSION : %d\n",dim);
 
1529
+            return(0);
 
1530
+          }
 
1531
+          continue;
 
1532
       } else if(!strncmp(chaine,"Vertices",strlen("Vertices"))) {
 
1533
-       fscanf(inm,"%d",&mesh->np);
 
1534
-       posnp = ftell(inm);
 
1535
-       continue;
 
1536
+        fscanf(inm,"%d",&mesh->np); 
 
1537
+        posnp = ftell(inm);
 
1538
+        continue;
 
1539
       } else if(!strncmp(chaine,"Triangles",strlen("Triangles"))) {
 
1540
-       fscanf(inm,"%d",&mesh->nt);
 
1541
-       posnt = ftell(inm);
 
1542
-       continue;
 
1543
+        fscanf(inm,"%d",&mesh->nt); 
 
1544
+        posnt = ftell(inm);
 
1545
+        continue;
 
1546
       } else if(!strncmp(chaine,"Tetrahedra",strlen("Tetrahedra"))) {
 
1547
-       fscanf(inm,"%d",&mesh->ne);
 
1548
-       netmp = mesh->ne;
 
1549
-       posne = ftell(inm);
 
1550
-       continue;
 
1551
-      } else if(!strncmp(chaine,"Hexahedra",strlen("Hexahedra"))) {
 
1552
-       assert(abs(mesh->info.option)==10);
 
1553
-       fscanf(inm,"%d",&nhex);
 
1554
-       //nhex=0;
 
1555
-       posnhex = ftell(inm);
 
1556
-       continue;
 
1557
-      } else if(!strncmp(chaine,"Pentahedra",strlen("Pentahedra"))) {
 
1558
-       assert(abs(mesh->info.option)==10);
 
1559
-       fscanf(inm,"%d",&npris);
 
1560
-       //npris=0;
 
1561
-       posnpris = ftell(inm);
 
1562
-       continue;
 
1563
-      } else if(!strncmp(chaine,"Corners",strlen("Corners"))) {
 
1564
-       fscanf(inm,"%d",&ncor);
 
1565
-       posncor = ftell(inm);
 
1566
-       continue;
 
1567
-      } else if(!strncmp(chaine,"Edges",strlen("Edges"))) {
 
1568
-       fscanf(inm,"%d",&ned);
 
1569
-       posned = ftell(inm);
 
1570
-       continue;
 
1571
-      } else if(abs(mesh->info.option)==10 && !strncmp(chaine,"Quadrilaterals",strlen("Quadrilaterals"))) {
 
1572
-       fscanf(inm,"%d",&nq);
 
1573
-       posnq = ftell(inm);
 
1574
-       continue;
 
1575
-      }
 
1576
-    }
 
1577
+        fscanf(inm,"%d",&mesh->ne); 
 
1578
+        netmp = mesh->ne;
 
1579
+        posne = ftell(inm);
 
1580
+        continue;
 
1581
+      } else if(!strncmp(chaine,"Hexahedra",strlen("Hexahedra"))) { 
 
1582
+        assert(abs(mesh->info.option)==10);  
 
1583
+        fscanf(inm,"%d",&nhex); 
 
1584
+                               //nhex=0;
 
1585
+        posnhex = ftell(inm);
 
1586
+        continue;
 
1587
+      } else if(!strncmp(chaine,"Pentahedra",strlen("Pentahedra"))) { 
 
1588
+        assert(abs(mesh->info.option)==10); 
 
1589
+        fscanf(inm,"%d",&npris);
 
1590
+                               //npris=0;
 
1591
+        posnpris = ftell(inm);
 
1592
+        continue;
 
1593
+      } else if(!strncmp(chaine,"Corners",strlen("Corners"))) { 
 
1594
+        fscanf(inm,"%d",&ncor); 
 
1595
+        posncor = ftell(inm);
 
1596
+        continue;
 
1597
+      } else if(!strncmp(chaine,"Edges",strlen("Edges"))) { 
 
1598
+             fscanf(inm,"%d",&ned); 
 
1599
+             posned = ftell(inm);
 
1600
+             continue;
 
1601
+           } else if(abs(mesh->info.option)==10 && !strncmp(chaine,"Quadrilaterals",strlen("Quadrilaterals"))) {
 
1602
+                   fscanf(inm,"%d",&nq); 
 
1603
+                   posnq = ftell(inm);
 
1604
+                   continue;
 
1605
+                 }
 
1606
+    }  
 
1607
   } else {
 
1608
     bdim = 0;
 
1609
     fread(&mesh->ver,sw,1,inm);
 
1610
-    iswp=0;
 
1611
-    if(mesh->ver==16777216)
 
1612
-      iswp=1;
 
1613
+    iswp=0;   
 
1614
+    if(mesh->ver==16777216) 
 
1615
+      iswp=1;    
 
1616
     else if(mesh->ver!=1) {
 
1617
       fprintf(stdout,"BAD FILE ENCODING\n");
 
1618
-    }
 
1619
-    fread(&mesh->ver,sw,1,inm);
 
1620
-    if(iswp) mesh->ver = MMG_swapbin(mesh->ver);
 
1621
-    while(fread(&binch,sw,1,inm)!=0 && binch!=54 ) {
 
1622
-      if(iswp) binch=MMG_swapbin(binch);
 
1623
-      if(binch==54) break;
 
1624
+    } 
 
1625
+    fread(&mesh->ver,sw,1,inm); 
 
1626
+    if(iswp) mesh->ver = MMG_swapbin(mesh->ver); 
 
1627
+    while(fread(&binch,sw,1,inm)!=0 && binch!=54 ) {  
 
1628
+      if(iswp) binch=MMG_swapbin(binch);      
 
1629
+      if(binch==54) break;  
 
1630
       if(!bdim && binch==3) {  //Dimension
 
1631
-       fread(&bdim,sw,1,inm);  //NulPos=>20
 
1632
-       if(iswp) bdim=MMG_swapbin(bdim);
 
1633
-       fread(&bdim,sw,1,inm);
 
1634
-       if(iswp) bdim=MMG_swapbin(bdim);
 
1635
-       if(bdim!=3) {
 
1636
-         fprintf(stdout,"BAD SOL DIMENSION : %d\n",dim);
 
1637
-         exit(0);
 
1638
-         return(1);
 
1639
-       }
 
1640
-       continue;
 
1641
+        fread(&bdim,sw,1,inm);  //NulPos=>20
 
1642
+        if(iswp) bdim=MMG_swapbin(bdim);
 
1643
+        fread(&bdim,sw,1,inm);  
 
1644
+        if(iswp) bdim=MMG_swapbin(bdim);
 
1645
+        if(bdim!=3) {
 
1646
+          fprintf(stdout,"BAD SOL DIMENSION : %d\n",dim);
 
1647
+          exit(0);
 
1648
+          return(1);
 
1649
+        }
 
1650
+        continue;
 
1651
       } else if(!mesh->np && binch==4) {  //Vertices
 
1652
-       fread(&bpos,sw,1,inm); //NulPos
 
1653
-       if(iswp) bpos=MMG_swapbin(bpos);
 
1654
-       fread(&mesh->np,sw,1,inm);
 
1655
-       if(iswp) mesh->np=MMG_swapbin(mesh->np);
 
1656
-       posnp = ftell(inm);
 
1657
-       rewind(inm);
 
1658
-       fseek(inm,bpos,SEEK_SET);
 
1659
-       continue;
 
1660
+        fread(&bpos,sw,1,inm); //NulPos 
 
1661
+        if(iswp) bpos=MMG_swapbin(bpos);
 
1662
+        fread(&mesh->np,sw,1,inm); 
 
1663
+        if(iswp) mesh->np=MMG_swapbin(mesh->np);
 
1664
+        posnp = ftell(inm);     
 
1665
+        rewind(inm);
 
1666
+        fseek(inm,bpos,SEEK_SET);        
 
1667
+        continue;
 
1668
       }  else if(!mesh->nt && binch==6) {//Triangles
 
1669
-       fread(&bpos,sw,1,inm); //NulPos
 
1670
-       if(iswp) bpos=MMG_swapbin(bpos);
 
1671
-       fread(&mesh->nt,sw,1,inm);
 
1672
-       if(iswp) mesh->nt=MMG_swapbin(mesh->nt);
 
1673
-       posnt = ftell(inm);
 
1674
-       rewind(inm);
 
1675
-       fseek(inm,bpos,SEEK_SET);
 
1676
-       continue;
 
1677
-      } else if(!mesh->ne && binch==8) {
 
1678
-       fread(&bpos,sw,1,inm); //NulPos
 
1679
-       if(iswp) bpos=MMG_swapbin(bpos);
 
1680
-       fread(&mesh->ne,sw,1,inm);
 
1681
-       if(iswp) mesh->ne=MMG_swapbin(mesh->ne);
 
1682
-       netmp = mesh->ne;
 
1683
-       posne = ftell(inm);
 
1684
-       rewind(inm);
 
1685
-       fseek(inm,bpos,SEEK_SET);
 
1686
-       continue;
 
1687
-      } else if(!nhex && binch==10) {
 
1688
-       assert(abs(mesh->info.option)==10);
 
1689
-       fread(&bpos,sw,1,inm); //NulPos
 
1690
-       if(iswp) bpos=MMG_swapbin(bpos);
 
1691
-       fread(&nhex,sw,1,inm);
 
1692
-       if(iswp) nhex=MMG_swapbin(nhex);
 
1693
-       posnhex = ftell(inm);
 
1694
-       rewind(inm);
 
1695
-       fseek(inm,bpos,SEEK_SET);
 
1696
-       continue;
 
1697
-      } else if(!npris && binch==9) {
 
1698
-       assert(abs(mesh->info.option)==10);
 
1699
-       fread(&bpos,sw,1,inm); //NulPos
 
1700
-       if(iswp) bpos=MMG_swapbin(bpos);
 
1701
-       fread(&npris,sw,1,inm);
 
1702
-       if(iswp) npris=MMG_swapbin(npris);
 
1703
-       posnpris = ftell(inm);
 
1704
-       rewind(inm);
 
1705
-       fseek(inm,bpos,SEEK_SET);
 
1706
-       continue;
 
1707
-      } else if(!ncor && binch==13) {
 
1708
-       fread(&bpos,sw,1,inm); //NulPos
 
1709
-       if(iswp) bpos=MMG_swapbin(bpos);
 
1710
-       fread(&ncor,sw,1,inm);
 
1711
-       if(iswp) ncor=MMG_swapbin(ncor);
 
1712
-       posncor = ftell(inm);
 
1713
-       rewind(inm);
 
1714
-       fseek(inm,bpos,SEEK_SET);
 
1715
-       continue;
 
1716
-      } else if(!ned && binch==5) { //Edges
 
1717
-       fread(&bpos,sw,1,inm); //NulPos
 
1718
-       if(iswp) bpos=MMG_swapbin(bpos);
 
1719
-       fread(&ned,sw,1,inm);
 
1720
-       if(iswp) ned=MMG_swapbin(ned);
 
1721
-       posned = ftell(inm);
 
1722
-       rewind(inm);
 
1723
-       fseek(inm,bpos,SEEK_SET);
 
1724
-       continue;
 
1725
-      } else {
 
1726
-       //printf("on traite ? %d\n",binch);
 
1727
-       fread(&bpos,sw,1,inm); //NulPos
 
1728
-       if(iswp) bpos=MMG_swapbin(bpos);
 
1729
-       //printf("on avance... Nulpos %d\n",bpos);
 
1730
-       rewind(inm);
 
1731
-       fseek(inm,bpos,SEEK_SET);
 
1732
-      }
 
1733
-    }
 
1734
-
 
1735
+        fread(&bpos,sw,1,inm); //NulPos 
 
1736
+        if(iswp) bpos=MMG_swapbin(bpos);
 
1737
+        fread(&mesh->nt,sw,1,inm); 
 
1738
+        if(iswp) mesh->nt=MMG_swapbin(mesh->nt);
 
1739
+        posnt = ftell(inm); 
 
1740
+        rewind(inm);
 
1741
+        fseek(inm,bpos,SEEK_SET);        
 
1742
+        continue;
 
1743
+       } else if(!mesh->ne && binch==8) {  
 
1744
+         fread(&bpos,sw,1,inm); //NulPos 
 
1745
+         if(iswp) bpos=MMG_swapbin(bpos);
 
1746
+         fread(&mesh->ne,sw,1,inm); 
 
1747
+         if(iswp) mesh->ne=MMG_swapbin(mesh->ne);
 
1748
+         netmp = mesh->ne;
 
1749
+         posne = ftell(inm);
 
1750
+         rewind(inm);
 
1751
+         fseek(inm,bpos,SEEK_SET);        
 
1752
+         continue;
 
1753
+       } else if(!nhex && binch==10) { 
 
1754
+         assert(abs(mesh->info.option)==10);
 
1755
+         fread(&bpos,sw,1,inm); //NulPos 
 
1756
+         if(iswp) bpos=MMG_swapbin(bpos);
 
1757
+         fread(&nhex,sw,1,inm); 
 
1758
+         if(iswp) nhex=MMG_swapbin(nhex);
 
1759
+         posnhex = ftell(inm);
 
1760
+         rewind(inm);
 
1761
+         fseek(inm,bpos,SEEK_SET);        
 
1762
+         continue;
 
1763
+       } else if(!npris && binch==9) { 
 
1764
+         assert(abs(mesh->info.option)==10);
 
1765
+         fread(&bpos,sw,1,inm); //NulPos 
 
1766
+         if(iswp) bpos=MMG_swapbin(bpos);
 
1767
+         fread(&npris,sw,1,inm); 
 
1768
+         if(iswp) npris=MMG_swapbin(npris);
 
1769
+         posnpris = ftell(inm);
 
1770
+         rewind(inm);
 
1771
+         fseek(inm,bpos,SEEK_SET);        
 
1772
+         continue;
 
1773
+       } else if(!ncor && binch==13) { 
 
1774
+         fread(&bpos,sw,1,inm); //NulPos 
 
1775
+         if(iswp) bpos=MMG_swapbin(bpos);
 
1776
+         fread(&ncor,sw,1,inm);          
 
1777
+         if(iswp) ncor=MMG_swapbin(ncor);
 
1778
+         posncor = ftell(inm);
 
1779
+         rewind(inm);
 
1780
+         fseek(inm,bpos,SEEK_SET);        
 
1781
+         continue;
 
1782
+        } else if(!ned && binch==5) { //Edges
 
1783
+              fread(&bpos,sw,1,inm); //NulPos 
 
1784
+              if(iswp) bpos=MMG_swapbin(bpos);
 
1785
+              fread(&ned,sw,1,inm); 
 
1786
+              if(iswp) ned=MMG_swapbin(ned);
 
1787
+              posned = ftell(inm);
 
1788
+              rewind(inm);
 
1789
+              fseek(inm,bpos,SEEK_SET);        
 
1790
+              continue;
 
1791
+             } else {
 
1792
+         //printf("on traite ? %d\n",binch);
 
1793
+         fread(&bpos,sw,1,inm); //NulPos 
 
1794
+         if(iswp) bpos=MMG_swapbin(bpos);
 
1795
+         //printf("on avance... Nulpos %d\n",bpos);         
 
1796
+         rewind(inm);
 
1797
+         fseek(inm,bpos,SEEK_SET);        
 
1798
+       }     
 
1799
+    }            
 
1800
+    
 
1801
   }
 
1802
 
 
1803
   if ( abs(mesh->info.option)==10 ) {
 
1804
-    fprintf(stdout,"  -- READING %8d HEXA %8d PRISMS\n",nhex,npris);
 
1805
-    if(!mesh->ne) netmp = 0;
 
1806
-    mesh->ne += 6*nhex + 3*npris;
 
1807
+    fprintf(stdout,"  -- READING %8d HEXA %8d PRISMS\n",nhex,npris);  
 
1808
+    if(!mesh->ne) netmp = 0;  
 
1809
+    mesh->ne += 6*nhex + 3*npris; 
 
1810
   }
 
1811
 
 
1812
   if ( abs(mesh->info.imprim) > 5 )
431
1813
     fprintf(stdout,"  -- READING DATA FILE %s\n",data);
432
1814
 
433
1815
   if ( !mesh->np || !mesh->ne ) {
435
1817
+    fprintf(stdout,"  ** MISSING DAT qqA\n");
436
1818
     return(0);
437
1819
   }
 
1820
-  if(abs(mesh->info.option)==10) { //allocation
 
1821
+       if(abs(mesh->info.option)==10) { //allocation
 
1822
     listhexa  = (pHexa)M_calloc(nhex+1,sizeof(Hexa),"allochexa");
 
1823
-    assert(listhexa);
 
1824
-    adjahex = (int*)M_calloc(6*nhex+7,sizeof(int),"allocadjhexa");
 
1825
-    assert(adjahex);
 
1826
-  }
 
1827
+         assert(listhexa);     
 
1828
+         adjahex = (int*)M_calloc(6*nhex+7,sizeof(int),"allocadjhexa");
 
1829
+         assert(adjahex);                             
 
1830
+  }  
438
1831
   if ( !MMG_zaldy(mesh) )  return(0);
439
 
@@ -563,7 +951,7 @@
 
1832
   /* read mesh vertices */
 
1833
   mesh->npfixe = mesh->np;
 
1834
@@ -342,35 +775,35 @@
 
1835
   fseek(inm,posnp,SEEK_SET);
 
1836
   for (k=1; k<=mesh->np; k++) {
 
1837
     ppt = &mesh->point[k];
 
1838
-    if (mesh->ver < 2) { /*float*/
 
1839
+    if (mesh->ver < 2) { /*float*/ 
 
1840
       if (!bin) {
 
1841
-       for (i=0 ; i<3 ; i++) {
 
1842
-         fscanf(inm,"%f",&fc);
 
1843
-         ppt->c[i] = (double) fc;
 
1844
-       }
 
1845
-       fscanf(inm,"%d",&ppt->ref);
 
1846
+        for (i=0 ; i<3 ; i++) {
 
1847
+          fscanf(inm,"%f",&fc);
 
1848
+          ppt->c[i] = (double) fc;
 
1849
+        } 
 
1850
+        fscanf(inm,"%d",&ppt->ref);
 
1851
       } else {
 
1852
-       for (i=0 ; i<3 ; i++) {
 
1853
-         fread(&fc,sw,1,inm);
 
1854
-         if(iswp) fc=MMG_swapf(fc);
 
1855
-         ppt->c[i] = (double) fc;
 
1856
-       }
 
1857
-       fread(&ppt->ref,sw,1,inm);
 
1858
-       if(iswp) ppt->ref=MMG_swapbin(ppt->ref);
 
1859
+        for (i=0 ; i<3 ; i++) {
 
1860
+          fread(&fc,sw,1,inm); 
 
1861
+          if(iswp) fc=MMG_swapf(fc);    
 
1862
+          ppt->c[i] = (double) fc;
 
1863
+        }     
 
1864
+        fread(&ppt->ref,sw,1,inm);         
 
1865
+        if(iswp) ppt->ref=MMG_swapbin(ppt->ref);    
 
1866
       }
 
1867
     } else {
 
1868
-      if (!bin)
 
1869
-       fscanf(inm,"%lf %lf %lf %d",&ppt->c[0],&ppt->c[1],&ppt->c[2],&ppt->ref);
 
1870
+      if (!bin) 
 
1871
+        fscanf(inm,"%lf %lf %lf %d",&ppt->c[0],&ppt->c[1],&ppt->c[2],&ppt->ref); 
 
1872
       else {
 
1873
-       for (i=0 ; i<3 ; i++) {
 
1874
-         fread(&ppt->c[i],sd,1,inm);
 
1875
-         if(iswp) ppt->c[i]=MMG_swapd(ppt->c[i]);
 
1876
-       }
 
1877
-       fread(&ppt->ref,sw,1,inm);
 
1878
-       if(iswp) ppt->ref=MMG_swapbin(ppt->ref);
 
1879
-      }
 
1880
-    }
 
1881
-    ppt->tag  = M_UNUSED;
 
1882
+        for (i=0 ; i<3 ; i++) { 
 
1883
+          fread(&ppt->c[i],sd,1,inm);
 
1884
+          if(iswp) ppt->c[i]=MMG_swapd(ppt->c[i]); 
 
1885
+        }   
 
1886
+        fread(&ppt->ref,sw,1,inm);         
 
1887
+        if(iswp) ppt->ref=MMG_swapbin(ppt->ref);    
 
1888
+      }  
 
1889
+    }             
 
1890
+    ppt->tag  = M_UNUSED;    
 
1891
   }
 
1892
 
 
1893
   /* read mesh triangles */
 
1894
@@ -378,227 +811,226 @@
 
1895
   rewind(inm);
 
1896
   fseek(inm,posnt,SEEK_SET);
 
1897
   for (k=1; k<=mesh->nt; k++) {
 
1898
-    pt1 = &mesh->tria[k];
 
1899
+    pt1 = &mesh->tria[k]; 
 
1900
     if (!bin)
 
1901
       fscanf(inm,"%d %d %d %d",&pt1->v[0],&pt1->v[1],&pt1->v[2],&pt1->ref);
 
1902
     else {
 
1903
-      for (i=0 ; i<3 ; i++) {
 
1904
-       fread(&pt1->v[i],sw,1,inm);
 
1905
-       if(iswp) pt1->v[i]=MMG_swapbin(pt1->v[i]);
 
1906
-      }
 
1907
-      fread(&pt1->ref,sw,1,inm);
 
1908
-      if(iswp) pt1->ref=MMG_swapbin(pt1->ref);
 
1909
-    }
 
1910
-  }
 
1911
-  /* read mesh quads (option 10)*/
 
1912
-  if(abs(mesh->info.option)==10) {
 
1913
-    fprintf(stdout,"     QUADS READING %d\n",nq);
 
1914
+      for (i=0 ; i<3 ; i++) { 
 
1915
+        fread(&pt1->v[i],sw,1,inm); 
 
1916
+        if(iswp) pt1->v[i]=MMG_swapbin(pt1->v[i]);    
 
1917
+      }
 
1918
+      fread(&pt1->ref,sw,1,inm); 
 
1919
+      if(iswp) pt1->ref=MMG_swapbin(pt1->ref);           
 
1920
+    }  
 
1921
+  }
 
1922
+  /* read mesh quads (option 10)*/ 
 
1923
+       if(abs(mesh->info.option)==10) { 
 
1924
+               fprintf(stdout,"     QUADS READING %d\n",nq);
 
1925
     mesh->ntfixe += 4*nq;
 
1926
 
 
1927
     rewind(inm);
 
1928
     fseek(inm,posnq,SEEK_SET);
 
1929
     for (k=1; k<=nq; k++) {
 
1930
       if (!bin)
 
1931
-       fscanf(inm,"%d %d %d %d %d",&p0,&p1,&p2,&p3,&ref);
 
1932
+        fscanf(inm,"%d %d %d %d %d",&p0,&p1,&p2,&p3,&ref);
 
1933
       else {
 
1934
-       fread(&p0,sw,1,inm);
 
1935
-       if(iswp) p0=MMG_swapbin(p0);
 
1936
-       fread(&p1,sw,1,inm);
 
1937
-       if(iswp) p1=MMG_swapbin(p1);
 
1938
-       fread(&p2,sw,1,inm);
 
1939
-       if(iswp) p2=MMG_swapbin(p2);
 
1940
-       fread(&p3,sw,1,inm);
 
1941
-       if(iswp) p3=MMG_swapbin(p3);
 
1942
-       fread(&pt1->ref,sw,1,inm);
 
1943
-       if(iswp) ref=MMG_swapbin(ref);
 
1944
-      }
 
1945
+        fread(&p0,sw,1,inm); 
 
1946
+        if(iswp) p0=MMG_swapbin(p0);    
 
1947
+        fread(&p1,sw,1,inm); 
 
1948
+        if(iswp) p1=MMG_swapbin(p1);    
 
1949
+        fread(&p2,sw,1,inm); 
 
1950
+        if(iswp) p2=MMG_swapbin(p2);    
 
1951
+        fread(&p3,sw,1,inm); 
 
1952
+        if(iswp) p3=MMG_swapbin(p3);    
 
1953
+             fread(&pt1->ref,sw,1,inm); 
 
1954
+             if(iswp) ref=MMG_swapbin(ref);           
 
1955
+      } 
 
1956
       /*creation of 4 triangles per quads because we don't know how hexa will be cut*/
 
1957
-      pt1 = &mesh->tria[++mesh->nt];
 
1958
-      pt1->v[0] = p0;
 
1959
-      pt1->v[1] = p1;
 
1960
-      pt1->v[2] = p2;
 
1961
-      pt1->ref  = ref;
 
1962
-      pt1 = &mesh->tria[++mesh->nt];
 
1963
-      pt1->v[0] = p0;
 
1964
-      pt1->v[1] = p2;
 
1965
-      pt1->v[2] = p3;
 
1966
-      pt1->ref  = ref;
 
1967
-      pt1 = &mesh->tria[++mesh->nt];
 
1968
-      pt1->v[0] = p0;
 
1969
-      pt1->v[1] = p1;
 
1970
-      pt1->v[2] = p3;
 
1971
-      pt1->ref  = ref;
 
1972
-      pt1 = &mesh->tria[++mesh->nt];
 
1973
-      pt1->v[0] = p1;
 
1974
-      pt1->v[1] = p2;
 
1975
-      pt1->v[2] = p3;
 
1976
-      pt1->ref  = ref;
 
1977
-
 
1978
-    }
 
1979
-  }
 
1980
-  /*read and store edges*/
 
1981
-  if (ned) {
 
1982
-    if ( !MMG_zaldy4(&hed,ned) ) {
 
1983
-      if ( mesh->info.ddebug )  fprintf(stdout,"  ## MEMORY ALLOCATION PROBLEM : EDGES IGNORED\n");
 
1984
-      ned = 0;
 
1985
-    }
 
1986
-    mesh->ned = ned;
 
1987
+      pt1 = &mesh->tria[++mesh->nt]; 
 
1988
+                       pt1->v[0] = p0;
 
1989
+                       pt1->v[1] = p1;
 
1990
+                       pt1->v[2] = p2;
 
1991
+                       pt1->ref  = ref;
 
1992
+      pt1 = &mesh->tria[++mesh->nt]; 
 
1993
+                       pt1->v[0] = p0;
 
1994
+                       pt1->v[1] = p2;
 
1995
+                       pt1->v[2] = p3;
 
1996
+                       pt1->ref  = ref;
 
1997
+      pt1 = &mesh->tria[++mesh->nt]; 
 
1998
+                       pt1->v[0] = p0;
 
1999
+                       pt1->v[1] = p1;
 
2000
+                       pt1->v[2] = p3;
 
2001
+                       pt1->ref  = ref;
 
2002
+      pt1 = &mesh->tria[++mesh->nt]; 
 
2003
+                       pt1->v[0] = p1;
 
2004
+                       pt1->v[1] = p2;
 
2005
+                       pt1->v[2] = p3;
 
2006
+                       pt1->ref  = ref;
 
2007
 
2008
+    }
 
2009
+  }
 
2010
+       /*read and store edges*/
 
2011
+  if (ned) {         
 
2012
+         if ( !MMG_zaldy4(&hed,ned) ) {
 
2013
+      if ( mesh->info.ddebug )  fprintf(stdout,"  ## MEMORY ALLOCATION PROBLEM : EDGES IGNORED\n"); 
 
2014
+                       ned = 0;
 
2015
+    }   
 
2016
+               mesh->ned = ned;
 
2017
     rewind(inm);
 
2018
-    fseek(inm,posned,SEEK_SET);
 
2019
-    for (k=1; k<=ned; k++) {
 
2020
+    fseek(inm,posned,SEEK_SET); 
 
2021
+    for (k=1; k<=ned; k++) { 
 
2022
       if (!bin)
 
2023
-       fscanf(inm,"%d %d %d",&nu1,&nu2,&ref);
 
2024
+        fscanf(inm,"%d %d %d",&nu1,&nu2,&ref);
 
2025
       else {
 
2026
-       fread(&nu1,sw,1,inm);
 
2027
-       if(iswp) nu1=MMG_swapbin(nu1);
 
2028
-       fread(&nu2,sw,1,inm);
 
2029
-       if(iswp) nu2=MMG_swapbin(nu2);
 
2030
-       fread(&ref,sw,1,inm);
 
2031
-       if(iswp) ref=MMG_swapbin(ref);
 
2032
-      }
 
2033
-      if(MMG_edgePut(&hed,nu1,nu2,2)>1) {
 
2034
-       fprintf(stdout,"  ## WARNING DOUBLE EDGE : %d %d\n",nu1,nu2);
 
2035
-      }
 
2036
-      mesh->point[nu1].geom = M_RIDGE_GEO;
 
2037
-      mesh->point[nu2].geom = M_RIDGE_GEO;
 
2038
+        fread(&nu1,sw,1,inm); 
 
2039
+        if(iswp) nu1=MMG_swapbin(nu1);    
 
2040
+        fread(&nu2,sw,1,inm); 
 
2041
+        if(iswp) nu2=MMG_swapbin(nu2);    
 
2042
+        fread(&ref,sw,1,inm); 
 
2043
+        if(iswp) ref=MMG_swapbin(ref);    
 
2044
+      }  
 
2045
+                       if(MMG_edgePut(&hed,nu1,nu2,2)>1) {
 
2046
+                               fprintf(stdout,"  ## WARNING DOUBLE EDGE : %d %d\n",nu1,nu2);
 
2047
+                       } 
 
2048
+                       mesh->point[nu1].geom = M_RIDGE_GEO;  
 
2049
+                       mesh->point[nu2].geom = M_RIDGE_GEO;  
 
2050
     }
 
2051
   }
 
2052
 
 
2053
   /* read mesh tetrahedra */
 
2054
   mesh->nefixe = mesh->ne;
 
2055
   rewind(inm);
 
2056
-  fseek(inm,posne,SEEK_SET);
 
2057
-  reorient = 0;
 
2058
-  for (k=1; k<=netmp; k++) {
 
2059
+  fseek(inm,posne,SEEK_SET); 
 
2060
+       reorient = 0;
 
2061
+  for (k=1; k<=netmp; k++) { 
 
2062
     pt = &mesh->tetra[k];
 
2063
-    if (!bin)
 
2064
-      fscanf(inm,"%d %d %d %d %d",&pt->v[0],&pt->v[1],&pt->v[2],&pt->v[3],&ref);
 
2065
-    else {
 
2066
-
 
2067
-      for (i=0 ; i<4 ; i++) {
 
2068
-       fread(&pt->v[i],sw,1,inm);
 
2069
-       if(iswp) pt->v[i]=MMG_swapbin(pt->v[i]);
 
2070
-      }
 
2071
-      fread(&ref,sw,1,inm);
 
2072
-      if(iswp) ref=MMG_swapbin(ref);
 
2073
-    }
 
2074
+    if (!bin) 
 
2075
+      fscanf(inm,"%d %d %d %d %d",&pt->v[0],&pt->v[1],&pt->v[2],&pt->v[3],&ref); 
 
2076
+    else {                                                                        
 
2077
+       
 
2078
+      for (i=0 ; i<4 ; i++) { 
 
2079
+        fread(&pt->v[i],sw,1,inm); 
 
2080
+        if(iswp) pt->v[i]=MMG_swapbin(pt->v[i]);    
 
2081
+      }
 
2082
+      fread(&ref,sw,1,inm);         
 
2083
+      if(iswp) ref=MMG_swapbin(ref);           
 
2084
+    }  
 
2085
     pt->ref  = ref;//0;//ref ;
 
2086
 
 
2087
     /*check orientation*/
 
2088
-    volref = MMG_voltet(mesh,k);
 
2089
-    if(volref < 0) {
 
2090
-      reorient++;
 
2091
-      tmp = pt->v[2];
 
2092
-      pt->v[2] = pt->v[3];
 
2093
-      pt->v[3] = tmp;
 
2094
-    }
 
2095
-
 
2096
+               volref = MMG_voltet(mesh,k);
 
2097
+               if(volref < 0) {
 
2098
+                if(!reorient) {
 
2099
+                  fprintf(stdout,"\n     $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ \n");
 
2100
+                  fprintf(stdout,"         BAD ORIENTATION : vol < 0 -- Some tetra will be reoriented\n");     
 
2101
+                  fprintf(stdout,"     $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ \n\n");
 
2102
+                  reorient = 1;        
 
2103
+                }
 
2104
+                tmp = pt->v[2];
 
2105
+     pt->v[2] = pt->v[3];
 
2106
+     pt->v[3] = tmp;
 
2107
+               }
 
2108
+         
 
2109
     for(i=0 ; i<4 ; i++)
 
2110
-      pt->bdryref[i] = -1;
 
2111
-
 
2112
-    if (ned) {
 
2113
-      for(i=0 ; i<6 ; i++) {
 
2114
-       nu1 = pt->v[MMG_iare[i][0]];
 
2115
-       nu2 = pt->v[MMG_iare[i][1]];
 
2116
-       pt->bdryinfo[i] = MMG_edgePoint(&hed,nu1,nu2);
 
2117
-      }
 
2118
-
 
2119
-    } else {
 
2120
-      for(i=0 ; i<6 ; i++)
 
2121
-       pt->bdryinfo[i] = 0;
 
2122
-    }
 
2123
+      pt->bdryref[i] = -1;  
 
2124
+    
 
2125
+               if (ned) {
 
2126
+           for(i=0 ; i<6 ; i++) {                         
 
2127
+                               nu1 = pt->v[MMG_iare[i][0]];
 
2128
+                               nu2 = pt->v[MMG_iare[i][1]];
 
2129
+             pt->bdryinfo[i] = MMG_edgePoint(&hed,nu1,nu2);
 
2130
+                       }                       
 
2131
+                       
 
2132
+               } else {
 
2133
+           for(i=0 ; i<6 ; i++)
 
2134
+             pt->bdryinfo[i] = 0;                      
 
2135
+               }
 
2136
   }
 
2137
-  if(reorient) {
 
2138
-    fprintf(stdout,"\n     $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ \n");
 
2139
-    fprintf(stdout,"         BAD ORIENTATION : vol < 0 -- %8d tetra reoriented\n",reorient);
 
2140
-    fprintf(stdout,"     $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ \n\n");
 
2141
-    reorient = 1;
 
2142
-  }
 
2143
-   if (ned) M_free(hed.item);
 
2144
+  if (ned) M_free(hed.item); 
 
2145
 
 
2146
-  /*read corners*/
 
2147
+  /*read corners*/ 
 
2148
   if (ncor) {
 
2149
     rewind(inm);
 
2150
-    fseek(inm,posncor,SEEK_SET);
 
2151
+    fseek(inm,posncor,SEEK_SET); 
 
2152
     mesh->ncor = ncor;
 
2153
-    for (k=1; k<=ncor; k++) {
 
2154
+    for (k=1; k<=ncor; k++) { 
 
2155
       if (!bin)
 
2156
-       fscanf(inm,"%d",&ref);
 
2157
+        fscanf(inm,"%d",&ref);
 
2158
       else {
 
2159
-       fread(&ref,sw,1,inm);
 
2160
-       if(iswp) ref=MMG_swapbin(ref);
 
2161
-      }
 
2162
+        fread(&ref,sw,1,inm); 
 
2163
+        if(iswp) ref=MMG_swapbin(ref);    
 
2164
+      }  
 
2165
       ppt = &mesh->point[ref];
 
2166
-      ppt->geom = M_CORNER;
 
2167
-    }
 
2168
+      ppt->geom = M_CORNER; 
 
2169
+    } 
 
2170
   }
 
2171
-
 
2172
-
 
2173
-  if ( abs(mesh->info.option)==10 ) {
 
2174
+   
 
2175
+       
 
2176
+  if ( abs(mesh->info.option)==10 ) { 
 
2177
     if(bin) {
 
2178
       printf("NOT SUPPORTED\n");
 
2179
       exit(0);
 
2180
-    }
 
2181
-    if ( !MMG_zaldy4(&hed2,3*npris+6*nhex) ) {
 
2182
-      if ( mesh->info.ddebug )  fprintf(stdout,"  ## MEMORY ALLOCATION PROBLEM : PRISM IGNORED\n");
 
2183
-      npris = 0;
 
2184
-      nhex  = 0;
 
2185
-    }
 
2186
+    } 
 
2187
+         if ( !MMG_zaldy4(&hed2,3*npris+6*nhex) ) {
 
2188
+      if ( mesh->info.ddebug )  fprintf(stdout,"  ## MEMORY ALLOCATION PROBLEM : PRISM IGNORED\n"); 
 
2189
+                       npris = 0;
 
2190
+                       nhex  = 0;
 
2191
+    }   
 
2192
 
 
2193
     /*read hexa and transform to tetra*/
 
2194
     rewind(inm);
 
2195
-    fseek(inm,posnhex,SEEK_SET);
 
2196
-    nbado = 0;
 
2197
+    fseek(inm,posnhex,SEEK_SET);   
 
2198
+               nbado = 0;
 
2199
     for (k=1; k<=nhex; k++) {
 
2200
-      ph = &listhexa[k];
 
2201
-      fscanf(inm,"%d %d %d %d %d %d %d %d %d",&ph->v[0],&ph->v[1],&ph->v[2],&ph->v[3],&ph->v[4],&ph->v[5],&ph->v[6],&ph->v[7],&ph->ref);
 
2202
-      //fscanf(inm,"%d %d %d %d %d %d %d %d %d",&p0,&p4,&p2,&p1,&p3,&p5,&p6,&p7,&ref);
 
2203
-      //printf("hex %d : %d %d %d %d %d %d %d %d\n",k,p0,p1,p2,p3,p4,p5,p6,p7);
 
2204
+                       ph = &listhexa[k];   
 
2205
+      fscanf(inm,"%d %d %d %d %d %d %d %d %d",&ph->v[0],&ph->v[1],&ph->v[2],&ph->v[3],&ph->v[4],&ph->v[5],&ph->v[6],&ph->v[7],&ph->ref); 
 
2206
+      //fscanf(inm,"%d %d %d %d %d %d %d %d %d",&p0,&p4,&p2,&p1,&p3,&p5,&p6,&p7,&ref); 
 
2207
+      //printf("hex %d : %d %d %d %d %d %d %d %d\n",k,p0,p1,p2,p3,p4,p5,p6,p7); 
 
2208
       //check orientability of the hexahedra : vol of tet p0 p1 p3 p4
 
2209
-      volhex = MMG_quickvol(mesh->point[ph->v[0]].c,mesh->point[ph->v[1]].c,mesh->point[ph->v[2]].c,mesh->point[ph->v[3]].c);
 
2210
-      if(k==1) {
 
2211
-       volref = volhex;
 
2212
-       //printf("vol %e\n",volref);
 
2213
-      }
 
2214
-      else {
 
2215
-       if(volref*volhex < 0) {
 
2216
-         fprintf(stdout,"BAD ORIENTATION OF HEXAHEDRON %d : %d %d %d %d %d %d %d %d\n",k,p0,p1,p2,p3,p4,p5,p6,p7);
 
2217
-         nbado++;
 
2218
-         tmp = ph->v[3];
 
2219
-         ph->v[3] = ph->v[1];
 
2220
-         ph->v[1] = tmp;
 
2221
-         tmp = ph->v[5];
 
2222
-         ph->v[5] = ph->v[7];
 
2223
-         ph->v[7] = tmp;
 
2224
-       }
 
2225
-      }
 
2226
-      // MMG_cuthex(mesh,&hed2,netmp+(k-1)*6,ph->v[0],ph->v[1],ph->v[2],ph->v[3],ph->v[4],ph->v[5],ph->v[6],ph->v[7],ph->ref);
 
2227
-    }
 
2228
-    fprintf(stdout,"%8d HEXA REORIENTED\n",nbado);
 
2229
+                       volhex = MMG_quickvol(mesh->point[ph->v[0]].c,mesh->point[ph->v[1]].c,mesh->point[ph->v[2]].c,mesh->point[ph->v[3]].c);
 
2230
+                       if(k==1) {
 
2231
+                               volref = volhex; 
 
2232
+                               //printf("vol %e\n",volref);
 
2233
+                       }
 
2234
+                       else {
 
2235
+                               if(volref*volhex < 0) {
 
2236
+                                       fprintf(stdout,"BAD ORIENTATION OF HEXAHEDRON %d : %d %d %d %d %d %d %d %d\n",k,p0,p1,p2,p3,p4,p5,p6,p7);
 
2237
+                                       nbado++;
 
2238
+                                       tmp = ph->v[3];
 
2239
+                                       ph->v[3] = ph->v[1];
 
2240
+                                       ph->v[1] = tmp;
 
2241
+                                       tmp = ph->v[5];
 
2242
+                                       ph->v[5] = ph->v[7];
 
2243
+                                       ph->v[7] = tmp;
 
2244
+                               }
 
2245
+                       } 
 
2246
+                       // MMG_cuthex(mesh,&hed2,netmp+(k-1)*6,ph->v[0],ph->v[1],ph->v[2],ph->v[3],ph->v[4],ph->v[5],ph->v[6],ph->v[7],ph->ref);
 
2247
+    }  
 
2248
+               fprintf(stdout,"%8d HEXA REORIENTED\n",nbado);
 
2249
 
 
2250
-    if(!MMG_hashHexa(listhexa,adjahex,nhex)) return(0);
 
2251
-    MMG_cuthex(mesh,&hed2,listhexa,adjahex,nhex,netmp);
 
2252
+               if(!MMG_hashHexa(listhexa,adjahex,nhex)) return(0);  
 
2253
+         MMG_cuthex(mesh,&hed2,listhexa,adjahex,nhex,netmp); 
 
2254
     /*read prism and transform to tetra
 
2255
-      ---> compatibility pbs ==> hash edge and switch case*/
 
2256
+               ---> compatibility pbs ==> hash edge and switch case*/  
 
2257
     rewind(inm);
 
2258
-    fseek(inm,posnpris,SEEK_SET);
 
2259
-    nimp = 0;
 
2260
-    ne = netmp+6*nhex;
 
2261
+    fseek(inm,posnpris,SEEK_SET); 
 
2262
+               nimp = 0; 
 
2263
+               ne = netmp+6*nhex;
 
2264
     for (k=1; k<=npris; k++) {
 
2265
-      fscanf(inm,"%d %d %d %d %d %d %d",&p0,&p1,&p2,&p3,&p4,&p5,&ref);
 
2266
-      if(!MMG_cutprism(mesh,&hed2,ne,p0,p1,p2,p3,p4,p5,ref))
 
2267
-       {
 
2268
-         if(mesh->info.imprim < 0 ) fprintf(stdout,"DECOMPOSITION PRISM INVALID \n\n");
 
2269
-         mesh->ne += 5;
 
2270
-         ne += 8;
 
2271
-         nimp++;
 
2272
-         continue;
 
2273
-       }
 
2274
-      ne += 3;
 
2275
+      fscanf(inm,"%d %d %d %d %d %d %d",&p0,&p1,&p2,&p3,&p4,&p5,&ref); 
 
2276
+                       if(!MMG_cutprism(mesh,&hed2,ne,p0,p1,p2,p3,p4,p5,ref))
 
2277
+                       {
 
2278
+                               if(mesh->info.imprim < 0 ) fprintf(stdout,"DECOMPOSITION PRISM INVALID \n\n"); 
 
2279
+                               mesh->ne += 5;
 
2280
+                               ne += 8;
 
2281
+                               nimp++; 
 
2282
+                               continue;
 
2283
+                       }
 
2284
+                       ne += 3;
 
2285
     }
 
2286
-    if(abs(mesh->info.imprim) > 3 )fprintf(stdout,"     %d INVALID DECOMPOSITION\n\n",nimp);
 
2287
+               if(abs(mesh->info.imprim) > 3 )fprintf(stdout,"     %d INVALID DECOMPOSITION\n\n",nimp);
 
2288
   }
 
2289
-
 
2290
+  
 
2291
   if ( abs(mesh->info.imprim) > 3 && abs(mesh->info.option)!=10 ) {
 
2292
     fprintf(stdout,"     NUMBER OF GIVEN VERTICES   %8d\n",mesh->npfixe);
 
2293
     if ( mesh->ntfixe )
 
2294
@@ -609,24 +1041,26 @@
 
2295
     if ( ned )
 
2296
       fprintf(stdout,"     NUMBER OF GIVEN EDGES      %8d\n",ned);
 
2297
   }
 
2298
-  fclose(inm);
 
2299
-  return(1);
 
2300
+ fclose(inm);
 
2301
+ return(1);
 
2302
 }
440
2303
 
441
2304
 
442
2305
 /* load solution (metric) */
443
 
-int MMG_loadSol(pSol sol,char *filename,int npmax) { 
 
2306
-int MMG_loadSol(pSol sol,char *filename,int npmax) {
 
2307
-  FILE       *inm;
444
2308
+int MMG_loadSol(pSol sol,char *filename,int npmax,void *dataff) { 
445
 
   FILE       *inm;   
 
2309
+  FILE       *inm;   
446
2310
   float       fsol;
447
 
   double      tmp;       
448
 
@@ -571,6 +959,8 @@
 
2311
-  double      tmp;
 
2312
+  double      tmp;       
 
2313
   int         binch,bdim,iswp;
449
2314
   int         k,i,isol,type,bin,dim,btyp,bpos;
450
2315
   long        posnp;
451
2316
   char        *ptr,data[128],chaine[128];
 
2317
-
 
2318
-  posnp = 0;
452
2319
+    if(dataff) 
453
2320
+       return MMG_loadSolff( sol,filename,npmax,(DataFF*) dataff);
454
 
   
455
 
   posnp = 0; 
 
2321
+  
 
2322
+  posnp = 0; 
456
2323
   bin   = 0;
457
 
@@ -664,12 +1054,12 @@
458
 
     
459
 
   }       
 
2324
-  iswp  = 0;
 
2325
+  iswp  = 0; 
 
2326
 
 
2327
   strcpy(data,filename);
 
2328
   ptr = strstr(data,".mesh");
 
2329
@@ -645,94 +1079,94 @@
 
2330
   }
 
2331
   fprintf(stdout,"  %%%% %s OPENED\n",data);
 
2332
 
 
2333
-
 
2334
-  if(!bin) {
 
2335
+   
 
2336
+  if(!bin) {   
 
2337
     strcpy(chaine,"DDD");
 
2338
-    while(fscanf(inm,"%s",&chaine[0])!=EOF && strncmp(chaine,"End",strlen("End")) ) {
 
2339
+    while(fscanf(inm,"%s",&chaine[0])!=EOF && strncmp(chaine,"End",strlen("End")) ) { 
 
2340
       if(!strncmp(chaine,"Dimension",strlen("Dimension"))) {
 
2341
-       fscanf(inm,"%d",&dim);
 
2342
-       if(dim!=3) {
 
2343
-         fprintf(stdout,"BAD SOL DIMENSION : %d\n",dim);
 
2344
-         return(1);
 
2345
-       }
 
2346
-       continue;
 
2347
+          fscanf(inm,"%d",&dim);
 
2348
+          if(dim!=3) {
 
2349
+            fprintf(stdout,"BAD SOL DIMENSION : %d\n",dim); 
 
2350
+            return(1);
 
2351
+          }
 
2352
+          continue;
 
2353
       } else if(!strncmp(chaine,"SolAtVertices",strlen("SolAtVertices"))) {
 
2354
-       fscanf(inm,"%d",&sol->np);
 
2355
-       fscanf(inm,"%d",&type);
 
2356
-       if(type!=1) {
 
2357
-         fprintf(stdout,"SEVERAL SOLUTION => IGNORED : %d\n",type);
 
2358
-         return(1);
 
2359
-       }
 
2360
-       fscanf(inm,"%d",&btyp);
 
2361
-       posnp = ftell(inm);
 
2362
-       break;
 
2363
-      }
 
2364
-    }
 
2365
-  } else {
 
2366
-    fread(&binch,sw,1,inm);
 
2367
-    iswp=0;
 
2368
-    if(binch==16777216) iswp=1;
 
2369
+        fscanf(inm,"%d",&sol->np); 
 
2370
+        fscanf(inm,"%d",&type); 
 
2371
+        if(type!=1) {
 
2372
+          fprintf(stdout,"SEVERAL SOLUTION => IGNORED : %d\n",type);
 
2373
+          return(1);
 
2374
+        }
 
2375
+        fscanf(inm,"%d",&btyp);
 
2376
+        posnp = ftell(inm);
 
2377
+        break;
 
2378
+      } 
 
2379
+    }            
 
2380
+  } else {     
 
2381
+    fread(&binch,sw,1,inm); 
 
2382
+    iswp=0;   
 
2383
+    if(binch==16777216) iswp=1;    
 
2384
     else if(binch!=1) {
 
2385
       fprintf(stdout,"BAD FILE ENCODING\n");
 
2386
-    }
 
2387
-    fread(&sol->ver,sw,1,inm);
 
2388
-    if(iswp) sol->ver = MMG_swapbin(sol->ver);
 
2389
+    } 
 
2390
+    fread(&sol->ver,sw,1,inm); 
 
2391
+    if(iswp) sol->ver = MMG_swapbin(sol->ver); 
 
2392
     while(fread(&binch,sw,1,inm)!=EOF && binch!=54 ) {
 
2393
-      if(iswp) binch=MMG_swapbin(binch);
 
2394
-      if(binch==54) break;
 
2395
+      if(iswp) binch=MMG_swapbin(binch);      
 
2396
+      if(binch==54) break;  
 
2397
       if(binch==3) {  //Dimension
 
2398
-       fread(&bdim,sw,1,inm);  //NulPos=>20
 
2399
-       if(iswp) bdim=MMG_swapbin(bdim);
 
2400
-       fread(&bdim,sw,1,inm);
 
2401
-       if(iswp) bdim=MMG_swapbin(bdim);
 
2402
-       if(bdim!=3) {
 
2403
-         fprintf(stdout,"BAD SOL DIMENSION : %d\n",dim);
 
2404
-         exit(0);
 
2405
-         return(1);
 
2406
-       }
 
2407
-       continue;
 
2408
+        fread(&bdim,sw,1,inm);  //NulPos=>20
 
2409
+        if(iswp) bdim=MMG_swapbin(bdim);
 
2410
+        fread(&bdim,sw,1,inm);
 
2411
+        if(iswp) bdim=MMG_swapbin(bdim);
 
2412
+        if(bdim!=3) {
 
2413
+          fprintf(stdout,"BAD SOL DIMENSION : %d\n",dim);
 
2414
+          exit(0);
 
2415
+          return(1);
 
2416
+        }
 
2417
+        continue;
 
2418
       } else if(binch==62) {  //SolAtVertices
 
2419
-       fread(&binch,sw,1,inm); //NulPos
 
2420
-       if(iswp) binch=MMG_swapbin(binch);
 
2421
-       fread(&sol->np,sw,1,inm);
 
2422
-       if(iswp) sol->np=MMG_swapbin(sol->np);
 
2423
-       fread(&binch,sw,1,inm); //nb sol
 
2424
-       if(iswp) binch=MMG_swapbin(binch);
 
2425
-       if(binch!=1) {
 
2426
-         fprintf(stdout,"SEVERAL SOLUTION => IGNORED : %d\n",type);
 
2427
-         return(1);
 
2428
-       }
 
2429
-       fread(&btyp,sw,1,inm); //typsol
 
2430
-       if(iswp) btyp=MMG_swapbin(btyp);
 
2431
-       posnp = ftell(inm);
 
2432
-       break;
 
2433
+        fread(&binch,sw,1,inm); //NulPos
 
2434
+        if(iswp) binch=MMG_swapbin(binch);
 
2435
+        fread(&sol->np,sw,1,inm); 
 
2436
+        if(iswp) sol->np=MMG_swapbin(sol->np);
 
2437
+        fread(&binch,sw,1,inm); //nb sol
 
2438
+        if(iswp) binch=MMG_swapbin(binch);
 
2439
+        if(binch!=1) {
 
2440
+          fprintf(stdout,"SEVERAL SOLUTION => IGNORED : %d\n",type);
 
2441
+          return(1);
 
2442
+        }
 
2443
+        fread(&btyp,sw,1,inm); //typsol
 
2444
+        if(iswp) btyp=MMG_swapbin(btyp);
 
2445
+        posnp = ftell(inm);
 
2446
+        break;
 
2447
       } else {
 
2448
-       fread(&bpos,sw,1,inm); //Pos
 
2449
-       if(iswp) bpos=MMG_swapbin(bpos);
 
2450
-       rewind(inm);
 
2451
-       fseek(inm,bpos,SEEK_SET);
 
2452
-      }
 
2453
-    }
 
2454
-
 
2455
-  }
 
2456
+        fread(&bpos,sw,1,inm); //Pos 
 
2457
+        if(iswp) bpos=MMG_swapbin(bpos);
 
2458
+        rewind(inm);
 
2459
+        fseek(inm,bpos,SEEK_SET);        
 
2460
+      } 
 
2461
+    }            
 
2462
+    
 
2463
+  }       
460
2464
   if ( !sol->np ) {
461
2465
-    fprintf(stdout,"  ** MISSING DATA\n");
462
2466
+    fprintf(stdout,"  ** MISSING DATA ss\n");
469
2473
     sol->np = 0;
470
2474
     return(1);
471
2475
   }
472
 
@@ -680,7 +1070,7 @@
 
2476
-
 
2477
+  
 
2478
   sol->offset = (btyp==1) ? 1 : 6;
 
2479
 
 
2480
   if ( abs(MMG_imprim) > 5 )
473
2481
     fprintf(stdout,"  -- READING DATA FILE %s\n",data);
474
2482
 
475
2483
   if ( !sol->np ) {
478
2486
     return(0);
479
2487
   }
480
2488
   sol->npfixe = sol->np;
481
 
@@ -731,7 +1121,7 @@
 
2489
@@ -742,31 +1176,31 @@
 
2490
   /* read mesh solutions */
 
2491
   sol->npfixe = sol->np;
 
2492
   rewind(inm);
 
2493
-  fseek(inm,posnp,SEEK_SET);
 
2494
+  fseek(inm,posnp,SEEK_SET);  
 
2495
   for (k=1; k<=sol->np; k++) {
 
2496
     isol = (k-1) * sol->offset + 1;
 
2497
-    if (sol->ver == 1) {
 
2498
+    if (sol->ver == 1) { 
 
2499
       for (i=0; i<sol->offset; i++) {
 
2500
-       if(!bin){
 
2501
-         fscanf(inm,"%f",&fsol);
 
2502
-         sol->met[isol + i] = (double) fsol;
 
2503
-       } else {
 
2504
-         fread(&fsol,sw,1,inm);
 
2505
-         if(iswp) fsol=MMG_swapf(fsol);
 
2506
-         sol->met[isol + i] = (double) fsol;
 
2507
-       }
 
2508
-      }
 
2509
+        if(!bin){
 
2510
+          fscanf(inm,"%f",&fsol);    
 
2511
+          sol->met[isol + i] = (double) fsol;
 
2512
+        } else {
 
2513
+          fread(&fsol,sw,1,inm);             
 
2514
+          if(iswp) fsol=MMG_swapf(fsol);
 
2515
+          sol->met[isol + i] = (double) fsol;
 
2516
+        }
 
2517
+      } 
 
2518
     } else {
 
2519
       for (i=0; i<sol->offset; i++) {
 
2520
-       if(!bin){
 
2521
-         fscanf(inm,"%lf",&sol->met[isol + i]);
 
2522
+        if(!bin){
 
2523
+          fscanf(inm,"%lf",&sol->met[isol + i]); 
 
2524
 
 
2525
-       } else {
 
2526
-         fread(&sol->met[isol + i],sd,1,inm);
 
2527
-         if(iswp) sol->met[isol + i]=MMG_swapd(sol->met[isol + i]);
 
2528
-       }
 
2529
-      }
 
2530
-    }
 
2531
+        } else {
 
2532
+          fread(&sol->met[isol + i],sd,1,inm);       
 
2533
+          if(iswp) sol->met[isol + i]=MMG_swapd(sol->met[isol + i]);
 
2534
+        } 
 
2535
+      } 
 
2536
+    }             
 
2537
     /* MMG_swap data */
 
2538
     if ( sol->offset == 6 ) {
 
2539
       tmp                = sol->met[isol + 2];
 
2540
@@ -778,13 +1212,13 @@
 
2541
   if ( abs(MMG_imprim) > 3 )
 
2542
     fprintf(stdout,"     NUMBER OF GIVEN DATA       %8d\n",sol->npfixe);
 
2543
 
 
2544
-  fclose(inm);
 
2545
-  return(1);
 
2546
+  fclose(inm);   
 
2547
+  return(1);  
482
2548
 }
483
2549
 
484
2550
 
485
2551
-int MMG_loadVect(pMesh mesh,char *filename,int npmax) {
 
2552
-  FILE       *inm;
486
2553
+int MMG_loadVect(pMesh mesh,char *filename,int npmax,void *dataff) {
487
 
   FILE       *inm;   
 
2554
+  FILE       *inm;   
488
2555
   pDispl       pd;
489
2556
   float       fsol;
490
 
@@ -739,7 +1129,10 @@
491
 
   int         k,i,type,bin,dim,btyp,bpos,iadr;
 
2557
   int         binch,bdim,iswp;
 
2558
@@ -792,10 +1226,13 @@
492
2559
   long        posnp;
493
2560
   char        *ptr,data[128],chaine[128];
494
 
-  
495
 
+
 
2561
 
 
2562
-  pd = mesh->disp;
496
2563
+  if(dataff) 
497
2564
+      return MMG_loadVectff( mesh, filename,npmax,(DataFF*) dataff);
498
 
+
499
 
   pd = mesh->disp;
500
 
   
501
 
   posnp = 0; 
502
 
@@ -843,7 +1236,7 @@
 
2565
 
 
2566
-  posnp = 0;
 
2567
-  bin   = 0;
 
2568
+  pd = mesh->disp;
 
2569
+  
 
2570
+  posnp = 0; 
 
2571
+  bin   = 0; 
 
2572
   iswp  = 0;
 
2573
 
 
2574
   strcpy(data,filename);
 
2575
@@ -815,76 +1252,76 @@
 
2576
   }
 
2577
   fprintf(stdout,"  %%%% %s OPENED\n",data);
 
2578
 
 
2579
-
 
2580
-  if(!bin) {
 
2581
+   
 
2582
+  if(!bin) {   
 
2583
     strcpy(chaine,"DDD");
 
2584
-    while(fscanf(inm,"%s",&chaine[0])!=EOF && strncmp(chaine,"End",strlen("End")) ) {
 
2585
+    while(fscanf(inm,"%s",&chaine[0])!=EOF && strncmp(chaine,"End",strlen("End")) ) { 
 
2586
       if(!strncmp(chaine,"Dimension",strlen("Dimension"))) {
 
2587
-       fscanf(inm,"%d",&dim);
 
2588
-       if(dim!=3) {
 
2589
-         fprintf(stdout,"BAD SOL DIMENSION : %d\n",dim);
 
2590
-         return(1);
 
2591
-       }
 
2592
-       continue;
 
2593
+          fscanf(inm,"%d",&dim);
 
2594
+          if(dim!=3) {
 
2595
+            fprintf(stdout,"BAD SOL DIMENSION : %d\n",dim); 
 
2596
+            return(1);
 
2597
+          }
 
2598
+          continue;
 
2599
       } else if(!strncmp(chaine,"SolAtVertices",strlen("SolAtVertices"))) {
 
2600
-       fscanf(inm,"%d",&pd->np);
 
2601
-       fscanf(inm,"%d",&type);
 
2602
-       if(type!=1) {
 
2603
-         fprintf(stdout,"SEVERAL SOLUTION => IGNORED : %d\n",type);
 
2604
-         return(1);
 
2605
-       }
 
2606
-       fscanf(inm,"%d",&btyp);
 
2607
-       posnp = ftell(inm);
 
2608
-       break;
 
2609
-      }
 
2610
-    }
 
2611
-  } else {
 
2612
-    fread(&pd->ver,sw,1,inm);
 
2613
-    iswp=0;
 
2614
-    if(pd->ver==16777216) iswp=1;
 
2615
+        fscanf(inm,"%d",&pd->np); 
 
2616
+        fscanf(inm,"%d",&type); 
 
2617
+        if(type!=1) {
 
2618
+          fprintf(stdout,"SEVERAL SOLUTION => IGNORED : %d\n",type);
 
2619
+          return(1);
 
2620
+        }
 
2621
+        fscanf(inm,"%d",&btyp);
 
2622
+        posnp = ftell(inm);
 
2623
+        break;
 
2624
+      } 
 
2625
+    }            
 
2626
+  } else {     
 
2627
+    fread(&pd->ver,sw,1,inm); 
 
2628
+    iswp=0;   
 
2629
+    if(pd->ver==16777216) iswp=1;    
 
2630
     else if(pd->ver!=1) {
 
2631
       fprintf(stdout,"BAD FILE ENCODING\n");
 
2632
-    }
 
2633
-    fread(&pd->ver,sw,1,inm);
 
2634
-    if(iswp) pd->ver = MMG_swapbin(pd->ver);
 
2635
+    } 
 
2636
+    fread(&pd->ver,sw,1,inm); 
 
2637
+    if(iswp) pd->ver = MMG_swapbin(pd->ver); 
 
2638
     while(fread(&binch,sw,1,inm)!=EOF && binch!=54 ) {
 
2639
-      if(iswp) binch=MMG_swapbin(binch);
 
2640
-      if(binch==54) break;
 
2641
+      if(iswp) binch=MMG_swapbin(binch);      
 
2642
+      if(binch==54) break;  
 
2643
       if(binch==3) {  //Dimension
 
2644
-       fread(&bdim,sw,1,inm);  //Pos=>20
 
2645
-       if(iswp) bdim=MMG_swapbin(bdim);
 
2646
-       fread(&bdim,sw,1,inm);
 
2647
-       if(iswp) bdim=MMG_swapbin(bdim);
 
2648
-       if(bdim!=3) {
 
2649
-         fprintf(stdout,"BAD SOL DIMENSION : %d\n",dim);
 
2650
-         exit(0);
 
2651
-         return(1);
 
2652
-       }
 
2653
-       continue;
 
2654
+        fread(&bdim,sw,1,inm);  //Pos=>20
 
2655
+        if(iswp) bdim=MMG_swapbin(bdim);      
 
2656
+        fread(&bdim,sw,1,inm);
 
2657
+        if(iswp) bdim=MMG_swapbin(bdim);      
 
2658
+        if(bdim!=3) {
 
2659
+          fprintf(stdout,"BAD SOL DIMENSION : %d\n",dim);
 
2660
+          exit(0);
 
2661
+          return(1);
 
2662
+        }
 
2663
+        continue;
 
2664
       } else if(binch==62) {  //SolAtVertices
 
2665
-       fread(&binch,sw,1,inm); //Pos
 
2666
-       if(iswp) binch=MMG_swapbin(binch);
 
2667
-       fread(&pd->np,sw,1,inm);
 
2668
-       if(iswp) pd->np=MMG_swapbin(pd->np);
 
2669
-       fread(&binch,sw,1,inm); //nb sol
 
2670
-       if(iswp) binch=MMG_swapbin(binch);
 
2671
-       if(binch!=1) {
 
2672
-         fprintf(stdout,"SEVERAL SOLUTION => IGNORED : %d\n",type);
 
2673
-         return(1);
 
2674
-       }
 
2675
-       fread(&btyp,sw,1,inm); //typsol
 
2676
-       if(iswp) btyp=MMG_swapbin(btyp);
 
2677
-       posnp = ftell(inm);
 
2678
-       break;
 
2679
+        fread(&binch,sw,1,inm); //Pos
 
2680
+        if(iswp) binch=MMG_swapbin(binch);      
 
2681
+        fread(&pd->np,sw,1,inm); 
 
2682
+        if(iswp) pd->np=MMG_swapbin(pd->np);      
 
2683
+        fread(&binch,sw,1,inm); //nb sol
 
2684
+        if(iswp) binch=MMG_swapbin(binch);      
 
2685
+        if(binch!=1) {
 
2686
+          fprintf(stdout,"SEVERAL SOLUTION => IGNORED : %d\n",type);
 
2687
+          return(1);
 
2688
+        }
 
2689
+        fread(&btyp,sw,1,inm); //typsol
 
2690
+        if(iswp) btyp=MMG_swapbin(btyp);      
 
2691
+        posnp = ftell(inm);
 
2692
+        break;
 
2693
       } else {
 
2694
-       fread(&bpos,sw,1,inm); //Pos
 
2695
-       if(iswp) bpos=MMG_swapbin(bpos);
 
2696
-       rewind(inm);
 
2697
-       fseek(inm,bpos,SEEK_SET);
 
2698
-      }
 
2699
-    }
 
2700
-
 
2701
-  }
 
2702
+        fread(&bpos,sw,1,inm); //Pos 
 
2703
+        if(iswp) bpos=MMG_swapbin(bpos);      
 
2704
+        rewind(inm);
 
2705
+        fseek(inm,bpos,SEEK_SET);        
 
2706
+      } 
 
2707
+    }            
 
2708
+    
 
2709
+  }       
 
2710
   if ( !pd->np ) {
 
2711
     fprintf(stdout,"  ** MISSING DATA\n");
 
2712
     return(0);
 
2713
@@ -895,7 +1332,7 @@
503
2714
   }
504
2715
 
505
2716
   if ( btyp != 2 ) {
508
2719
     return(0);
509
2720
   }
510
2721
 
511
 
@@ -887,7 +1280,7 @@
 
2722
@@ -907,47 +1344,50 @@
 
2723
   fseek(inm,posnp,SEEK_SET);
 
2724
   for (k=1; k<=pd->np; k++) {
 
2725
     iadr = (k - 1) * 3 + 1;
 
2726
-    if (pd->ver < 2) {
 
2727
+    if (pd->ver < 2) { 
 
2728
       for (i=0; i<3; i++) {
 
2729
-       if(!bin){
 
2730
-         fscanf(inm,"%f",&fsol);
 
2731
-         pd->mv[iadr + i] = (double) fsol;
 
2732
-       } else {
 
2733
-         fread(&fsol,sw,1,inm);
 
2734
-         if(iswp) fsol=MMG_swapf(fsol);
 
2735
-         pd->mv[iadr + i] = (double) fsol;
 
2736
-       }
 
2737
-      }
 
2738
+        if(!bin){
 
2739
+          fscanf(inm,"%f",&fsol); 
 
2740
+          pd->mv[iadr + i] = (double) fsol;
 
2741
+        } else {
 
2742
+          fread(&fsol,sw,1,inm);             
 
2743
+          if(iswp) fsol=MMG_swapf(fsol);      
 
2744
+          pd->mv[iadr + i] = (double) fsol;
 
2745
+        }
 
2746
+      } 
 
2747
     } else {
 
2748
       for (i=0; i<3; i++) {
 
2749
-       if(!bin){
 
2750
-         fscanf(inm,"%lf",&pd->mv[iadr + i]);
 
2751
-       } else {
 
2752
-         fread(&pd->mv[iadr + i],sd,1,inm);
 
2753
-         if(iswp) pd->mv[iadr + i]=MMG_swapd(pd->mv[iadr + i]);
 
2754
-       }
 
2755
-      }
 
2756
-    }
 
2757
+        if(!bin){
 
2758
+          fscanf(inm,"%lf",&pd->mv[iadr + i]); 
 
2759
+        } else {
 
2760
+          fread(&pd->mv[iadr + i],sd,1,inm);
 
2761
+          if(iswp) pd->mv[iadr + i]=MMG_swapd(pd->mv[iadr + i]);      
 
2762
+        } 
 
2763
+      } 
 
2764
+    }             
 
2765
   }
 
2766
 
 
2767
   if ( abs(mesh->info.imprim) > 3 )
 
2768
     fprintf(stdout,"     NUMBER OF GIVEN DATA       %8d\n",pd->np);
 
2769
 
 
2770
-  fclose(inm);
 
2771
+  fclose(inm); 
 
2772
   return(1);
 
2773
 }
512
2774
 
513
2775
 
514
2776
 /* save mesh to disk */
515
 
-int MMG_saveMesh(pMesh mesh,char *filename) {  
 
2777
-int MMG_saveMesh(pMesh mesh,char *filename) {
 
2778
-  FILE*        inm;
 
2779
-  Hedge                          hed;
516
2780
+int MMG_saveMesh(pMesh mesh,char *filename,void *dataff) {  
517
 
   FILE*        inm; 
518
 
        Hedge                            hed;
 
2781
+  FILE*        inm; 
 
2782
+       Hedge                            hed;
519
2783
   pPoint       ppt;
520
 
@@ -896,6 +1289,9 @@
 
2784
   pTria        pt1;
 
2785
   pTetra       pt;
521
2786
   int          i,k,np,ne,nc,ned,*cor,*ed,ref,bin,bpos;
522
 
   char        *ptr,data[128],chaine[128]; 
 
2787
-  char        *ptr,data[128],chaine[128];
 
2788
+  char        *ptr,data[128],chaine[128]; 
523
2789
   int          binch,nu1,nu2;
524
2790
+  if(dataff) 
525
2791
+      return MMG_saveMeshff( mesh, filename,(DataFF*)  dataff);
527
2793
   mesh->ver = 2; //double precision
528
2794
   bin = 0;
529
2795
   strcpy(data,filename);
530
 
@@ -1145,7 +1541,7 @@
 
2796
@@ -959,28 +1399,28 @@
 
2797
       *ptr = '\0';
 
2798
       strcat(data,".mesh");
 
2799
       if( !(inm = fopen(data,"w")) ) {
 
2800
-       fprintf(stderr,"  ** UNABLE TO OPEN %s.\n",data);
 
2801
-       return(0);
 
2802
+        fprintf(stderr,"  ** UNABLE TO OPEN %s.\n",data);
 
2803
+        return(0);
 
2804
       }
 
2805
     } else {
 
2806
-      bin = 1;
 
2807
+      bin = 1;   
 
2808
     }
 
2809
   }
 
2810
-  else {
 
2811
+  else { 
 
2812
     ptr = strstr(data,".meshb");
 
2813
     if( ptr ) bin = 1;
 
2814
     if( !(inm = fopen(data,"w")) ) {
 
2815
       fprintf(stderr,"  ** UNABLE TO OPEN %s.\n",data);
 
2816
       return(0);
 
2817
-    }
 
2818
+    } 
 
2819
   }
 
2820
   fprintf(stdout,"  %%%% %s OPENED\n",data);
 
2821
 
 
2822
   /*entete fichier*/
 
2823
   if(!bin) {
 
2824
-    strcpy(&chaine[0],"MeshVersionFormatted 2\n");
 
2825
+    strcpy(&chaine[0],"MeshVersionFormatted 2\n"); 
 
2826
     fprintf(inm,"%s",chaine);
 
2827
-    strcpy(&chaine[0],"\n\nDimension 3\n");
 
2828
+    strcpy(&chaine[0],"\n\nDimension 3\n"); 
 
2829
     fprintf(inm,"%s ",chaine);
 
2830
   } else {
 
2831
     binch = 1; //MeshVersionFormatted
 
2832
@@ -993,33 +1433,38 @@
 
2833
     fwrite(&bpos,sw,1,inm);
 
2834
     binch = 3;
 
2835
     fwrite(&binch,sw,1,inm);
 
2836
-
 
2837
+    
 
2838
   }
 
2839
 
 
2840
   /* compact vertices */
 
2841
-  if(mesh->ncor) {
 
2842
+  if(mesh->ncor) {   
 
2843
     cor = (int*) M_calloc(mesh->ncor,sizeof(int),"MMG_savemesh");
 
2844
-    assert(cor);
 
2845
+    assert(cor);   
 
2846
   }
 
2847
-  if(mesh->ned) {
 
2848
-    if ( !MMG_zaldy4(&hed,mesh->ned) ) {
 
2849
-      if ( mesh->info.ddebug )  fprintf(stdout,"  ## MEMORY ALLOCATION PROBLEM : EXPORT EDGES IGNORED\n");
 
2850
-      mesh->ned = 0;
 
2851
-    }
 
2852
+  if(mesh->ned) {   
 
2853
+         if ( !MMG_zaldy4(&hed,mesh->ned) ) {
 
2854
+      if ( mesh->info.ddebug )  fprintf(stdout,"  ## MEMORY ALLOCATION PROBLEM : EXPORT EDGES IGNORED\n"); 
 
2855
+                       mesh->ned = 0;
 
2856
+    }   
 
2857
     ed = (int*)M_calloc(2*mesh->ned,sizeof(int),"MMG_savemesh");
 
2858
-    assert(ed);
 
2859
+    assert(ed);   
 
2860
   }
 
2861
-  np = 0;
 
2862
+  np = 0; 
 
2863
   nc = 0;
 
2864
   for (k=1; k<=mesh->np; k++) {
 
2865
     ppt = &mesh->point[k];
 
2866
-    if ( ppt->tag & M_UNUSED )  continue;
 
2867
-    ppt->tmp = ++np;
 
2868
+    if ( ppt->tag & M_UNUSED )  continue;  
 
2869
+               ppt->tmp = ++np;  
 
2870
     if ( ppt->geom & M_CORNER )  cor[nc++] = ppt->tmp;
 
2871
+  } 
 
2872
+  //assert(mesh->ncor==nc);
 
2873
+  if(mesh->ncor!=nc) {
 
2874
+    fprintf(stdout,"WARNING: some corners have been added or deleted\n");
 
2875
+    mesh->ncor = nc;
 
2876
   }
 
2877
-  assert(mesh->ncor==nc);
 
2878
+
 
2879
   if(!bin) {
 
2880
-    strcpy(&chaine[0],"\n\nVertices\n");
 
2881
+    strcpy(&chaine[0],"\n\nVertices\n"); 
 
2882
     fprintf(inm,"%s",chaine);
 
2883
     fprintf(inm,"%d\n",np);
 
2884
   } else {
 
2885
@@ -1027,27 +1472,27 @@
 
2886
     fwrite(&binch,sw,1,inm);
 
2887
     bpos += 12+(1+3*mesh->ver)*4*np; //NullPos
 
2888
     fwrite(&bpos,sw,1,inm);
 
2889
-    fwrite(&np,sw,1,inm);
 
2890
+    fwrite(&np,sw,1,inm);    
 
2891
   }
 
2892
   for(k=1; k<=mesh->np; k++) {
 
2893
     ppt = &mesh->point[k];
 
2894
-    if ( ppt->tag & M_UNUSED )  continue;
 
2895
-    //if(ppt->tmp==52453) printf("point %d --> %d\n",ppt->tmp,k);
 
2896
+    if ( ppt->tag & M_UNUSED )  continue;  
 
2897
+               //if(ppt->tmp==52453) printf("point %d --> %d\n",ppt->tmp,k);
 
2898
     if(!bin) {
 
2899
       fprintf(inm,"%.15lg %.15lg %.15lg %d\n",ppt->c[0],ppt->c[1],ppt->c[2],ppt->ref);
 
2900
     } else {
 
2901
-      fwrite((unsigned char*)&ppt->c[0],sd,1,inm);
 
2902
-      fwrite((unsigned char*)&ppt->c[1],sd,1,inm);
 
2903
-      fwrite((unsigned char*)&ppt->c[2],sd,1,inm);
 
2904
-      fwrite((unsigned char*)&ppt->ref,sw,1,inm);
 
2905
+      fwrite((unsigned char*)&ppt->c[0],sd,1,inm);    
 
2906
+      fwrite((unsigned char*)&ppt->c[1],sd,1,inm);    
 
2907
+      fwrite((unsigned char*)&ppt->c[2],sd,1,inm);    
 
2908
+      fwrite((unsigned char*)&ppt->ref,sw,1,inm);    
 
2909
     }
 
2910
   }
 
2911
 
 
2912
-  /* rebuild triangles tabular and write triangles */
 
2913
+  /* rebuild triangles tabular and write triangles */ 
 
2914
   mesh->nt = 0;
 
2915
   if(MMG_markBdry(mesh)) {
 
2916
     if(!bin) {
 
2917
-      strcpy(&chaine[0],"\n\nTriangles\n");
 
2918
+      strcpy(&chaine[0],"\n\nTriangles\n"); 
 
2919
       fprintf(inm,"%s",chaine);
 
2920
       fprintf(inm,"%d \n",mesh->nt);
 
2921
     } else {
 
2922
@@ -1055,49 +1500,48 @@
 
2923
       fwrite(&binch,sw,1,inm);
 
2924
       bpos += 12+16*mesh->nt; //Pos
 
2925
       fwrite(&bpos,sw,1,inm);
 
2926
-      fwrite(&mesh->nt,sw,1,inm);
 
2927
+      fwrite(&mesh->nt,sw,1,inm);    
 
2928
     }
 
2929
     for (k=1; k<=mesh->nt; k++) {
 
2930
       pt1  = &mesh->tria[k];
 
2931
-      ref  = pt1->ref;
 
2932
+           ref  = pt1->ref;    
 
2933
       if(!bin) {
 
2934
-       //if(ref==0) printf("tr %d bad ref!!\n",k);
 
2935
-       fprintf(inm,"%d %d %d %d\n",mesh->point[pt1->v[0]].tmp,mesh->point[pt1->v[1]].tmp
 
2936
-               ,mesh->point[pt1->v[2]].tmp,ref);
 
2937
+        fprintf(inm,"%d %d %d %d\n",mesh->point[pt1->v[0]].tmp,mesh->point[pt1->v[1]].tmp
 
2938
+                                                         ,mesh->point[pt1->v[2]].tmp,ref);
 
2939
       } else {
 
2940
-       fwrite(&mesh->point[pt1->v[0]].tmp,sw,1,inm);
 
2941
-       fwrite(&mesh->point[pt1->v[1]].tmp,sw,1,inm);
 
2942
-       fwrite(&mesh->point[pt1->v[2]].tmp,sw,1,inm);
 
2943
-       fwrite(&ref,sw,1,inm);
 
2944
+        fwrite(&mesh->point[pt1->v[0]].tmp,sw,1,inm);    
 
2945
+        fwrite(&mesh->point[pt1->v[1]].tmp,sw,1,inm);    
 
2946
+        fwrite(&mesh->point[pt1->v[2]].tmp,sw,1,inm);    
 
2947
+        fwrite(&ref,sw,1,inm);    
 
2948
       }
 
2949
     }
 
2950
-  }
 
2951
-
 
2952
+  }   
 
2953
 
2954
   /* write tetrahedra */
 
2955
-  ne = 0;
 
2956
-  ned = 0;
 
2957
-  //printf("avt %d\n",mesh->ned);
 
2958
+  ne = 0; 
 
2959
+       ned = 0;  
 
2960
+       //printf("avt %d\n",mesh->ned);
 
2961
   for (k=1; k<=mesh->ne; k++) {
 
2962
     pt = &mesh->tetra[k];
 
2963
-    if ( !pt->v[0] )  continue;
 
2964
-    if(mesh->ned) {
 
2965
-      for (i=0 ; i<6 ; i++) {
 
2966
-       if (pt->bdryinfo[i]) {
 
2967
-         nu1 = pt->v[MMG_iare[i][0]];
 
2968
-         nu2 = pt->v[MMG_iare[i][1]];
 
2969
-         if (MMG_edgePut(&hed,nu1,nu2,2)<=1) {
 
2970
-           ed[2*ned] = (mesh->point[nu1]).tmp;
 
2971
-           ed[2*ned + 1] = (mesh->point[nu2]).tmp;
 
2972
-           ned++;
 
2973
-         }
 
2974
-       }
 
2975
-      }
 
2976
-    }
 
2977
-    ne++;
 
2978
+    if ( !pt->v[0] )  continue;  
 
2979
+               if(mesh->ned) {
 
2980
+                 for (i=0 ; i<6 ; i++) {
 
2981
+                       if (pt->bdryinfo[i]) {
 
2982
+                               nu1 = pt->v[MMG_iare[i][0]];
 
2983
+                               nu2 = pt->v[MMG_iare[i][1]];
 
2984
+                               if (MMG_edgePut(&hed,nu1,nu2,2)<=1) {
 
2985
+                                       ed[2*ned] = (mesh->point[nu1]).tmp;
 
2986
+                                       ed[2*ned + 1] = (mesh->point[nu2]).tmp;
 
2987
+                                       ned++;
 
2988
+                               } 
 
2989
+                       }
 
2990
+                 } 
 
2991
+               }
 
2992
+         ne++;  
 
2993
   }
 
2994
-  //printf("ned %d\n",ned);
 
2995
+       //printf("ned %d\n",ned);
 
2996
   if(!bin) {
 
2997
-    strcpy(&chaine[0],"\n\nTetrahedra\n");
 
2998
+    strcpy(&chaine[0],"\n\nTetrahedra\n"); 
 
2999
     fprintf(inm,"%s",chaine);
 
3000
     fprintf(inm,"%d\n",ne);
 
3001
   } else {
 
3002
@@ -1105,29 +1549,29 @@
 
3003
     fwrite(&binch,sw,1,inm);
 
3004
     bpos += 12 + 20*ne;//Pos
 
3005
     fwrite(&bpos,sw,1,inm);
 
3006
-    fwrite((unsigned char*)&ne,sw,1,inm);
 
3007
-  }
 
3008
-  ne=0;
 
3009
+    fwrite((unsigned char*)&ne,sw,1,inm);    
 
3010
+  } 
 
3011
+       ne=0;
 
3012
   for (k=1; k<=mesh->ne; k++) {
 
3013
     pt = &mesh->tetra[k];
 
3014
-    if ( !pt->v[0] )  continue;
 
3015
-    ne++;
 
3016
-    ref = pt->ref;
 
3017
+    if ( !pt->v[0] )  continue;  
 
3018
+               ne++; 
 
3019
+    ref = pt->ref;    
 
3020
     if(!bin) {
 
3021
       fprintf(inm,"%d %d %d %d %d\n",mesh->point[pt->v[0]].tmp,mesh->point[pt->v[1]].tmp
 
3022
-             ,mesh->point[pt->v[2]].tmp,mesh->point[pt->v[3]].tmp,ref);
 
3023
+                                                          ,mesh->point[pt->v[2]].tmp,mesh->point[pt->v[3]].tmp,ref);
 
3024
     } else {
 
3025
-      fwrite(&mesh->point[pt->v[0]].tmp,sw,1,inm);
 
3026
-      fwrite(&mesh->point[pt->v[1]].tmp,sw,1,inm);
 
3027
-      fwrite(&mesh->point[pt->v[2]].tmp,sw,1,inm);
 
3028
-      fwrite(&mesh->point[pt->v[3]].tmp,sw,1,inm);
 
3029
-      fwrite(&ref,sw,1,inm);
 
3030
+      fwrite(&mesh->point[pt->v[0]].tmp,sw,1,inm);    
 
3031
+      fwrite(&mesh->point[pt->v[1]].tmp,sw,1,inm);    
 
3032
+      fwrite(&mesh->point[pt->v[2]].tmp,sw,1,inm);    
 
3033
+      fwrite(&mesh->point[pt->v[3]].tmp,sw,1,inm);    
 
3034
+      fwrite(&ref,sw,1,inm);    
 
3035
     }
 
3036
-  }
 
3037
-
 
3038
+  }  
 
3039
+     
 
3040
   if(mesh->ned) {
 
3041
     if(!bin) {
 
3042
-      strcpy(&chaine[0],"\n\nEdges\n");
 
3043
+      strcpy(&chaine[0],"\n\nEdges\n"); 
 
3044
       fprintf(inm,"%s",chaine);
 
3045
       fprintf(inm,"%d\n",ned);
 
3046
     } else {
 
3047
@@ -1135,50 +1579,50 @@
 
3048
       fwrite(&binch,sw,1,inm);
 
3049
       bpos += 12 + 3*4*ned;//Pos
 
3050
       fwrite(&bpos,sw,1,inm);
 
3051
-      fwrite((unsigned char*)&ned,sw,1,inm);
 
3052
-    }
 
3053
-    for (k=0; k<ned; k++) {
 
3054
-      ref = 0;
 
3055
-      if(!bin) {
 
3056
-       fprintf(inm,"%d %d %d \n",ed[2*k],ed[2*k+1],ref);
 
3057
-      } else {
 
3058
-       fwrite(&ed[2*k],sw,1,inm);
 
3059
-       fwrite(&ed[2*k+1],sw,1,inm);
 
3060
-       fwrite(&ref,sw,1,inm);
 
3061
-      }
 
3062
-    }
 
3063
-    M_free(hed.item);
 
3064
-    M_free(ed);
 
3065
+      fwrite((unsigned char*)&ned,sw,1,inm);    
 
3066
+    } 
 
3067
+         for (k=0; k<ned; k++) {
 
3068
+           ref = 0;    
 
3069
+           if(!bin) {
 
3070
+             fprintf(inm,"%d %d %d \n",ed[2*k],ed[2*k+1],ref);
 
3071
+           } else {
 
3072
+             fwrite(&ed[2*k],sw,1,inm);    
 
3073
+             fwrite(&ed[2*k+1],sw,1,inm);    
 
3074
+             fwrite(&ref,sw,1,inm);    
 
3075
+           }
 
3076
+         }
 
3077
+         M_free(hed.item);
 
3078
+                       M_free(ed);
 
3079
   }
 
3080
-
 
3081
+  
 
3082
   /* write corners */
 
3083
   if(!bin) {
 
3084
-    strcpy(&chaine[0],"\n\nCorners\n");
 
3085
+    strcpy(&chaine[0],"\n\nCorners\n"); 
 
3086
     fprintf(inm,"%s",chaine);
 
3087
     fprintf(inm,"%d\n",mesh->ncor);
 
3088
   } else {
 
3089
     binch = 13; //Corners
 
3090
     fwrite(&binch,sw,1,inm);
 
3091
-    bpos += 12 + 4*mesh->ncor;//Pos
 
3092
+    bpos += 12 + 4*mesh->ncor;//Pos  
 
3093
     fwrite(&bpos,sw,1,inm);
 
3094
-    fwrite((unsigned char*)&mesh->ncor,sw,1,inm);
 
3095
+    fwrite((unsigned char*)&mesh->ncor,sw,1,inm);    
 
3096
   }
 
3097
   for (k=0; k<mesh->ncor; k++) {
 
3098
     if(!bin) {
 
3099
       fprintf(inm,"%d \n",cor[k]);
 
3100
     } else {
 
3101
-      fwrite(&cor[k],sw,1,inm);
 
3102
+      fwrite(&cor[k],sw,1,inm);    
 
3103
     }
 
3104
-  }
 
3105
+  }  
 
3106
   /*fin fichier*/
 
3107
   if(!bin) {
 
3108
-    strcpy(&chaine[0],"\n\nEnd\n");
 
3109
+    strcpy(&chaine[0],"\n\nEnd\n"); 
 
3110
     fprintf(inm,"%s",chaine);
 
3111
   } else {
 
3112
     binch = 54; //End
 
3113
     fwrite(&binch,sw,1,inm);
 
3114
   }
 
3115
-  fclose(inm);
 
3116
+  fclose(inm); 
 
3117
   if(mesh->ncor) M_free(cor);
 
3118
   if ( mesh->info.imprim ) {
 
3119
     fprintf(stdout,"     NUMBER OF GIVEN VERTICES   %8d\n",mesh->npfixe);
 
3120
@@ -1193,20 +1637,22 @@
 
3121
     if ( mesh->ned )
 
3122
       fprintf(stdout,"     TOTAL NUMBER OF EDGES      %8d\n",ned);
 
3123
   }
 
3124
-  //if(ned!=mesh->ned) exit(0);
 
3125
+       //if(ned!=mesh->ned) exit(0);
 
3126
   return(1);
 
3127
 
531
3128
 }
532
3129
 
533
3130
 
536
3133
   FILE*        inm;
537
3134
   pPoint       ppt;
538
3135
   float        fsol;
539
 
@@ -1153,6 +1549,8 @@
 
3136
   double       tmp;
540
3137
   int          i,k,nbl,isol,bin,bpos,typ;
541
 
   char        *ptr,data[128],chaine[128]; 
 
3138
-  char        *ptr,data[128],chaine[128];
 
3139
+  char        *ptr,data[128],chaine[128]; 
542
3140
   int          binch;
543
3141
+  if(dataff) 
544
3142
+      return MMG_saveSolff( mesh, sol, filename,(DataFF*) dataff);
545
3143
 
546
3144
   if ( !sol->np )  return(1);
547
3145
   bin = 1;
548
 
@@ -1224,7 +1622,7 @@
549
 
          typ = 3;
 
3146
@@ -1219,24 +1665,24 @@
 
3147
       *ptr = '\0';
 
3148
       bin  = 0;
 
3149
     } else {
 
3150
-      ptr = strstr(data,".solb");
 
3151
-      if ( ptr ) {
 
3152
-       *ptr = '\0';
 
3153
-       bin  = 1;
 
3154
+           ptr = strstr(data,".solb");
 
3155
+           if ( ptr ) {
 
3156
+             *ptr = '\0';
 
3157
+             bin  = 1; 
 
3158
       } else {
 
3159
-       ptr = strstr(data,".sol");
 
3160
-       if ( ptr ) {
 
3161
-         *ptr = '\0';
 
3162
-         bin  = 0;
 
3163
-       }
 
3164
-      }
 
3165
-    }
 
3166
+                         ptr = strstr(data,".sol");
 
3167
+                         if ( ptr ) {
 
3168
+                           *ptr = '\0';
 
3169
+                           bin  = 0;   
 
3170
+                         }
 
3171
+                       }
 
3172
+    } 
 
3173
   }
 
3174
-  if ( bin )
 
3175
+  if ( bin ) 
 
3176
     strcat(data,".solb");
 
3177
   else
 
3178
     strcat(data,".sol");
 
3179
-
 
3180
+  
 
3181
   sol->ver = 2;
 
3182
   if( bin && !(inm = fopen(data,"wb")) ) {
 
3183
     fprintf(stderr,"  ** UNABLE TO OPEN %s.\n",data);
 
3184
@@ -1251,9 +1697,9 @@
 
3185
 
 
3186
   /*entete fichier*/
 
3187
   if(!bin) {
 
3188
-    strcpy(&chaine[0],"MeshVersionFormatted 2\n");
 
3189
+    strcpy(&chaine[0],"MeshVersionFormatted 2\n"); 
 
3190
     fprintf(inm,"%s",chaine);
 
3191
-    strcpy(&chaine[0],"\n\nDimension 3\n");
 
3192
+    strcpy(&chaine[0],"\n\nDimension 3\n"); 
 
3193
     fprintf(inm,"%s ",chaine);
 
3194
   } else {
 
3195
     binch = 1; //MeshVersionFormatted
 
3196
@@ -1266,19 +1712,19 @@
 
3197
     fwrite(&bpos,sw,1,inm);
 
3198
     binch = 3;
 
3199
     fwrite(&binch,sw,1,inm);
 
3200
-
 
3201
+    
 
3202
   }
 
3203
 
 
3204
 
 
3205
   switch(sol->offset) {
 
3206
   case 1:
 
3207
-    typ = 1;
 
3208
-    break;
 
3209
+        typ = 1;
 
3210
+   break;
 
3211
   case 6:
 
3212
-    typ = 3;
 
3213
+         typ = 3;
550
3214
     break;
551
3215
   default:
552
3216
-    fprintf(stdout,"  ** DATA IGNORED\n");
554
3218
     return(0);
555
3219
   }
556
3220
 
557
 
@@ -1301,7 +1699,7 @@
 
3221
@@ -1287,11 +1733,11 @@
 
3222
   for (k=1; k<=mesh->np; k++) {
 
3223
     ppt = &mesh->point[k];
 
3224
     if ( ppt->tag & M_UNUSED )  continue;
 
3225
-    nbl++;
 
3226
+       nbl++;
 
3227
   }
 
3228
-
 
3229
+  
 
3230
   if(!bin) {
 
3231
-    strcpy(&chaine[0],"\n\nSolAtVertices\n");
 
3232
+    strcpy(&chaine[0],"\n\nSolAtVertices\n"); 
 
3233
     fprintf(inm,"%s",chaine);
 
3234
     fprintf(inm,"%d\n",nbl);
 
3235
     fprintf(inm,"%d %d\n",1,typ);
 
3236
@@ -1300,7 +1746,7 @@
 
3237
     fwrite(&binch,sw,1,inm);
 
3238
     bpos += 20+(sol->offset*sol->ver)*4*nbl; //Pos
 
3239
     fwrite(&bpos,sw,1,inm);
 
3240
-    fwrite(&nbl,sw,1,inm);
 
3241
+    fwrite(&nbl,sw,1,inm);    
 
3242
     binch = 1; //nb sol
 
3243
     fwrite(&binch,sw,1,inm);
 
3244
     binch = typ; //typ sol
 
3245
@@ -1317,34 +1763,34 @@
 
3246
       sol->met[isol + 3] = tmp;
 
3247
     }
 
3248
     if (sol->ver < 2) {
 
3249
-      if(!bin) {
 
3250
-       for (i=0; i<sol->offset; i++) {
 
3251
-         fsol = (float) sol->met[isol + i];
 
3252
-         fprintf(inm,"%f ",fsol);
 
3253
-       }
 
3254
-       fprintf(inm,"\n");
 
3255
+      if(!bin) { 
 
3256
+        for (i=0; i<sol->offset; i++) {
 
3257
+          fsol = (float) sol->met[isol + i];
 
3258
+          fprintf(inm,"%f ",fsol);
 
3259
+        } 
 
3260
+        fprintf(inm,"\n");  
 
3261
       } else {
 
3262
-       for (i=0; i<sol->offset; i++) {
 
3263
-         fsol = (float) sol->met[isol + i];
 
3264
-         fwrite(&fsol,sw,1,inm);
 
3265
-       }
 
3266
+        for (i=0; i<sol->offset; i++) { 
 
3267
+          fsol = (float) sol->met[isol + i];
 
3268
+          fwrite(&fsol,sw,1,inm);
 
3269
+        }    
 
3270
       }
 
3271
     } else {
 
3272
-      if(!bin) {
 
3273
-       for (i=0; i<sol->offset; i++)
 
3274
-         fprintf(inm,"%.15lg ",sol->met[isol + i]);
 
3275
-       fprintf(inm,"\n");
 
3276
+      if(!bin) { 
 
3277
+        for (i=0; i<sol->offset; i++)
 
3278
+          fprintf(inm,"%.15lg ",sol->met[isol + i]); 
 
3279
+        fprintf(inm,"\n");  
 
3280
       } else {
 
3281
-       for (i=0; i<sol->offset; i++)
 
3282
-         fwrite(&sol->met[isol + i],sd,1,inm);
 
3283
+        for (i=0; i<sol->offset; i++)
 
3284
+          fwrite(&sol->met[isol + i],sd,1,inm);    
 
3285
       }
 
3286
-
 
3287
+      
 
3288
     }
 
3289
   }
 
3290
-
 
3291
+  
 
3292
   /*fin fichier*/
 
3293
   if(!bin) {
 
3294
-    strcpy(&chaine[0],"\n\nEnd\n");
 
3295
+    strcpy(&chaine[0],"\n\nEnd\n"); 
 
3296
     fprintf(inm,"%s",chaine);
 
3297
   } else {
 
3298
     binch = 54; //End
 
3299
@@ -1355,14 +1801,16 @@
558
3300
 }
559
3301
 
560
3302
 /*save the node speed : coornew-coorold/dt*/
561
3303
-int MMG_saveVect(pMesh mesh,char *filename) {
 
3304
-  FILE*        inm;
562
3305
+int MMG_saveVect(pMesh mesh,char *filename,void *dataff) {
563
 
   FILE*        inm;  
 
3306
+  FILE*        inm;  
564
3307
   pDispl        pd;
565
3308
   pPoint       ppt;
566
 
@@ -1309,6 +1707,8 @@
 
3309
   double       dsol,dd;
567
3310
   int          i,k,nbl,bin,bpos,typ;
568
 
   char        *ptr,data[128],chaine[128]; 
 
3311
-  char        *ptr,data[128],chaine[128];
 
3312
+  char        *ptr,data[128],chaine[128]; 
569
3313
   unsigned char binch;
570
3314
+  if(dataff) 
571
3315
+      return MMG_saveVectff( mesh, filename,(DataFF*) dataff);
572
3316
 
573
3317
   pd      = mesh->disp;
574
3318
   pd->ver = 2;
575
 
diff -u mmg3d4/build/sources/libmmg3d.h mmg3d4-new/build/sources/libmmg3d.h
576
 
--- mmg3d4/build/sources/libmmg3d.h     2011-04-14 18:23:46.000000000 +0200
577
 
+++ mmg3d4-new/build/sources/libmmg3d.h 2011-06-22 11:54:38.000000000 +0200
578
 
@@ -111,12 +111,12 @@
579
 
 typedef MMG_Sol * MMG_pSol;
580
 
 
581
 
 /* inout */
582
 
-int  MMG_loadMesh(MMG_pMesh ,char *);
583
 
-int  MMG_loadSol(MMG_pSol ,char *,int );
584
 
-int  MMG_loadVect(MMG_pMesh ,char *,int );
585
 
-int  MMG_saveMesh(MMG_pMesh ,char *);
586
 
-int  MMG_saveSol(MMG_pMesh ,MMG_pSol ,char *);
587
 
-int  MMG_saveVect(MMG_pMesh ,char *);
588
 
+int  MMG_loadMesh(MMG_pMesh ,char *,void *);
589
 
+int  MMG_loadSol(MMG_pSol ,char *,int ,void *);
590
 
+int  MMG_loadVect(MMG_pMesh ,char *,int ,void *);
591
 
+int  MMG_saveMesh(MMG_pMesh ,char *,void *);
592
 
+int  MMG_saveSol(MMG_pMesh ,MMG_pSol ,char *,void *);
593
 
+int  MMG_saveVect(MMG_pMesh ,char *,void *);
594
 
 
595
 
 #ifdef  __cplusplus
596
 
 namespace mmg3d{
597
 
diff -u mmg3d4/build/sources/mesh.h mmg3d4-new/build/sources/mesh.h
598
 
--- mmg3d4/build/sources/mesh.h 2011-04-14 18:05:40.000000000 +0200
599
 
+++ mmg3d4-new/build/sources/mesh.h     2011-07-11 10:29:12.000000000 +0200
600
 
@@ -394,17 +394,17 @@
601
 
 
602
 
 /* function pointers */
603
 
 typedef int (*MMG_Swap)(pMesh ,pSol ,pList );
604
 
-MMG_Swap MMG_swpptr;
605
 
-double (*MMG_length)(double *,double *,double *,double *);
606
 
-double (*MMG_caltet)(pMesh ,pSol ,int );
607
 
-double (*MMG_calte1)(pMesh ,pSol ,int );
608
 
-int    (*MMG_caltet2)(pMesh ,pSol ,int ,int ,double ,double *);
609
 
-int    (*MMG_cavity)(pMesh ,pSol ,int ,int ,pList ,int );
610
 
-int    (*MMG_buckin)(pMesh ,pSol ,pBucket ,int );
611
 
-int    (*MMG_optlen)(pMesh ,pSol ,double ,int );
612
 
-int    (*MMG_interp)(double *,double *,double *,double );
613
 
-int    (*MMG_optlentet)(pMesh ,pSol ,pQueue ,double ,int ,int );
614
 
-int    (*MMG_movevertex)(pMesh ,pSol ,int ,int );
615
 
+extern MMG_Swap MMG_swpptr;
616
 
+extern double (*MMG_length)(double *,double *,double *,double *);
617
 
+extern double (*MMG_caltet)(pMesh ,pSol ,int );
618
 
+extern double (*MMG_calte1)(pMesh ,pSol ,int );
619
 
+extern int    (*MMG_caltet2)(pMesh ,pSol ,int ,int ,double ,double *);
620
 
+extern int    (*MMG_cavity)(pMesh ,pSol ,int ,int ,pList ,int );
621
 
+extern int    (*MMG_buckin)(pMesh ,pSol ,pBucket ,int );
622
 
+extern int    (*MMG_optlen)(pMesh ,pSol ,double ,int );
623
 
+extern int    (*MMG_interp)(double *,double *,double *,double );
624
 
+extern int    (*MMG_optlentet)(pMesh ,pSol ,pQueue ,double ,int ,int );
625
 
+extern int    (*MMG_movevertex)(pMesh ,pSol ,int ,int );
626
 
 
627
 
 
628
 
 #endif
629
 
diff -u mmg3d4/build/sources/mmg3d4.c mmg3d4-new/build/sources/mmg3d4.c
630
 
--- mmg3d4/build/sources/mmg3d4.c       2011-04-14 18:05:12.000000000 +0200
631
 
+++ mmg3d4-new/build/sources/mmg3d4.c   2011-07-07 11:23:09.000000000 +0200
632
 
@@ -84,9 +84,9 @@
633
 
     if(it && !(it%2) ) {
634
 
       bucket = MMG_newBucket(mesh,M_MAX(mesh->info.bucksiz,BUCKSIZ));
635
 
       if ( !bucket )  return(0);
636
 
-                       MMG_saveMesh(mesh,"avtana.mesh");
637
 
+                       MMG_saveMesh(mesh,"avtana.mesh",0);
638
 
       MMG_analar(mesh,sol,bucket,&na,&nd,&nf,alert);      
639
 
-                       MMG_saveMesh(mesh,"apresana.mesh");
640
 
+                       MMG_saveMesh(mesh,"apresana.mesh",0);
641
 
       if ( abs(mesh->info.imprim) > 5 ) 
642
 
         fprintf(stdout,"     %7d INSERTED  %7d REMOVED   %7d FILTERED\n",na,nd,nf);  
643
 
 
644
 
@@ -118,8 +118,8 @@
645
 
       if ( *alert ) {
646
 
         fprintf(stdout," \n\n ** UNABLE TO CUT (analarcutting)\n");
647
 
         fprintf(stdout," ** RETRY WITH -m > %6d \n\n",mesh->info.memory);
648
 
-        MMG_saveMesh(mesh,"crash.mesh");
649
 
-        MMG_saveSol(mesh,sol,"crash.sol"); 
650
 
+        MMG_saveMesh(mesh,"crash.mesh",0);
651
 
+        MMG_saveSol(mesh,sol,"crash.sol",0); 
652
 
         exit(0);
653
 
       }
654
 
       M_free(hash.item);      
655
 
@@ -136,7 +136,7 @@
656
 
     }
657
 
     // printf("chkmsh\n");   
658
 
                MMG_unscaleMesh(mesh,sol);
659
 
-    MMG_saveMesh(mesh,"chk.mesh");
660
 
+    MMG_saveMesh(mesh,"chk.mesh",0);
661
 
     //MMG_chkmsh(mesh,1,-1);
662
 
                //if(it==1)exit(0);             
663
 
      /* delaunization */ 
664
 
diff -u mmg3d4/build/sources/mmg3dConfig.h mmg3d4-new/build/sources/mmg3dConfig.h
665
 
--- mmg3d4/build/sources/mmg3dConfig.h  2011-06-30 14:09:37.000000000 +0200
666
 
+++ mmg3d4-new/build/sources/mmg3dConfig.h      2011-06-16 09:50:58.000000000 +0200
667
 
@@ -2,4 +2,4 @@
668
 
 #define Tutorial_VERSION_MAJOR 
669
 
 #define Tutorial_VERSION_MINOR 
670
 
 
671
 
-#define USE_SCOTCH
672
 
+/* #undef USE_SCOTCH */
673
 
diff -u mmg3d4/build/sources/mmg3dlib/mmg3dlib.c mmg3d4-new/build/sources/mmg3dlib/mmg3dlib.c
674
 
--- mmg3d4/build/sources/mmg3dlib/mmg3dlib.c    2011-04-15 15:32:59.000000000 +0200
675
 
+++ mmg3d4-new/build/sources/mmg3dlib/mmg3dlib.c        2011-07-07 11:23:59.000000000 +0200
676
 
@@ -332,7 +332,7 @@
677
 
   if ( !MMG_hashTetra(mesh) )    return(1);
678
 
   if ( !MMG_markBdry(mesh) )     return(1);
679
 
   if (abs(mesh->info.option)==10) {
680
 
-    MMG_saveMesh(mesh,"tetra.mesh");
681
 
+    MMG_saveMesh(mesh,"tetra.mesh",0);
682
 
     return(0);
683
 
   }           
684
 
   if ( !sol->np) {
685
 
@@ -378,7 +378,7 @@
686
 
     if ( abs(info->option) == 9 ) {  
687
 
       if(!MMG_mmg3d9(mesh,sol,&alert)) {
688
 
         if ( !MMG_unscaleMesh(mesh,sol) )  return(1);
689
 
-        MMG_saveMesh(mesh,"errormoving.mesh");
690
 
+        MMG_saveMesh(mesh,"errormoving.mesh",0);
691
 
              //MMG_saveSol(mesh,sol,mesh->outf);
692
 
              return(1);
693
 
       }
694
 
diff -u mmg3d4/build/sources/sproto.h mmg3d4-new/build/sources/sproto.h
695
 
--- mmg3d4/build/sources/sproto.h       2011-04-14 18:08:32.000000000 +0200
696
 
+++ mmg3d4-new/build/sources/sproto.h   2011-06-22 18:36:45.000000000 +0200
697
 
@@ -67,13 +67,13 @@
698
 
 int  MMG_inEdge(pHedge ,int *,int *,int *);
699
 
 int  MMG_markBdry(pMesh );
700
 
 
701
 
-/* inout */
702
 
-int  MMG_loadMesh(pMesh ,char *);
703
 
-int  MMG_loadSol(pSol ,char *,int );
704
 
-int  MMG_loadVect(pMesh ,char *,int );
705
 
-int  MMG_saveMesh(pMesh ,char *);
706
 
-int  MMG_saveSol(pMesh ,pSol ,char *);
707
 
-int  MMG_saveVect(pMesh ,char *);
708
 
+/* inout add param  F.H. june 2011 (dataff) */
709
 
+int  MMG_loadMesh(pMesh ,char *,void *);
710
 
+int  MMG_loadSol(pSol ,char *,int ,void *);
711
 
+int  MMG_loadVect(pMesh ,char *,int ,void *);
712
 
+int  MMG_saveMesh(pMesh ,char *,void *);
713
 
+int  MMG_saveSol(pMesh ,pSol ,char *,void *);
714
 
+int  MMG_saveVect(pMesh ,char *,void *);
715
 
 
716
 
 int  MMG_loctet(pMesh ,int ,int ,double *,double *);
717
 
 int  MMG_computeMetric(pMesh ,pSol ,int ,double * );
718
 
diff -u mmg3d4/build/sources/swapar.c mmg3d4-new/build/sources/swapar.c
719
 
--- mmg3d4/build/sources/swapar.c       2011-04-14 18:08:49.000000000 +0200
720
 
+++ mmg3d4-new/build/sources/swapar.c   2011-07-07 11:24:44.000000000 +0200
721
 
@@ -77,7 +77,7 @@
722
 
   }
723
 
 
724
 
   if ( ncas && MMG_swpptr ) {
725
 
-               if(ddebug) MMG_saveMesh(mesh,"avt.mesh");
726
 
+               if(ddebug) MMG_saveMesh(mesh,"avt.mesh",0);
727
 
     for (l=1; l<=lon; l++) {
728
 
       jel = list->tetra[l]/6;
729
 
       pt  = &mesh->tetra[jel]; 
730
 
@@ -97,7 +97,7 @@
731
 
       if ( pt->qual >= declic )  MMG_kiuput(q,jel);
732
 
       for (i=0; i<4; i++)  mesh->point[pt->v[i]].flag = mesh->flag; 
733
 
     }
734
 
-               if(ddebug) MMG_saveMesh(mesh,"sw.mesh");
735
 
+               if(ddebug) MMG_saveMesh(mesh,"sw.mesh",0);
736
 
     return(1);
737
 
   }
738
 
 
739
 
--- mmg3d4/build/sources/dataff.h       2011-09-01 22:11:53.000000000 +0200
740
 
+++ new-mmg3d4/build/sources/dataff.h   2011-09-01 12:39:39.000000000 +0200
741
 
@@ -0,0 +1,60 @@
742
 
+/*
743
 
+ *  dataff.h
744
 
+ *  
745
 
+ *
746
 
+ *  Created by Fr\E9d\E9ric Hecht on 19/06/11.
747
 
+ *  Copyright 2011 UPMC. All rights reserved.
748
 
+ *
749
 
750
 
+ */
751
 
+
752
 
+enum ff_data_type {
753
 
+    ff_id_vertex =0,
754
 
+    ff_id_seg =1,
755
 
+    ff_id_tria=2,
756
 
+    ff_id_tet =3,
757
 
+
758
 
+    ff_id_prism =5,
759
 
+    ff_id_hex =6,
760
 
+    ff_id_quad =7,
761
 
+    ff_id_corner=8
762
 
+} ;
763
 
+
764
 
+
765
 
+typedef struct  DataFF 
766
 
+{
767
 
+  const char  * meshname;
768
 
+  const char  * movename;
769
 
+  const char  * solname;
770
 
+  int imprim;
771
 
+  int memory;
772
 
+  int   np; //  nb of vertices  in/out 
773
 
+  int   typesol; //  1 iso , 6 : m11; m12,m13,m22,m23,m33
774
 
+  void * mesh;
775
 
+  double * sol; /* metric :size typesol*np  */
776
 
+  double * mov; /* displac. size :3*np  */ 
777
 
+  void (*set_mesh)(void *dataff,int *data,int ldata);
778
 
+  void (*end_mesh)(void *dataff);
779
 
+  void (*set_v)(void *dataff,int i,double *xyz,int lab);
780
 
+  void (*set_elmt)(void *dataff,int ff_id,int i,int *k,int lab);
781
 
+  void (*get_mesh)(void *dataff,int *data,int ldata);
782
 
+  void (*get_v3)(void *dataff,int i,double *xyz,int *lab);
783
 
+  void (*get_elmt)(void *dataff,int ff_id,int i,int *k,int *lab);
784
 
+} DataFF;
785
 
+
786
 
+#ifdef __cplusplus
787
 
+extern "C" {
788
 
+#endif  
789
 
+    int mainmmg3d(int argc,char *argv[],DataFF *dataff); 
790
 
+
791
 
+#ifdef __cplusplus
792
 
+}
793
 
+#endif 
794
 
+/*
795
 
+ m11 = met[0] 
796
 
+ m12 = met[1] 
797
 
+ m13 = met[2] 
798
 
+ m22 = met[3]
799
 
+ m23 = met[4] 
800
 
+ m33 = met[5]  
801
 
+*/
802
 
--- mmg3d4/build/sources/quality.c      2011-04-14 18:08:09.000000000 +0200
803
 
+++ new-mmg3d4/build/sources/quality.c  2011-11-15 17:24:57.000000000 +0100
804
 
@@ -46,7 +46,7 @@
805
 
 #include "mesh.h"  
806
 
 
807
 
 
808
 
-double MMG_rao(pMesh mesh,int k,int inm);
809
 
+double MMG_rao(pMesh mesh,int k,FILE* inm) ;
810
 
 double MMG_caltetrao(pMesh mesh,pSol sol,int iel) {
811
 
        return(MMG_rao(mesh,iel,0));
812
 
 }
813
 
--- mmg3d4/build/sources/delaunay.c     2011-04-14 18:06:36.000000000 +0200
814
 
+++ new-mmg3d4/build/sources/delaunay.c 2011-11-15 17:31:31.000000000 +0100
815
 
@@ -728,7 +728,7 @@
816
 
   if ( ppt->tag & M_UNUSED )  return(0);
817
 
 
818
 
   tref = mesh->tetra[list->tetra[1]/6].ref;
819
 
-#warning remove this test
820
 
+  // #warning remove this test
821
 
   for (k=1; k<=lon; k++)
822
 
     if(tref!=mesh->tetra[list->tetra[k]/6].ref) 
823
 
        printf("pbs coquil %d %d tet %d\n",tref,mesh->tetra[list->tetra[k]/6].ref,list->tetra[k]/6);
824
 
--- mmg3d4/build/sources/analarcutting.c        2011-04-14 18:04:05.000000000 +0200
825
 
+++ new-mmg3d4/build/sources/analarcutting.c    2011-11-15 17:31:01.000000000 +0100
826
 
@@ -307,7 +307,7 @@
827
 
   printf("6 cut : %8d\n",n6);
828
 
   printf("---------------------------\n"); */  
829
 
        if ( !na )  return(na);
830
 
-#warning check memory allocation
831
 
+       // #warning check memory allocation
832
 
   
833
 
   //printf("%d cut init --- nb tet %d\n",na,mesh->ne);
834
 
   return(na);
835
 
--- mmg3d4/build/sources/pattern.c      2011-11-15 17:33:06.000000000 +0100
836
 
+++ new-mmg3d4/build/sources/pattern.c  2011-11-15 17:23:13.000000000 +0100
837
 
@@ -47,7 +47,7 @@
838
 
 
839
 
 
840
 
 unsigned char MMG_arfa[3][4] = { {2,0,1,3}, {1,2,0,3}, {0,1,2,3} }; 
841
 
-extern int MMG_permar[10][4];
842
 
+extern int MMG_permar[12][4];
843
 
 extern int MMG_pointar[64][2];
844
 
 extern int ddebug;
845
 
 //insert ip on ia-ib
846
 
--- mmg3d4/build/sources/optlen.c       2011-04-14 18:07:52.000000000 +0200
847
 
+++ new-mmg3d4/build/sources/optlen.c   2011-11-15 17:39:10.000000000 +0100
848
 
@@ -48,7 +48,7 @@
849
 
 #define  HQCOEF    0.9 
850
 
 #define  HCRIT     0.98
851
 
 
852
 
-double MMG_rao(pMesh mesh,int k,int inm);
853
 
+double MMG_rao(pMesh mesh,int k,FILE* );
854
 
 int MMG_optlen_ani(pMesh mesh,pSol sol,double declic,int base) {
855
 
   pTetra    pt,pt1;
856
 
   pPoint    ppa,ppb;
857
 
--- mmg3d4/build/sources/mmg3d4.c       2012-04-15 21:20:28.000000000 +0200
858
 
+++ mmg3d4-v0/build/sources/mmg3d4.c    2012-04-15 21:18:37.000000000 +0200
859
 
@@ -45,13 +45,13 @@
860
 
 ****************************************************************************/
861
 
 #include "mesh.h"
862
 
 
863
 
-int MMG_npuiss,MMG_nvol,MMG_npres;
864
 
-int MMG_nlen,MMG_ncal,MMG_ntopo,MMG_nex;
865
 
-int MMG_npuisstot,MMG_nvoltot,MMG_nprestot;
866
 
-int MMG_npdtot;
867
 
-int MMG_nplen,MMG_npref,MMG_bouffe;
868
 
+extern int MMG_npuiss,MMG_nvol,MMG_npres;
869
 
+extern int MMG_nlen,MMG_ncal,MMG_ntopo,MMG_nex;
870
 
+extern int MMG_npuisstot,MMG_nvoltot,MMG_nprestot;
871
 
+extern int MMG_npdtot;
872
 
+extern int MMG_nplen,MMG_npref,MMG_bouffe;
873
 
 
874
 
 int ddebug;
875
 
 
876
 
 int MMG_mmg3d4(pMesh mesh,pSol sol,int *alert) {
877
 
   Hedge    hash;
878
 
--- mmg3d4/build/sources/mmg3dmain/mmg3d.c      2011-12-02 15:08:08.000000000 +0100
879
 
+++ mmg3d4-new/build/sources/mmg3dmain/mmg3d.c  2012-04-20 16:47:08.000000000 +0200
880
 
@@ -46,7 +46,7 @@
881
 
 #include "compil.date"
882
 
 #include "mesh.h"
883
 
 #include "eigenv.h"
 
3319
@@ -1378,7 +1826,7 @@
 
3320
       bin  = 0;
 
3321
     }
 
3322
   }
 
3323
-  if ( bin )
 
3324
+  if ( bin ) 
 
3325
     strcat(data,".o.solb");
 
3326
   else
 
3327
     strcat(data,".o.sol");
 
3328
@@ -1395,9 +1843,9 @@
 
3329
 
 
3330
   /*entete fichier*/
 
3331
   if(!bin) {
 
3332
-    strcpy(&chaine[0],"MeshVersionFormatted 2\n");
 
3333
+    strcpy(&chaine[0],"MeshVersionFormatted 2\n"); 
 
3334
     fprintf(inm,"%s",chaine);
 
3335
-    strcpy(&chaine[0],"\n\nDimension 3\n");
 
3336
+    strcpy(&chaine[0],"\n\nDimension 3\n"); 
 
3337
     fprintf(inm,"%s ",chaine);
 
3338
   } else {
 
3339
     binch = 1; //MeshVersionFormatted
 
3340
@@ -1410,20 +1858,20 @@
 
3341
     fwrite(&bpos,sw,1,inm);
 
3342
     binch = 3;
 
3343
     fwrite(&binch,sw,1,inm);
884
3344
-
885
 
+#include "dataff.h"
886
 
 TIM_mytime         MMG_ctim[TIMEMAX];
887
 
 short               MMG_imprim;
888
 
 
889
 
@@ -395,6 +395,7 @@
890
 
            100.*ttot/ttim[0],call[0],ttot/(float)call[0]);
891
 
   }
892
 
   fprintf(stdout,"\n   ELAPSED TIME  %.2f SEC.  (%.2f)\n",ttim[0],ttot);
893
 
+  fflush(stdout);
894
 
 }
895
 
 
896
 
 
897
 
@@ -432,13 +433,14 @@
898
 
 }
899
 
 
900
 
 
901
 
-int main(int argc,char *argv[]) {
902
 
+int mainmmg3d(int argc,char *argv[],DataFF *dataff) {
903
3345
+    
904
 
   pMesh        mesh;
905
 
   pSol         sol;
906
 
   Info         *info;
907
 
   int          alert;
908
 
-int k,iadr,i,jj,kk,ii;
909
 
-double lambda[3],v[3][3],*mold,*m;
910
 
+  int k,iadr,i,jj,kk,ii;
911
 
+  double       lambda[3],v[3][3],*mold,*m;
912
 
 
913
 
   fprintf(stdout,"  -- MMG3d, Release %s (%s) \n",M_VER,M_REL);
914
 
   fprintf(stdout,"     Copyright (c) LJLL/IMB, 2010\n");
915
 
@@ -450,7 +452,7 @@
916
 
   signal(SIGSEGV,excfun);
917
 
   signal(SIGTERM,excfun);
918
 
   signal(SIGINT,excfun);
919
 
-  atexit(endcod);
920
 
+  if(dataff==0) atexit(endcod);
921
 
 
922
 
   TIM_tminit(MMG_ctim,TIMEMAX);
923
 
   TIM_chrono(ON,&MMG_ctim[0]);
924
 
@@ -477,15 +479,27 @@
925
 
   info->noinsert = 0; 
926
 
   info->dt       = 1.;
927
 
   info->bdry     = 0;
928
 
-
929
 
+  /* modif F. Hecht ..*/
930
 
+  if(dataff)
931
 
+    {
932
 
+      mesh->name=dataff->meshname;
933
 
+      mesh->move=dataff->movename;
934
 
+      sol->name=dataff->solname;
935
 
+      /*      printf(" #### %p %p %p --- \n",mesh->name,mesh->move,sol->name); */
936
 
+      info->imprim=dataff->imprim;
937
 
+      info->memory=dataff->memory;
938
 
+    }
939
 
+  /* end modf */ 
940
 
   if ( !parsar(argc,argv,mesh,sol) )  return(1);
941
 
   MMG_imprim = info->imprim;
942
 
   
943
 
   /* load data */
944
 
   if ( MMG_imprim )   fprintf(stdout,"\n  -- INPUT DATA\n");
945
 
-  TIM_chrono(ON,&MMG_ctim[1]);
946
 
-  if ( !MMG_loadMesh(mesh,mesh->name) )  return(1); 
947
 
-  if ( !MMG_loadSol(sol,sol->name,mesh->npmax) )  return(1);
948
 
+  TIM_chrono(ON,&MMG_ctim[1]); 
949
 
+  /* modif FH. for interface with ff++ add dataff param     */
950
 
+  if ( !MMG_loadMesh(mesh,mesh->name,dataff ))  return(1); 
951
 
+  if ( !MMG_loadSol(sol,sol->name,mesh->npmax,dataff ) )  return(1);
952
 
953
 
   if ( sol->np && sol->np != mesh->np ) {
954
 
     fprintf(stdout,"  ## WARNING: WRONG SOLUTION NUMBER. IGNORED\n");
955
 
     sol->np = 0;
956
 
@@ -493,7 +507,7 @@
957
 
 
958
 
   if ( !parsop(mesh) )  return(1);
959
 
 
960
 
-  if ( abs(info->option) == 9 && !MMG_loadVect(mesh,mesh->move,mesh->np) )  return(0);
961
 
+  if ( abs(info->option) == 9 && !MMG_loadVect(mesh,mesh->move,mesh->np,dataff) )  return(0);
962
 
 
963
 
   if ( !MMG_setfunc(sol->offset) ) return(1);
964
 
   if ( !MMG_scaleMesh(mesh,sol) )  return(1);
965
 
@@ -523,7 +537,7 @@
966
 
   if ( !MMG_hashTetra(mesh) )    return(1);
967
 
   if ( !MMG_markBdry(mesh) )     return(1);
968
 
   if (abs(mesh->info.option)==10) {
969
 
-    MMG_saveMesh(mesh,"tetra.mesh");
970
 
+    MMG_saveMesh(mesh,"tetra.mesh",dataff);
971
 
     return(0);
972
 
   }           
973
 
 
974
 
@@ -566,8 +580,8 @@
975
 
     if ( abs(info->option) == 9 ) {
976
 
       if(!MMG_mmg3d9(mesh,sol,&alert)) {
977
 
         if ( !MMG_unscaleMesh(mesh,sol) )  return(1);
978
 
-        MMG_saveMesh(mesh,mesh->outf);
979
 
-           MMG_saveSol(mesh,sol,mesh->outf);
980
 
+        MMG_saveMesh(mesh,mesh->outf,dataff);
981
 
+           MMG_saveSol(mesh,sol,mesh->outf,dataff);
982
 
            return(1);
 
3346
   }
 
3347
-  typ = 2;
 
3348
+       typ = 2;
 
3349
 
 
3350
   /* write data */
 
3351
   nbl = 0;
 
3352
   for (k=1; k<=mesh->np; k++) {
 
3353
     ppt = &mesh->point[k];
 
3354
     if ( ppt->tag & M_UNUSED )  continue;
 
3355
-    nbl++;
 
3356
+       nbl++;
 
3357
   }
 
3358
-
 
3359
+  
 
3360
   if(!bin) {
 
3361
-    strcpy(&chaine[0],"\n\nSolAtVertices\n");
 
3362
+    strcpy(&chaine[0],"\n\nSolAtVertices\n"); 
 
3363
     fprintf(inm,"%s",chaine);
 
3364
     fprintf(inm,"%d\n",nbl);
 
3365
     fprintf(inm,"%d %d\n",1,typ);
 
3366
@@ -1432,34 +1880,34 @@
 
3367
     fwrite(&binch,sw,1,inm);
 
3368
     bpos += 20+(3*pd->ver)*4*nbl; //Pos
 
3369
     fwrite(&bpos,sw,1,inm);
 
3370
-    fwrite(&nbl,sw,1,inm);
 
3371
+    fwrite(&nbl,sw,1,inm);    
 
3372
     binch = 1; //nb sol
 
3373
     fwrite(&binch,sw,1,inm);
 
3374
     binch = typ; //typ sol
 
3375
     fwrite(&binch,sw,1,inm);
 
3376
-  }
 
3377
-
 
3378
-
 
3379
-  dd = mesh->info.delta / (double)PRECI;
 
3380
+  } 
 
3381
+  
 
3382
+  
 
3383
+  dd = mesh->info.delta / (double)PRECI;  
 
3384
   fprintf(stdout,"        DT %e\n",mesh->info.dt);
 
3385
   for (k=1; k<=mesh->np; k++) {
 
3386
     ppt = &mesh->point[k];
 
3387
-    if ( ppt->tag & M_UNUSED )  continue;
 
3388
+    if ( ppt->tag & M_UNUSED )  continue; 
 
3389
     for (i=0 ; i<3 ; i++) {
 
3390
-      dsol = (ppt->c[i] - mesh->disp->cold[3*(k-1) + 1 + i]* dd - mesh->info.min[i])/mesh->info.dt;
 
3391
-      if(!bin) {
 
3392
-       fprintf(inm,"%.15lg ",dsol);
 
3393
+      dsol = (ppt->c[i] - mesh->disp->cold[3*(k-1) + 1 + i]* dd - mesh->info.min[i])/mesh->info.dt; 
 
3394
+      if(!bin) { 
 
3395
+        fprintf(inm,"%.15lg ",dsol); 
 
3396
       } else {
 
3397
-       fwrite(&dsol,sd,1,inm);
 
3398
+        fwrite(&dsol,sd,1,inm);    
983
3399
       }
984
 
       /*puts("appel 1");
985
 
@@ -669,18 +683,18 @@
986
 
     fprintf(stdout,"\n  ## WARNING: INCOMPLETE MESH  %d , %d\n",
987
 
             mesh->np,mesh->ne);
988
 
 
989
 
-  if ( MMG_imprim )  fprintf(stdout,"\n  -- WRITING DATA FILE %s\n",mesh->outf);
990
 
+  if ( MMG_imprim && !dataff)  fprintf(stdout,"\n  -- WRITING DATA FILE %s\n",mesh->outf);
991
 
   TIM_chrono(ON,&MMG_ctim[1]);
992
 
   if ( !MMG_unscaleMesh(mesh,sol) )  return(1);
993
 
-  MMG_saveMesh(mesh,mesh->outf);
994
 
+  MMG_saveMesh(mesh,mesh->outf,dataff);
995
 
   if ( info->option == 9 ) {
996
 
-    MMG_saveSol(mesh,sol,mesh->outf);
997
 
-    MMG_saveVect(mesh,mesh->move);    
998
 
+    MMG_saveSol(mesh,sol,mesh->outf,dataff);
999
 
+    MMG_saveVect(mesh,mesh->move,dataff);    
 
3400
     }
 
3401
-    if (!bin) fprintf(inm,"\n");
 
3402
+    if (!bin) fprintf(inm,"\n");  
1000
3403
   }
1001
 
   else
1002
 
-    MMG_saveSol(mesh,sol,mesh->outf);
1003
 
+    MMG_saveSol(mesh,sol,mesh->outf,dataff);   
1004
 
   TIM_chrono(OFF,&MMG_ctim[1]);
1005
 
-  if ( MMG_imprim )  fprintf(stdout,"  -- WRITING COMPLETED\n");
1006
 
+  if ( MMG_imprim && !dataff)  fprintf(stdout,"  -- WRITING COMPLETED\n");
1007
 
 
1008
 
   /* free mem */
1009
 
   M_free(mesh->point);
1010
 
@@ -697,5 +711,24 @@
1011
 
 
1012
 
   if ( MMG_imprim < -4 || info->ddebug )  M_memDump();
1013
 
   M_free(mesh);
1014
 
+  if(MMG_imprim && dataff ) endcod();
1015
 
   return(0);
1016
 
 }
1017
 
+
1018
 
+int main(int argc,char *argv[])  {
1019
 
+    return  mainmmg3d( argc,argv,0);
1020
 
+}
1021
 
+/*
1022
 
+ def 
1023
 
+ */
1024
 
+ MMG_Swap MMG_swpptr;
1025
 
+ double (*MMG_length)(double *,double *,double *,double *);
1026
 
+ double (*MMG_caltet)(pMesh ,pSol ,int );
1027
 
+ double (*MMG_calte1)(pMesh ,pSol ,int );
1028
 
+ int    (*MMG_caltet2)(pMesh ,pSol ,int ,int ,double ,double *);
1029
 
+ int    (*MMG_cavity)(pMesh ,pSol ,int ,int ,pList ,int );
1030
 
+ int    (*MMG_buckin)(pMesh ,pSol ,pBucket ,int );
1031
 
+ int    (*MMG_optlen)(pMesh ,pSol ,double ,int );
1032
 
+ int    (*MMG_interp)(double *,double *,double *,double );
1033
 
+ int    (*MMG_optlentet)(pMesh ,pSol ,pQueue ,double ,int ,int );
1034
 
+ int    (*MMG_movevertex)(pMesh ,pSol ,int ,int );
 
3404
-
 
3405
-
 
3406
+  
 
3407
+  
 
3408
   /*fin fichier*/
 
3409
   if(!bin) {
 
3410
-    strcpy(&chaine[0],"\n\nEnd\n");
 
3411
+    strcpy(&chaine[0],"\n\nEnd\n"); 
 
3412
     fprintf(inm,"%s",chaine);
 
3413
   } else {
 
3414
     binch = 54; //End