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
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
5
printf("6 cut : %8d\n",n6);
6
printf("---------------------------\n"); */
8
-#warning check memory allocation
9
+ // #warning check memory allocation
11
//printf("%d cut init --- nb tet %d\n",na,mesh->ne);
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
23
int MMG_decouphex(pMesh mesh, pHedge hed,int k,int* p,int ref) {
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
34
+ * Created by Fr\E9d\E9ric Hecht on 19/06/11.
35
+ * Copyright 2011 UPMC. All rights reserved.
53
+typedef struct DataFF
55
+ const char * meshname;
56
+ const char * movename;
57
+ const char * solname;
60
+ int np; // nb of vertices in/out
61
+ int typesol; // 1 iso , 6 : m11; m12,m13,m22,m23,m33
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);
77
+ int mainmmg3d(int argc,char *argv[],DataFF *dataff);
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
94
if ( ppt->tag & M_UNUSED ) return(0);
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;
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 *);
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 @@
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 );
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
160
Co-auteurs : Cecile Dobrzynski et Pascal Frey.
6
161
Propriétaires :IPB - UPMC -INRIA.
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.
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.
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.
203
This file is part of MMG3D
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
****************************************************************************/
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;
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;
226
int MMG_mmg3d4(pMesh mesh,pSol sol,int *alert) {
231
- int base,na,nd,ns,nna,nnd,nns,dd,it,nf,maxtou;
232
- double lmoy,LLLONG;
235
+ int base,na,nd,ns,nna,nnd,nns,dd,it,nf,maxtou;
236
+ double lmoy,LLLONG;
239
if ( abs(mesh->info.imprim) > 3 )
240
fprintf(stdout," ** SIZE OPTIMIZATION\n");
241
if ( mesh->info.imprim < 0 ) {
246
- declic = 3. / ALPHAD;
247
+ declic = 3. / ALPHAD;
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);
270
- M_free(bucket->head);
271
- M_free(bucket->link);
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);
280
+ M_free(bucket->head);
281
+ M_free(bucket->link);
288
- //printf("IT %d $$$$$$$$$$$ LLLONG %9.3f\n",it,LLLONG);
289
- nna = nns = nnd = 0;
291
+ //printf("IT %d $$$$$$$$$$$ LLLONG %9.3f\n",it,LLLONG);
292
+ nna = nns = nnd = 0;
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");
301
+ if ( mesh->info.ddebug ) fprintf(stdout," ## MEMORY ALLOCATION PROBLEM.\n");
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("--------------------------------------");
312
+ puts("--------------------------------------");
313
+ puts("--------------------------------------");
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");
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);
330
- else if ( *alert ) nna = 0;
332
+ else if ( *alert ) nna = 0;
334
if ( nna /*|| it == (maxtou-1)*/ ) {
336
if ( !MMG_hashTetra(mesh) ) return(0);
337
if ( !MMG_markBdry(mesh) ) return(0);
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);
357
nnd = MMG_colvert(mesh,sol,base);
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);
365
while ( na+nd+nns+nna+nnd > 0 && ++it < maxtou && lmoy > 1.3);
367
@@ -161,80 +161,80 @@
368
MMG_prilen(mesh,sol);
372
- //MMG_saveMesh(mesh,"aprescut.mesh");
373
- fprintf(stdout," ---\n");
376
+ //MMG_saveMesh(mesh,"aprescut.mesh",0);
377
+ fprintf(stdout," ---\n");
395
- /* 2. field points */
396
- if ( mesh->info.imprim < -4 ) {
397
- MMG_prilen(mesh,sol);
398
- fprintf(stdout," -- FIELD POINTS\n");
401
- /* create filter */
402
- bucket = MMG_newBucket(mesh,M_MAX(mesh->info.bucksiz,BUCKSIZ));
403
- if ( !bucket ) return(0);
406
- MMG_analar(mesh,sol,bucket,&na,&nd,&nf,alert);
410
- if ( nd < 1000 ) break;
415
- if ( dd < 5 || dd < 0.05*nd ) break;
416
- else if ( it > 12 && nd >= na ) break;
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);
423
- while ( na+nd > 0 && ++it < maxtou );
425
- if ( nna+nnd && abs(mesh->info.imprim) < 3 ) {
426
- fprintf(stdout," %7d INSERTED %7d REMOVED %7d FILTERED\n",na,nd,nf);
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);
448
- if ( mesh->info.imprim < 0 ) {
449
- MMG_outqua(mesh,sol);
450
- MMG_prilen(mesh,sol);
453
- M_free(bucket->head);
454
- M_free(bucket->link);
456
+ /* 2. field points */
457
+ if ( mesh->info.imprim < -4 ) {
458
+ MMG_prilen(mesh,sol);
459
+ fprintf(stdout," -- FIELD POINTS\n");
462
+ /* create filter */
463
+ bucket = MMG_newBucket(mesh,M_MAX(mesh->info.bucksiz,BUCKSIZ));
464
+ if ( !bucket ) return(0);
467
+ MMG_analar(mesh,sol,bucket,&na,&nd,&nf,alert);
471
+ if ( nd < 1000 ) break;
476
+ if ( dd < 5 || dd < 0.05*nd ) break;
477
+ else if ( it > 12 && nd >= na ) break;
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);
484
+ while ( na+nd > 0 && ++it < maxtou );
486
+ if ( nna+nnd && abs(mesh->info.imprim) < 3 ) {
487
+ fprintf(stdout," %7d INSERTED %7d REMOVED %7d FILTERED\n",na,nd,nf);
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);
503
+ if ( mesh->info.imprim < 0 ) {
504
+ MMG_outqua(mesh,sol);
505
+ MMG_prilen(mesh,sol);
508
+ M_free(bucket->head);
509
+ M_free(bucket->link);
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
519
#define Tutorial_VERSION_MAJOR
520
#define Tutorial_VERSION_MINOR
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
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);
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);
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
549
#include "compil.date"
554
TIM_mytime MMG_ctim[TIMEMAX];
558
100.*ttot/ttim[0],call[0],ttot/(float)call[0]);
560
fprintf(stdout,"\n ELAPSED TIME %.2f SEC. (%.2f)\n",ttim[0],ttot);
570
-int main(int argc,char *argv[]) {
571
+int mainmmg3d(int argc,char *argv[],DataFF *dataff) {
576
signal(SIGSEGV,excfun);
577
signal(SIGTERM,excfun);
578
signal(SIGINT,excfun);
580
+ if(dataff==0) atexit(endcod);
582
TIM_tminit(MMG_ctim,TIMEMAX);
583
TIM_chrono(ON,&MMG_ctim[0]);
584
@@ -479,15 +479,27 @@
589
+ /* modif F. Hecht ..*/
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;
600
if ( !parsar(argc,argv,mesh,sol) ) return(1);
601
MMG_imprim = info->imprim;
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);
612
if ( sol->np && sol->np != mesh->np ) {
613
fprintf(stdout," ## WARNING: WRONG SOLUTION NUMBER. IGNORED\n");
617
if ( !parsop(mesh) ) return(1);
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);
622
if ( !MMG_setfunc(sol->offset) ) return(1);
623
if ( !MMG_scaleMesh(mesh,sol) ) return(1);
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);
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);
644
@@ -678,18 +690,18 @@
645
fprintf(stdout,"\n ## WARNING: INCOMPLETE MESH %d , %d\n",
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);
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");
671
if ( MMG_imprim < -4 || info->ddebug ) M_memDump();
673
+ if(MMG_imprim && dataff ) endcod();
677
+int main(int argc,char *argv[]) {
678
+ return mainmmg3d( argc,argv,0);
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
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) {
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
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];
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
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));
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
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]);
737
- if ( abs(mesh->info.imprim) < 5 ) return;
738
+ if ( abs(mesh->info.imprim) < 5 ) return (1) ;
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
746
int MMG_inEdge(pHedge ,int *,int *,int *);
747
int MMG_markBdry(pMesh );
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 *);
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
770
-/****************************************************************************
771
-Logiciel initial: MMG3D Version 4.0
772
-Co-auteurs : Cecile Dobrzynski et Pascal Frey.
773
-Propriétaires :IPB - UPMC -INRIA.
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.
13
Ce fichier est une partie de MMG3D.
15
along with MMG3D. If not, see <http://www.gnu.org/licenses/>.
777
-Version 3 ou toute version ultérieure.
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.
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.
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
-****************************************************************************/
817
-int MMG_swapar(pMesh mesh,pSol sol,pQueue q,List *list,int lon,double crit,double declic) {
819
- int i,l,jel,ncas,ddebug,iadr;
823
- if ( !MMG_getnElt(mesh,10) ) return(-1);
824
- if(0 && list->tetra[1]/6==2352) ddebug=1;
829
- ncas = MMG_simu32(mesh,sol,list,crit);
832
- ncas = MMG_simu44(mesh,sol,list,crit);
835
- ncas = MMG_simu56(mesh,sol,list,crit);
838
- ncas = MMG_simu68(mesh,sol,list,crit);
841
- ncas = MMG_simu710(mesh,sol,list,crit);
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];
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]);
859
- lon = MMG_swpptr(mesh,sol,list);
861
- if(!lon) return(0);
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;
870
- if(ddebug) {MMG_saveMesh(mesh,"sw.mesh"); exit(0);}
876
+/****************************************************************************
877
+Logiciel initial: MMG3D Version 4.0
878
+Co-auteurs : Cecile Dobrzynski et Pascal Frey.
879
+Propriétaires :IPB - UPMC -INRIA.
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.
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.
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.
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
+****************************************************************************/
923
+int MMG_swapar(pMesh mesh,pSol sol,pQueue q,List *list,int lon,double crit,double declic) {
925
+ int i,l,jel,ncas,ddebug,iadr;
929
+ if ( !MMG_getnElt(mesh,10) ) return(-1);
930
+ if(0 && list->tetra[1]/6==2352) ddebug=1;
935
+ ncas = MMG_simu32(mesh,sol,list,crit);
938
+ ncas = MMG_simu44(mesh,sol,list,crit);
941
+ ncas = MMG_simu56(mesh,sol,list,crit);
944
+ ncas = MMG_simu68(mesh,sol,list,crit);
947
+ ncas = MMG_simu710(mesh,sol,list,crit);
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];
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]);
965
+ lon = MMG_swpptr(mesh,sol,list);
967
+ if(!lon) return(0);
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;
976
+ if(ddebug) {MMG_saveMesh(mesh,"sw.mesh",0); exit(0);}
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
987
along with MMG3D. If not, see <http://www.gnu.org/licenses/>.
16
988
****************************************************************************/
19
990
+#include "dataff.h"
21
extern short MMG_imprim;
993
extern short MMG_imprim;
994
@@ -100,35 +101,467 @@
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) {
422
double volhex,volref;
1437
- int k,dim,ref,bin,bpos,i,tmp;
1439
+ int k,dim,ref,bin,bpos,i,tmp;
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;
1447
- double volhex,volref;
1448
+ int p0,p1,p2,p3,p4,p5,p6,p7;
1449
+ int binch,bdim,iswp,nu1,nu2,nimp,ne,nbado;
1451
+ double volhex,volref;
426
1455
+ return MMG_loadMeshff( mesh,filename,(DataFF*) dataff);
428
1458
posnp = posnt = posne = posnhex = posnpris = 0;
429
1459
netmp = ncor = ned = 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;
1467
strcpy(data,filename);
1468
- ptr = strstr(data,".mesh");
1469
+ ptr = strstr(data,".mesh");
1471
strcat(data,".meshb");
1472
if( !(inm = fopen(data,"rb")) ) {
1475
strcat(data,".mesh");
1476
if( !(inm = fopen(data,"r")) ) {
1477
- fprintf(stderr," ** %s NOT FOUND.\n",data);
1479
+ fprintf(stderr," ** %s NOT FOUND.\n",data);
1484
@@ -147,194 +580,194 @@
1485
ptr = strstr(data,".meshb");
1487
if( !(inm = fopen(data,"r")) ) {
1488
- fprintf(stderr," ** %s NOT FOUND.\n",data);
1491
+ fprintf(stderr," ** %s NOT FOUND.\n",data);
1496
if( !(inm = fopen(data,"rb")) ) {
1497
- fprintf(stderr," ** %s NOT FOUND.\n",data);
1499
+ fprintf(stderr," ** %s NOT FOUND.\n",data);
1508
fprintf(stdout," %%%% %s OPENED\n",data);
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);
1517
+ fscanf(inm,"%d",&mesh->ver);
1519
} else if(!strncmp(chaine,"Dimension",strlen("Dimension"))) {
1520
- fscanf(inm,"%d",&dim);
1522
- fprintf(stdout,"BAD DIMENSION : %d\n",dim);
1526
+ fscanf(inm,"%d",&dim);
1528
+ fprintf(stdout,"BAD DIMENSION : %d\n",dim);
1532
} else if(!strncmp(chaine,"Vertices",strlen("Vertices"))) {
1533
- fscanf(inm,"%d",&mesh->np);
1534
- posnp = ftell(inm);
1536
+ fscanf(inm,"%d",&mesh->np);
1537
+ posnp = ftell(inm);
1539
} else if(!strncmp(chaine,"Triangles",strlen("Triangles"))) {
1540
- fscanf(inm,"%d",&mesh->nt);
1541
- posnt = ftell(inm);
1543
+ fscanf(inm,"%d",&mesh->nt);
1544
+ posnt = ftell(inm);
1546
} else if(!strncmp(chaine,"Tetrahedra",strlen("Tetrahedra"))) {
1547
- fscanf(inm,"%d",&mesh->ne);
1549
- posne = ftell(inm);
1551
- } else if(!strncmp(chaine,"Hexahedra",strlen("Hexahedra"))) {
1552
- assert(abs(mesh->info.option)==10);
1553
- fscanf(inm,"%d",&nhex);
1555
- posnhex = ftell(inm);
1557
- } else if(!strncmp(chaine,"Pentahedra",strlen("Pentahedra"))) {
1558
- assert(abs(mesh->info.option)==10);
1559
- fscanf(inm,"%d",&npris);
1561
- posnpris = ftell(inm);
1563
- } else if(!strncmp(chaine,"Corners",strlen("Corners"))) {
1564
- fscanf(inm,"%d",&ncor);
1565
- posncor = ftell(inm);
1567
- } else if(!strncmp(chaine,"Edges",strlen("Edges"))) {
1568
- fscanf(inm,"%d",&ned);
1569
- posned = ftell(inm);
1571
- } else if(abs(mesh->info.option)==10 && !strncmp(chaine,"Quadrilaterals",strlen("Quadrilaterals"))) {
1572
- fscanf(inm,"%d",&nq);
1573
- posnq = ftell(inm);
1577
+ fscanf(inm,"%d",&mesh->ne);
1579
+ posne = ftell(inm);
1581
+ } else if(!strncmp(chaine,"Hexahedra",strlen("Hexahedra"))) {
1582
+ assert(abs(mesh->info.option)==10);
1583
+ fscanf(inm,"%d",&nhex);
1585
+ posnhex = ftell(inm);
1587
+ } else if(!strncmp(chaine,"Pentahedra",strlen("Pentahedra"))) {
1588
+ assert(abs(mesh->info.option)==10);
1589
+ fscanf(inm,"%d",&npris);
1591
+ posnpris = ftell(inm);
1593
+ } else if(!strncmp(chaine,"Corners",strlen("Corners"))) {
1594
+ fscanf(inm,"%d",&ncor);
1595
+ posncor = ftell(inm);
1597
+ } else if(!strncmp(chaine,"Edges",strlen("Edges"))) {
1598
+ fscanf(inm,"%d",&ned);
1599
+ posned = ftell(inm);
1601
+ } else if(abs(mesh->info.option)==10 && !strncmp(chaine,"Quadrilaterals",strlen("Quadrilaterals"))) {
1602
+ fscanf(inm,"%d",&nq);
1603
+ posnq = ftell(inm);
1609
fread(&mesh->ver,sw,1,inm);
1611
- if(mesh->ver==16777216)
1614
+ if(mesh->ver==16777216)
1616
else if(mesh->ver!=1) {
1617
fprintf(stdout,"BAD FILE ENCODING\n");
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;
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);
1636
- fprintf(stdout,"BAD SOL DIMENSION : %d\n",dim);
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);
1646
+ fprintf(stdout,"BAD SOL DIMENSION : %d\n",dim);
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);
1658
- fseek(inm,bpos,SEEK_SET);
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);
1666
+ fseek(inm,bpos,SEEK_SET);
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);
1675
- fseek(inm,bpos,SEEK_SET);
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);
1683
- posne = ftell(inm);
1685
- fseek(inm,bpos,SEEK_SET);
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);
1695
- fseek(inm,bpos,SEEK_SET);
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);
1705
- fseek(inm,bpos,SEEK_SET);
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);
1714
- fseek(inm,bpos,SEEK_SET);
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);
1723
- fseek(inm,bpos,SEEK_SET);
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);
1731
- fseek(inm,bpos,SEEK_SET);
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);
1741
+ fseek(inm,bpos,SEEK_SET);
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);
1749
+ posne = ftell(inm);
1751
+ fseek(inm,bpos,SEEK_SET);
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);
1761
+ fseek(inm,bpos,SEEK_SET);
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);
1771
+ fseek(inm,bpos,SEEK_SET);
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);
1780
+ fseek(inm,bpos,SEEK_SET);
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);
1789
+ fseek(inm,bpos,SEEK_SET);
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);
1797
+ fseek(inm,bpos,SEEK_SET);
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;
1812
if ( abs(mesh->info.imprim) > 5 )
431
1813
fprintf(stdout," -- READING DATA FILE %s\n",data);
433
1815
if ( !mesh->np || !mesh->ne ) {
435
1817
+ fprintf(stdout," ** MISSING DAT qqA\n");
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");
1824
- adjahex = (int*)M_calloc(6*nhex+7,sizeof(int),"allocadjhexa");
1828
+ adjahex = (int*)M_calloc(6*nhex+7,sizeof(int),"allocadjhexa");
438
1831
if ( !MMG_zaldy(mesh) ) return(0);
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*/
1841
- for (i=0 ; i<3 ; i++) {
1842
- fscanf(inm,"%f",&fc);
1843
- ppt->c[i] = (double) fc;
1845
- fscanf(inm,"%d",&ppt->ref);
1846
+ for (i=0 ; i<3 ; i++) {
1847
+ fscanf(inm,"%f",&fc);
1848
+ ppt->c[i] = (double) fc;
1850
+ fscanf(inm,"%d",&ppt->ref);
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;
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;
1864
+ fread(&ppt->ref,sw,1,inm);
1865
+ if(iswp) ppt->ref=MMG_swapbin(ppt->ref);
1869
- fscanf(inm,"%lf %lf %lf %d",&ppt->c[0],&ppt->c[1],&ppt->c[2],&ppt->ref);
1871
+ fscanf(inm,"%lf %lf %lf %d",&ppt->c[0],&ppt->c[1],&ppt->c[2],&ppt->ref);
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]);
1877
- fread(&ppt->ref,sw,1,inm);
1878
- if(iswp) ppt->ref=MMG_swapbin(ppt->ref);
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]);
1886
+ fread(&ppt->ref,sw,1,inm);
1887
+ if(iswp) ppt->ref=MMG_swapbin(ppt->ref);
1890
+ ppt->tag = M_UNUSED;
1893
/* read mesh triangles */
1894
@@ -378,227 +811,226 @@
1896
fseek(inm,posnt,SEEK_SET);
1897
for (k=1; k<=mesh->nt; k++) {
1898
- pt1 = &mesh->tria[k];
1899
+ pt1 = &mesh->tria[k];
1901
fscanf(inm,"%d %d %d %d",&pt1->v[0],&pt1->v[1],&pt1->v[2],&pt1->ref);
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]);
1907
- fread(&pt1->ref,sw,1,inm);
1908
- if(iswp) pt1->ref=MMG_swapbin(pt1->ref);
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]);
1918
+ fread(&pt1->ref,sw,1,inm);
1919
+ if(iswp) pt1->ref=MMG_swapbin(pt1->ref);
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;
1928
fseek(inm,posnq,SEEK_SET);
1929
for (k=1; k<=nq; k++) {
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);
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);
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);
1956
/*creation of 4 triangles per quads because we don't know how hexa will be cut*/
1957
- pt1 = &mesh->tria[++mesh->nt];
1962
- pt1 = &mesh->tria[++mesh->nt];
1967
- pt1 = &mesh->tria[++mesh->nt];
1972
- pt1 = &mesh->tria[++mesh->nt];
1980
- /*read and store edges*/
1982
- if ( !MMG_zaldy4(&hed,ned) ) {
1983
- if ( mesh->info.ddebug ) fprintf(stdout," ## MEMORY ALLOCATION PROBLEM : EDGES IGNORED\n");
1987
+ pt1 = &mesh->tria[++mesh->nt];
1992
+ pt1 = &mesh->tria[++mesh->nt];
1997
+ pt1 = &mesh->tria[++mesh->nt];
2002
+ pt1 = &mesh->tria[++mesh->nt];
2010
+ /*read and store edges*/
2012
+ if ( !MMG_zaldy4(&hed,ned) ) {
2013
+ if ( mesh->info.ddebug ) fprintf(stdout," ## MEMORY ALLOCATION PROBLEM : EDGES IGNORED\n");
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++) {
2023
- fscanf(inm,"%d %d %d",&nu1,&nu2,&ref);
2024
+ fscanf(inm,"%d %d %d",&nu1,&nu2,&ref);
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);
2033
- if(MMG_edgePut(&hed,nu1,nu2,2)>1) {
2034
- fprintf(stdout," ## WARNING DOUBLE EDGE : %d %d\n",nu1,nu2);
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);
2045
+ if(MMG_edgePut(&hed,nu1,nu2,2)>1) {
2046
+ fprintf(stdout," ## WARNING DOUBLE EDGE : %d %d\n",nu1,nu2);
2048
+ mesh->point[nu1].geom = M_RIDGE_GEO;
2049
+ mesh->point[nu2].geom = M_RIDGE_GEO;
2053
/* read mesh tetrahedra */
2054
mesh->nefixe = mesh->ne;
2056
- fseek(inm,posne,SEEK_SET);
2058
- for (k=1; k<=netmp; k++) {
2059
+ fseek(inm,posne,SEEK_SET);
2061
+ for (k=1; k<=netmp; k++) {
2062
pt = &mesh->tetra[k];
2064
- fscanf(inm,"%d %d %d %d %d",&pt->v[0],&pt->v[1],&pt->v[2],&pt->v[3],&ref);
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]);
2071
- fread(&ref,sw,1,inm);
2072
- if(iswp) ref=MMG_swapbin(ref);
2075
+ fscanf(inm,"%d %d %d %d %d",&pt->v[0],&pt->v[1],&pt->v[2],&pt->v[3],&ref);
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]);
2082
+ fread(&ref,sw,1,inm);
2083
+ if(iswp) ref=MMG_swapbin(ref);
2085
pt->ref = ref;//0;//ref ;
2087
/*check orientation*/
2088
- volref = MMG_voltet(mesh,k);
2092
- pt->v[2] = pt->v[3];
2096
+ volref = MMG_voltet(mesh,k);
2099
+ fprintf(stdout,"\n $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ \n");
2100
+ fprintf(stdout," BAD ORIENTATION : vol < 0 -- Some tetra will be reoriented\n");
2101
+ fprintf(stdout," $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ \n\n");
2105
+ pt->v[2] = pt->v[3];
2109
for(i=0 ; i<4 ; i++)
2110
- pt->bdryref[i] = -1;
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);
2120
- for(i=0 ; i<6 ; i++)
2121
- pt->bdryinfo[i] = 0;
2123
+ pt->bdryref[i] = -1;
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);
2133
+ for(i=0 ; i<6 ; i++)
2134
+ pt->bdryinfo[i] = 0;
2138
- fprintf(stdout,"\n $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ \n");
2139
- fprintf(stdout," BAD ORIENTATION : vol < 0 -- %8d tetra reoriented\n",reorient);
2140
- fprintf(stdout," $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ \n\n");
2143
- if (ned) M_free(hed.item);
2144
+ if (ned) M_free(hed.item);
2150
- fseek(inm,posncor,SEEK_SET);
2151
+ fseek(inm,posncor,SEEK_SET);
2153
- for (k=1; k<=ncor; k++) {
2154
+ for (k=1; k<=ncor; k++) {
2156
- fscanf(inm,"%d",&ref);
2157
+ fscanf(inm,"%d",&ref);
2159
- fread(&ref,sw,1,inm);
2160
- if(iswp) ref=MMG_swapbin(ref);
2162
+ fread(&ref,sw,1,inm);
2163
+ if(iswp) ref=MMG_swapbin(ref);
2165
ppt = &mesh->point[ref];
2166
- ppt->geom = M_CORNER;
2168
+ ppt->geom = M_CORNER;
2173
- if ( abs(mesh->info.option)==10 ) {
2176
+ if ( abs(mesh->info.option)==10 ) {
2178
printf("NOT SUPPORTED\n");
2181
- if ( !MMG_zaldy4(&hed2,3*npris+6*nhex) ) {
2182
- if ( mesh->info.ddebug ) fprintf(stdout," ## MEMORY ALLOCATION PROBLEM : PRISM IGNORED\n");
2187
+ if ( !MMG_zaldy4(&hed2,3*npris+6*nhex) ) {
2188
+ if ( mesh->info.ddebug ) fprintf(stdout," ## MEMORY ALLOCATION PROBLEM : PRISM IGNORED\n");
2193
/*read hexa and transform to tetra*/
2195
- fseek(inm,posnhex,SEEK_SET);
2197
+ fseek(inm,posnhex,SEEK_SET);
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);
2212
- //printf("vol %e\n",volref);
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);
2219
- ph->v[3] = ph->v[1];
2222
- ph->v[5] = ph->v[7];
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);
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);
2232
+ //printf("vol %e\n",volref);
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);
2239
+ ph->v[3] = ph->v[1];
2242
+ ph->v[5] = ph->v[7];
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);
2248
+ fprintf(stdout,"%8d HEXA REORIENTED\n",nbado);
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*/
2258
- fseek(inm,posnpris,SEEK_SET);
2260
- ne = netmp+6*nhex;
2261
+ fseek(inm,posnpris,SEEK_SET);
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))
2268
- if(mesh->info.imprim < 0 ) fprintf(stdout,"DECOMPOSITION PRISM INVALID \n\n");
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))
2278
+ if(mesh->info.imprim < 0 ) fprintf(stdout,"DECOMPOSITION PRISM INVALID \n\n");
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);
2291
if ( abs(mesh->info.imprim) > 3 && abs(mesh->info.option)!=10 ) {
2292
fprintf(stdout," NUMBER OF GIVEN VERTICES %8d\n",mesh->npfixe);
2294
@@ -609,24 +1041,26 @@
2296
fprintf(stdout," NUMBER OF GIVEN EDGES %8d\n",ned);
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) {
444
2308
+int MMG_loadSol(pSol sol,char *filename,int npmax,void *dataff) {
2313
int binch,bdim,iswp;
449
2314
int k,i,isol,type,bin,dim,btyp,bpos;
451
2316
char *ptr,data[128],chaine[128];
453
2320
+ return MMG_loadSolff( sol,filename,npmax,(DataFF*) dataff);
457
@@ -664,12 +1054,12 @@
2327
strcpy(data,filename);
2328
ptr = strstr(data,".mesh");
2329
@@ -645,94 +1079,94 @@
2331
fprintf(stdout," %%%% %s OPENED\n",data);
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);
2343
- fprintf(stdout,"BAD SOL DIMENSION : %d\n",dim);
2347
+ fscanf(inm,"%d",&dim);
2349
+ fprintf(stdout,"BAD SOL DIMENSION : %d\n",dim);
2353
} else if(!strncmp(chaine,"SolAtVertices",strlen("SolAtVertices"))) {
2354
- fscanf(inm,"%d",&sol->np);
2355
- fscanf(inm,"%d",&type);
2357
- fprintf(stdout,"SEVERAL SOLUTION => IGNORED : %d\n",type);
2360
- fscanf(inm,"%d",&btyp);
2361
- posnp = ftell(inm);
2366
- fread(&binch,sw,1,inm);
2368
- if(binch==16777216) iswp=1;
2369
+ fscanf(inm,"%d",&sol->np);
2370
+ fscanf(inm,"%d",&type);
2372
+ fprintf(stdout,"SEVERAL SOLUTION => IGNORED : %d\n",type);
2375
+ fscanf(inm,"%d",&btyp);
2376
+ posnp = ftell(inm);
2381
+ fread(&binch,sw,1,inm);
2383
+ if(binch==16777216) iswp=1;
2385
fprintf(stdout,"BAD FILE ENCODING\n");
2387
- fread(&sol->ver,sw,1,inm);
2388
- if(iswp) sol->ver = MMG_swapbin(sol->ver);
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);
2403
- fprintf(stdout,"BAD SOL DIMENSION : %d\n",dim);
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);
2413
+ fprintf(stdout,"BAD SOL DIMENSION : %d\n",dim);
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);
2426
- fprintf(stdout,"SEVERAL SOLUTION => IGNORED : %d\n",type);
2429
- fread(&btyp,sw,1,inm); //typsol
2430
- if(iswp) btyp=MMG_swapbin(btyp);
2431
- posnp = ftell(inm);
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);
2440
+ fprintf(stdout,"SEVERAL SOLUTION => IGNORED : %d\n",type);
2443
+ fread(&btyp,sw,1,inm); //typsol
2444
+ if(iswp) btyp=MMG_swapbin(btyp);
2445
+ posnp = ftell(inm);
2448
- fread(&bpos,sw,1,inm); //Pos
2449
- if(iswp) bpos=MMG_swapbin(bpos);
2451
- fseek(inm,bpos,SEEK_SET);
2456
+ fread(&bpos,sw,1,inm); //Pos
2457
+ if(iswp) bpos=MMG_swapbin(bpos);
2459
+ fseek(inm,bpos,SEEK_SET);
460
2464
if ( !sol->np ) {
461
2465
- fprintf(stdout," ** MISSING DATA\n");
462
2466
+ fprintf(stdout," ** MISSING DATA ss\n");
527
2793
mesh->ver = 2; //double precision
529
2795
strcpy(data,filename);
530
@@ -1145,7 +1541,7 @@
2796
@@ -959,28 +1399,28 @@
2798
strcat(data,".mesh");
2799
if( !(inm = fopen(data,"w")) ) {
2800
- fprintf(stderr," ** UNABLE TO OPEN %s.\n",data);
2802
+ fprintf(stderr," ** UNABLE TO OPEN %s.\n",data);
2812
ptr = strstr(data,".meshb");
2814
if( !(inm = fopen(data,"w")) ) {
2815
fprintf(stderr," ** UNABLE TO OPEN %s.\n",data);
2820
fprintf(stdout," %%%% %s OPENED\n",data);
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);
2831
binch = 1; //MeshVersionFormatted
2832
@@ -993,33 +1433,38 @@
2833
fwrite(&bpos,sw,1,inm);
2835
fwrite(&binch,sw,1,inm);
2840
/* compact vertices */
2843
cor = (int*) M_calloc(mesh->ncor,sizeof(int),"MMG_savemesh");
2848
- if ( !MMG_zaldy4(&hed,mesh->ned) ) {
2849
- if ( mesh->info.ddebug ) fprintf(stdout," ## MEMORY ALLOCATION PROBLEM : EXPORT EDGES IGNORED\n");
2853
+ if ( !MMG_zaldy4(&hed,mesh->ned) ) {
2854
+ if ( mesh->info.ddebug ) fprintf(stdout," ## MEMORY ALLOCATION PROBLEM : EXPORT EDGES IGNORED\n");
2857
ed = (int*)M_calloc(2*mesh->ned,sizeof(int),"MMG_savemesh");
2864
for (k=1; k<=mesh->np; k++) {
2865
ppt = &mesh->point[k];
2866
- if ( ppt->tag & M_UNUSED ) continue;
2868
+ if ( ppt->tag & M_UNUSED ) continue;
2870
if ( ppt->geom & M_CORNER ) cor[nc++] = ppt->tmp;
2872
+ //assert(mesh->ncor==nc);
2873
+ if(mesh->ncor!=nc) {
2874
+ fprintf(stdout,"WARNING: some corners have been added or deleted\n");
2877
- assert(mesh->ncor==nc);
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);
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);
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);
2899
fprintf(inm,"%.15lg %.15lg %.15lg %d\n",ppt->c[0],ppt->c[1],ppt->c[2],ppt->ref);
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);
2912
- /* rebuild triangles tabular and write triangles */
2913
+ /* rebuild triangles tabular and write triangles */
2915
if(MMG_markBdry(mesh)) {
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);
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);
2929
for (k=1; k<=mesh->nt; k++) {
2930
pt1 = &mesh->tria[k];
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);
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);
2954
/* write tetrahedra */
2957
- //printf("avt %d\n",mesh->ned);
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;
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;
2978
+ if ( !pt->v[0] ) continue;
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;
2994
- //printf("ned %d\n",ned);
2995
+ //printf("ned %d\n",ned);
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);
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);
3009
+ fwrite((unsigned char*)&ne,sw,1,inm);
3012
for (k=1; k<=mesh->ne; k++) {
3013
pt = &mesh->tetra[k];
3014
- if ( !pt->v[0] ) continue;
3017
+ if ( !pt->v[0] ) continue;
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);
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);
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);
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);
3053
- for (k=0; k<ned; k++) {
3056
- fprintf(inm,"%d %d %d \n",ed[2*k],ed[2*k+1],ref);
3058
- fwrite(&ed[2*k],sw,1,inm);
3059
- fwrite(&ed[2*k+1],sw,1,inm);
3060
- fwrite(&ref,sw,1,inm);
3065
+ fwrite((unsigned char*)&ned,sw,1,inm);
3067
+ for (k=0; k<ned; k++) {
3070
+ fprintf(inm,"%d %d %d \n",ed[2*k],ed[2*k+1],ref);
3072
+ fwrite(&ed[2*k],sw,1,inm);
3073
+ fwrite(&ed[2*k+1],sw,1,inm);
3074
+ fwrite(&ref,sw,1,inm);
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);
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);
3097
for (k=0; k<mesh->ncor; k++) {
3099
fprintf(inm,"%d \n",cor[k]);
3101
- fwrite(&cor[k],sw,1,inm);
3102
+ fwrite(&cor[k],sw,1,inm);
3108
- strcpy(&chaine[0],"\n\nEnd\n");
3109
+ strcpy(&chaine[0],"\n\nEnd\n");
3110
fprintf(inm,"%s",chaine);
3113
fwrite(&binch,sw,1,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 @@
3122
fprintf(stdout," TOTAL NUMBER OF EDGES %8d\n",ned);
3124
- //if(ned!=mesh->ned) exit(0);
3125
+ //if(ned!=mesh->ned) exit(0);
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;
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);
3243
fwrite(&binch,sw,1,inm);
3244
binch = typ; //typ sol
3245
@@ -1317,34 +1763,34 @@
3246
sol->met[isol + 3] = tmp;
3250
- for (i=0; i<sol->offset; i++) {
3251
- fsol = (float) sol->met[isol + i];
3252
- fprintf(inm,"%f ",fsol);
3254
- fprintf(inm,"\n");
3256
+ for (i=0; i<sol->offset; i++) {
3257
+ fsol = (float) sol->met[isol + i];
3258
+ fprintf(inm,"%f ",fsol);
3260
+ fprintf(inm,"\n");
3262
- for (i=0; i<sol->offset; i++) {
3263
- fsol = (float) sol->met[isol + i];
3264
- fwrite(&fsol,sw,1,inm);
3266
+ for (i=0; i<sol->offset; i++) {
3267
+ fsol = (float) sol->met[isol + i];
3268
+ fwrite(&fsol,sw,1,inm);
3273
- for (i=0; i<sol->offset; i++)
3274
- fprintf(inm,"%.15lg ",sol->met[isol + i]);
3275
- fprintf(inm,"\n");
3277
+ for (i=0; i<sol->offset; i++)
3278
+ fprintf(inm,"%.15lg ",sol->met[isol + i]);
3279
+ fprintf(inm,"\n");
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);
3294
- strcpy(&chaine[0],"\n\nEnd\n");
3295
+ strcpy(&chaine[0],"\n\nEnd\n");
3296
fprintf(inm,"%s",chaine);
3299
@@ -1355,14 +1801,16 @@
560
3302
/*save the node speed : coornew-coorold/dt*/
561
3303
-int MMG_saveVect(pMesh mesh,char *filename) {
562
3305
+int MMG_saveVect(pMesh mesh,char *filename,void *dataff) {
566
@@ -1309,6 +1707,8 @@
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;
571
3315
+ return MMG_saveVectff( mesh, filename,(DataFF*) dataff);
573
3317
pd = mesh->disp;
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;
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 *);
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 @@
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 );
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
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);
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);
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);
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
668
#define Tutorial_VERSION_MAJOR
669
#define Tutorial_VERSION_MINOR
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
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);
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);
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
698
int MMG_inEdge(pHedge ,int *,int *,int *);
699
int MMG_markBdry(pMesh );
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 *);
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
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];
731
if ( pt->qual >= declic ) MMG_kiuput(q,jel);
732
for (i=0; i<4; i++) mesh->point[pt->v[i]].flag = mesh->flag;
734
- if(ddebug) MMG_saveMesh(mesh,"sw.mesh");
735
+ if(ddebug) MMG_saveMesh(mesh,"sw.mesh",0);
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
746
+ * Created by Fr\E9d\E9ric Hecht on 19/06/11.
747
+ * Copyright 2011 UPMC. All rights reserved.
765
+typedef struct DataFF
767
+ const char * meshname;
768
+ const char * movename;
769
+ const char * solname;
772
+ int np; // nb of vertices in/out
773
+ int typesol; // 1 iso , 6 : m11; m12,m13,m22,m23,m33
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);
789
+ int mainmmg3d(int argc,char *argv[],DataFF *dataff);
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
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));
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
816
if ( ppt->tag & M_UNUSED ) return(0);
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
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
833
//printf("%d cut init --- nb tet %d\n",na,mesh->ne);
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
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];
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
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) {
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
860
****************************************************************************/
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;
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;
876
int MMG_mmg3d4(pMesh mesh,pSol sol,int *alert) {
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
881
#include "compil.date"
3319
@@ -1378,7 +1826,7 @@
3325
strcat(data,".o.solb");
3327
strcat(data,".o.sol");
3328
@@ -1395,9 +1843,9 @@
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);
3339
binch = 1; //MeshVersionFormatted
3340
@@ -1410,20 +1858,20 @@
3341
fwrite(&bpos,sw,1,inm);
3343
fwrite(&binch,sw,1,inm);
886
TIM_mytime MMG_ctim[TIMEMAX];
890
100.*ttot/ttim[0],call[0],ttot/(float)call[0]);
892
fprintf(stdout,"\n ELAPSED TIME %.2f SEC. (%.2f)\n",ttim[0],ttot);
897
@@ -432,13 +433,14 @@
901
-int main(int argc,char *argv[]) {
902
+int mainmmg3d(int argc,char *argv[],DataFF *dataff) {
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;
913
fprintf(stdout," -- MMG3d, Release %s (%s) \n",M_VER,M_REL);
914
fprintf(stdout," Copyright (c) LJLL/IMB, 2010\n");
916
signal(SIGSEGV,excfun);
917
signal(SIGTERM,excfun);
918
signal(SIGINT,excfun);
920
+ if(dataff==0) atexit(endcod);
922
TIM_tminit(MMG_ctim,TIMEMAX);
923
TIM_chrono(ON,&MMG_ctim[0]);
924
@@ -477,15 +479,27 @@
929
+ /* modif F. Hecht ..*/
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;
940
if ( !parsar(argc,argv,mesh,sol) ) return(1);
941
MMG_imprim = info->imprim;
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);
953
if ( sol->np && sol->np != mesh->np ) {
954
fprintf(stdout," ## WARNING: WRONG SOLUTION NUMBER. IGNORED\n");
958
if ( !parsop(mesh) ) return(1);
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);
963
if ( !MMG_setfunc(sol->offset) ) return(1);
964
if ( !MMG_scaleMesh(mesh,sol) ) return(1);
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);
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);
3352
for (k=1; k<=mesh->np; k++) {
3353
ppt = &mesh->point[k];
3354
if ( ppt->tag & M_UNUSED ) continue;
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);
3373
fwrite(&binch,sw,1,inm);
3374
binch = typ; //typ sol
3375
fwrite(&binch,sw,1,inm);
3379
- dd = mesh->info.delta / (double)PRECI;
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;
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;
3395
+ fprintf(inm,"%.15lg ",dsol);
3397
- fwrite(&dsol,sd,1,inm);
3398
+ fwrite(&dsol,sd,1,inm);
985
@@ -669,18 +683,18 @@
986
fprintf(stdout,"\n ## WARNING: INCOMPLETE MESH %d , %d\n",
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);
3401
- if (!bin) fprintf(inm,"\n");
3402
+ if (!bin) fprintf(inm,"\n");
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");
1009
M_free(mesh->point);
1010
@@ -697,5 +711,24 @@
1012
if ( MMG_imprim < -4 || info->ddebug ) M_memDump();
1014
+ if(MMG_imprim && dataff ) endcod();
1018
+int main(int argc,char *argv[]) {
1019
+ return mainmmg3d( argc,argv,0);
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 );
3410
- strcpy(&chaine[0],"\n\nEnd\n");
3411
+ strcpy(&chaine[0],"\n\nEnd\n");
3412
fprintf(inm,"%s",chaine);