mmgs
mmgs.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 _MMGS_H
25 #define _MMGS_H
26 
27 #include "libmmgs.h"
28 #include "mmgcommon.h"
29 
30 #ifdef __cplusplus
31 extern "C" {
32 #endif
33 
34 /* numerical accuracy */
35 #define _MMGS_ALPHAD 3.464101615137755 /* 6.0 / sqrt(3.0) */
36 
37 #define _MMGS_LOPTL 1.4
38 #define _MMGS_LOPTS 0.71
39 #define _MMGS_LLONG 2.0
40 #define _MMGS_LSHRT 0.3
41 
42 #define _MMGS_LMAX 1024
43 #define _MMGS_BADKAL 2.e-2
44 #define _MMGS_NULKAL 1.e-4
45 
46 #define _MMGS_NPMAX 500000
47 #define _MMGS_NTMAX 1000000
48 #define _MMGS_XPMAX 500000
49 
50 
51 #define MS_SIN(tag) ((tag & MG_CRN) || (tag & MG_REQ) || (tag & MG_NOM))
52 
53 
55 #define _MMGS_RETURN_AND_FREE(mesh,met,val)do \
56  { \
57  if ( !MMGS_Free_all(MMG5_ARG_start, \
58  MMG5_ARG_ppMesh,&mesh,MMG5_ARG_ppMet,&met, \
59  MMG5_ARG_end) ) { \
60  return MMG5_LOWFAILURE; \
61  } \
62  return(val); \
63  }while(0)
64 
67 #define _MMGS_POINT_REALLOC(mesh,sol,ip,wantedGap,law,o,tag,retval ) do \
68  { \
69  int klink; \
70  \
71  _MMG5_TAB_RECALLOC(mesh,mesh->point,mesh->npmax,wantedGap,MMG5_Point, \
72  "larger point table",law,retval); \
73  \
74  mesh->npnil = mesh->np+1; \
75  for (klink=mesh->npnil; klink<mesh->npmax-1; klink++) \
76  mesh->point[klink].tmp = klink+1; \
77  \
78  /* solution */ \
79  if ( sol->m ) { \
80  _MMG5_ADD_MEM(mesh,(sol->size*(mesh->npmax-sol->npmax))*sizeof(double), \
81  "larger solution",law); \
82  _MMG5_SAFE_REALLOC(sol->m,sol->size*(mesh->npmax+1),double, \
83  "larger solution",retval); \
84  } \
85  sol->npmax = mesh->npmax; \
86  \
87  /* We try again to add the point */ \
88  ip = _MMGS_newPt(mesh,o,tag); \
89  if ( !ip ) {law;} \
90  }while(0)
91 
94 #define _MMGS_TRIA_REALLOC( mesh,jel,wantedGap,law,retval ) do \
95  { \
96  int klink,oldSiz; \
97  \
98  oldSiz = mesh->ntmax; \
99  _MMG5_TAB_RECALLOC(mesh,mesh->tria,mesh->ntmax,wantedGap,MMG5_Tria, \
100  "larger tria table",law,retval); \
101  \
102  mesh->nenil = mesh->nt+1; \
103  for (klink=mesh->nenil; klink<mesh->ntmax-1; klink++) \
104  mesh->tria[klink].v[2] = klink+1; \
105  \
106  if ( mesh->adja ) { \
107  /* adja table */ \
108  _MMG5_ADD_MEM(mesh,3*(mesh->ntmax-oldSiz)*sizeof(int), \
109  "larger adja table",law); \
110  _MMG5_SAFE_RECALLOC(mesh->adja,3*mesh->nt+5,3*mesh->ntmax+5,int \
111  ,"larger adja table",retval); \
112  } \
113  \
114  /* We try again to add the point */ \
115  jel = _MMGS_newElt(mesh); \
116  if ( !jel ) {law;} \
117  }while(0)
118 
119 /* prototypes */
120 int _MMGS_Init_mesh_var( va_list argptr );
121 int _MMGS_Free_all_var( va_list argptr );
122 int _MMGS_Free_structures_var( va_list argptr );
123 int _MMGS_Free_names_var( va_list argptr );
124 
134 int boulet(MMG5_pMesh mesh,int start,int ip,int *list);
135 int boulechknm(MMG5_pMesh mesh,int start,int ip,int *list);
136 int boulep(MMG5_pMesh mesh,int start,int ip,int *list);
137 int bouletrid(MMG5_pMesh mesh,int start,int ip,int *il1,int *l1,int *il2,int *l2,int *ip0,int *ip1);
138 int _MMGS_newPt(MMG5_pMesh mesh,double c[3],double n[3]);
139 void _MMGS_delPt(MMG5_pMesh mesh,int ip);
141 int _MMGS_delElt(MMG5_pMesh mesh,int iel);
142 int chkedg(MMG5_pMesh ,int );
144 int _MMGS_bezierInt(_MMG5_pBezier ,double *,double *,double *,double *);
145 int _MMGS_simbulgept(MMG5_pMesh mesh,MMG5_pSol met, int k,int i,int ip);
146 int _MMGS_split1_sim(MMG5_pMesh mesh,MMG5_pSol met,int k,int i, int *vx);
147 int _MMG5_split2_sim(MMG5_pMesh mesh,MMG5_pSol met,int k,int *vx);
148 int _MMGS_split3_sim(MMG5_pMesh mesh,MMG5_pSol met,int k,int *vx);
149 int _MMGS_split1(MMG5_pMesh mesh,MMG5_pSol met,int k,int i,int *vx);
150 int _MMGS_split2(MMG5_pMesh mesh,MMG5_pSol met,int k,int *vx);
151 int _MMGS_split3(MMG5_pMesh mesh,MMG5_pSol met,int k,int *vx);
152 int split1b(MMG5_pMesh mesh,int k,char i,int ip);
153 int chkcol(MMG5_pMesh mesh,MMG5_pSol met,int k,char i,int *list,char typchk);
154 int colver(MMG5_pMesh mesh,int *list,int ilist);
155 int colver3(MMG5_pMesh mesh,int*list);
156 int colver2(MMG5_pMesh mesh,int *ilist);
157 int swapar(MMG5_pMesh mesh,int k,int i);
158 int chkswp(MMG5_pMesh mesh,MMG5_pSol met,int k,int i,char typchk);
159 int swpedg(MMG5_pMesh mesh,MMG5_pSol met,int *list,int ilist,char typchk);
160 char typelt(MMG5_pPoint p[3],char *ia);
161 int litswp(MMG5_pMesh mesh,int k,char i,double kal);
162 int litcol(MMG5_pMesh mesh,int k,char i,double kal);
163 int _MMG5_mmgsChkmsh(MMG5_pMesh,int,int);
164 int paratmet(double c0[3],double n0[3],double m[6],double c1[3],double n1[3],double mt[6]);
165 int intregmet(MMG5_pMesh mesh,MMG5_pSol met,int k,char i,double s,double mr[6]);
166 int _MMG5_intridmet(MMG5_pMesh,MMG5_pSol,int,int,double,double*,double*);
167 int setref(MMG5_pMesh,int,int,int);
168 int delref(MMG5_pMesh);
170 int chknor(MMG5_pMesh);
171 long long _MMG5_memSize(void);
173 
174 #ifdef USE_SCOTCH
175 int _MMG5_mmgsRenumbering(int vertBoxNbr, MMG5_pMesh mesh, MMG5_pSol sol);
176 #endif
177 
178 /* useful functions to debug */
179 int _MMGS_indElt(MMG5_pMesh mesh,int kel);
180 int _MMGS_indPt(MMG5_pMesh mesh,int kp);
181 
182 /* function pointers */
183 /* init structures */
185 /* iso/aniso computations */
186 extern double caleltsig_ani(MMG5_pMesh mesh,MMG5_pSol met,int iel);
187 extern double caleltsig_iso(MMG5_pMesh mesh,MMG5_pSol met,int iel);
193 int intmet_iso(MMG5_pMesh mesh,MMG5_pSol met,int k,char i,int ip,double s);
194 int intmet_ani(MMG5_pMesh mesh,MMG5_pSol met,int k,char i,int ip,double s);
195 int _MMGS_intmet33_ani(MMG5_pMesh,MMG5_pSol,int,char,int,double);
196 int movridpt_iso(MMG5_pMesh mesh,MMG5_pSol met,int *list,int ilist);
197 int movintpt_iso(MMG5_pMesh mesh,MMG5_pSol met,int *list,int ilist);
198 int movridpt_ani(MMG5_pMesh mesh,MMG5_pSol met,int *list,int ilist);
199 int movintpt_ani(MMG5_pMesh mesh,MMG5_pSol met,int *list,int ilist);
201 
205 int (*intmet)(MMG5_pMesh mesh,MMG5_pSol met,int k,char i,int ip,double s);
206 int (*movridpt)(MMG5_pMesh mesh,MMG5_pSol met,int *list,int ilist);
207 int (*movintpt)(MMG5_pMesh mesh,MMG5_pSol met,int *list,int ilist);
208 
213 static inline
219 #ifdef USE_SCOTCH
220  _MMG5_renumbering = _MMG5_mmgsRenumbering;
221 #endif
222 }
223 
224 #ifdef __cplusplus
225 }
226 #endif
227 
228 #endif
int _MMG5_split2_sim(MMG5_pMesh mesh, MMG5_pSol met, int k, int *vx)
Definition: split_s.c:338
int chkedg(MMG5_pMesh, int)
Definition: mmgs1.c:206
int _MMGS_newElt(MMG5_pMesh mesh)
Definition: zaldy_s.c:71
int(* intmet)(MMG5_pMesh mesh, MMG5_pSol met, int k, char i, int ip, double s)
Definition: mmgs.h:205
static void _MMGS_Set_commonFunc()
Definition: mmgs.h:214
int intmet_iso(MMG5_pMesh mesh, MMG5_pSol met, int k, char i, int ip, double s)
Definition: intmet_s.c:77
int _MMG5_mmgsChkmsh(MMG5_pMesh, int, int)
Definition: chkmsh_s.c:48
! double * m
Definition: libmmgtypesf.h:585
void _MMG5_Init_parameters(MMG5_pMesh mesh)
Definition: API_functions.c:51
int _MMGS_intmet33_ani(MMG5_pMesh, MMG5_pSol, int, char, int, double)
Definition: intmet_s.c:143
int(* _MMG5_bezierCP)(MMG5_pMesh, MMG5_Tria *, _MMG5_pBezier, char)
Definition: mmgcommon.h:531
int(* _MMG5_indPt)(MMG5_pMesh mesh, int kp)
Definition: mmgcommon.h:536
double caleltsig_ani(MMG5_pMesh mesh, MMG5_pSol met, int iel)
Definition: quality_s.c:52
int(* _MMG5_chkmsh)(MMG5_pMesh, int, int)
Definition: mmgcommon.h:530
int(* _MMG5_defsiz)(MMG5_pMesh mesh, MMG5_pSol met)
Definition: mmgs.h:203
int chknor(MMG5_pMesh)
Definition: chkmsh_s.c:403
int movridpt_iso(MMG5_pMesh mesh, MMG5_pSol met, int *list, int ilist)
Definition: movpt_s.c:332
! double c[3]
Definition: libmmgtypesf.h:244
int _MMG5_intridmet(MMG5_pMesh, MMG5_pSol, int, int, double, double *, double *)
int _MMGS_outqua(MMG5_pMesh, MMG5_pSol)
Definition: quality_s.c:452
void _MMG5_defaultValues(MMG5_pMesh)
int _MMGS_analys(MMG5_pMesh mesh)
Definition: analys_s.c:817
int k
Definition: mmgcommon.h:426
Definition: libmmgtypes.h:526
int _MMGS_indElt(MMG5_pMesh mesh, int kel)
Definition: gentools_s.c:122
int swapar(MMG5_pMesh mesh, int k, int i)
Definition: swapar_s.c:296
int _MMGS_zaldy(MMG5_pMesh mesh)
Definition: zaldy_s.c:198
double caleltsig_iso(MMG5_pMesh mesh, MMG5_pSol met, int iel)
Definition: quality_s.c:139
int boulet(MMG5_pMesh mesh, int start, int ip, int *list)
Definition: boulep_s.c:49
int _MMGS_prilen(MMG5_pMesh mesh, MMG5_pSol met, int)
Definition: quality_s.c:281
int curvpo(MMG5_pMesh, MMG5_pSol)
int _MMGS_indPt(MMG5_pMesh mesh, int kp)
Definition: gentools_s.c:138
int gradsiz_ani(MMG5_pMesh mesh, MMG5_pSol met)
Definition: anisosiz_s.c:814
int _MMGS_split2(MMG5_pMesh mesh, MMG5_pSol met, int k, int *vx)
Definition: split_s.c:414
int _MMGS_bezierInt(_MMG5_pBezier, double *, double *, double *, double *)
int _MMGS_delElt(MMG5_pMesh mesh, int iel)
Definition: zaldy_s.c:93
int _MMGS_defsiz_ani(MMG5_pMesh mesh, MMG5_pSol met)
Definition: anisosiz_s.c:724
int chkswp(MMG5_pMesh mesh, MMG5_pSol met, int k, int i, char typchk)
Definition: swapar_s.c:39
int chkmet(MMG5_pMesh, MMG5_pSol)
Definition: chkmsh_s.c:290
int _MMGS_Free_all_var(va_list argptr)
Definition: variadic_s.c:205
int delref(MMG5_pMesh)
Definition: gentools_s.c:39
int movintpt_ani(MMG5_pMesh mesh, MMG5_pSol met, int *list, int ilist)
Definition: anisomovpt_s.c:48
int _MMGS_Free_names_var(va_list argptr)
Definition: variadic_s.c:394
int _MMGS_Init_mesh_var(va_list argptr)
Definition: variadic_s.c:123
int intmet_ani(MMG5_pMesh mesh, MMG5_pSol met, int k, char i, int ip, double s)
Definition: intmet_s.c:104
int _MMGS_split1(MMG5_pMesh mesh, MMG5_pSol met, int k, int i, int *vx)
Definition: split_s.c:107
int boulechknm(MMG5_pMesh mesh, int start, int ip, int *list)
Definition: boulep_s.c:111
long long _MMG5_memSize(void)
Definition: tools.c:418
int litcol(MMG5_pMesh mesh, int k, char i, double kal)
Definition: colver_s.c:454
int intregmet(MMG5_pMesh mesh, MMG5_pSol met, int k, char i, double s, double mr[6])
Definition: intmet_s.c:57
int _MMGS_inqua(MMG5_pMesh, MMG5_pSol)
Definition: quality_s.c:386
int _MMGS_memOption(MMG5_pMesh mesh)
Definition: zaldy_s.c:113
int bouletrid(MMG5_pMesh mesh, int start, int ip, int *il1, int *l1, int *il2, int *l2, int *ip0, int *ip1)
Definition: boulep_s.c:312
int(* movintpt)(MMG5_pMesh mesh, MMG5_pSol met, int *list, int ilist)
Definition: mmgs.h:207
const int va_list argptr
Definition: API_functionsf_s.c:546
int colver3(MMG5_pMesh mesh, int *list)
Definition: colver_s.c:351
int paratmet(double c0[3], double n0[3], double m[6], double c1[3], double n1[3], double mt[6])
Structure to store points of a MMG mesh.
Definition: libmmgtypes.h:205
int gradsiz_iso(MMG5_pMesh mesh, MMG5_pSol met)
Definition: isosiz_s.c:260
API headers for the mmgs library.
int litswp(MMG5_pMesh mesh, int k, char i, double kal)
Definition: swapar_s.c:354
int _MMGS_newPt(MMG5_pMesh mesh, double c[3], double n[3])
Definition: zaldy_s.c:39
int _MMGS_mmgs2(MMG5_pMesh, MMG5_pSol)
Definition: mmgs2.c:583
int _MMG5_mmgs1(MMG5_pMesh, MMG5_pSol)
Definition: mmgs1.c:1347
int(* gradsiz)(MMG5_pMesh mesh, MMG5_pSol met)
Definition: mmgs.h:204
int chkcol(MMG5_pMesh mesh, MMG5_pSol met, int k, char i, int *list, char typchk)
Definition: colver_s.c:53
int _MMGS_split3_sim(MMG5_pMesh mesh, MMG5_pSol met, int k, int *vx)
Definition: split_s.c:487
double(* _MMG5_calelt)(MMG5_pMesh mesh, MMG5_pSol met, MMG5_pTria ptt)
Definition: mmgs.h:202
int _MMGS_simbulgept(MMG5_pMesh mesh, MMG5_pSol met, int k, int i, int ip)
Definition: split_s.c:158
MMG mesh structure.
Definition: libmmgtypes.h:473
int colver2(MMG5_pMesh mesh, int *ilist)
Definition: colver_s.c:414
int _MMGS_Free_structures_var(va_list argptr)
Definition: variadic_s.c:306
int _MMGS_defsiz_iso(MMG5_pMesh mesh, MMG5_pSol met)
Definition: isosiz_s.c:51
int _MMG5_mmgsBezierCP(MMG5_pMesh, MMG5_Tria *, _MMG5_pBezier, char ori)
Definition: bezier_s.c:54
int _MMGS_split1_sim(MMG5_pMesh mesh, MMG5_pSol met, int k, int i, int *vx)
Definition: split_s.c:50
Definition: mmgcommon.h:383
! char ori
Definition: libmmgtypesf.h:400
! double n[3]
Definition: libmmgtypesf.h:245
int assignEdge(MMG5_pMesh mesh)
Definition: hash_s.c:112
! double n1[3]
Definition: libmmgtypesf.h:264
int(* movridpt)(MMG5_pMesh mesh, MMG5_pSol met, int *list, int ilist)
Definition: mmgs.h:206
int movridpt_ani(MMG5_pMesh mesh, MMG5_pSol met, int *list, int ilist)
Definition: anisomovpt_s.c:264
void _MMGS_delPt(MMG5_pMesh mesh, int ip)
Definition: zaldy_s.c:58
MMG5_pMesh * mesh
Definition: API_functionsf_s.c:63
int swpedg(MMG5_pMesh mesh, MMG5_pSol met, int *list, int ilist, char typchk)
Definition: swapar_s.c:407
Definition: libmmgtypes.h:261
int(* _MMG5_indElt)(MMG5_pMesh mesh, int kel)
Definition: mmgcommon.h:535
int boulep(MMG5_pMesh mesh, int start, int ip, int *list)
Definition: boulep_s.c:242
int colver(MMG5_pMesh mesh, int *list, int ilist)
Definition: colver_s.c:261
! int s
Definition: libmmgtypesf.h:251
int split1b(MMG5_pMesh mesh, int k, char i, int ip)
Definition: split_s.c:220
char typelt(MMG5_pPoint p[3], char *ia)
Definition: quality_s.c:509
int _MMGS_split3(MMG5_pMesh mesh, MMG5_pSol met, int k, int *vx)
Definition: split_s.c:575
int _MMGS_hashTria(MMG5_pMesh)
Definition: hash_s.c:76
int movintpt_iso(MMG5_pMesh mesh, MMG5_pSol met, int *list, int ilist)
Definition: movpt_s.c:41
int setref(MMG5_pMesh, int, int, int)
Definition: gentools_s.c:64