49#define MMGS_RETURN_AND_PACK(mesh,met,sol,val)do \
51 if ( !MMGS_packMesh(mesh,met,sol) ) { \
52 mesh->npi = mesh->np; \
53 mesh->nti = mesh->nt; \
54 mesh->nai = mesh->na; \
55 mesh->nei = mesh->ne; \
57 if ( met ) { met->npi = met->np; } \
58 if ( sol ) { sol->npi = sol->np; } \
59 return MMG5_LOWFAILURE; \
61 _LIBMMG5_RETURN(mesh,met,sol,val); \
76 for(k=1; k <=
mesh->
np; k++) {
96 MMG5_int iadr,iadrnew,iadrv,*adjav,*adja,*adjanew,voy;
97 MMG5_int k,nt,np,na,jel,nc,nr,nbl;
106 for (k=1; k<=
mesh->
np; k++) {
108 if ( !
MG_VOK(ppt) )
continue;
111 ppt->
ref = MMG5_abs(ppt->
ref);
118 for (k=1; k<=
mesh->
nt; k++) {
120 if ( !
MG_EOK(pt) )
continue;
132 iadrnew = 3*(nbl-1) + 1;
134 for(i=0 ; i<3 ; i++) {
135 adjanew[i] = adja[i];
136 if(!adja[i])
continue;
137 iadrv = 3*(adja[i]/3-1) +1;
140 adjav[adja[i]%3] = 3*nbl + voy;
146 for(i=0 ; i<3 ; i++) {
171 if ( met && met->
m ) {
173 for (k=1; k<=
mesh->
np; k++) {
175 if ( !
MG_VOK(ppt) )
continue;
176 imet = k * met->
size;
177 imetnew = nbl * met->
size;
179 for (i=0; i<met->
size; i++)
180 met->
m[imetnew + i] = met->
m[imet + i];
187 for (k=1; k<=
mesh->
np; k++) {
189 if ( !
MG_VOK(ppt) )
continue;
190 imet = k *
sol->size;
191 imetnew = nbl *
sol->size;
193 for (i=0; i<
sol->size; i++)
194 sol->m[imetnew + i] =
sol->m[imet + i];
202 for (k=1; k<=
mesh->
np; k++) {
204 if ( !
MG_VOK(ppt) )
continue;
232 printf(
" ## Warning: uncomplete mesh\n")
238 for (k=1; k<=
mesh->
nt; k++) {
241 for (i=0; i<3; i++) {
271 for(k=1 ; k<=
mesh->
np ; k++)
284 fprintf(stderr,
"\n ## Warning: %s: invalid mesh.\n",__func__);
289 fprintf(stdout,
" NUMBER OF VERTICES %8" MMG5_PRId
" CORNERS %8" MMG5_PRId
"\n",
mesh->
np,nc);
290 fprintf(stdout,
" NUMBER OF TRIANGLES %8" MMG5_PRId
"\n",
mesh->
nt);
293 fprintf(stdout,
" NUMBER OF EDGES %8" MMG5_PRId
" RIDGES %8" MMG5_PRId
"\n",
mesh->
na,nr);
302 int8_t mettofree = 0;
314 fprintf(stdout,
"\n ## WARNING: ISO MODE NOT PROVIDED: ENABLING ISOVALUE DISCRETIZATION MODE (-ls) \n");
351 if ( met && met->
np ) {
353 printf(
"\n ## ERROR: MISMATCH OPTIONS: OPTIM OPTION CAN NOT BE USED"
354 " WITH AN INPUT METRIC.\n");
360 printf(
"\n ## ERROR: MISMATCH OPTIONS: HSIZ OPTION CAN NOT BE USED"
361 " WITH AN INPUT METRIC.\n");
368 printf(
"\n ## ERROR: MISMATCH OPTIONS: HSIZ AND OPTIM OPTIONS CAN NOT BE USED"
375 printf(
"\n ## ERROR: MISMATCH OPTIONS: OPTIM OPTION IS NOT AVAILABLE IN"
376 " SURFACIC LEVEL_SET DISCRETIZATION MODE.\n");
381 if (
mesh->
info.
imprim > 0 ) fprintf(stdout,
"\n -- MMGSLS: INPUT DATA\n");
386 fprintf(stderr,
"\n ## WARNING: WRONG SOLUTION NUMBER. IGNORED\n");
390 else if (
sol->size!=1 ) {
391 fprintf(stderr,
"\n ## ERROR: WRONG DATA TYPE.\n");
395 if ( met && met->
np && (met->
np !=
mesh->
np) ) {
396 fprintf(stdout,
"\n ## WARNING: WRONG METRIC NUMBER. IGNORED\n");
403 fprintf(stderr,
"\n ## Unable to clean old isosurface.\n");
410 fprintf(stdout,
" -- INPUT DATA COMPLETED. %s\n",stim);
416 fprintf(stdout,
"\n -- PHASE 1 : ISOSURFACE DISCRETIZATION\n");
437 fprintf(stderr,
"\n ## ERROR: A VALID SOLUTION FILE IS NEEDED \n");
462 fprintf(stdout,
" -- PHASE 1 COMPLETED. %s\n",stim);
466 fprintf(stdout,
"\n -- PHASE 2 : ANALYSIS\n");
489 fprintf(stdout,
" -- PHASE 2 COMPLETED. %s\n",stim);
494 fprintf(stdout,
"\n -- PHASE 3 : MESH IMPROVEMENT\n");
500 fprintf(stderr,
"\n ## Hashing problem. Invalid mesh.\n");
510 fprintf(stdout,
" -- PHASE 3 COMPLETED. %s\n",stim);
521 if (
mesh->
info.
imprim > 0 ) fprintf(stdout,
"\n -- MESH PACKED UP\n");
537 fprintf(stdout,
"\n MMGSLS: ELAPSED TIME %s\n",stim);
538 fprintf(stdout,
"\n %s\n END OF MODULE MMGS\n %s\n\n",
MG_STR,
MG_STR);
577 fprintf(stderr,
"\n ## ERROR: LEVEL-SET DISCRETISATION UNAVAILABLE"
578 " (MMGS_IPARAM_iso or MMGS_IPARAM_isosurf):\n"
579 " YOU MUST CALL THE MMGS_MMGSLS FUNCTION TO USE THIS OPTION.\n");
587 if (
mesh->
info.
imprim > 0 ) fprintf(stdout,
"\n -- MMGS: INPUT DATA\n");
593 fprintf(stdout,
" ## WARNING: WRONG SOLUTION NUMBER. IGNORED\n");
597 else if ( met->
size!=1 && met->
size!=6 ) {
598 fprintf(stderr,
"\n ## ERROR: WRONG DATA TYPE.\n");
605 printf(
"\n ## ERROR: MISMATCH OPTIONS: OPTIM OPTION CAN NOT BE USED"
606 " WITH AN INPUT METRIC.\n");
611 printf(
"\n ## ERROR: MISMATCH OPTIONS: HSIZ OPTION CAN NOT BE USED"
612 " WITH AN INPUT METRIC.\n");
617 printf(
"\n ## ERROR: MISMATCH OPTIONS: HSIZ AND OPTIM OPTIONS CAN NOT BE USED"
625 fprintf(stdout,
" -- INPUT DATA COMPLETED. %s\n",stim);
631 fprintf(stdout,
"\n -- PHASE 1 : ANALYSIS\n");
676 fprintf(stdout,
" -- PHASE 1 COMPLETED. %s\n",stim);
681 fprintf(stdout,
"\n -- PHASE 2 : %s MESHING\n",met->
size < 6 ?
"ISOTROPIC" :
"ANISOTROPIC");
686 fprintf(stderr,
"\n ## Hashing problem. Invalid mesh.\n");
696 fprintf(stdout,
" -- PHASE 2 COMPLETED. %s\n",stim);
709 if (
mesh->
info.
imprim > 0 ) fprintf(stdout,
"\n -- MESH PACKED UP\n");
719 fprintf(stdout,
"\n MMGSLIB: ELAPSED TIME %s\n",stim);
720 fprintf(stdout,
"\n %s\n END OF MODULE MMGS\n %s\n\n",
MG_STR,
MG_STR);
MMG5_pMesh MMG5_pSol * sol
int MMGS_analys(MMG5_pMesh mesh)
MMG5_int MMG5_grad2metSurf(MMG5_pMesh mesh, MMG5_pSol met, MMG5_pTria pt, MMG5_int np1, MMG5_int np2)
int MMG5_grad2metSurfreq(MMG5_pMesh mesh, MMG5_pSol met, MMG5_pTria pt, MMG5_int npmaster, MMG5_int npslave)
int MMG5_mmgsBezierCP(MMG5_pMesh mesh, MMG5_Tria *pt, MMG5_pBezier pb, int8_t ori)
int MMG5_mmgsChkmsh(MMG5_pMesh mesh, int severe, MMG5_int base)
void tminit(mytime *t, int maxtim)
Initialize mytime object.
void printim(double elps, char *stim)
Print real time.
void chrono(int cmode, mytime *ptt)
Function to measure time.
int MMGS_hashTria(MMG5_pMesh mesh)
LIBMMG_CORE_EXPORT int MMG5_unscaleMesh(MMG5_pMesh mesh, MMG5_pSol met, MMG5_pSol ls)
LIBMMG_CORE_EXPORT int MMG5_scaleMesh(MMG5_pMesh mesh, MMG5_pSol met, MMG5_pSol ls)
int MMGS_mmgsls(MMG5_pMesh mesh, MMG5_pSol sol, MMG5_pSol umet)
Main "program" for level-set discretization.
static int MMGS_packMesh(MMG5_pMesh mesh, MMG5_pSol sol, MMG5_pSol met)
int MMGS_mmgslib(MMG5_pMesh mesh, MMG5_pSol met)
Main "program" for mesh adaptation.
void MMGS_Set_commonFunc(void)
Set common function pointers between mmgs and mmg3d to the matching mmgs functions.
static void MMGS_Free_topoTables(MMG5_pMesh mesh)
#define MMGS_RETURN_AND_PACK(mesh, met, sol, val)
API headers and documentation for the mmgs library.
LIBMMGS_EXPORT int MMGS_Clean_isoSurf(MMG5_pMesh mesh)
Clean data (triangles and edges) linked to isosurface.
LIBMMGS_EXPORT int(* MMGS_doSol)(MMG5_pMesh mesh, MMG5_pSol met)
Compute an isotropic size map according to the mean of the length of the edges passing through a vert...
LIBMMGS_EXPORT void MMGS_setfunc(MMG5_pMesh mesh, MMG5_pSol met)
Set function pointers for caltet, lenedg, defsiz and gradsiz.
LIBMMGS_EXPORT int MMGS_Set_constantSize(MMG5_pMesh mesh, MMG5_pSol met)
Compute a constant size map.
int MMGS_mmgs2(MMG5_pMesh, MMG5_pSol, MMG5_pSol)
int MMGS_outqua(MMG5_pMesh, MMG5_pSol)
int MMGS_inqua(MMG5_pMesh, MMG5_pSol)
int MMG5_mmgsRenumbering(int, MMG5_pMesh, MMG5_pSol, MMG5_pSol, MMG5_int *)
int MMG5_mmgs1(MMG5_pMesh, MMG5_pSol, MMG5_int *)
int MMGS_prilen(MMG5_pMesh mesh, MMG5_pSol met, int)
#define MMG5_STRONGFAILURE
#define MMG5_SAFE_CALLOC(ptr, size, type, law)
int MMG5_3dSolTruncature_ani(MMG5_pMesh mesh, MMG5_pSol met)
#define _LIBMMG5_RETURN(mesh, sol, met, val)
static void MMG5_excfun(int sigid)
#define MMG5_ADD_MEM(mesh, size, message, law)
static const uint8_t MMG5_inxt2[6]
static void MMG5_warnScotch(MMG5_pMesh mesh)
#define MMG5_SAFE_FREE(ptr)
#define MMG5_DEL_MEM(mesh, ptr)
Structure to store edges of am MMG mesh.
Structure to store vertices of an MMG mesh.
Structure to store triangles of a MMG mesh.