Mmg
Simplicial remeshers (mesh adaptation, isovalue discretization, lagrangian movement)
libmmg3d_tools.c
Go to the documentation of this file.
1/* =============================================================================
2** This file is part of the mmg software package for the tetrahedral
3** mesh modification.
4** Copyright (c) Bx INP/CNRS/Inria/UBordeaux/UPMC, 2004-
5**
6** mmg is free software: you can redistribute it and/or modify it
7** under the terms of the GNU Lesser General Public License as published
8** by the Free Software Foundation, either version 3 of the License, or
9** (at your option) any later version.
10**
11** mmg is distributed in the hope that it will be useful, but WITHOUT
12** ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13** FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
14** License for more details.
15**
16** You should have received a copy of the GNU Lesser General Public
17** License and of the GNU General Public License along with mmg (in
18** files COPYING.LESSER and COPYING). If not, see
19** <http://www.gnu.org/licenses/>. Please read their terms carefully and
20** use this copy of the mmg distribution only if you accept them.
21** =============================================================================
22*/
23
33#include "libmmg3d.h"
34#include "mmgcommon_private.h"
36#include "mmgversion.h"
38#include "mmgexterns_private.h"
39
40
42
43 if ( mesh->info.ani || (met && met->size == 6) ) {
44 /* Force data consistency: if aniso metric is provided, met->size==6 and
45 * info.ani==0; with -A option, met->size==1 and info.ani==1 */
46 met->size = 6;
47 mesh->info.ani = 1;
48
49 if ( (!met->m) && (!mesh->info.optim) && mesh->info.hsiz<=0. ) {
50 MMG5_caltet = MMG5_caltet_iso;
51 MMG5_caltri = MMG5_caltri_iso;
53 MMG5_lenedg = MMG5_lenedg_iso;
55 MMG5_lenSurfEdg = MMG5_lenSurfEdg_iso;
56 }
57 else {
58 MMG5_caltet = MMG5_caltet_ani;
59 MMG5_caltri = MMG5_caltri_ani;
61 MMG5_lenedg = MMG5_lenedg_ani;
63 MMG5_lenSurfEdg = MMG5_lenSurfEdg_ani;
64 }
65 MMG5_intmet = MMG5_intmet_ani;
66 MMG5_lenedgspl = MMG5_lenedg_ani;
67 MMG5_movintpt = MMG5_movintpt_ani;
68 MMG5_movbdyregpt = MMG5_movbdyregpt_ani;
69 MMG5_movbdyrefpt = MMG5_movbdyrefpt_ani;
70 MMG5_movbdynompt = MMG5_movbdynompt_ani;
71 MMG5_movbdyridpt = MMG5_movbdyridpt_ani;
72 MMG5_interp4bar = MMG5_interp4bar_ani;
73 MMG5_compute_meanMetricAtMarkedPoints = MMG5_compute_meanMetricAtMarkedPoints_ani;
74 MMG3D_defsiz = MMG3D_defsiz_ani;
75 MMG3D_gradsiz = MMG3D_gradsiz_ani;
76 MMG3D_gradsizreq = MMG3D_gradsizreq_ani;
77#ifndef MMG_PATTERN
78 MMG5_cavity = MMG5_cavity_ani;
79 MMG3D_PROctreein = MMG3D_PROctreein_ani;
80#endif
81 }
82 else {
83 if ( mesh->info.optimLES ) {
84 MMG5_caltet = MMG3D_caltetLES_iso;
85 MMG5_movintpt = MMG5_movintpt_iso;
86 }
87 else {
88 MMG5_caltet = MMG5_caltet_iso;
89 MMG5_movintpt = MMG5_movintpt_iso;
90 }
91 MMG5_caltri = MMG5_caltri_iso;
93 MMG5_lenedg = MMG5_lenedg_iso;
95 MMG5_lenSurfEdg = MMG5_lenSurfEdg_iso;
96 MMG5_intmet = MMG5_intmet_iso;
97 MMG5_lenedgspl = MMG5_lenedg_iso;
98 MMG5_movbdyregpt = MMG5_movbdyregpt_iso;
99 MMG5_movbdyrefpt = MMG5_movbdyrefpt_iso;
100 MMG5_movbdynompt = MMG5_movbdynompt_iso;
101 MMG5_movbdyridpt = MMG5_movbdyridpt_iso;
102 MMG5_interp4bar = MMG5_interp4bar_iso;
103 MMG5_compute_meanMetricAtMarkedPoints = MMG5_compute_meanMetricAtMarkedPoints_iso;
104 MMG3D_defsiz = MMG3D_defsiz_iso;
105 MMG3D_gradsiz = MMG3D_gradsiz_iso;
106 MMG3D_gradsizreq = MMG3D_gradsizreq_iso;
107
108#ifndef MMG_PATTERN
109 MMG5_cavity = MMG5_cavity_iso;
110 MMG3D_PROctreein = MMG3D_PROctreein_iso;
111#endif
112 }
113}
114
115int MMG3D_Get_adjaTet(MMG5_pMesh mesh, MMG5_int kel, MMG5_int listet[4]) {
116 MMG5_int idx;
117
118 if ( ! mesh->adja ) {
119 if (! MMG3D_hashTetra(mesh, 0))
120 return 0;
121 }
122
123 idx = 4*(kel-1);
124 listet[0] = mesh->adja[idx+1]/4;
125 listet[1] = mesh->adja[idx+2]/4;
126 listet[2] = mesh->adja[idx+3]/4;
127 listet[3] = mesh->adja[idx+4]/4;
128
129 return 1;
130}
131
132int MMG3D_usage(char *prog) {
133
134 /* Common generic options, file options and mode options */
135 MMG5_mmgUsage(prog);
136
137 /* Lagrangian option (only for mmg2d/3d) */
139
140 /* Common parameters (first section) */
142
143 /* Parameters shared by mmg2d and 3d only*/
145
146#ifndef MMG_PATTERN
147 fprintf(stdout,"-octree val specify the max number of points per octree cell \n");
148#endif
149#ifdef USE_SCOTCH
150 fprintf(stdout,"-rn [n] turn on or off the renumbering using SCOTCH [1/0] \n");
151#endif
152 fprintf(stdout,"\n");
153
154 fprintf(stdout,"-nofem do not force Mmg to create a finite element mesh \n");
155 fprintf(stdout,"-nosurf no surface modifications\n");
156
157 fprintf(stdout,"\n");
158
159 /* Common parameters (second section) */
161
162 fprintf(stdout,"-optimLES enable skewness improvement (for LES computations)\n");
163
164 /* Common options for advanced users */
166
167 fprintf(stdout,"\n\n");
168
169 return 1;
170}
171
173
175
176#ifndef MMG_PATTERN
177 fprintf(stdout,"Max number of point per octree cell (-octree) : %d\n",
179#endif
180#ifdef USE_SCOTCH
181 fprintf(stdout,"SCOTCH renumbering : enabled\n");
182#else
183 fprintf(stdout,"SCOTCH renumbering : disabled\n");
184#endif
185 fprintf(stdout,"\n\n");
186
187 return 1;
188}
189
190// In ls mode : metric must be provided using -met option (-sol or default is the ls).
191// In adp mode : -sol or -met or default allow to store the metric.
192int MMG3D_parsar(int argc,char *argv[],MMG5_pMesh mesh,MMG5_pSol met,MMG5_pSol sol) {
193 MMG5_pSol tmp = NULL;
194 int i;
195 char namein[MMG5_FILESTR_LGTH];
196
197 /* First step: search if user want to see the default parameters values. */
198 for ( i=1; i< argc; ++i ) {
199 if ( !strcmp(argv[i],"-val") ) {
200 if ( !MMG3D_defaultValues(mesh) ) return 0;
201 return 0;
202 }
203 }
204
205 /* Second step: read all other arguments. */
206 i = 1;
207 while ( i < argc ) {
208 if ( *argv[i] == '-' ) {
209 switch(argv[i][1]) {
210 case '?':
211 MMG3D_usage(argv[0]);
212 return 0;
213
214 case 'a':
215 if ( !strcmp(argv[i],"-ar") && ++i < argc )
217 atof(argv[i])) )
218 return 0;
219 break;
220 case 'A': /* anisotropy */
222 return 0;
223 break;
224 case 'd':
225 if ( !strcmp(argv[i],"-default") ) {
226 mesh->mark=1;
227 }
228 else {
229 /* debug */
231 return 0;
232 }
233 }
234 break;
235 case 'h':
236 if ( !strcmp(argv[i],"-hmin") && ++i < argc ) {
238 atof(argv[i])) )
239 return 0;
240 }
241 else if ( !strcmp(argv[i],"-hmax") && ++i < argc ) {
243 atof(argv[i])) )
244 return 0;
245 }
246 else if ( !strcmp(argv[i],"-hsiz") && ++i < argc ) {
248 atof(argv[i])) )
249 return 0;
250
251 }
252 else if ( !strcmp(argv[i],"-hausd") && ++i <= argc ) {
254 atof(argv[i])) )
255 return 0;
256 }
257 else if ( !strcmp(argv[i],"-hgradreq") && ++i <= argc ) {
259 atof(argv[i])) )
260 return 0;
261 }
262 else if ( !strcmp(argv[i],"-hgrad") && ++i <= argc ) {
264 atof(argv[i])) )
265 return 0;
266 }
267 else {
268 MMG3D_usage(argv[0]);
269 return 0;
270 }
271 break;
272 case 'i':
273 if ( !strcmp(argv[i],"-in") ) {
274 if ( ++i < argc && isascii(argv[i][0]) && argv[i][0]!='-') {
275 if ( !MMG3D_Set_inputMeshName(mesh, argv[i]) )
276 return 0;
277
278 }else{
279 fprintf(stderr,"Missing filname for %c%c\n",argv[i-1][1],argv[i-1][2]);
280 MMG3D_usage(argv[0]);
281 return 0;
282 }
283 }
284 else if ( !strcmp(argv[i],"-isoref") && ++i <= argc ) {
286 atoi(argv[i])) )
287 return 0;
288 }
289 else {
290 MMG3D_usage(argv[0]);
291 return 0;
292 }
293 break;
294 case 'l':
295 if ( !strcmp(argv[i],"-lag") ) {
296 if ( ++i < argc && isdigit(argv[i][0]) ) {
297 if ( !MMG3D_Set_iparameter(mesh,met,MMG3D_IPARAM_lag,atoi(argv[i])) )
298 return 0;
299 }
300 else if ( i == argc ) {
301 fprintf(stderr,"Missing argument option %s\n",argv[i-1]);
302 MMG3D_usage(argv[0]);
303 return 0;
304 }
305 else {
306 fprintf(stderr,"Missing argument option %s\n",argv[i-1]);
307 MMG3D_usage(argv[0]);
308 i--;
309 return 0;
310 }
311 }
312 else if ( !strcmp(argv[i],"-ls") ) {
314 return 0;
315 if ( ++i < argc && (isdigit(argv[i][0]) ||
316 (argv[i][0]=='-' && isdigit(argv[i][1])) ) ) {
317 if ( !MMG3D_Set_dparameter(mesh,met,MMG3D_DPARAM_ls,atof(argv[i])) )
318 return 0;
319 }
320 else i--;
321 }
322 else if ( !strcmp(argv[i],"-lssurf") ) {
324 return 0;
325 if ( ++i < argc && (isdigit(argv[i][0]) ||
326 (argv[i][0]=='-' && isdigit(argv[i][1])) ) ) {
327 if ( !MMG3D_Set_dparameter(mesh,met,MMG3D_DPARAM_ls,atof(argv[i])) )
328 return 0;
329 }
330 else i--;
331 }
332 break;
333 case 'm':
334 if ( !strcmp(argv[i],"-met") ) {
335 if ( !met ) {
336 fprintf(stderr,"No metric structure allocated for %c%c%c option\n",
337 argv[i-1][1],argv[i-1][2],argv[i-1][3]);
338 return 0;
339 }
340 if ( ++i < argc && isascii(argv[i][0]) && argv[i][0]!='-' ) {
341 if ( !MMG3D_Set_inputSolName(mesh,met,argv[i]) )
342 return 0;
343 }
344 else {
345 fprintf(stderr,"Missing filname for %c%c%c\n",argv[i-1][1],argv[i-1][2],argv[i-1][3]);
346 MMG3D_usage(argv[0]);
347 return 0;
348 }
349 }
350 else if ( !strcmp(argv[i],"-m") ) {
351 /* memory */
352 if ( ++i < argc && isdigit(argv[i][0]) ) {
353 if ( !MMG3D_Set_iparameter(mesh,met,MMG3D_IPARAM_mem,atoi(argv[i])) )
354 return 0;
355 }
356 else {
357 fprintf(stderr,"Missing argument option %c\n",argv[i-1][1]);
358 MMG3D_usage(argv[0]);
359 return 0;
360 }
361 }
362 break;
363 case 'n':
364 if ( !strcmp(argv[i],"-nofem") ) {
366 return 0;
367 }
368 else if ( !strcmp(argv[i],"-nreg") ) {
370 return 0;
371 }
372 else if ( !strcmp(argv[i],"-nr") ) {
374 return 0;
375 }
376 else if ( !strcmp(argv[i],"-nsd") ) {
377 if ( ++i < argc && isdigit(argv[i][0]) ) {
378 if ( !MMG3D_Set_iparameter(mesh,met,MMG3D_IPARAM_numsubdomain,atoi(argv[i])) )
379 return 0;
380 }
381 else {
382 fprintf(stderr,"Missing argument option %c\n",argv[i-1][1]);
383 MMG3D_usage(argv[0]);
384 return 0;
385 }
386 }
387 else if ( !strcmp(argv[i],"-noswap") ) {
389 return 0;
390 }
391 else if( !strcmp(argv[i],"-noinsert") ) {
393 return 0;
394 }
395 else if( !strcmp(argv[i],"-nomove") ) {
397 return 0;
398 }
399 else if( !strcmp(argv[i],"-nosurf") ) {
401 return 0;
402 }
403 else if( !strcmp(argv[i],"-nosizreq") ) {
405 return 0;
406 }
407 }
408 break;
409 case 'o':
410 if ( (!strcmp(argv[i],"-out")) || (!strcmp(argv[i],"-o")) ) {
411 if ( ++i < argc && isascii(argv[i][0]) && argv[i][0]!='-') {
412 if ( !MMG3D_Set_outputMeshName(mesh,argv[i]) )
413 return 0;
414 }else{
415 fprintf(stderr,"Missing filname for %c%c%c\n",
416 argv[i-1][1],argv[i-1][2],argv[i-1][3]);
417 MMG3D_usage(argv[0]);
418 return 0;
419 }
420 }
421 else if ( !strcmp(argv[i],"-opnbdy") ) {
423 return 0;
424 }
425#ifndef MMG_PATTERN
426 else if ( !strcmp(argv[i],"-octree") && ++i < argc ) {
428 atoi(argv[i])) )
429 return 0;
430 }
431#endif
432 else if( !strcmp(argv[i],"-optimLES") ) {
434 return 0;
435 }
436 else if( !strcmp(argv[i],"-optim") ) {
438 return 0;
439 }
440 break;
441 case 'r':
442 if ( !strcmp(argv[i],"-rmc") ) {
444 return 0;
445 if ( ++i < argc && (isdigit(argv[i][0]) ) ) {
446 if ( !MMG3D_Set_dparameter(mesh,met,MMG3D_DPARAM_rmc,atof(argv[i])) )
447 return 0;
448 }
449 else i--;
450 }
451#ifdef USE_SCOTCH
452 else if ( !strcmp(argv[i],"-rn") ) {
453 if ( ++i < argc ) {
454 if ( isdigit(argv[i][0]) ) {
455 if ( !MMG3D_Set_iparameter(mesh,met,MMG3D_IPARAM_renum,atoi(argv[i])) )
456 return 0;
457 }
458 else {
459 fprintf(stderr,"Missing argument option %s\n",argv[i-1]);
460 MMG3D_usage(argv[0]);
461 return 0;
462 }
463 }
464 else {
465 fprintf(stderr,"Missing argument option %s\n",argv[i-1]);
466 MMG3D_usage(argv[0]);
467 return 0;
468 }
469 }
470#endif
471 else {
472 fprintf(stderr,"Unrecognized option %s\n",argv[i]);
473 MMG3D_usage(argv[0]);
474 return 0;
475 }
476 break;
477 case 's':
478 if ( !strcmp(argv[i],"-sol") ) {
479 /* For retrocompatibility, store the metric if no sol structure available */
480 tmp = sol ? sol : met;
481 assert(tmp);
482 if ( ++i < argc && isascii(argv[i][0]) && argv[i][0]!='-' ) {
483 if ( !MMG3D_Set_inputSolName(mesh,tmp,argv[i]) )
484 return 0;
485 }
486 else {
487 fprintf(stderr,"Missing filname for %c%c%c\n",argv[i-1][1],argv[i-1][2],argv[i-1][3]);
488 MMG3D_usage(argv[0]);
489 return 0;
490 }
491 }
492 break;
493 case 'v':
494 if ( ++i < argc ) {
495 if ( isdigit(argv[i][0]) ||
496 (argv[i][0]=='-' && isdigit(argv[i][1])) ) {
497 if ( !MMG3D_Set_iparameter(mesh,met,MMG3D_IPARAM_verbose,atoi(argv[i])) )
498 return 0;
499 }
500 else {
501 i--;
502 fprintf(stderr,"Missing argument option %s\n",argv[i]);
503 }
504 }
505 else {
506 fprintf(stderr,"Missing argument option %s\n",argv[i-1]);
507 MMG3D_usage(argv[0]);
508 return 0;
509 }
510 break;
511 case 'x':
512 if ( !strcmp(argv[i],"-xreg") ) {
514 return 0;
515 }
516 break;
517 default:
518 fprintf(stderr,"Unrecognized option %s\n",argv[i]);
519 MMG3D_usage(argv[0]);
520 return 0;
521 }
522 }
523 else {
524 if ( mesh->namein == NULL ) {
525 if ( !MMG3D_Set_inputMeshName(mesh,argv[i]) )
526 return 0;
527 if ( mesh->info.imprim == -99 ) {
529 return 0;
530 }
531 }
532 else if ( mesh->nameout == NULL ) {
533 if ( !MMG3D_Set_outputMeshName(mesh,argv[i]) )
534 return 0;
535 }
536 else {
537 fprintf(stdout,"Argument %s ignored\n",argv[i]);
538 MMG3D_usage(argv[0]);
539 return 0;
540 }
541 }
542 i++;
543 }
544
545 /* check file names */
546 if ( mesh->info.imprim == -99 ) {
547 fprintf(stdout,"\n -- PRINT (0 10(advised) -10) ?\n");
548 fflush(stdin);
549 MMG_FSCANF(stdin,"%d",&i);
551 return 0;
552 }
553
554 if ( mesh->namein == NULL ) {
555 fprintf(stdout," -- INPUT MESH NAME ?\n");
556 fflush(stdin);
557 MMG_FSCANF(stdin,"%127s",namein);
558 if ( !MMG3D_Set_inputMeshName(mesh,namein) )
559 return 0;
560 }
561
562 if ( mesh->nameout == NULL ) {
564 return 0;
565 }
566
567 /* adp mode: if the metric name has been stored in sol, move it in met */
568 if ( met->namein==NULL && sol && sol->namein && !(mesh->info.iso || mesh->info.isosurf || mesh->info.lag>=0) ) {
570 return 0;
572 }
573
574 /* default : store solution (resp. displacement) name in iso
575 * (resp. lagrangian) mode, metric name otherwise */
576 tmp = ( mesh->info.iso || mesh->info.isosurf || mesh->info.lag >=0 ) ? sol : met;
577 assert ( tmp );
578 if ( tmp->namein == NULL ) {
579 if ( !MMG3D_Set_inputSolName(mesh,tmp,"") ) { return 0; }
580 }
581 if ( met->nameout == NULL ) {
582 if ( !MMG3D_Set_outputSolName(mesh,met,"") )
583 return 0;
584 }
585
586 return 1;
587}
588
590 float fp1,fp2,hausd;
591 int i,j,ret,npar,nbr,split;
592 MMG5_int ref,rin,rex,br;
593 char *ptr,buf[256],data[256];
594 FILE *in;
595 fpos_t position;
596
597 /* check for parameter file */
598 strcpy(data,mesh->namein);
599 ptr = strstr(data,".mesh");
600 if ( ptr ) *ptr = '\0';
601 strcat(data,".mmg3d");
602 in = fopen(data,"rb");
603 if ( !in ) {
604 strcat(data,".mmg3d5");
605 in = fopen(data,"rb");
606 if ( !in ) {
607 sprintf(data,"%s","DEFAULT.mmg3d");
608 in = fopen(data,"rb");
609 if ( !in ) {
610 sprintf(data,"%s","DEFAULT.mmg3d5");
611 in = fopen(data,"rb");
612 if ( !in ) {
613 return 1;
614 }
615 }
616 }
617 }
618 if ( mesh->info.imprim >= 0 )
619 fprintf(stdout,"\n %%%% %s OPENED\n",data);
620
621 /* read parameters */
622 while ( !feof(in) ) {
623 /* scan line */
624 ret = fscanf(in,"%255s",data);
625 if ( !ret || feof(in) ) break;
626 for (i=0; i<strlen(data); i++) data[i] = tolower(data[i]);
627
628 /* Read user-defined references for the LS mode */
629 if ( !strcmp(data,"lsreferences") ) {
630 ret = fscanf(in,"%d",&npar);
631 if ( !ret ) {
632 fprintf(stderr," %%%% Wrong format for lsreferences: %d\n",npar);
633 return 0;
634 }
635
637 return 0;
638 }
639 for (i=0; i<mesh->info.nmat; i++) {
640 MMG_FSCANF(in,"%" MMG5_PRId "",&ref);
641 fgetpos(in,&position);
642 MMG_FSCANF(in,"%255s",data);
643 split = MMG5_MMAT_NoSplit;
644 rin = rex = ref;
645 if ( strcmp(data,"nosplit") ) {
646 fsetpos(in,&position);
647 split = MMG5_MMAT_Split;
648 MMG_FSCANF(in,"%" MMG5_PRId "",&rin);
649 MMG_FSCANF(in,"%" MMG5_PRId "",&rex);
650 }
651 if ( !MMG3D_Set_multiMat(mesh,met,ref,split,rin,rex) ) {
652 return 0;
653 }
654 }
655 }
656 /* Read user-defined local parameters and store them in the structure info->par */
657 else if ( !strcmp(data,"parameters") ) {
658 ret = fscanf(in,"%d",&npar);
659
660 if ( !ret ) {
661 fprintf(stderr," %%%% Wrong format for parameters: %d\n",npar);
662 return 0;
663 }
664
666 return 0;
667 }
668
669 for (i=0; i<mesh->info.npar; i++) {
670 ret = fscanf(in,"%" MMG5_PRId " %255s ",&ref,buf);
671 if ( ret )
672 ret = fscanf(in,"%f %f %f",&fp1,&fp2,&hausd);
673
674 if ( !ret ) {
675 fprintf(stderr," %%%% Wrong format: %s\n",buf);
676 return 0;
677 }
678
679 for (j=0; j<strlen(buf); j++) buf[j] = tolower(buf[j]);
680
681 if ( (!strcmp(buf,"triangles") || !strcmp(buf,"triangle")) ) {
682 if ( !MMG3D_Set_localParameter(mesh,met,MMG5_Triangle,ref,fp1,fp2,hausd) ) {
683 return 0;
684 }
685 }
686 else if ( !strcmp(buf,"tetrahedra") || !strcmp(buf,"tetrahedron") ) {
687 if ( !MMG3D_Set_localParameter(mesh,met,MMG5_Tetrahedron,ref,fp1,fp2,hausd) ) {
688 return 0;
689 }
690 }
691 else {
692 fprintf(stderr," %%%% Wrong format: %s\n",buf);
693 return 0;
694 }
695 }
696 }
697 else if ( !strcmp(data,"lsbasereferences") ) {
698 MMG_FSCANF(in,"%d",&nbr);
700 return 0;
701
702 for (i=0; i<mesh->info.nbr; i++) {
703 MMG_FSCANF(in,"%" MMG5_PRId "",&br);
704 if ( !MMG3D_Set_lsBaseReference(mesh,met,br) ) {
705 return 0;
706 }
707 }
708 }
709 }
710 fclose(in);
711 return 1;
712}
713
715
716 free(mesh->info.par);
717 mesh->info.npar = 0;
718
719 return 1;
720}
721
723 MMG5_pTetra pt,pt1;
724 MMG5_pPrism pp;
725 MMG5_pTria ptt;
726 MMG5_Hash hash;
727 int i;
728 MMG5_int ref,*adja,j,k,iel;
729
730 *nb_tria = 0;
731 memset ( &hash, 0x0, sizeof(MMG5_Hash));
732
733 if ( !mesh->tetra ) {
734 /* No triangle at all */
735 return 1;
736 }
737
740 if ( !mesh->adja ) {
741 /* create tetra adjacency */
742 if ( !MMG3D_hashTetra( mesh,0 ) ) {
743 fprintf(stderr,"\n ## Error: %s: unable to create "
744 "adjacency table.\n",__func__);
745 return 0;
746 }
747 }
748
749 if ( !mesh->adjapr ) {
750 /* create prism adjacency */
751 if ( !MMG3D_hashPrism(mesh) ) {
752 fprintf(stderr,"\n ## Error: %s: Prism hashing problem.\n",__func__);
753 return 0;
754 }
755 }
756
757 /* If mesh->xtetra is filled, we assume that the surface analysis is
758 * complete */
759 if ( !mesh->xtetra ) {
760 /* compatibility triangle orientation w/r tetras */
761 if ( !MMG5_bdryPerm(mesh) ) {
762 fprintf(stderr,"\n ## Error: %s: Boundary orientation problem.\n",__func__);
763 return 0;
764 }
765 /* identify surface mesh */
766 if ( !MMG5_chkBdryTria(mesh) ) {
767 fprintf(stderr,"\n ## Error: %s: Boundary problem.\n",__func__);
768 return 0;
769 }
772
773 /* create surface adjacency */
774 if ( !MMG3D_hashTria(mesh,&hash) ) {
775 MMG5_DEL_MEM(mesh,hash.item);
776 fprintf(stderr,"\n ## Error: %s: Hashing problem.\n",__func__);
777 return 0;
778 }
779
780 /* identify connexity and flip orientation of faces if needed */
781 if ( !MMG5_setadj(mesh) ) {
782 fprintf(stderr,"\n ## Error: %s: Topology problem.\n",__func__);
783 MMG5_DEL_MEM(mesh,hash.item);
784 return 0;
785 }
786
787 /* set bdry entities to tetra and fill the orientation field */
788 if ( !MMG5_bdrySet(mesh) ) {
789 MMG5_DEL_MEM(mesh,hash.item);
790 fprintf(stderr,"\n ## Error: %s: Boundary problem.\n",__func__);
791 return 0;
792 }
793 MMG5_DEL_MEM(mesh,hash.item);
794 }
795
797 for ( k=1; k<=mesh->ne; k++ ) {
798 pt = &mesh->tetra[k];
799 if ( !MG_EOK(pt) ) continue;
800
801 adja = &mesh->adja[4*(k-1)+1];
802
803 for ( i=0; i<4; i++ ) {
804 iel = adja[i] / 4;
805 assert ( iel != k );
806
807 pt1 = &mesh->tetra[iel];
808
809 if ( (!iel) || (pt->ref != pt1->ref) ||
810 (mesh->info.opnbdy && pt->xt &&
811 (mesh->xtetra[pt->xt].ftag[i] & MG_BDY) ) ) {
812 /* Do not treat boundary faces */
813 continue;
814 }
815 if ( k < iel ) {
816 /* Treat face from the tetra with lowest index */
817 ++(*nb_tria);
818 }
819 }
820 }
821 for ( k=1; k<=mesh->nprism; k++ ) {
822 pp = &mesh->prism[k];
823 if ( !MG_EOK(pp) ) continue;
824
825 adja = &mesh->adjapr[5*(k-1)+1];
826
827 for ( i=0; i<2; i++ ) {
828 iel = adja[i] / 5;
829
830 if ( iel<0 ) {
831 ref = mesh->tetra[MMG5_abs(iel)].ref;
832 } else {
833 ref = mesh->prism[iel].ref;
834 }
835
836 if ( (!iel) || (pp->ref != ref) ||
837 (mesh->info.opnbdy && pp->xpr &&
838 (mesh->xprism[pp->xpr].ftag[i] & MG_BDY) ) ) {
839 /* Do not treat boundary faces */
840 continue;
841 }
842 if ( k < iel ) {
843 /* Treat face from the element with lowest index */
844 ++(*nb_tria);
845 }
846 }
847 }
848
849 if ( !(*nb_tria) ) {
850 return 1;
851 }
852
854 if ( mesh->nt ) {
855 MMG5_ADD_MEM(mesh,(*nb_tria)*sizeof(MMG5_Tria),"non boundary triangles",
856 printf(" Exit program.\n");
857 MMG5_DEL_MEM(mesh,hash.item);
858 return 0);
859 MMG5_SAFE_RECALLOC(mesh->tria,(mesh->nt+1),(mesh->nt+(*nb_tria)+1),
860 MMG5_Tria,"non bdy tria arrray",return 0);
861 }
862 else {
863 MMG5_ADD_MEM(mesh,((*nb_tria)+1)*sizeof(MMG5_Tria),"non boundary triangles",
864 printf(" Exit program.\n");
865 MMG5_DEL_MEM(mesh,hash.item);
866 return 0);
867 MMG5_SAFE_RECALLOC(mesh->tria,0,((*nb_tria)+1),
868 MMG5_Tria,"non bdy tria arrray",return 0);
869 }
870
871 j = mesh->nt+1;
872 for ( k=1; k<=mesh->ne; k++ ) {
873 pt = &mesh->tetra[k];
874 if ( !MG_EOK(pt) ) continue;
875
876 adja = &mesh->adja[4*(k-1)+1];
877
878 for ( i=0; i<4; i++ ) {
879 iel = adja[i] / 4;
880 assert ( iel != k );
881
882 pt1 = &mesh->tetra[iel];
883
884 if ( (!iel) || (pt->ref != pt1->ref) ||
885 (mesh->info.opnbdy && pt->xt &&
886 (mesh->xtetra[pt->xt].ftag[i] & MG_BDY)) ) {
887 /* Do not treat boundary faces */
888 continue;
889 }
890 if ( k < iel ) {
891 /* Treat edge from the triangle with lowest index */
892 ptt = &mesh->tria[j++];
893 assert ( ptt );
894 ptt->v[0] = pt->v[MMG5_idir[i][0]];
895 ptt->v[1] = pt->v[MMG5_idir[i][1]];
896 ptt->v[2] = pt->v[MMG5_idir[i][2]];
897 ptt->ref = mesh->xtetra[pt->xt].ref[i];
898 }
899 }
900 }
901
902 for ( k=1; k<=mesh->nprism; k++ ) {
903 pp = &mesh->prism[k];
904 if ( !MG_EOK(pp) ) continue;
905
906 adja = &mesh->adjapr[5*(k-1)+1];
907
908 for ( i=0; i<2; i++ ) {
909 iel = adja[i] / 5;
910
911 if ( iel<0 ) {
912 ref = mesh->tetra[MMG5_abs(iel)].ref;
913 } else {
914 ref = mesh->prism[iel].ref;
915 }
916 if ( (!iel) || (pp->ref != ref) ||
917 (mesh->info.opnbdy && pp->xpr &&
918 (mesh->xprism[pp->xpr].ftag[i] & MG_BDY)) ) {
919 /* Do not treat boundary faces */
920 continue;
921 }
922 if ( k < iel ) {
923 /* Treat edge from the triangle with lowest index */
924 ptt = &mesh->tria[j++];
925 assert ( ptt );
926 ptt->v[0] = pp->v[MMG5_idir_pr[i][0]];
927 ptt->v[1] = pp->v[MMG5_idir_pr[i][1]];
928 ptt->v[2] = pp->v[MMG5_idir_pr[i][2]];
929 ptt->ref = mesh->xprism[pp->xpr].ref[i];
930 }
931 }
932 }
933
934 return 1;
935}
936
937int MMG3D_Get_nonBdyTriangle(MMG5_pMesh mesh,MMG5_int* v0,MMG5_int* v1,MMG5_int* v2,
938 MMG5_int* ref,MMG5_int idx) {
939 MMG5_pTria ptt;
940 size_t nt_tot=0;
941 char *ptr_c = (char*)mesh->tria;
942
943 if ( !mesh->tria ) {
944 fprintf(stderr,"\n ## Error: %s: triangle array is not allocated.\n"
945 " Please, call the MMG3D_Get_numberOfNonBdyTriangles function"
946 " before the %s one.\n",
947 __func__,__func__);
948 return 0;
949 }
950
951 ptr_c = ptr_c-sizeof(size_t);
952 nt_tot = *((size_t*)ptr_c);
953
954 if ( mesh->nt==(MMG5_int)nt_tot ) {
955 fprintf(stderr,"\n ## Error: %s: no internal triangle.\n"
956 " Please, call the MMG3D_Get_numberOfNonBdyTriangles function"
957 " before the %s one and check that the number of internal"
958 " triangles is non null.\n",
959 __func__,__func__);
960 return 0;
961 }
962
963 if ( mesh->nt+idx > (MMG5_int)nt_tot ) {
964 fprintf(stderr,"\n ## Error: %s: Can't get the internal triangle of index %" MMG5_PRId "."
965 " Index must be between 1 and %zu.\n",
966 __func__,idx,nt_tot-(size_t)mesh->nt);
967 return 0;
968 }
969
970 ptt = &mesh->tria[mesh->nt+idx];
971
972 *v0 = ptt->v[0];
973 *v1 = ptt->v[1];
974 *v2 = ptt->v[2];
975
976 if ( ref != NULL ) {
977 *ref = ptt->ref;
978 }
979
980 return 1;
981}
982
984
985 memcpy(&mesh->info,info,sizeof(MMG5_Info));
987 if( mesh->info.mem > 0) {
988 if((mesh->npmax < mesh->np || mesh->ntmax < mesh->nt || mesh->nemax < mesh->ne)) {
989 return 0;
990 } else if(mesh->info.mem < 39)
991 return 0;
992 }
993 return 1;
994}
995
997
998 memcpy(info,&mesh->info,sizeof(MMG5_Info));
999 return;
1000}
1001
1002int MMG3D_mmg3dcheck(MMG5_pMesh mesh,MMG5_pSol met,MMG5_pSol sol,double critmin, double lmin,
1003 double lmax, MMG5_int *eltab,int8_t metRidTyp) {
1004
1005 mytime ctim[TIMEMAX];
1006 int ier;
1007 char stim[32];
1008
1010
1014
1015 signal(SIGABRT,MMG5_excfun);
1016 signal(SIGFPE,MMG5_excfun);
1017 signal(SIGILL,MMG5_excfun);
1018 signal(SIGSEGV,MMG5_excfun);
1019 signal(SIGTERM,MMG5_excfun);
1020 signal(SIGINT,MMG5_excfun);
1021
1022 tminit(ctim,TIMEMAX);
1023 chrono(ON,&(ctim[0]));
1024
1025 /* Check options */
1026 if ( mesh->info.lag > -1 ) {
1027 fprintf(stderr,"\n ## Error: lagrangian mode unavailable (MMG3D_IPARAM_lag):\n"
1028 " You must call the MMG3D_mmg3dmov function to move a rigidbody.\n");
1030 }
1031 else if ( mesh->info.iso ) {
1032 fprintf(stderr,"\n ## Error: level-set discretisation unavailable"
1033 " (MMG3D_IPARAM_iso):\n"
1034 " You must call the MMG3D_mmg3dmov function to use this option.\n");
1036 }
1037
1038#ifdef USE_SCOTCH
1040#endif
1041
1042 if ( mesh->info.imprim > 0 ) fprintf(stdout,"\n -- MMG3DLIB: INPUT DATA\n");
1043 /* load data */
1044 chrono(ON,&(ctim[1]));
1046
1047 if ( met ) {
1048 if ( met->np && (met->np != mesh->np) ) {
1049 fprintf(stdout," ## WARNING: WRONG SOLUTION NUMBER. IGNORED\n");
1050 MMG5_DEL_MEM(mesh,met->m);
1051 met->np = 0;
1052 }
1053 else if ( met->size!=1 && met->size!=6 ) {
1054 fprintf(stderr,"\n ## ERROR: WRONG DATA TYPE.\n");
1056 }
1057 }
1058 if ( sol ) {
1059 if ( sol->np && (sol->np != mesh->np) ) {
1060 fprintf(stdout," ## WARNING: WRONG SOLUTION NUMBER. IGNORED\n");
1061 MMG5_DEL_MEM(mesh,sol->m);
1062 sol->np = 0;
1063 }
1064 else if ( sol->size!=1 && sol->size!=6 ) {
1065 fprintf(stderr,"\n ## ERROR: WRONG DATA TYPE.\n");
1067 }
1068 }
1069
1070 chrono(OFF,&(ctim[1]));
1071 printim(ctim[1].gdif,stim);
1072 if ( mesh->info.imprim > 0 )
1073 fprintf(stdout," -- INPUT DATA COMPLETED. %s\n",stim);
1074
1075 /* analysis */
1076 chrono(ON,&(ctim[2]));
1077 MMG3D_setfunc(mesh,met);
1078
1079 if ( mesh->info.imprim > 0 ) {
1080 fprintf(stdout,"\n %s\n MODULE MMG3D: IMB-LJLL : %s (%s)\n %s\n",
1081 MG_STR,MMG_VERSION_RELEASE,MMG_RELEASE_DATE,MG_STR);
1082 fprintf(stdout,"\n -- PHASE 1 : ANALYSIS\n");
1083 }
1084
1085 /* scaling mesh */
1087
1088
1089 MMG3D_searchqua(mesh,met,critmin,eltab,metRidTyp);
1090 ier = MMG3D_searchlen(mesh,met,lmin,lmax,eltab,metRidTyp);
1091 if ( !ier )
1093
1095}
1096
1097void MMG3D_searchqua(MMG5_pMesh mesh,MMG5_pSol met,double critmin, MMG5_int *eltab,
1098 int8_t metRidTyp) {
1099 MMG5_pTetra pt;
1100 double rap;
1101 MMG5_int k;
1102
1103 assert ( met );
1104
1105 for (k=1; k<=mesh->ne; k++) {
1106 pt = &mesh->tetra[k];
1107
1108 if( !MG_EOK(pt) )
1109 continue;
1110
1111 if ( (!metRidTyp) && met->m && met->size>1 ) {
1112 rap = MMG3D_ALPHAD * MMG5_caltet33_ani(mesh,met,pt);
1113 }
1114 else {
1115 rap = MMG3D_ALPHAD * MMG5_caltet(mesh,met,pt);
1116 }
1117
1118 if ( rap == 0.0 || rap < critmin ) {
1119 eltab[k] = 1;
1120 }
1121 }
1122 return;
1123}
1124
1125int MMG3D_Get_tetFromTria(MMG5_pMesh mesh, MMG5_int ktri, MMG5_int *ktet, int *iface) {
1126 MMG5_int val;
1127
1128 val = mesh->tria[ktri].cc;
1129
1130 if ( !val ) {
1131 fprintf(stderr," ## Error: %s: the main fonction of the Mmg library must be"
1132 " called before this function.\n",__func__);
1133 return 0;
1134 }
1135
1136 *ktet = val/4;
1137
1138 *iface = val%4;
1139
1140 return 1;
1141}
1142
1143
1144int MMG3D_Get_tetsFromTria(MMG5_pMesh mesh, MMG5_int ktri, MMG5_int ktet[2], int iface[2])
1145{
1146 int ier;
1147 MMG5_int itet;
1148#ifndef NDEBUG
1149 MMG5_int ia0,ib0,ic0,ia1,ib1,ic1;
1150#endif
1151
1152 ktet[0] = ktet[1] = 0;
1153 iface[0] = iface[1] = 0;
1154
1155 ier = MMG3D_Get_tetFromTria(mesh,ktri,ktet,iface);
1156
1157 if ( !ier ) return 0;
1158
1159 if ( !mesh->adja ) {
1160 if (!MMG3D_hashTetra(mesh, 0) )
1161 return 0;
1162 }
1163
1164 itet = mesh->adja[4*(*ktet-1) + *iface + 1 ];
1165
1166 if ( itet ) {
1167 ktet[1] = itet/4;
1168 iface[1] = itet%4;
1169
1170#ifndef NDEBUG
1171 ia0 = mesh->tetra[ktet[0]].v[MMG5_idir[iface[0]][0]];
1172 ib0 = mesh->tetra[ktet[0]].v[MMG5_idir[iface[0]][1]];
1173 ic0 = mesh->tetra[ktet[0]].v[MMG5_idir[iface[0]][2]];
1174
1175 ia1 = mesh->tetra[ktet[1]].v[MMG5_idir[iface[1]][0]];
1176 ib1 = mesh->tetra[ktet[1]].v[MMG5_idir[iface[1]][1]];
1177 ic1 = mesh->tetra[ktet[1]].v[MMG5_idir[iface[1]][2]];
1178
1179 assert ( ( (ia0 == ia1) && ((ib0 == ic1) && (ic0 == ib1 )) ) ||
1180 ( (ia0 == ib1) && ((ib0 == ia1) && (ic0 == ic1 )) ) ||
1181 ( (ia0 == ic1) && ((ib0 == ib1) && (ic0 == ia1 )) ) );
1182#endif
1183 }
1184
1185 return 1;
1186}
1187
1188
1190 double lmax, MMG5_int *eltab,int8_t metRidTyp) {
1191 MMG5_pTetra pt;
1192 MMG5_Hash hash;
1193 double len;
1194 MMG5_int k,np,nq;
1195 int8_t ia,i0,i1,ier;
1196
1197 /* Hash all edges in the mesh */
1198 if ( !MMG5_hashNew(mesh,&hash,mesh->np,7*mesh->np) ) return 0;
1199
1200 for(k=1; k<=mesh->ne; k++) {
1201 pt = &mesh->tetra[k];
1202 if ( !MG_EOK(pt) ) continue;
1203
1204 for(ia=0; ia<6; ia++) {
1205 i0 = MMG5_iare[ia][0];
1206 i1 = MMG5_iare[ia][1];
1207 np = pt->v[i0];
1208 nq = pt->v[i1];
1209
1210 if(!MMG5_hashEdge(mesh,&hash,np,nq,0)){
1211 fprintf(stderr,"\n ## Error: %s: function MMG5_hashEdge return 0\n",
1212 __func__);
1213 return 0;
1214 }
1215 }
1216 }
1217
1218 /* Pop edges from hash table, and analyze their length */
1219 for(k=1; k<=mesh->ne; k++) {
1220 pt = &mesh->tetra[k];
1221 if ( !MG_EOK(pt) ) continue;
1222
1223 for(ia=0; ia<6; ia++) {
1224 i0 = MMG5_iare[ia][0];
1225 i1 = MMG5_iare[ia][1];
1226 np = pt->v[i0];
1227 nq = pt->v[i1];
1228
1229 /* Remove edge from hash ; ier = 1 if edge has been found */
1230 ier = MMG5_hashPop(&hash,np,nq);
1231 if( ier ) {
1232 if ( (!metRidTyp) && met->m && met->size>1 ) {
1233 len = MMG5_lenedg(mesh,met,ia,pt);
1234 }
1235 else {
1236 len = MMG5_lenedg33_ani(mesh,met,ia,pt);
1237 }
1238
1239 if( (len < lmin) || (len > lmax) ) {
1240 eltab[k] = 1;
1241 break;
1242 }
1243 }
1244 }
1245 }
1246 MMG5_DEL_MEM(mesh,hash.item);
1247 return 1;
1248}
1249
1261static inline
1263 MMG5_pTetra pt;
1264 MMG5_int k;
1265 int i,ier;
1266
1267 assert ( mesh->info.optim );
1268
1269 /* Detect the point not used by the mesh */
1270 ++mesh->base;
1271
1272#ifndef NDEBUG
1273 for (k=1; k<=mesh->np; k++) {
1274 assert ( mesh->point[k].flag < mesh->base );
1275 }
1276#endif
1277
1278 /* For mmg3d, detect points used by tetra */
1279 for (k=1; k<=mesh->ne; k++) {
1280 pt = &mesh->tetra[k];
1281 if ( !MG_EOK(pt) ) continue;
1282
1283 for (i=0; i<4; i++) {
1284 mesh->point[pt->v[i]].flag = mesh->base;
1285 }
1286 }
1287
1288 /* Compute hmin/hmax on unflagged points and truncate the metric */
1289 if ( !ani ) {
1291 }
1292 else {
1293 MMG5_solTruncature_ani = MMG5_3dSolTruncature_ani;
1295 }
1296
1297 return ier;
1298}
1299
1311 MMG5_pTetra pt;
1312 MMG5_pPoint p1,p2;
1313 double ux,uy,uz,dd;
1314 MMG5_int k,ipa,ipb;
1315 int i,ia,ib,type;
1316 // we guess that we have less than INT32_MAX edges passing through a point
1317 int *mark;
1318
1319 MMG5_SAFE_CALLOC(mark,mesh->np+1,int,return 0);
1320
1321 /* Memory alloc */
1322 if ( met->size!=1 ) {
1323 fprintf(stderr,"\n ## Error: %s: unexpected size of metric: %d.\n",
1324 __func__,met->size);
1325 return 0;
1326 }
1327
1328 type=1;
1329 if ( !MMG3D_Set_solSize(mesh,met,MMG5_Vertex,mesh->np,type) )
1330 return 0;
1331
1332 /* Travel the triangles edges and add the edge contribution to edges
1333 * extermities */
1334 for (k=1; k<=mesh->ne; k++) {
1335 pt = &mesh->tetra[k];
1336 if ( !MG_EOK(pt) ) continue;
1337
1338 for (i=0; i<6; i++) {
1339 ia = MMG5_iare[i][0];
1340 ib = MMG5_iare[i][1];
1341 ipa = pt->v[ia];
1342 ipb = pt->v[ib];
1343 p1 = &mesh->point[ipa];
1344 p2 = &mesh->point[ipb];
1345
1346 ux = p1->c[0] - p2->c[0];
1347 uy = p1->c[1] - p2->c[1];
1348 uz = p1->c[2] - p2->c[2];
1349 dd = sqrt(ux*ux + uy*uy + uz*uz);
1350
1351 met->m[ipa] += dd;
1352 mark[ipa]++;
1353 met->m[ipb] += dd;
1354 mark[ipb]++;
1355 }
1356 }
1357
1358 /* vertex size */
1359 for (k=1; k<=mesh->np; k++) {
1360 if ( !mark[k] ) {
1361 continue;
1362 }
1363 else
1364 met->m[k] = met->m[k] / (double)mark[k];
1365 }
1366
1367 MMG5_SAFE_FREE(mark);
1368
1369 /* Metric truncation */
1371
1372 return 1;
1373}
1374
1386 MMG5_pTetra pt;
1387 MMG5_pPoint p1,p2;
1388 double u[3],dd,tensordot[6];
1389 MMG5_int k,iadr,ipa,ipb;
1390 int i,j,type;
1391 // we guess that we have less than INT32_MAX edges passing through a point
1392 int *mark;
1393
1394 MMG5_SAFE_CALLOC(mark,mesh->np+1,int,return 0);
1395
1396 /* Memory alloc */
1397 if ( met->size!=6 ) {
1398 fprintf(stderr,"\n ## Error: %s: unexpected size of metric: %d.\n",
1399 __func__,met->size);
1400 return 0;
1401 }
1402
1403 type = 3;
1404 if ( !MMG3D_Set_solSize(mesh,met,MMG5_Vertex,mesh->np,type) )
1405 return 0;
1406
1407 /* Travel the tetra edges and add the edge contribution to edges
1408 * extermities */
1409 for (k=1; k<=mesh->ne; k++) {
1410 pt = &mesh->tetra[k];
1411 if ( !MG_EOK(pt) ) continue;
1412
1413 for (i=0; i<6; i++) {
1414 ipa = pt->v[MMG5_iare[i][0]];
1415 ipb = pt->v[MMG5_iare[i][1]];
1416 p1 = &mesh->point[ipa];
1417 p2 = &mesh->point[ipb];
1418
1419 u[0] = p1->c[0] - p2->c[0];
1420 u[1] = p1->c[1] - p2->c[1];
1421 u[2] = p1->c[2] - p2->c[2];
1422
1423 tensordot[0] = u[0]*u[0];
1424 tensordot[1] = u[0]*u[1];
1425 tensordot[2] = u[0]*u[2];
1426 tensordot[3] = u[1]*u[1];
1427 tensordot[4] = u[1]*u[2];
1428 tensordot[5] = u[2]*u[2];
1429
1430 iadr = 6*ipa;
1431 for ( j=0; j<6; ++j ) {
1432 met->m[iadr+j] += tensordot[j];
1433 }
1434 mark[ipa]++;
1435
1436 iadr = 6*ipb;
1437 for ( j=0; j<6; ++j ) {
1438 met->m[iadr+j] += tensordot[j];
1439 }
1440 mark[ipb]++;
1441 }
1442 }
1443
1444 for (k=1; k<=mesh->np; k++) {
1445 if ( !mark[k] ) {
1446 continue;
1447 }
1448
1449 /* Metric = nedges/dim * inv (sum(tensor_dot(edges,edges))).
1450 * sum(tensor_dot) is stored in sol->m so reuse tensordot to
1451 * compute M. */
1452 iadr = 6*k;
1453 if ( !MMG5_invmat(met->m+iadr,tensordot) ) {
1454 /* Non invertible matrix: impose FLT_MIN, it will be truncated by hmax
1455 * later */
1456 fprintf(stdout, " ## Warning: %s: %d: non invertible matrix."
1457 " Impose hmax size at point\n",__func__,__LINE__);
1458 met->m[iadr+0] = FLT_MIN;
1459 met->m[iadr+1] = 0;
1460 met->m[iadr+2] = 0;
1461 met->m[iadr+3] = FLT_MIN;
1462 met->m[iadr+4] = 0;
1463 met->m[iadr+5] = FLT_MIN;
1464 continue;
1465 }
1466
1467 dd = (double)mark[k]/3.;
1468
1469 for ( j=0; j<6; ++j ) {
1470 met->m[iadr+j] = dd*tensordot[j];
1471 }
1472
1473#ifndef NDEBUG
1474 /* Check metric */
1475 double lambda[3],vp[3][3];
1476 if (!MMG5_eigenv3d(1,met->m+iadr,lambda,vp) ) {
1477 fprintf(stdout, " ## Warning: %s: %d: non diagonalizable metric.",
1478 __func__,__LINE__);
1479 }
1480
1481 assert ( lambda[0] > 0. && lambda[1] > 0. && lambda[2] > 0.
1482 && "Negative eigenvalue" );
1483 assert ( isfinite(lambda[0]) && isfinite(lambda[1]) && isfinite(lambda[2])
1484 && "Infinite eigenvalue" );
1485#endif
1486 }
1487
1488 MMG5_SAFE_FREE(mark);
1489
1491
1492 return 1;
1493}
1494
1496 double hsiz;
1497 int type;
1498
1499 /* Set solution size */
1500 if ( mesh->info.ani ) {
1501 met->size = 6;
1502 type = 3;
1503 }
1504 else {
1505 met->size = 1;
1506 type = 1;
1507 }
1508
1509 /* Memory alloc */
1510 if ( !MMG3D_Set_solSize(mesh,met,MMG5_Vertex,mesh->np,type) )
1511 return 0;
1512
1513 if ( !MMG5_Compute_constantSize(mesh,met,&hsiz) )
1514 return 0;
1515
1516 mesh->info.hsiz = hsiz;
1517
1518 MMG5_Set_constantSize(mesh,met,hsiz);
1519
1520 return 1;
1521}
1522
1524 MMG5_int k;
1525 double tmp;
1526
1527 if ( met->size!=6 ) { return 1; }
1528
1529 for ( k=1; k<=met->np; ++k ) {
1530
1531 tmp = met->m[6*k+2];
1532
1533 met->m[6*k+2] = met->m[6*k+3];
1534 met->m[6*k+3] = tmp;
1535
1536 }
1537 return 1;
1538}
1539
1540int MMG3D_Compute_eigenv(double m[6],double lambda[3],double vp[3][3]) {
1541
1542 return MMG5_eigenv3d(1,m,lambda,vp);
1543
1544}
1545
1547
1548 /* sol */
1549 if ( !sol ) return;
1550
1551 if ( sol->m )
1552 MMG5_DEL_MEM(mesh,sol->m);
1553
1554 if ( sol->namein ) {
1556 }
1557
1558 if ( sol->nameout ) {
1560 }
1561
1562 memset ( sol, 0x0, sizeof(MMG5_Sol) );
1563
1564 /* Reset state to a scalar status */
1565 sol->dim = 3;
1566 sol->ver = 2;
1567 sol->size = 1;
1568 sol->type = 1;
1569
1570 return;
1571}
1572
1574 MMG5_int k,nref;
1575
1576 nref = 0;
1578 if ( mesh->tria ) {
1579
1580 MMG5_int nt = mesh->nt;
1581 k = 1;
1582 do {
1583 MMG5_pTria ptt = &mesh->tria[k];
1584
1585 if ( !MG_EOK(ptt) ) {
1586 continue;
1587 }
1588
1589 if ( MMG5_abs(ptt->ref) == mesh->info.isoref ) {
1590 /* Current tria will be suppressed: search last non isosurf tria to fill
1591 * empty position */
1592 MMG5_pTria ptt1 = &mesh->tria[mesh->nt];
1593 assert( ptt1 );
1594
1595 while ( ((!MG_EOK(ptt1)) || (MMG5_abs(ptt1->ref) == mesh->info.isoref))
1596 && k < mesh->nt ) {
1597 --mesh->nt;
1598 ptt1 = &mesh->tria[mesh->nt];
1599
1600 }
1601 if ( ptt != ptt1 ) {
1602 /* We don't find any tria to keep after index k */
1603 memcpy(ptt,ptt1,sizeof(MMG5_Tria));
1604 --mesh->nt;
1605 }
1606 }
1607 /* Initially negative refs were used to mark isosurface: keep following
1608 * piece of code for retrocompatibility */
1609 if ( ptt->ref < 0 ) {
1610 ptt->ref = -ptt->ref;
1611 ++nref;
1612 }
1613 }
1614 while ( ++k < mesh->nt );
1615
1616 /* At the end of the loop, either k==mesh->nt, either k==mesh->nt+1 (because
1617 * tria at idx mesh->nt was iso or unused and element mesh->nt+1 has been
1618 * copied into k) */
1619 assert ( (k==mesh->nt) || (k==mesh->nt+1) );
1620
1621 /* Check if last element is iso */
1622 MMG5_pTria ptt = &mesh->tria[mesh->nt];
1623 if ( (!MG_EOK(ptt)) || (MMG5_abs(ptt->ref) == mesh->info.isoref) ) {
1624 --mesh->nt;
1625 }
1626
1627 if ( mesh->info.imprim > 4 ) {
1628 fprintf(stdout," Deleted iso triangles: %" MMG5_PRId "\n",nt-mesh->nt);
1629 }
1630
1631 if( !mesh->nt ) {
1633 }
1634 else if ( mesh->nt < nt ) {
1635 MMG5_ADD_MEM(mesh,(mesh->nt-nt)*sizeof(MMG5_Tria),"triangles",
1636 fprintf(stderr," Exit program.\n");
1637 return 0);
1639 "triangles",return 0);
1640 }
1641 }
1642
1644 return MMG5_Clean_isoEdges(mesh);
1645}
int MMG5_Compute_constantSize(MMG5_pMesh mesh, MMG5_pSol met, double *hsiz)
void MMG5_Set_constantSize(MMG5_pMesh mesh, MMG5_pSol met, double hsiz)
int MMG3D_Set_multiMat(MMG5_pMesh mesh, MMG5_pSol sol, MMG5_int ref, int split, MMG5_int rin, MMG5_int rout)
int MMG3D_Set_inputMeshName(MMG5_pMesh mesh, const char *meshin)
int MMG3D_Set_dparameter(MMG5_pMesh mesh, MMG5_pSol sol, int dparam, double val)
int MMG3D_Set_localParameter(MMG5_pMesh mesh, MMG5_pSol sol, int typ, MMG5_int ref, double hmin, double hmax, double hausd)
int MMG3D_Set_lsBaseReference(MMG5_pMesh mesh, MMG5_pSol sol, MMG5_int br)
int MMG3D_Set_inputSolName(MMG5_pMesh mesh, MMG5_pSol sol, const char *solin)
int MMG3D_Set_outputSolName(MMG5_pMesh mesh, MMG5_pSol sol, const char *solout)
int MMG3D_Set_outputMeshName(MMG5_pMesh mesh, const char *meshout)
int MMG3D_Set_iparameter(MMG5_pMesh mesh, MMG5_pSol sol, int iparam, MMG5_int val)
int MMG3D_Set_solSize(MMG5_pMesh mesh, MMG5_pSol sol, int typEntity, MMG5_int np, int typSol)
int ier
tmp[*strlen0]
MMG5_pMesh MMG5_pSol * sol
if(!ier) exit(EXIT_FAILURE)
MMG5_pMesh * mesh
int MMG3D_PROctreein_iso(MMG5_pMesh mesh, MMG5_pSol sol, MMG3D_pPROctree PROctree, MMG5_int ip, double lmax)
Definition: PRoctree_3d.c:1143
int MMG3D_PROctreein_ani(MMG5_pMesh mesh, MMG5_pSol sol, MMG3D_pPROctree PROctree, MMG5_int ip, double lmax)
Definition: PRoctree_3d.c:1225
int MMG5_setadj(MMG5_pMesh mesh)
Definition: analys_3d.c:108
int MMG5_movbdynompt_ani(MMG5_pMesh mesh, MMG5_pSol met, MMG3D_pPROctree PROctree, int64_t *listv, int ilistv, MMG5_int *lists, int ilists, int improve)
int MMG5_movbdyregpt_ani(MMG5_pMesh mesh, MMG5_pSol met, MMG3D_pPROctree PROctree, int64_t *listv, int ilistv, MMG5_int *lists, int ilists, int improveSurf, int improveVol)
int MMG5_movbdyrefpt_ani(MMG5_pMesh mesh, MMG5_pSol met, MMG3D_pPROctree PROctree, int64_t *listv, int ilistv, MMG5_int *lists, int ilists, int improve)
int MMG5_movintpt_ani(MMG5_pMesh mesh, MMG5_pSol met, MMG3D_pPROctree PROctree, int64_t *list, int ilist, int improve)
Definition: anisomovpt_3d.c:58
int MMG5_movbdyridpt_ani(MMG5_pMesh mesh, MMG5_pSol met, MMG3D_pPROctree PROctree, int64_t *listv, int ilistv, MMG5_int *lists, int ilists, int improve)
int MMG5_compute_meanMetricAtMarkedPoints_ani(MMG5_pMesh mesh, MMG5_pSol met)
Definition: anisosiz.c:2205
int MMG3D_gradsiz_ani(MMG5_pMesh mesh, MMG5_pSol met)
Definition: anisosiz_3d.c:2073
int MMG3D_defsiz_ani(MMG5_pMesh mesh, MMG5_pSol met)
Definition: anisosiz_3d.c:1310
int MMG3D_gradsizreq_ani(MMG5_pMesh mesh, MMG5_pSol met)
Definition: anisosiz_3d.c:2210
MMG5_Info info
void tminit(mytime *t, int maxtim)
Initialize mytime object.
Definition: chrono.c:120
void printim(double elps, char *stim)
Print real time.
Definition: chrono.c:160
void chrono(int cmode, mytime *ptt)
Function to measure time.
Definition: chrono.c:49
#define TIMEMAX
int MMG5_cavity_iso(MMG5_pMesh mesh, MMG5_pSol sol, MMG5_int iel, int ip, int64_t *list, int lon, double volmin)
Definition: delaunay_3d.c:741
int MMG5_cavity_ani(MMG5_pMesh mesh, MMG5_pSol met, MMG5_int iel, int ip, int64_t *list, int lon, double volmin)
Definition: delaunay_3d.c:581
int MMG5_eigenv3d(int symmat, double *mat, double lambda[3], double v[3][3])
Find eigenvalues and vectors of a 3x3 matrix.
Definition: eigenv.c:385
int MMG5_hashNew(MMG5_pMesh mesh, MMG5_Hash *hash, MMG5_int hsiz, MMG5_int hmax)
Definition: hash.c:526
int MMG5_hashEdge(MMG5_pMesh mesh, MMG5_Hash *hash, MMG5_int a, MMG5_int b, MMG5_int k)
Definition: hash.c:345
int MMG3D_hashTetra(MMG5_pMesh mesh, int pack)
Definition: hash_3d.c:122
int MMG3D_hashPrism(MMG5_pMesh mesh)
Definition: hash_3d.c:238
int MMG5_chkBdryTria(MMG5_pMesh mesh)
Definition: hash_3d.c:1439
int MMG5_bdrySet(MMG5_pMesh mesh)
Definition: hash_3d.c:1744
int MMG3D_hashTria(MMG5_pMesh mesh, MMG5_Hash *hash)
Definition: hash_3d.c:749
int MMG5_hashPop(MMG5_Hash *hash, MMG5_int a, MMG5_int b)
Definition: hash_3d.c:761
int MMG5_bdryPerm(MMG5_pMesh mesh)
Definition: hash_3d.c:2135
static double MMG5_caltet_iso(MMG5_pMesh mesh, MMG5_pSol met, MMG5_pTetra pt)
static double MMG5_caltet_ani(MMG5_pMesh mesh, MMG5_pSol met, MMG5_pTetra pt)
static double MMG5_lenedg_iso(MMG5_pMesh mesh, MMG5_pSol met, int ia, MMG5_pTetra pt)
static double MMG5_lenedg33_ani(MMG5_pMesh mesh, MMG5_pSol met, int ia, MMG5_pTetra pt)
static double MMG3D_caltetLES_iso(MMG5_pMesh mesh, MMG5_pSol met, MMG5_pTetra pt)
static double MMG5_lenedg_ani(MMG5_pMesh mesh, MMG5_pSol met, int ia, MMG5_pTetra pt)
static double MMG5_lenedgCoor_ani(double *ca, double *cb, double *sa, double *sb)
inlined Functions
static double MMG5_lenSurfEdg_iso(MMG5_pMesh mesh, MMG5_pSol met, MMG5_int ip1, MMG5_int ip2, int8_t isedg)
static double MMG5_lenSurfEdg_ani(MMG5_pMesh mesh, MMG5_pSol met, MMG5_int np0, MMG5_int np1, int8_t isedg)
int MMG5_interp4bar_ani(MMG5_pMesh mesh, MMG5_pSol met, MMG5_int k, MMG5_int ip, double cb[4])
Definition: intmet_3d.c:390
int MMG5_interp4bar_iso(MMG5_pMesh mesh, MMG5_pSol met, MMG5_int k, MMG5_int ip, double cb[4])
Definition: intmet_3d.c:320
int MMG5_intmet_iso(MMG5_pMesh mesh, MMG5_pSol met, MMG5_int k, int8_t i, MMG5_int ip, double s)
Definition: intmet_3d.c:131
int MMG5_intmet_ani(MMG5_pMesh mesh, MMG5_pSol met, MMG5_int k, int8_t i, MMG5_int ip, double s)
Definition: intmet_3d.c:51
int MMG5_compute_meanMetricAtMarkedPoints_iso(MMG5_pMesh mesh, MMG5_pSol met)
Definition: isosiz.c:167
double MMG5_lenedgCoor_iso(double *ca, double *cb, double *ma, double *mb)
Compute edge length from edge's coordinates.
Definition: isosiz_3d.c:61
int MMG3D_gradsizreq_iso(MMG5_pMesh mesh, MMG5_pSol met)
Definition: isosiz_3d.c:1168
int MMG3D_gradsiz_iso(MMG5_pMesh mesh, MMG5_pSol met)
Definition: isosiz_3d.c:1083
int MMG3D_defsiz_iso(MMG5_pMesh mesh, MMG5_pSol met)
Definition: isosiz_3d.c:662
void MMG3D_Free_topoTables(MMG5_pMesh mesh)
Definition: libmmg3d.c:67
void MMG3D_Set_commonFunc(void)
Definition: libmmg3d.c:1745
API headers for the mmg3d library.
LIBMMG3D_EXPORT double(* MMG3D_lenedgCoor)(double *ca, double *cb, double *sa, double *sb)
Definition: mmg3dexterns.c:10
LIBMMG3D_EXPORT int(* MMG3D_doSol)(MMG5_pMesh mesh, MMG5_pSol met)
Definition: mmg3dexterns.c:11
@ MMG3D_DPARAM_hmin
Definition: libmmg3d.h:97
@ MMG3D_IPARAM_debug
Definition: libmmg3d.h:72
@ MMG3D_IPARAM_numberOfLocalParam
Definition: libmmg3d.h:87
@ MMG3D_IPARAM_isoref
Definition: libmmg3d.h:95
@ MMG3D_IPARAM_noswap
Definition: libmmg3d.h:82
@ MMG3D_IPARAM_opnbdy
Definition: libmmg3d.h:77
@ MMG3D_DPARAM_angleDetection
Definition: libmmg3d.h:96
@ MMG3D_DPARAM_hsiz
Definition: libmmg3d.h:99
@ MMG3D_IPARAM_isosurf
Definition: libmmg3d.h:75
@ MMG3D_DPARAM_hausd
Definition: libmmg3d.h:100
@ MMG3D_IPARAM_nosurf
Definition: libmmg3d.h:84
@ MMG3D_IPARAM_nomove
Definition: libmmg3d.h:83
@ MMG3D_IPARAM_renum
Definition: libmmg3d.h:91
@ MMG3D_DPARAM_hgrad
Definition: libmmg3d.h:101
@ MMG3D_IPARAM_nosizreq
Definition: libmmg3d.h:94
@ MMG3D_DPARAM_rmc
Definition: libmmg3d.h:104
@ MMG3D_IPARAM_angle
Definition: libmmg3d.h:73
@ MMG3D_IPARAM_noinsert
Definition: libmmg3d.h:81
@ MMG3D_DPARAM_ls
Definition: libmmg3d.h:103
@ MMG3D_DPARAM_hgradreq
Definition: libmmg3d.h:102
@ MMG3D_IPARAM_xreg
Definition: libmmg3d.h:86
@ MMG3D_DPARAM_hmax
Definition: libmmg3d.h:98
@ MMG3D_IPARAM_numsubdomain
Definition: libmmg3d.h:90
@ MMG3D_IPARAM_lag
Definition: libmmg3d.h:78
@ MMG3D_IPARAM_nreg
Definition: libmmg3d.h:85
@ MMG3D_IPARAM_numberOfMat
Definition: libmmg3d.h:89
@ MMG3D_IPARAM_verbose
Definition: libmmg3d.h:70
@ MMG3D_IPARAM_numberOfLSBaseReferences
Definition: libmmg3d.h:88
@ MMG3D_IPARAM_optimLES
Definition: libmmg3d.h:80
@ MMG3D_IPARAM_optim
Definition: libmmg3d.h:79
@ MMG3D_IPARAM_iso
Definition: libmmg3d.h:74
@ MMG3D_IPARAM_octree
Definition: libmmg3d.h:93
@ MMG3D_IPARAM_nofem
Definition: libmmg3d.h:76
@ MMG3D_IPARAM_mem
Definition: libmmg3d.h:71
#define MMG3D_ALPHAD
int MMG5_movbdyregpt_iso(MMG5_pMesh, MMG5_pSol, MMG3D_pPROctree, int64_t *, int, MMG5_int *, int, int, int)
Definition: movpt_3d.c:625
void MMG5_freeXPrisms(MMG5_pMesh mesh)
Definition: zaldy_3d.c:378
void MMG5_freeXTets(MMG5_pMesh mesh)
Definition: zaldy_3d.c:359
double MMG5_caltet33_ani(MMG5_pMesh mesh, MMG5_pSol met, MMG5_pTetra pt)
Definition: quality_3d.c:109
static const uint8_t MMG5_iare[6][2]
vertices of extremities of the edges of the tetra
int MMG5_movbdyrefpt_iso(MMG5_pMesh, MMG5_pSol, MMG3D_pPROctree, int64_t *, int, MMG5_int *, int, int)
Definition: movpt_3d.c:1438
int MMG5_movintpt_iso(MMG5_pMesh, MMG5_pSol, MMG3D_pPROctree, int64_t *, int, int)
Definition: movpt_3d.c:58
static const uint8_t MMG5_idir_pr[5][4]
idir[i]: vertices of face i for a prism
int MMG5_movbdyridpt_iso(MMG5_pMesh, MMG5_pSol, MMG3D_pPROctree, int64_t *, int, MMG5_int *, int, int)
Definition: movpt_3d.c:1606
int MMG3D_memOption(MMG5_pMesh mesh)
Definition: zaldy_3d.c:271
static const uint8_t MMG5_idir[4][3]
idir[i]: vertices of face opposite to vertex i
int MMG5_movbdynompt_iso(MMG5_pMesh, MMG5_pSol, MMG3D_pPROctree, int64_t *, int, MMG5_int *, int, int)
Definition: movpt_3d.c:1462
static void MMG5_warnOrientation(MMG5_pMesh mesh)
void MMG3D_searchqua(MMG5_pMesh mesh, MMG5_pSol met, double critmin, MMG5_int *eltab, int8_t metRidTyp)
int MMG3D_searchlen(MMG5_pMesh mesh, MMG5_pSol met, double lmin, double lmax, MMG5_int *eltab, int8_t metRidTyp)
void MMG3D_destockOptions(MMG5_pMesh mesh, MMG5_Info *info)
int MMG3D_usage(char *prog)
static int MMG3D_solTruncatureForOptim(MMG5_pMesh mesh, MMG5_pSol met, int ani)
void MMG3D_setfunc(MMG5_pMesh mesh, MMG5_pSol met)
int MMG3D_mmg3dcheck(MMG5_pMesh mesh, MMG5_pSol met, MMG5_pSol sol, double critmin, double lmin, double lmax, MMG5_int *eltab, int8_t metRidTyp)
int MMG3D_Get_nonBdyTriangle(MMG5_pMesh mesh, MMG5_int *v0, MMG5_int *v1, MMG5_int *v2, MMG5_int *ref, MMG5_int idx)
int MMG3D_parsop(MMG5_pMesh mesh, MMG5_pSol met)
int MMG3D_Compute_eigenv(double m[6], double lambda[3], double vp[3][3])
int MMG3D_Get_tetsFromTria(MMG5_pMesh mesh, MMG5_int ktri, MMG5_int ktet[2], int iface[2])
void MMG3D_Free_solutions(MMG5_pMesh mesh, MMG5_pSol sol)
int MMG3D_Get_numberOfNonBdyTriangles(MMG5_pMesh mesh, MMG5_int *nb_tria)
int MMG3D_stockOptions(MMG5_pMesh mesh, MMG5_Info *info)
int MMG3D_freeLocalPar(MMG5_pMesh mesh)
int MMG3D_doSol_iso(MMG5_pMesh mesh, MMG5_pSol met)
int MMG3D_Set_constantSize(MMG5_pMesh mesh, MMG5_pSol met)
int MMG3D_defaultValues(MMG5_pMesh mesh)
int MMG3D_Clean_isoSurf(MMG5_pMesh mesh)
int MMG3D_Get_tetFromTria(MMG5_pMesh mesh, MMG5_int ktri, MMG5_int *ktet, int *iface)
int MMG3D_parsar(int argc, char *argv[], MMG5_pMesh mesh, MMG5_pSol met, MMG5_pSol sol)
int MMG3D_Get_adjaTet(MMG5_pMesh mesh, MMG5_int kel, MMG5_int listet[4])
Return adjacent elements of a tetrahedron.
int MMG3D_switch_metricStorage(MMG5_pMesh mesh, MMG5_pSol met)
int MMG3D_doSol_ani(MMG5_pMesh mesh, MMG5_pSol met)
LIBMMG_CORE_EXPORT int MMG5_Clean_isoEdges(MMG5_pMesh mesh)
Definition: libtools.c:365
LIBMMG_CORE_EXPORT int MMG5_scaleMesh(MMG5_pMesh mesh, MMG5_pSol met, MMG5_pSol ls)
Definition: scalem.c:649
#define MMG5_MMAT_Split
Definition: libmmgtypes.h:205
#define MMG5_STRONGFAILURE
Definition: libmmgtypes.h:59
#define MMG5_LOWFAILURE
Definition: libmmgtypes.h:51
#define MMG5_SUCCESS
Definition: libmmgtypes.h:43
@ MMG5_Tensor
Definition: libmmgtypes.h:215
#define MMG5_MMAT_NoSplit
Definition: libmmgtypes.h:197
@ MMG5_Vertex
Definition: libmmgtypes.h:224
@ MMG5_Tetrahedron
Definition: libmmgtypes.h:227
@ MMG5_Triangle
Definition: libmmgtypes.h:226
void MMG5_advancedUsage(void)
Definition: libtools.c:302
void MMG5_mmgUsage(char *prog)
Definition: libtools.c:210
void MMG5_paramUsage1(void)
Definition: libtools.c:239
void MMG5_2d3dUsage(void)
Definition: libtools.c:291
void MMG5_mmgDefaultValues(MMG5_pMesh mesh)
Definition: libtools.c:70
void MMG5_lagUsage(void)
Definition: libtools.c:275
void MMG5_paramUsage2(void)
Definition: libtools.c:258
#define MMG5_SAFE_CALLOC(ptr, size, type, law)
int MMG5_3dSolTruncature_ani(MMG5_pMesh mesh, MMG5_pSol met)
Definition: scalem.c:453
#define _LIBMMG5_RETURN(mesh, sol, met, val)
double MMG5_caltri_ani(MMG5_pMesh mesh, MMG5_pSol met, MMG5_pTria ptt)
Definition: quality.c:115
#define MG_EOK(pt)
static void MMG5_excfun(int sigid)
#define MMG5_ADD_MEM(mesh, size, message, law)
static void MMG5_warnScotch(MMG5_pMesh mesh)
int MMG5_solTruncature_iso(MMG5_pMesh mesh, MMG5_pSol met)
Definition: scalem.c:299
#define MG_BDY
#define MG_STR
#define MMG5_FILESTR_LGTH
double MMG5_caltri_iso(MMG5_pMesh mesh, MMG5_pSol met, MMG5_pTria ptt)
Definition: quality.c:199
#define MMG5_SAFE_FREE(ptr)
#define MMG_FSCANF(stream, format,...)
#define MMG5_DEL_MEM(mesh, ptr)
int MMG5_invmat(double *m, double *mi)
Definition: tools.c:562
#define MMG5_SAFE_RECALLOC(ptr, prevSize, newSize, type, message, law)
Identic as MMG5_HGeom but use MMG5_hedge to store edges instead of MMG5_hgeom (memory economy).
Definition: libmmgtypes.h:595
MMG5_hedge * item
Definition: libmmgtypes.h:597
Store input parameters of the run.
Definition: libmmgtypes.h:516
int8_t iso
Definition: libmmgtypes.h:534
double hsiz
Definition: libmmgtypes.h:518
int8_t isosurf
Definition: libmmgtypes.h:535
uint8_t ani
Definition: libmmgtypes.h:546
MMG5_int isoref
Definition: libmmgtypes.h:521
int PROctree
Definition: libmmgtypes.h:527
uint8_t optimLES
Definition: libmmgtypes.h:546
int8_t lag
Definition: libmmgtypes.h:540
MMG5_pPar par
Definition: libmmgtypes.h:517
uint8_t optim
Definition: libmmgtypes.h:546
MMG mesh structure.
Definition: libmmgtypes.h:605
MMG5_int ntmax
Definition: libmmgtypes.h:612
MMG5_Info info
Definition: libmmgtypes.h:651
MMG5_int * adjapr
Definition: libmmgtypes.h:632
MMG5_int ne
Definition: libmmgtypes.h:612
MMG5_pPoint point
Definition: libmmgtypes.h:641
char * nameout
Definition: libmmgtypes.h:653
MMG5_int mark
Definition: libmmgtypes.h:618
MMG5_int * adja
Definition: libmmgtypes.h:624
MMG5_pPrism prism
Definition: libmmgtypes.h:645
MMG5_int nemax
Definition: libmmgtypes.h:612
MMG5_int npmax
Definition: libmmgtypes.h:612
MMG5_int base
Definition: libmmgtypes.h:616
MMG5_pTetra tetra
Definition: libmmgtypes.h:643
MMG5_pxPrism xprism
Definition: libmmgtypes.h:646
MMG5_int nt
Definition: libmmgtypes.h:612
MMG5_pTria tria
Definition: libmmgtypes.h:647
MMG5_int np
Definition: libmmgtypes.h:612
MMG5_pxTetra xtetra
Definition: libmmgtypes.h:644
MMG5_int nprism
Definition: libmmgtypes.h:613
char * namein
Definition: libmmgtypes.h:652
Structure to store points of a MMG mesh.
Definition: libmmgtypes.h:270
double c[3]
Definition: libmmgtypes.h:271
MMG5_int flag
Definition: libmmgtypes.h:282
MMG5_int v[6]
Definition: libmmgtypes.h:463
MMG5_int ref
Definition: libmmgtypes.h:464
MMG5_int xpr
Definition: libmmgtypes.h:467
char * nameout
Definition: libmmgtypes.h:674
char * namein
Definition: libmmgtypes.h:673
double * m
Definition: libmmgtypes.h:671
MMG5_int np
Definition: libmmgtypes.h:665
MMG5_int v[4]
Definition: libmmgtypes.h:403
MMG5_int xt
Definition: libmmgtypes.h:407
MMG5_int ref
Definition: libmmgtypes.h:404
MMG5_int ref
Definition: libmmgtypes.h:335
MMG5_int v[3]
Definition: libmmgtypes.h:334
MMG5_int cc
Definition: libmmgtypes.h:337
int16_t ftag[5]
Definition: libmmgtypes.h:484
MMG5_int ref[5]
Definition: libmmgtypes.h:478
int16_t ftag[4]
Definition: libmmgtypes.h:423
MMG5_int ref[4]
Definition: libmmgtypes.h:419
Chrono object.