mmg3d
mmgcommon.h
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/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
24#ifndef MMGCOMMON_H
25#define MMGCOMMON_H
26
27#include <assert.h>
28#include <stdlib.h>
29#include <stdio.h>
30#include <limits.h>
31#include <string.h>
32#include <signal.h>
33#include <ctype.h>
34#include <float.h>
35#include <math.h>
36#include <complex.h>
37
38#if (defined(__APPLE__) && defined(__MACH__))
39#include <sys/sysctl.h>
40#elif defined(__unix__) || defined(__unix) || defined(unix)
41#include <unistd.h>
42#elif defined(_WIN16) || defined(_WIN32) || defined(_WIN64) || defined(__WIN32__) || defined(__TOS_WIN__) || defined(__WINDOWS__)
43#ifndef GNU
44#define _WIN32_WINNT 0x0500
45#endif
46
47#include <windows.h>
48#endif
49
50#ifdef __cplusplus
51extern "C" {
52#endif
53
54#include "eigenv.h"
55#include "libmmgcommon.h"
56
57#define MG_STR "&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&"
58
60#define MG_SMSGN(a,b) (((double)(a)*(double)(b) > (0.0)) ? (1) : (0))
61
63#define MMG5_BOXSIZE 500
64
66#define MMG5_MEMMAX 800
67#define MMG5_BITWIZE_MB_TO_B 20
68#define MMG5_MEMPERCENT 0.5
70/* Domain refs in iso mode */
71#define MG_PLUS 2
72#define MG_MINUS 3
73
74/* Macro for unset or unititialized mark */
75#define MMG5_UNSET -1
76
77/* reference of the boundary that moves in lagrangian mode */
78#define MMG5_DISPREF 10
79
80/* million */
81#define MMG5_MILLION 1048576
82
83/* numerical accuracy */
84#define MMG5_ANGEDG 0.707106781186548 /*0.573576436351046 */
85#define MMG5_ANGLIM -0.999999
86#define MMG5_ATHIRD 0.333333333333333
87
88#define MMG5_EPSD 1.e-30
89#define MMG5_EPSD2 1.0e-200
90#define MMG5_EPS 1.e-06
91#define MMG5_EPSOK 1.e-15
92#define MMG5_NULKAL 1.e-30
93
94#define MMG5_SQR32 0.866025403784439
95
96#ifndef M_PI
97#define M_PI 3.14159265358979323846
98#define M_PI_2 1.57079632679489661923
99#endif
100
101#define A64TH 0.015625
102#define A16TH 0.0625
103#define A32TH 0.03125
104
105#define MMG5_MEMMIN 38
107#define MMG5_LMAX 10240
108
109#define MMG5_PATHSEP '/'
110
111/* Variables for option initialization */
112#define MMG5_NONSET_MEM -1
113#define MMG5_NONSET_HMIN -1
114#define MMG5_NONSET_HMAX -1
115#define MMG5_NONSET_HSIZ -1
116#define MMG5_NONSET -1
117#define MMG5_HAUSD 0.01
118#define MMG5_HGRAD 0.26236426446
119#define MMG5_HGRADREQ 0.83290912294
120#define MMG5_NOHGRAD -1
121#define MMG5_LAG -1
122#define MMG5_NR -1
123#define MMG5_LS 0.0
124#define MMG5_PROCTREE 32
125#define MMG5_OFF 0
126#define MMG5_ON 1
127#define MMG5_GAP 0.2
128#define MMG5_HMINCOE 0.001
129#define MMG5_HMAXCOE 2
130#define MMG5_HMINMAXGAP 5
131#define MMG5_FEM 1
132#define MMG5_FILESTR_LGTH 128
134/* Macros */
135#define MG_MAX(a,b) (((a) > (b)) ? (a) : (b))
136#define MG_MIN(a,b) (((a) < (b)) ? (a) : (b))
137
138/* tags */
139#define MG_NOTAG (0)
140#define MG_REF (1 << 0)
141#define MG_GEO (1 << 1)
142#define MG_REQ (1 << 2)
143#define MG_NOM (1 << 3)
144#define MG_BDY (1 << 4)
145#define MG_CRN (1 << 5)
146#define MG_NOSURF (1 << 6)
147#define MG_OPNBDY (1 << 7)
148#define MG_OLDPARBDY (1 << 11)
149#define MG_PARBDYBDY (1 << 12)
150#define MG_PARBDY (1 << 13)
151#define MG_NUL (1 << 14)
153/* binary tags for local parameters */
154#define MG_Vert (1 << 0 )
155#define MG_Tria (1 << 1 )
156#define MG_Tetra (1 << 2 )
157#define MG_Edge (1 << 3 )
160#define MG_VOK(ppt) (ppt && ((ppt)->tag < MG_NUL))
161#define MG_EOK(pt) (pt && ((pt)->v[0] > 0))
163#define MG_EDG(tag) ((tag & MG_GEO) || (tag & MG_REF))
164#define MG_SIN(tag) ((tag & MG_CRN) || (tag & MG_REQ))
165#define MG_RID(tag) ((!( MG_SIN(tag)||(tag & MG_NOM))) && tag & MG_GEO )
168#define MG_SET(flag,bit) ((flag) |= (1 << (bit)))
169#define MG_CLR(flag,bit) ((flag) &= ~(1 << (bit)))
170#define MG_GET(flag,bit) ((flag) & (1 << (bit)))
172#define MMG5_KA 7
173#define MMG5_KB 11
175/* file reading */
176#define MMG5_SW 4
177#define MMG5_SD 8
178
182#define _LIBMMG5_RETURN(mesh,sol,met,val)do \
183 { \
184 signal(SIGABRT,SIG_DFL); \
185 signal(SIGFPE,SIG_DFL); \
186 signal(SIGILL,SIG_DFL); \
187 signal(SIGSEGV,SIG_DFL); \
188 signal(SIGTERM,SIG_DFL); \
189 signal(SIGINT,SIG_DFL); \
190 mesh->npi = mesh->np; \
191 mesh->nti = mesh->nt; \
192 mesh->nai = mesh->na; \
193 mesh->nei = mesh->ne; \
194 mesh->xt = 0; \
195 if ( sol ) { sol->npi = sol->np; } \
196 if ( met ) { met->npi = met->np; } \
197 return val; \
198 }while(0)
199
200/* Macros for memory management */
203#define MMG5_CHK_MEM(mesh,size,string,law) do \
204 { \
205 if ( (mesh)->memCur > (mesh)->memMax ) { \
206 fprintf(stderr," ## Error:"); \
207 fprintf(stderr," unable to allocate %s.\n",string); \
208 fprintf(stderr," ## Check the mesh size or "); \
209 fprintf(stderr,"increase maximal authorized memory with the -m option.\n"); \
210 (mesh)->memCur -= (size); \
211 law; \
212 } \
213 }while(0)
214
215static inline
216void * mycalloc(size_t c, size_t s) {
217 char *ptr;
218 ptr = (char *)calloc(c*s+sizeof(size_t),1);
219 if (ptr == NULL)
220 return NULL;
221 else {
222 *((size_t*)ptr)=c*s;
223 ptr+=sizeof(size_t);
224 return (void*)ptr;
225 }
226}
227
228static inline
229void * mymalloc(size_t s) {
230 char *ptr;
231 ptr = (char *)malloc(s+sizeof(size_t));
232 if (ptr == NULL)
233 return NULL;
234 else {
235 *((size_t*)ptr)=s;
236 ptr+=sizeof(size_t);
237 return (void*)ptr;
238 }
239}
240
241static inline
242void * myrealloc(void * ptr_in, size_t s, size_t oldsize) {
243 char *ptr;
244 char *ptr_in_c = (char*)ptr_in;
245
246 if ( !ptr_in ) {
247 assert ( !oldsize );
248 return mymalloc( s );
249 }
250
251 ptr_in_c -= sizeof(size_t);
252 if (oldsize != *((size_t*)ptr_in_c)) {
253 fprintf(stderr, "myrealloc: Error: freed memory mismatch\n");
254 assert(0);
255 }
256 ptr = (char *)realloc(ptr_in_c, s+sizeof(size_t));
257 if (ptr == NULL)
258 return NULL;
259 else {
260 *((size_t*)ptr)=s;
261 ptr+=sizeof(size_t);
262 return (void*)ptr;
263 }
264}
265
266static inline
267size_t myfree(void *ptr) {
268 size_t s;
269 char * ptr_c = (char*)ptr;
270
271 if ( !ptr ) return 0;
272
273 ptr_c = ptr_c-sizeof(size_t);
274 s = *((size_t*)ptr_c);
275 free(ptr_c);
276
277 return s;
278}
279
281#define MMG5_DEL_MEM(mesh,ptr) do \
282 { \
283 size_t size_to_free = myfree(ptr); \
284 (mesh)->memCur -= size_to_free; \
285 ptr = NULL; \
286 }while(0)
287
290#define MMG5_ADD_MEM(mesh,size,message,law) do \
291 { \
292 (mesh)->memCur += (size); \
293 MMG5_CHK_MEM(mesh,size,message,law); \
294 }while(0)
295
297#define MMG5_SAFE_FREE(ptr) do \
298 { \
299 myfree(ptr); \
300 ptr = NULL; \
301 }while(0)
302
304#define MMG5_SAFE_CALLOC(ptr,size,type,law) do \
305 { \
306 ptr = (type*)mycalloc(size,sizeof(type)); \
307 if ( !ptr ) { \
308 perror(" ## Memory problem: calloc"); \
309 law; \
310 } \
311 }while(0)
312
314#define MMG5_SAFE_MALLOC(ptr,size,type,law) do \
315 { \
316 size_t size_to_allocate = (size)*sizeof(type); \
317 ptr = (type*)mymalloc(size_to_allocate); \
318 if ( !ptr ) { \
319 perror(" ## Memory problem: malloc"); \
320 law; \
321 } \
322 }while(0)
323
325#define MMG5_SAFE_REALLOC(ptr,prevSize,newSize,type,message,law) do \
326 { \
327 type* tmp; \
328 size_t size_to_allocate = (newSize)*sizeof(type); \
329 \
330 tmp = (type *)myrealloc((ptr),size_to_allocate,(prevSize)*sizeof(type)); \
331 if ( !tmp ) { \
332 MMG5_SAFE_FREE(ptr); \
333 perror(" ## Memory problem: realloc"); \
334 law; \
335 } \
336 \
337 (ptr) = tmp; \
338 }while(0)
339
341#define MMG5_SAFE_RECALLOC(ptr,prevSize,newSize,type,message,law) do \
342 { \
343 type* tmp; \
344 size_t size_to_allocate = (newSize)*sizeof(type); \
345 \
346 tmp = (type *)myrealloc((ptr),size_to_allocate,(prevSize)*sizeof(type)); \
347 if ( !tmp ) { \
348 MMG5_SAFE_FREE(ptr); \
349 perror(" ## Memory problem: realloc"); \
350 law; \
351 } \
352 else { \
353 (ptr) = tmp; \
354 assert(ptr); \
355 if ( newSize > prevSize ) { \
356 memset(&((ptr)[prevSize]),0,((newSize)-(prevSize))*sizeof(type)); \
357 } \
358 } \
359 }while(0)
360
364#define MMG5_TAB_RECALLOC(mesh,ptr,initSize,wantedGap,type,message,law) do \
365 { \
366 int gap; \
367 \
368 assert ( mesh->memCur < mesh->memMax ); \
369 \
370 gap = (int)(wantedGap * initSize); \
371 if ( !gap ) gap = 1; \
372 \
373 if ( mesh->memMax < mesh->memCur + gap*sizeof(type) ) { \
374 gap = (int)((mesh->memMax-mesh->memCur)/sizeof(type)); \
375 if(gap<1) { \
376 fprintf(stderr," ## Error:"); \
377 fprintf(stderr," unable to allocate %s.\n",message); \
378 fprintf(stderr," ## Check the mesh size or "); \
379 fprintf(stderr,"increase maximal authorized memory with the -m option.\n"); \
380 law; \
381 } \
382 } \
383 \
384 MMG5_ADD_MEM(mesh,gap*sizeof(type),message,law); \
385 MMG5_SAFE_RECALLOC((ptr),initSize+1,initSize+gap+1,type,message,law); \
386 initSize = initSize+gap; \
387 }while(0);
388
390#define MMG5_INCREASE_MEM_MESSAGE() do \
391 { \
392 printf(" ## Check the mesh size or increase maximal"); \
393 printf(" authorized memory with the -m option.\n"); \
394 } while(0)
395
396#define MMG5_SAFELL2LCAST(longlongval) (((longlongval) > (LONG_MAX)) ? 0 : ((long)(longlongval)))
397#define MMG5_SAFELL2ICAST(longlongval) (((longlongval) > (INT_MAX)) ? 0 : ((int)(longlongval)))
398
400#define MMG_FREAD(ptr,size,count,stream) do \
401 { \
402 \
403 if ( count != fread(ptr,size,count,stream) ) { \
404 fputs ( "Reading error", stderr ); \
405 return -1; \
406 } \
407 } while(0);
408
410#define CV_VA_NUM_ARGS_HELPER(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, N, ...) N
411
413#define CV_VA_NUM_ARGS(...) CV_VA_NUM_ARGS_HELPER(__VA_ARGS__, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0)
414
421#ifdef MMG_POSIX
422#define MMG_FSCANF(stream,format,...) do \
423 { \
424 int io_count = fscanf(stream,format,__VA_ARGS__); \
425 int args_count = CV_VA_NUM_ARGS(__VA_ARGS__); \
426 if ( args_count != io_count ) { \
427 fprintf (stderr, "Reading error: fscanf counts %d args while %d provided\n",io_count,args_count ); \
428 return -1; \
429 } \
430 } while(0);
431#else
432#define MMG_FSCANF(stream,format,...) do \
433 { \
434 int io_count = fscanf(stream,format,__VA_ARGS__); \
435 int args_count = CV_VA_NUM_ARGS(__VA_ARGS__); \
436 if ( 0 > io_count ) { \
437 fprintf (stderr, "Reading error: fscanf counts %d args\n",io_count); \
438 return -1; \
439 } \
440 } while(0);
441#endif
442
444#ifdef USE_SCOTCH
446static inline
447void MMG5_warnScotch(MMG5_pMesh mesh) {
448 if ( mesh->info.imprim > 4 || mesh->info.ddebug ) {
449 if ( mesh->info.mem >= 0 ) {
450 fprintf(stdout," ## Warning: we will overflow the memory asked with \"-m\"");
451 fprintf(stdout," option during Scotch call.\n" );
452 }
453 }
454}
455#endif
462static inline
463void MMG5_excfun(int sigid) {
464 fprintf(stdout,"\n Unexpected error:"); fflush(stdout);
465 switch(sigid) {
466 case SIGABRT:
467 fprintf(stdout," *** potential lack of memory.\n"); break;
468 case SIGFPE:
469 fprintf(stdout," *** Floating-point exception\n"); break;
470 case SIGILL:
471 fprintf(stdout," *** Illegal instruction\n"); break;
472 case SIGSEGV:
473 fprintf(stdout," *** Segmentation fault\n"); break;
474 case SIGTERM:
475 case SIGINT:
476 fprintf(stdout," *** Program killed\n"); break;
477 }
478 exit(EXIT_FAILURE);
479}
480
481/* Macro for fortran function generation */
495#define FORTRAN_NAME(nu,nl,pl,pc) \
496 void nu pl; \
497 void nl pl \
498 { nu pc; } \
499 void nl##_ pl \
500 { nu pc; } \
501 void nl##__ pl \
502 { nu pc; } \
503 void nu pl
504
517#define FORTRAN_VARIADIC(nu,nl,pl,body) \
518 void nu pl \
519 { body } \
520 void nl pl \
521 { body } \
522 void nl##_ pl \
523 { body } \
524 void nl##__ pl \
525 { body } \
526
544
545
546/* Global variables */
547 static const uint8_t MMG5_inxt2[6] = {1,2,0,1,2};
548 static const uint8_t MMG5_iprv2[3] = {2,0,1};
550/* Private structures */
557typedef struct {
558 double b[10][3];
559 double n[6][3];
560 double t[6][3];
564
569typedef struct MMG5_iNode_s {
570 int val;
573
578typedef struct MMG5_dNode_s {
579 int k;
580 double val;
583
584
585/* Functions declarations */
586 extern double MMG5_det3pt1vec(double c0[3],double c1[3],double c2[3],double v[3]);
587 extern double MMG5_det4pt(double c0[3],double c1[3],double c2[3],double c3[3]);
588 int MMG5_devangle(double* n1, double *n2, double crit);
589 extern double MMG5_orvol(MMG5_pPoint point,int *v);
590 int MMG5_Add_inode( MMG5_pMesh mesh, MMG5_iNode **liLi, int val );
591 int MMG5_Add_dnode( MMG5_pMesh mesh, MMG5_dNode **liLi, int, double);
592 extern void MMG5_bezierEdge(MMG5_pMesh, int, int, double*, double*, int8_t,double*);
593 int MMG5_buildridmet(MMG5_pMesh,MMG5_pSol,int,double,double,double,double*,double[3][3]);
594 extern int MMG5_buildridmetfic(MMG5_pMesh,double*,double*,double,double,double,double*);
595 int MMG5_buildridmetnor(MMG5_pMesh, MMG5_pSol, int,double*, double*,double[3][3]);
596void MMG5_check_hminhmax(MMG5_pMesh mesh, int8_t sethmin, int8_t sethmax);
597 int MMG5_paratmet(double c0[3],double n0[3],double m[6],double c1[3],double n1[3],double mt[6]);
598 void MMG5_mn(double m[6], double n[6], double mn[9] );
599 extern int MMG5_rmtr(double r[3][3],double m[6], double mr[6]);
601 int MMG5_boulep(MMG5_pMesh mesh,int start,int ip,int*,int *list);
602 int MMG5_boulec(MMG5_pMesh, int*, int, int i,double *tt);
603 int MMG5_boulen(MMG5_pMesh, int*, int, int i,double *nn);
604 int MMG5_bouler(MMG5_pMesh, int*, int, int i,int *,int *,int *, int*, int);
606 extern double MMG5_caltri_ani(MMG5_pMesh mesh,MMG5_pSol met,MMG5_pTria ptt);
607 extern double MMG5_caltri_iso(MMG5_pMesh mesh,MMG5_pSol met,MMG5_pTria ptt);
608 void MMG5_defUninitSize(MMG5_pMesh mesh,MMG5_pSol met,int8_t ismet);
609 void MMG5_displayLengthHisto(MMG5_pMesh,int,double*,int,int,double,
610 int,int,double,int,double*,int*,int8_t);
611 void MMG5_displayLengthHisto_internal( int,int,int,double,
612 int,int,double, int,double*,
613 int*,int8_t,int);
614 int MMG5_minQualCheck ( int iel, double minqual, double alpha );
616 MMG5_Bezier*,double r[3][3],double gv[2]);
617 void MMG5_fillDefmetregSys( int, MMG5_pPoint, int, MMG5_Bezier,double r[3][3],
618 double *, double *, double *, double *);
623 char *MMG5_Get_filenameExt( char *filename );
624 char *MMG5_Get_basename(char *path);
625 char *MMG5_Get_path(char *path);
626 char *MMG5_Remove_ext( char *path, char* );
627 const char *MMG5_Get_formatName(enum MMG5_Format fmt);
628 int MMG5_Get_format( char *ptr, int );
629 int MMG5_hashEdge(MMG5_pMesh mesh,MMG5_Hash *hash,int a,int b,int k);
630 int MMG5_hashUpdate(MMG5_Hash *hash,int a,int b,int k);
631 int MMG5_hashEdgeTag(MMG5_pMesh mesh,MMG5_Hash *hash,int a,int b,int16_t k);
632 int MMG5_hashGet(MMG5_Hash *hash,int a,int b);
633 int MMG5_hashNew(MMG5_pMesh mesh, MMG5_Hash *hash,int hsiz,int hmax);
634 int MMG5_intmetsavedir(MMG5_pMesh mesh, double *m,double *n,double *mr);
635 int MMG5_intridmet(MMG5_pMesh,MMG5_pSol,int,int,double,double*,double*);
636 int MMG5_mmgIntmet33_ani(double*,double*,double*,double);
637 int MMG5_mmgIntextmet(MMG5_pMesh,MMG5_pSol,int,double *,double *);
638 size_t MMG5_memSize(void);
641 int MMG5_mmgHashTria(MMG5_pMesh mesh, int *adja, MMG5_Hash*, int chkISO);
643 void MMG5_mmgUsage(char *prog);
644 void MMG5_paramUsage1(void);
645 void MMG5_paramUsage2(void);
646 void MMG5_2d3dUsage(void);
647 void MMG5_lagUsage(void);
648 void MMG5_advancedUsage(void);
649 extern int MMG5_nonUnitNorPts(MMG5_pMesh,int,int,int,double*);
650 extern double MMG5_nonorsurf(MMG5_pMesh mesh,MMG5_pTria pt);
651 extern int MMG5_norpts(MMG5_pMesh,int,int,int,double *);
652 extern int MMG5_nortri(MMG5_pMesh mesh,MMG5_pTria pt,double *n);
653 void MMG5_printTria(MMG5_pMesh mesh,char* fileName);
654 extern int MMG5_rotmatrix(double n[3],double r[3][3]);
655 int MMG5_invmat(double *m,double *mi);
656 int MMG5_invmatg(double m[9],double mi[9]);
657 int MMG5_invmat33(double m[3][3],double mi[3][3]);
659 double MMG5_ridSizeInNormalDir(MMG5_pMesh,int,double*,MMG5_pBezier,double,double);
660 double MMG5_ridSizeInTangentDir(MMG5_pMesh, MMG5_pPoint,int,int*,double,double);
661 int MMG5_scale_meshAndSol(MMG5_pMesh,MMG5_pSol,MMG5_pSol,double*,int8_t*,int8_t*);
662 int MMG5_scale_scalarMetric(MMG5_pMesh, MMG5_pSol,double, int8_t, int8_t);
664 int MMG5_scotchCall(MMG5_pMesh mesh, MMG5_pSol sol,MMG5_pSol fields,int*);
666 int MMG5_solveDefmetregSys( MMG5_pMesh, double r[3][3], double *, double *,
667 double *, double *, double, double, double);
669 double *, double *, double *, double *,
670 double, double, double);
672 double MMG5_surftri33_ani(MMG5_pMesh,MMG5_pTria,double*,double*,double*);
674 extern int MMG5_sys33sym(double a[6], double b[3], double r[3]);
676 int MMG5_interpreg_ani(MMG5_pMesh,MMG5_pSol,MMG5_pTria,int8_t,double,double *mr);
677 int MMG5_interp_iso(double *ma,double *mb,double *mp,double t);
678 int MMG5_intersecmet22(MMG5_pMesh mesh, double *m,double *n,double *mr);
681 double MMG2D_quickarea(double a[2],double b[2],double c[2]);
682 void MMG5_build3DMetric(MMG5_pMesh mesh,MMG5_pSol sol,int ip,double dbuf[6]);
685 FILE **inm,long *posNodes, long *posElts,
686 long **posNodeData, int *bin, int *iswp,
687 int *nelts,int *nsols);
690 const long posNodes,const long posElts,
691 const long *posNodeData,const int bin,
692 const int iswp,const int nelts,
693 const int nsols);
694int MMG5_saveMshMesh(MMG5_pMesh,MMG5_pSol*,const char*, int);
695int MMG5_loadSolHeader(const char*,int,FILE**,int*,int*,int*,int*,
696 int*,int*,int**,long*,int);
697int MMG5_chkMetricType(MMG5_pMesh mesh,int *type, FILE *inm);
698int MMG5_readFloatSol3D(MMG5_pSol,FILE*,int,int,int);
699int MMG5_readDoubleSol3D(MMG5_pSol,FILE*,int,int,int);
700int MMG5_saveSolHeader( MMG5_pMesh,const char*,FILE**,int,int*,int,
701 int,int,int*,int*);
702void MMG5_writeDoubleSol3D(MMG5_pMesh,MMG5_pSol,FILE*,int,int,int);
705
706int MMG5_defsiz_startingMessage (MMG5_pMesh,MMG5_pSol,const char * funcname );
711
718int MMG5_simred(MMG5_pMesh,double*,double*,double dm[2],double dn[2],double vp[2][2]);
719void MMG5_gradEigenvreq(double *dm,double *dn,double,int8_t,int8_t *);
720int MMG5_updatemetreq_ani(double *n,double dn[2],double vp[2][2]);
721int MMG5_swapbin(int sbin);
722float MMG5_swapf(float sbin);
723double MMG5_swapd(double sbin);
724int MMG5_isSplit(MMG5_pMesh ,int ,int *,int *);
725int MMG5_getIniRef(MMG5_pMesh ,int );
726
727
728/* tools */
730void MMG5_mark_usedVertices ( MMG5_pMesh mesh,void (*delPt)(MMG5_pMesh,int) );
731void MMG5_keep_subdomainElts ( MMG5_pMesh,int,int (*delElt)(MMG5_pMesh,int) );
732
733/* function pointers */
734extern int (*MMG5_chkmsh)(MMG5_pMesh,int,int);
735extern int (*MMG5_bezierCP)(MMG5_pMesh ,MMG5_Tria *,MMG5_pBezier ,int8_t );
736extern double (*MMG5_lenSurfEdg)(MMG5_pMesh mesh,MMG5_pSol sol ,int ,int, int8_t );
737extern int (*MMG5_grad2met_ani)(MMG5_pMesh,MMG5_pSol,MMG5_pTria,int,int);
740
741
742/* useful functions to debug */
743extern int (*MMG5_indElt)(MMG5_pMesh mesh,int kel);
744extern int (*MMG5_indPt)(MMG5_pMesh mesh,int kp);
745
746#ifdef USE_SCOTCH
747extern int (*MMG5_renumbering)(int,MMG5_pMesh,MMG5_pSol sol,MMG5_pSol fields,int*);
748#endif
749
751
752#ifdef __cplusplus
753}
754#endif
755
756#endif
MMG5_pMesh char * filename
Definition: API_functionsf_3d.c:1015
MMG5_pMesh * mesh
Definition: API_functionsf_3d.c:65
API header for the common part of the MMG libraries.
MMG5_Tria * MMG5_pTria
Definition: libmmgtypes.h:314
MMG5_Sol * MMG5_pSol
Definition: libmmgtypes.h:623
MMG5_Mesh * MMG5_pMesh
Definition: libmmgtypes.h:604
int MMG5_simred(MMG5_pMesh, double *, double *, double dm[2], double dn[2], double vp[2][2])
Definition: anisosiz.c:1262
void MMG5_bezierEdge(MMG5_pMesh, int, int, double *, double *, int8_t, double *)
int MMG5_gradsizreq_ani(MMG5_pMesh mesh, MMG5_pSol met)
Definition: anisosiz.c:1801
int(* MMG5_chkmsh)(MMG5_pMesh, int, int)
Definition: mmgexterns.c:27
int MMG5_loadSolHeader(const char *, int, FILE **, int *, int *, int *, int *, int *, int *, int **, long *, int)
Definition: inout.c:2019
int MMG5_scotchCall(MMG5_pMesh mesh, MMG5_pSol sol, MMG5_pSol fields, int *)
Definition: librnbg.c:229
void MMG5_mmgInit_parameters(MMG5_pMesh mesh)
int MMG5_readFloatSol3D(MMG5_pSol, FILE *, int, int, int)
Definition: inout.c:2159
int MMG5_unscaleMesh(MMG5_pMesh mesh, MMG5_pSol met, MMG5_pSol ls)
Definition: scalem.c:401
void MMG5_gradEigenvreq(double *dm, double *dn, double, int8_t, int8_t *)
Definition: anisosiz.c:1380
int(* MMG5_compute_meanMetricAtMarkedPoints)(MMG5_pMesh, MMG5_pSol)
Definition: mmgexterns.c:34
int MMG5_loadMshMesh_part1(MMG5_pMesh mesh, const char *filename, FILE **inm, long *posNodes, long *posElts, long **posNodeData, int *bin, int *iswp, int *nelts, int *nsols)
Definition: inout.c:238
void MMG5_advancedUsage(void)
Definition: mmg.c:135
int MMG5_mmgHashTria(MMG5_pMesh mesh, int *adja, MMG5_Hash *, int chkISO)
Definition: hash.c:50
int MMG5_check_readedMesh(MMG5_pMesh mesh, int nref)
Definition: inout.c:486
void MMG5_mn(double m[6], double n[6], double mn[9])
Definition: tools.c:171
int MMG5_readDoubleSol3D(MMG5_pSol, FILE *, int, int, int)
Definition: inout.c:2208
size_t MMG5_memSize(void)
Definition: tools.c:547
int MMG5_countLocalParamAtTri(MMG5_pMesh, MMG5_iNode **)
Definition: mmg.c:192
int(* MMG5_bezierCP)(MMG5_pMesh, MMG5_Tria *, MMG5_pBezier, int8_t)
Definition: mmgexterns.c:28
int MMG5_boulec(MMG5_pMesh, int *, int, int i, double *tt)
Definition: boulep.c:189
int MMG5_scale_scalarMetric(MMG5_pMesh, MMG5_pSol, double, int8_t, int8_t)
Definition: scalem.c:122
int MMG5_gradsizreq_iso(MMG5_pMesh, MMG5_pSol)
Definition: isosiz.c:368
double MMG5_caltri_ani(MMG5_pMesh mesh, MMG5_pSol met, MMG5_pTria ptt)
Definition: quality.c:115
double MMG2D_quickarea(double a[2], double b[2], double c[2])
Definition: tools.c:858
int MMG5_hashEdge(MMG5_pMesh mesh, MMG5_Hash *hash, int a, int b, int k)
Definition: hash.c:217
static void * mycalloc(size_t c, size_t s)
Definition: mmgcommon.h:216
char * MMG5_Get_basename(char *path)
Definition: mmg.c:402
int MMG5_intridmet(MMG5_pMesh, MMG5_pSol, int, int, double, double *, double *)
int MMG5_solveDefmetrefSys(MMG5_pMesh, MMG5_pPoint, int *, double r[3][3], double *, double *, double *, double *, double, double, double)
void MMG5_printSolStats(MMG5_pMesh mesh, MMG5_pSol *sol)
Definition: inout.c:2485
void MMG5_memOption_memSet(MMG5_pMesh mesh)
Definition: tools.c:586
float MMG5_swapf(float sbin)
Definition: inout.c:61
double MMG5_nonorsurf(MMG5_pMesh mesh, MMG5_pTria pt)
Definition: tools.c:107
int MMG5_Add_dnode(MMG5_pMesh mesh, MMG5_dNode **liLi, int, double)
Definition: tools.c:742
static void * myrealloc(void *ptr_in, size_t s, size_t oldsize)
Definition: mmgcommon.h:242
int MMG5_grad2metSurfreq(MMG5_pMesh, MMG5_pSol, MMG5_pTria, int, int)
Definition: anisosiz.c:1448
int MMG5_boundingBox(MMG5_pMesh mesh)
Definition: scalem.c:45
static void MMG5_excfun(int sigid)
Definition: mmgcommon.h:463
int MMG5_Add_inode(MMG5_pMesh mesh, MMG5_iNode **liLi, int val)
Definition: tools.c:644
int MMG5_updatemetreq_ani(double *n, double dn[2], double vp[2][2])
Definition: anisosiz.c:1411
int MMG5_regnor(MMG5_pMesh mesh)
Definition: analys.c:46
void MMG5_mmgUsage(char *prog)
Definition: mmg.c:44
int MMG5_writeLocalParamAtTri(MMG5_pMesh, MMG5_iNode *, FILE *)
Definition: mmg.c:236
const char * MMG5_Get_formatName(enum MMG5_Format fmt)
Definition: mmg.c:556
int MMG5_getIniRef(MMG5_pMesh, int)
Definition: mmg2.c:82
void MMG5_build3DMetric(MMG5_pMesh mesh, MMG5_pSol sol, int ip, double dbuf[6])
Definition: inout.c:1479
int MMG5_interp_iso(double *ma, double *mb, double *mp, double t)
Definition: intmet.c:478
double MMG5_surftri_iso(MMG5_pMesh mesh, MMG5_pSol met, MMG5_pTria ptt)
Definition: isosiz.c:42
int(* MMG5_indPt)(MMG5_pMesh mesh, int kp)
Definition: mmgexterns.c:31
void MMG5_check_hminhmax(MMG5_pMesh mesh, int8_t sethmin, int8_t sethmax)
Definition: scalem.c:88
int MMG5_compute_meanMetricAtMarkedPoints_ani(MMG5_pMesh mesh, MMG5_pSol met)
Definition: anisosiz.c:1685
double MMG5_ridSizeInTangentDir(MMG5_pMesh, MMG5_pPoint, int, int *, double, double)
Definition: anisosiz.c:723
int MMG5_scale_meshAndSol(MMG5_pMesh, MMG5_pSol, MMG5_pSol, double *, int8_t *, int8_t *)
Definition: scalem.c:182
void MMG5_displayLengthHisto(MMG5_pMesh, int, double *, int, int, double, int, int, double, int, double *, int *, int8_t)
Definition: quality.c:251
int MMG5_intersecmet22(MMG5_pMesh mesh, double *m, double *n, double *mr)
Definition: mettools.c:254
void MMG5_paramUsage1(void)
Definition: mmg.c:72
void MMG5_2d3dUsage(void)
Definition: mmg.c:121
void MMG5_solTruncatureForOptim(MMG5_pMesh mesh, MMG5_pSol met)
Definition: mmg.c:263
static const uint8_t MMG5_iprv2[3]
Definition: mmgcommon.h:548
double MMG5_det3pt1vec(double c0[3], double c1[3], double c2[3], double v[3])
Definition: tools.c:807
int MMG5_mmgIntextmet(MMG5_pMesh, MMG5_pSol, int, double *, double *)
int MMG5_mmgIntmet33_ani(double *, double *, double *, double)
Definition: intmet.c:49
double MMG5_det4pt(double c0[3], double c1[3], double c2[3], double c3[3])
Definition: tools.c:819
MMG5_Format
Type of supported file format.
Definition: mmgcommon.h:531
@ MMG5_FMT_MeditBinary
Definition: mmgcommon.h:533
@ MMG5_FMT_Tetgen
Definition: mmgcommon.h:541
@ MMG5_FMT_VtkVtk
Definition: mmgcommon.h:540
@ MMG5_FMT_GmshBinary
Definition: mmgcommon.h:535
@ MMG5_FMT_VtkPvtp
Definition: mmgcommon.h:536
@ MMG5_FMT_Unknown
Definition: mmgcommon.h:542
@ MMG5_FMT_GmshASCII
Definition: mmgcommon.h:534
@ MMG5_FMT_MeditASCII
Definition: mmgcommon.h:532
@ MMG5_FMT_VtkVtp
Definition: mmgcommon.h:539
@ MMG5_FMT_VtkPvtu
Definition: mmgcommon.h:537
@ MMG5_FMT_VtkVtu
Definition: mmgcommon.h:538
int MMG5_saveMshMesh(MMG5_pMesh, MMG5_pSol *, const char *, int)
Definition: inout.c:1538
int MMG5_buildridmetnor(MMG5_pMesh, MMG5_pSol, int, double *, double *, double[3][3])
void MMG5_mark_pointsOnReqEdge_fromTria(MMG5_pMesh mesh)
Definition: isosiz.c:242
int MMG5_buildridmetfic(MMG5_pMesh, double *, double *, double, double, double, double *)
MMG5_Bezier * MMG5_pBezier
Definition: mmgcommon.h:563
void MMG5_writeDoubleSol3D(MMG5_pMesh, MMG5_pSol, FILE *, int, int, int)
Definition: inout.c:2257
void MMG5_mmgDefaultValues(MMG5_pMesh mesh)
Definition: mmg.c:150
int MMG5_sum_reqEdgeLengthsAtPoint(MMG5_pMesh, MMG5_pSol, int ip0, int ip1)
Definition: isosiz.c:129
int MMG5_hashUpdate(MMG5_Hash *hash, int a, int b, int k)
Definition: hash.c:271
int MMG5_chkMetricType(MMG5_pMesh mesh, int *type, FILE *inm)
Definition: inout.c:2435
void MMG5_keep_subdomainElts(MMG5_pMesh, int, int(*delElt)(MMG5_pMesh, int))
Definition: tools.c:958
int MMG5_rmtr(double r[3][3], double m[6], double mr[6])
Definition: tools.c:199
int MMG5_invmat33(double m[3][3], double mi[3][3])
Definition: tools.c:370
int MMG5_hashEdgeTag(MMG5_pMesh mesh, MMG5_Hash *hash, int a, int b, int16_t k)
Definition: hash.c:307
void MMG5_lagUsage(void)
Definition: mmg.c:105
double MMG5_swapd(double sbin)
Definition: inout.c:73
int MMG5_loadVtuMesh(MMG5_pMesh mesh, MMG5_pSol sol, const char *filename)
int MMG5_hashGet(MMG5_Hash *hash, int a, int b)
Definition: hash.c:364
void MMG5_defUninitSize(MMG5_pMesh mesh, MMG5_pSol met, int8_t ismet)
Definition: anisosiz.c:225
double(* MMG5_lenSurfEdg)(MMG5_pMesh mesh, MMG5_pSol sol, int, int, int8_t)
Definition: mmgexterns.c:29
int MMG5_saveSolHeader(MMG5_pMesh, const char *, FILE **, int, int *, int, int, int, int *, int *)
Definition: inout.c:2323
int MMG5_paratmet(double c0[3], double n0[3], double m[6], double c1[3], double n1[3], double mt[6])
Definition: mettools.c:652
int MMG5_norpts(MMG5_pMesh, int, int, int, double *)
Definition: tools.c:130
struct MMG5_iNode_s MMG5_iNode
void MMG5_Free_ilinkedList(MMG5_pMesh mesh, MMG5_iNode *liLi)
Definition: tools.c:696
static const uint8_t MMG5_inxt2[6]
Definition: mmgcommon.h:547
void MMG5_mark_verticesAsUnused(MMG5_pMesh mesh)
Definition: tools.c:881
static size_t myfree(void *ptr)
Definition: mmgcommon.h:267
double MMG5_surftri_ani(MMG5_pMesh mesh, MMG5_pSol met, MMG5_pTria ptt)
Definition: anisosiz.c:122
void MMG5_displayLengthHisto_internal(int, int, int, double, int, int, double, int, double *, int *, int8_t, int)
Definition: quality.c:293
double MMG5_ridSizeInNormalDir(MMG5_pMesh, int, double *, MMG5_pBezier, double, double)
void MMG5_printTria(MMG5_pMesh mesh, char *fileName)
Definition: tools.c:520
void MMG5_printMetStats(MMG5_pMesh mesh, MMG5_pSol met)
Definition: inout.c:2467
int MMG5_devangle(double *n1, double *n2, double crit)
Definition: tools.c:50
int MMG5_isSplit(MMG5_pMesh, int, int *, int *)
Definition: mmg2.c:48
int MMG5_grad2metSurf(MMG5_pMesh, MMG5_pSol, MMG5_pTria, int, int)
Definition: anisosiz.c:910
int MMG5_elementWeight(MMG5_pMesh, MMG5_pSol, MMG5_pTria, MMG5_pPoint, MMG5_Bezier *, double r[3][3], double gv[2])
Definition: anisomovpt.c:53
int MMG5_bouler(MMG5_pMesh, int *, int, int i, int *, int *, int *, int *, int)
Definition: boulep.c:277
int MMG5_scaleMesh(MMG5_pMesh mesh, MMG5_pSol met, MMG5_pSol ls)
Definition: scalem.c:273
int MMG5_buildridmet(MMG5_pMesh, MMG5_pSol, int, double, double, double, double *, double[3][3])
void MMG5_paramUsage2(void)
Definition: mmg.c:89
int(* MMG5_grad2metreq_ani)(MMG5_pMesh, MMG5_pSol, MMG5_pTria, int, int)
Definition: mmgexterns.c:33
int MMG5_nortri(MMG5_pMesh mesh, MMG5_pTria pt, double *n)
Definition: tools.c:156
int MMG5_interpreg_ani(MMG5_pMesh, MMG5_pSol, MMG5_pTria, int8_t, double, double *mr)
int(* MMG5_indElt)(MMG5_pMesh mesh, int kel)
Definition: mmgexterns.c:30
int MMG5_nonUnitNorPts(MMG5_pMesh, int, int, int, double *)
Definition: tools.c:74
int MMG5_loadMshMesh_part2(MMG5_pMesh mesh, MMG5_pSol *sol, FILE **inm, const long posNodes, const long posElts, const long *posNodeData, const int bin, const int iswp, const int nelts, const int nsols)
Definition: inout.c:626
int MMG5_rotmatrix(double n[3], double r[3][3])
Definition: tools.c:233
int MMG5_sys33sym(double a[6], double b[3], double r[3])
Definition: tools.c:464
void MMG5_gradation_info(MMG5_pMesh)
Definition: isosiz.c:96
int MMG5_boulen(MMG5_pMesh, int *, int, int i, double *nn)
Definition: boulep.c:113
int MMG5_defsiz_startingMessage(MMG5_pMesh, MMG5_pSol, const char *funcname)
Definition: isosiz.c:77
int(* MMG5_grad2met_ani)(MMG5_pMesh, MMG5_pSol, MMG5_pTria, int, int)
Definition: mmgexterns.c:32
char * MMG5_Get_path(char *path)
Definition: mmg.c:419
void MMG5_mark_usedVertices(MMG5_pMesh mesh, void(*delPt)(MMG5_pMesh, int))
Definition: tools.c:905
int MMG5_gradsiz_iso(MMG5_pMesh mesh, MMG5_pSol met)
Definition: isosiz.c:277
int MMG5_compute_meanMetricAtMarkedPoints_iso(MMG5_pMesh mesh, MMG5_pSol met)
Definition: isosiz.c:167
char * MMG5_Get_filenameExt(char *filename)
Definition: mmg.c:375
int MMG5_invmatg(double m[9], double mi[9])
Definition: tools.c:330
int MMG5_swapbin(int sbin)
Definition: inout.c:38
int MMG5_gradsiz_ani(MMG5_pMesh mesh, MMG5_pSol met, int *it)
Definition: anisosiz.c:1739
int MMG5_boulep(MMG5_pMesh mesh, int start, int ip, int *, int *list)
Definition: boulep.c:51
static void * mymalloc(size_t s)
Definition: mmgcommon.h:229
int MMG5_minQualCheck(int iel, double minqual, double alpha)
Definition: quality.c:342
char * MMG5_Remove_ext(char *path, char *)
Definition: mmg.c:454
double MMG5_orvol(MMG5_pPoint point, int *v)
Definition: tools.c:838
void MMG5_Free_dlinkedList(MMG5_pMesh mesh, MMG5_dNode *liLi)
Definition: tools.c:794
void MMG5_fillDefmetregSys(int, MMG5_pPoint, int, MMG5_Bezier, double r[3][3], double *, double *, double *, double *)
struct MMG5_dNode_s MMG5_dNode
void MMG5_Set_commonFunc(void)
double MMG5_caltri_iso(MMG5_pMesh mesh, MMG5_pSol met, MMG5_pTria ptt)
Definition: quality.c:198
int MMG5_reset_metricAtReqEdges_surf(MMG5_pMesh, MMG5_pSol, int8_t)
Definition: isosiz.c:204
int MMG5_hashNew(MMG5_pMesh mesh, MMG5_Hash *hash, int hsiz, int hmax)
Definition: hash.c:394
int MMG5_Get_format(char *ptr, int)
Definition: mmg.c:508
int MMG5_solveDefmetregSys(MMG5_pMesh, double r[3][3], double *, double *, double *, double *, double, double, double)
double MMG5_surftri33_ani(MMG5_pMesh, MMG5_pTria, double *, double *, double *)
double MMG5_caltri33_ani(MMG5_pMesh mesh, MMG5_pSol met, MMG5_pTria pt)
Definition: quality.c:47
int MMG5_intmetsavedir(MMG5_pMesh mesh, double *m, double *n, double *mr)
Definition: mettools.c:86
int MMG5_invmat(double *m, double *mi)
Definition: tools.c:279
Definition: mmgcommon.h:557
Identic as MMG5_HGeom but use MMG5_hedge to store edges instead of MMG5_hgeom (memory economy).
Definition: libmmgtypes.h:542
int8_t ddebug
Definition: libmmgtypes.h:487
int mem
Definition: libmmgtypes.h:478
int imprim
Definition: libmmgtypes.h:484
MMG mesh structure.
Definition: libmmgtypes.h:552
MMG5_Info info
Definition: libmmgtypes.h:599
Structure to store points of a MMG mesh.
Definition: libmmgtypes.h:241
Definition: libmmgtypes.h:610
Definition: libmmgtypes.h:301
Definition: mmgcommon.h:578
struct MMG5_dNode_s * nxt
Definition: mmgcommon.h:581
int k
Definition: mmgcommon.h:579
double val
Definition: mmgcommon.h:580
Cell for linked list of double value.
Definition: mmgcommon.h:569
struct MMG5_iNode_s * nxt
Definition: mmgcommon.h:571
int val
Definition: mmgcommon.h:570
Cell for linked list of integer value.