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/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 
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 ) do \
68  { \
69  int klink; \
70  \
71  MMG5_TAB_RECALLOC(mesh,mesh->point,mesh->npmax,wantedGap,MMG5_Point, \
72  "larger point table",law); \
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*(sol->npmax+1), \
83  sol->size*(mesh->npmax+1),double, \
84  "larger solution",law); \
85  } \
86  sol->npmax = mesh->npmax; \
87  \
88  /* We try again to add the point */ \
89  ip = MMGS_newPt(mesh,o,tag); \
90  if ( !ip ) {law;} \
91  }while(0)
92 
95 #define MMGS_TRIA_REALLOC( mesh,jel,wantedGap,law ) do \
96  { \
97  int klink,oldSiz; \
98  \
99  oldSiz = mesh->ntmax; \
100  MMG5_TAB_RECALLOC(mesh,mesh->tria,mesh->ntmax,wantedGap,MMG5_Tria, \
101  "larger tria table",law); \
102  \
103  mesh->nenil = mesh->nt+1; \
104  for (klink=mesh->nenil; klink<mesh->ntmax-1; klink++) \
105  mesh->tria[klink].v[2] = klink+1; \
106  \
107  if ( mesh->adja ) { \
108  /* adja table */ \
109  MMG5_ADD_MEM(mesh,3*(mesh->ntmax-oldSiz)*sizeof(int), \
110  "larger adja table",law); \
111  MMG5_SAFE_RECALLOC(mesh->adja,3*oldSiz+5,3*mesh->ntmax+5,int \
112  ,"larger adja table",law); \
113  } \
114  \
115  /* We try again to add the point */ \
116  jel = MMGS_newElt(mesh); \
117  if ( !jel ) {law;} \
118  }while(0)
119 
120 /* prototypes */
121 int MMGS_Init_mesh_var( va_list argptr );
122 int MMGS_Free_all_var( va_list argptr );
123 int MMGS_Free_structures_var( va_list argptr );
124 int MMGS_Free_names_var( va_list argptr );
125 
135 int boulet(MMG5_pMesh mesh,int start,int ip,int *list);
136 int boulechknm(MMG5_pMesh mesh,int start,int ip,int *list);
137 int boulep(MMG5_pMesh mesh,int start,int ip,int *list);
138 int bouletrid(MMG5_pMesh mesh,int start,int ip,int *il1,int *l1,int *il2,int *l2,int *ip0,int *ip1);
139 int MMGS_newPt(MMG5_pMesh mesh,double c[3],double n[3]);
140 void MMGS_delPt(MMG5_pMesh mesh,int ip);
142 int MMGS_delElt(MMG5_pMesh mesh,int iel);
143 int chkedg(MMG5_pMesh ,int );
145 int MMGS_bezierInt(MMG5_pBezier ,double *,double *,double *,double *);
146 int MMGS_simbulgept(MMG5_pMesh mesh,MMG5_pSol met, int k,int i,int ip);
147 int MMGS_split1_sim(MMG5_pMesh mesh,MMG5_pSol met,int k,int i, int *vx);
148 int MMG5_split2_sim(MMG5_pMesh mesh,MMG5_pSol met,int k,int *vx);
149 int MMGS_split3_sim(MMG5_pMesh mesh,MMG5_pSol met,int k,int *vx);
150 int MMGS_split1(MMG5_pMesh mesh,MMG5_pSol met,int k,int i,int *vx);
151 int MMGS_split2(MMG5_pMesh mesh,MMG5_pSol met,int k,int *vx);
152 int MMGS_split3(MMG5_pMesh mesh,MMG5_pSol met,int k,int *vx);
153 int split1b(MMG5_pMesh mesh,int k,char i,int ip);
154 int chkcol(MMG5_pMesh mesh,MMG5_pSol met,int k,char i,int *list,char typchk);
155 int colver(MMG5_pMesh mesh,int *list,int ilist);
156 int colver3(MMG5_pMesh mesh,int*list);
157 int colver2(MMG5_pMesh mesh,int *ilist);
158 int swapar(MMG5_pMesh mesh,int k,int i);
159 int chkswp(MMG5_pMesh mesh,MMG5_pSol met,int k,int i,char typchk);
160 int swpedg(MMG5_pMesh mesh,MMG5_pSol met,int *list,int ilist,char typchk);
161 char typelt(MMG5_pPoint p[3],char *ia);
162 int litswp(MMG5_pMesh mesh,int k,char i,double kal);
163 int litcol(MMG5_pMesh mesh,int k,char i,double kal);
164 int MMG5_mmgsChkmsh(MMG5_pMesh,int,int);
165 int paratmet(double c0[3],double n0[3],double m[6],double c1[3],double n1[3],double mt[6]);
166 int intregmet(MMG5_pMesh mesh,MMG5_pSol met,int k,char i,double s,double mr[6]);
167 int MMG5_intridmet(MMG5_pMesh,MMG5_pSol,int,int,double,double*,double*);
168 int setref(MMG5_pMesh,int,int,int);
169 int delref(MMG5_pMesh);
171 int chknor(MMG5_pMesh);
172 size_t MMG5_memSize(void);
175 
176 #ifdef USE_SCOTCH
177 int MMG5_mmgsRenumbering(int vertBoxNbr, MMG5_pMesh mesh, MMG5_pSol sol);
178 #endif
179 
180 /* useful functions to debug */
181 int MMGS_indElt(MMG5_pMesh mesh,int kel);
182 int MMGS_indPt(MMG5_pMesh mesh,int kp);
183 
184 /* function pointers */
185 /* init structures */
187 /* iso/aniso computations */
188 double caleltsig_ani(MMG5_pMesh mesh,MMG5_pSol met,int iel);
189 double caleltsig_iso(MMG5_pMesh mesh,MMG5_pSol met,int iel);
195 int intmet_iso(MMG5_pMesh mesh,MMG5_pSol met,int k,char i,int ip,double s);
196 int intmet_ani(MMG5_pMesh mesh,MMG5_pSol met,int k,char i,int ip,double s);
197 int MMGS_intmet33_ani(MMG5_pMesh,MMG5_pSol,int,char,int,double);
198 int movridpt_iso(MMG5_pMesh mesh,MMG5_pSol met,int *list,int ilist);
199 int movintpt_iso(MMG5_pMesh mesh,MMG5_pSol met,int *list,int ilist);
200 int movridpt_ani(MMG5_pMesh mesh,MMG5_pSol met,int *list,int ilist);
201 int movintpt_ani(MMG5_pMesh mesh,MMG5_pSol met,int *list,int ilist);
202 int MMGS_prilen(MMG5_pMesh mesh,MMG5_pSol met,int);
204 
209 int (*intmet)(MMG5_pMesh mesh,MMG5_pSol met,int k,char i,int ip,double s);
210 int (*movridpt)(MMG5_pMesh mesh,MMG5_pSol met,int *list,int ilist);
211 int (*movintpt)(MMG5_pMesh mesh,MMG5_pSol met,int *list,int ilist);
212 
217 static inline
225 #ifdef USE_SCOTCH
226  MMG5_renumbering = MMG5_mmgsRenumbering;
227 #endif
228 }
229 
230 #ifdef __cplusplus
231 }
232 #endif
233 
234 #endif
int chkedg(MMG5_pMesh, int)
Definition: mmgs1.c:210
int(* intmet)(MMG5_pMesh mesh, MMG5_pSol met, int k, char i, int ip, double s)
Definition: mmgs.h:209
int MMGS_analys(MMG5_pMesh mesh)
Definition: analys_s.c:819
int(* MMG5_grad2met_ani)(MMG5_pMesh, MMG5_pSol, MMG5_pTria, int, int)
Definition: mmgcommon.h:631
int intmet_iso(MMG5_pMesh mesh, MMG5_pSol met, int k, char i, int ip, double s)
Definition: intmet_s.c:77
! double * m
Definition: libmmgtypesf.h:627
int MMGS_Free_all_var(va_list argptr)
Definition: variadic_s.c:205
double caleltsig_ani(MMG5_pMesh mesh, MMG5_pSol met, int iel)
Definition: quality_s.c:52
int(* MMG5_bezierCP)(MMG5_pMesh, MMG5_Tria *, MMG5_pBezier, char)
Definition: mmgcommon.h:629
int MMGS_prilen(MMG5_pMesh mesh, MMG5_pSol met, int)
Definition: quality_s.c:281
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:333
! int k
Definition: libmmgtypesf.h:543
! double c[3]
Definition: libmmgtypesf.h:255
int MMGS_split2(MMG5_pMesh mesh, MMG5_pSol met, int k, int *vx)
Definition: split_s.c:414
int MMGS_set_metricAtPointsOnReqEdges(MMG5_pMesh, MMG5_pSol)
Definition: isosiz_s.c:86
Definition: libmmgtypes.h:563
int(* MMG5_chkmsh)(MMG5_pMesh, int, int)
Definition: mmgcommon.h:628
int(* MMG5_grad2metreq_ani)(MMG5_pMesh, MMG5_pSol, MMG5_pTria, int, int)
Definition: mmgcommon.h:632
int MMGS_newElt(MMG5_pMesh mesh)
Definition: zaldy_s.c:71
int MMGS_defsiz_iso(MMG5_pMesh mesh, MMG5_pSol met)
Definition: isosiz_s.c:137
int swapar(MMG5_pMesh mesh, int k, int i)
Definition: swapar_s.c:296
int MMGS_split3_sim(MMG5_pMesh mesh, MMG5_pSol met, int k, int *vx)
Definition: split_s.c:487
int MMGS_intmet33_ani(MMG5_pMesh, MMG5_pSol, int, char, int, double)
Definition: intmet_s.c:143
int MMGS_simbulgept(MMG5_pMesh mesh, MMG5_pSol met, int k, int i, int ip)
Definition: split_s.c:158
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 MMG5_grad2metSurf(MMG5_pMesh mesh, MMG5_pSol met, MMG5_pTria pt, int np1, int np2)
Definition: anisosiz.c:912
int MMGS_indPt(MMG5_pMesh mesh, int kp)
Definition: gentools_s.c:138
int MMGS_split3(MMG5_pMesh mesh, MMG5_pSol met, int k, int *vx)
Definition: split_s.c:575
int curvpo(MMG5_pMesh, MMG5_pSol)
int MMGS_zaldy(MMG5_pMesh mesh)
Definition: zaldy_s.c:241
int(* MMG5_indElt)(MMG5_pMesh mesh, int kel)
Definition: mmgcommon.h:637
double(* MMG5_calelt)(MMG5_pMesh mesh, MMG5_pSol met, MMG5_pTria ptt)
Definition: mmgs.h:205
static void MMGS_Set_commonFunc()
Definition: mmgs.h:218
int MMGS_newPt(MMG5_pMesh mesh, double c[3], double n[3])
Definition: zaldy_s.c:39
int MMGS_split1_sim(MMG5_pMesh mesh, MMG5_pSol met, int k, int i, int *vx)
Definition: split_s.c:50
int MMGS_gradsizreq_ani(MMG5_pMesh mesh, MMG5_pSol met)
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 delref(MMG5_pMesh)
Definition: gentools_s.c:39
int MMG5_mmgsBezierCP(MMG5_pMesh, MMG5_Tria *, MMG5_pBezier, char ori)
Definition: bezier_s.c:54
int movintpt_ani(MMG5_pMesh mesh, MMG5_pSol met, int *list, int ilist)
Definition: anisomovpt_s.c:48
int MMGS_outqua(MMG5_pMesh, MMG5_pSol)
Definition: quality_s.c:452
int intmet_ani(MMG5_pMesh mesh, MMG5_pSol met, int k, char i, int ip, double s)
Definition: intmet_s.c:104
int boulechknm(MMG5_pMesh mesh, int start, int ip, int *list)
Definition: boulep_s.c:111
int litcol(MMG5_pMesh mesh, int k, char i, double kal)
Definition: colver_s.c:455
int MMG5_intridmet(MMG5_pMesh, MMG5_pSol, int, int, double, double *, double *)
int intregmet(MMG5_pMesh mesh, MMG5_pSol met, int k, char i, double s, double mr[6])
Definition: intmet_s.c:57
int MMG5_mmgsChkmsh(MMG5_pMesh, int, int)
Definition: chkmsh_s.c:48
int MMGS_setMeshSize_alloc(MMG5_pMesh mesh)
Definition: zaldy_s.c:201
int(* MMG5_indPt)(MMG5_pMesh mesh, int kp)
Definition: mmgcommon.h:638
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 MMGS_split1(MMG5_pMesh mesh, MMG5_pSol met, int k, int i, int *vx)
Definition: split_s.c:107
int(* movintpt)(MMG5_pMesh mesh, MMG5_pSol met, int *list, int ilist)
Definition: mmgs.h:211
int MMGS_delElt(MMG5_pMesh mesh, int iel)
Definition: zaldy_s.c:93
const int va_list argptr
Definition: API_functionsf_s.c:626
int colver3(MMG5_pMesh mesh, int *list)
Definition: colver_s.c:352
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:214
int MMGS_gradsiz_ani(MMG5_pMesh mesh, MMG5_pSol met)
Definition: anisosiz_s.c:767
int MMGS_Init_mesh_var(va_list argptr)
Definition: variadic_s.c:123
API headers for the mmgs library.
int litswp(MMG5_pMesh mesh, int k, char i, double kal)
Definition: swapar_s.c:374
int MMG5_grad2metSurfreq(MMG5_pMesh mesh, MMG5_pSol met, MMG5_pTria pt, int npmaster, int npslave)
Definition: anisosiz.c:1450
int MMGS_memOption(MMG5_pMesh mesh)
Definition: zaldy_s.c:183
int(* MMGS_defsiz)(MMG5_pMesh mesh, MMG5_pSol met)
Definition: mmgs.h:206
int(* MMGS_gradsizreq)(MMG5_pMesh mesh, MMG5_pSol met)
Definition: mmgs.h:208
int MMGS_bezierInt(MMG5_pBezier, double *, double *, double *, double *)
void MMG5_Init_parameters(MMG5_pMesh mesh)
Definition: API_functions.c:51
int chkcol(MMG5_pMesh mesh, MMG5_pSol met, int k, char i, int *list, char typchk)
Definition: colver_s.c:53
Definition: mmgcommon.h:480
int MMGS_Free_names_var(va_list argptr)
Definition: variadic_s.c:388
int MMGS_hashTria(MMG5_pMesh)
Definition: hash_s.c:77
MMG mesh structure.
Definition: libmmgtypes.h:509
int MMGS_defsiz_ani(MMG5_pMesh mesh, MMG5_pSol met)
Definition: anisosiz_s.c:676
int colver2(MMG5_pMesh mesh, int *ilist)
Definition: colver_s.c:415
void MMGS_delPt(MMG5_pMesh mesh, int ip)
Definition: zaldy_s.c:58
int MMG5_split2_sim(MMG5_pMesh mesh, MMG5_pSol met, int k, int *vx)
Definition: split_s.c:338
int MMGS_indElt(MMG5_pMesh mesh, int kel)
Definition: gentools_s.c:122
int MMGS_inqua(MMG5_pMesh, MMG5_pSol)
Definition: quality_s.c:386
! char ori
Definition: libmmgtypesf.h:411
int MMGS_mmgs2(MMG5_pMesh, MMG5_pSol)
Definition: mmgs2.c:583
! double n[3]
Definition: libmmgtypesf.h:256
int assignEdge(MMG5_pMesh mesh)
Definition: hash_s.c:113
! double n1[3]
Definition: libmmgtypesf.h:275
void MMG5_defaultValues(MMG5_pMesh)
int(* movridpt)(MMG5_pMesh mesh, MMG5_pSol met, int *list, int ilist)
Definition: mmgs.h:210
int movridpt_ani(MMG5_pMesh mesh, MMG5_pSol met, int *list, int ilist)
Definition: anisomovpt_s.c:265
int(* MMGS_gradsiz)(MMG5_pMesh mesh, MMG5_pSol met)
Definition: mmgs.h:207
int MMG5_mmgs1(MMG5_pMesh, MMG5_pSol)
Definition: mmgs1.c:1352
int MMGS_Free_structures_var(va_list argptr)
Definition: variadic_s.c:296
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:427
Definition: libmmgtypes.h:270
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:262
! int s
Definition: libmmgtypesf.h:262
int split1b(MMG5_pMesh mesh, int k, char i, int ip)
Definition: split_s.c:220
size_t MMG5_memSize(void)
Definition: tools.c:547
char typelt(MMG5_pPoint p[3], char *ia)
Definition: quality_s.c:509
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