33#define MMG2D_RETURN_AND_PACK(mesh,met,sol,val)do \
35 if ( !MMG2D_pack(mesh,met,sol) ) { \
36 mesh->npi = mesh->np; \
37 mesh->nti = mesh->nt; \
38 mesh->nai = mesh->na; \
39 mesh->nei = mesh->ne; \
41 if ( met ) { met->npi = met->np; } \
42 if ( sol ) { sol->npi = sol->np; } \
43 return MMG5_LOWFAILURE; \
45 _LIBMMG5_RETURN(mesh,met,sol,val); \
91 fprintf(stdout,
"\n ## ERROR: NO TRIANGLES IN THE MESH. \n");
92 fprintf(stdout,
" To generate a mesh from boundaries call the"
93 " MMG2D_mmg2dmesh function\n.");
97 fprintf(stdout,
"\n ## ERROR: LEVEL-SET DISCRETISATION UNAVAILABLE"
98 " (MMG2D_IPARAM_iso or MMG2D_IPARAM_isosurf ):\n"
99 " YOU MUST CALL THE MMG2D_mmg2dls FUNCTION TO USE THIS"
104 fprintf(stdout,
"\n ## ERROR: LAGRANGIAN MODE UNAVAILABLE (MMG2D_IPARAM_lag):\n"
105 " YOU MUST CALL THE MMG2D_mmg2dmov FUNCTION TO MOVE A"
110 if (
mesh->
info.
imprim > 0 ) fprintf(stdout,
"\n -- MMG2DLIB: INPUT DATA\n");
116 fprintf(stdout,
"\n ## WARNING: WRONG SOLUTION NUMBER : %" MMG5_PRId
" != %" MMG5_PRId
"\n",met->
np,
mesh->
np);
119 else if ( met->
size!=1 && met->
size!=3 ) {
120 fprintf(stderr,
"\n ## ERROR: WRONG DATA TYPE.\n");
127 printf(
"\n ## ERROR: MISMATCH OPTIONS: OPTIM OPTION CAN NOT BE USED"
128 " WITH AN INPUT METRIC.\n");
133 printf(
"\n ## ERROR: MISMATCH OPTIONS: HSIZ OPTION CAN NOT BE USED"
134 " WITH AN INPUT METRIC.\n");
140 printf(
"\n ## ERROR: MISMATCH OPTIONS: HSIZ AND OPTIM OPTIONS CAN NOT BE USED"
149 fprintf(stdout,
" -- INPUT DATA COMPLETED. %s\n",stim);
156 fprintf(stdout,
" MAXIMUM NUMBER OF POINTS (NPMAX) : %8" MMG5_PRId
"\n",
mesh->
npmax);
157 fprintf(stdout,
" MAXIMUM NUMBER OF TRIANGLES (NTMAX) : %8" MMG5_PRId
"\n",
mesh->
ntmax);
162 if (
mesh->
info.
imprim > 0 ) fprintf(stdout,
"\n -- PHASE 1 : DATA ANALYSIS\n");
213 fprintf(stdout,
" -- PHASE 1 COMPLETED. %s\n",stim);
219 fprintf(stdout,
"\n -- PHASE 2 : %s MESHING\n",met->
size < 3 ?
"ISOTROPIC" :
"ANISOTROPIC");
230 fprintf(stdout,
" -- PHASE 2 COMPLETED. %s\n",stim);
245 if (
mesh->
info.
imprim > 0 ) fprintf(stdout,
"\n -- MESH PACKED UP\n");
256 fprintf(stdout,
"\n MMG2DLIB: ELAPSED TIME %s\n",stim);
257 fprintf(stdout,
"\n %s\n END OF MODULE MMG2D\n %s\n\n",
MG_STR,
MG_STR);
282 "initial triangles",
return 0);
285 for ( k=
mesh->
nenil; k<mesh->ntmax-1; k++) {
293 "initial edges",
return 0);
332 fprintf(stdout,
"\n ## ERROR: YOUR MESH CONTAINS ALREADY TRIANGLES.\n"
333 " THE MESH GENERATION OPTION IS UNAVAILABLE.\n");
338 fprintf(stdout,
"\n ## ERROR: LEVEL-SET DISCRETISATION UNAVAILABLE"
339 " (MMG2D_IPARAM_iso || MMG2D_IPARAM_isosurf ):\n"
340 " YOU MUST CALL THE MMG2D_MMG2DLS FUNCTION TO USE THIS OPTION.\n");
345 fprintf(stdout,
"\n ## ERROR: LAGRANGIAN MODE UNAVAILABLE (MMG2D_IPARAM_lag):\n"
346 " YOU MUST CALL THE MMG2D_MMG2DMOV FUNCTION TO MOVE A RIGIDBODY.\n");
352 printf(
"\n ## ERROR: MISMATCH OPTIONS: OPTIM OPTION CAN NOT BE USED"
353 " WITH AN INPUT METRIC.\n");
358 printf(
"\n ## ERROR: MISMATCH OPTIONS: HSIZ OPTION CAN NOT BE USED"
359 " WITH AN INPUT METRIC.\n");
365 printf(
"\n ## ERROR: MISMATCH OPTIONS: HSIZ AND OPTIM OPTIONS CAN NOT BE USED"
370 if (
mesh->
info.
imprim > 0 ) fprintf(stdout,
"\n -- MMG2DMESH: INPUT DATA\n");
376 fprintf(stdout,
"\n ## WARNING: WRONG SOLUTION NUMBER : %" MMG5_PRId
" != %" MMG5_PRId
"\n",met->
np,
mesh->
np);
378 }
else if ( met->
size!=1 && met->
size!=3 ) {
379 fprintf(stderr,
"\n ## ERROR: WRONG DATA TYPE.\n");
386 fprintf(stdout,
" -- INPUT DATA COMPLETED. %s\n",stim);
393 fprintf(stdout,
" MAXIMUM NUMBER OF POINTS (NPMAX) : %8" MMG5_PRId
"\n",
mesh->
npmax);
394 fprintf(stdout,
" MAXIMUM NUMBER OF TRIANGLES (NTMAX) : %8" MMG5_PRId
"\n",
mesh->
ntmax);
404 if (
mesh->
info.
imprim > 0 ) fprintf(stdout,
"\n -- PHASE 1 : MESH GENERATION\n");
420 printf(
" Exit program.\n");
434 fprintf(stdout,
" -- PHASE 1 COMPLETED. %s\n",stim);
439 fprintf(stdout,
"\n -- PHASE 2 : ANALYSIS\n");
474 fprintf(stdout,
" -- PHASE 2 COMPLETED. %s\n",stim);
479 fprintf(stdout,
"\n -- PHASE 3 : MESH IMPROVEMENT (%s)\n",
480 met->
size < 3 ?
"ISOTROPIC" :
"ANISOTROPIC");
490 fprintf(stdout,
" -- PHASE 3 COMPLETED. %s\n",stim);
507 if (
mesh->
info.
imprim > 0 ) fprintf(stdout,
"\n -- MESH PACKED UP\n");
516 fprintf(stdout,
"\n MMG2DMESH: ELAPSED TIME %s\n",stim);
517 fprintf(stdout,
"\n %s\n END OF MODULE MMG2D\n %s\n\n",
MG_STR,
MG_STR);
528 int8_t mettofree = 0;
538 fprintf(stdout,
"\n ## WARNING: ISO MODE NOT PROVIDED: ENABLING ISOVALUE DISCRETIZATION MODE (-ls) \n");
567 fprintf(stdout,
"\n ## ERROR: LAGRANGIAN MODE UNAVAILABLE (MMG2D_IPARAM_lag):\n"
568 " YOU MUST CALL THE MMG2D_mmg2dmov FUNCTION TO MOVE A RIGIDBODY.\n");
573 if (
mesh->
info.
imprim > 0 ) fprintf(stdout,
"\n -- MMG2DLS: INPUT DATA\n");
579 fprintf(stdout,
"\n ## ERROR: NO TRIANGLES IN THE MESH \n");
583 else if ( !
sol->m ) {
584 fprintf(stdout,
"\n ## ERROR: A VALID SOLUTION FILE IS NEEDED \n");
588 else if (
sol->size != 1 ) {
589 fprintf(stdout,
"\n ## ERROR: WRONG DATA TYPE.\n");
594 fprintf(stdout,
"\n ## WARNING: WRONG SOLUTION NUMBER. IGNORED\n");
600 if ( met && met->
np ) {
602 printf(
"\n ## ERROR: MISMATCH OPTIONS: OPTIM OPTION CAN NOT BE USED"
603 " WITH AN INPUT METRIC.\n");
608 printf(
"\n ## ERROR: MISMATCH OPTIONS: HSIZ OPTION CAN NOT BE USED"
609 " WITH AN INPUT METRIC.\n");
614 fprintf(stdout,
"\n ## WARNING: WRONG METRIC NUMBER. IGNORED\n");
621 printf(
"\n ## ERROR: MISMATCH OPTIONS: HSIZ AND OPTIM OPTIONS CAN NOT BE USED"
628 printf(
"\n ## ERROR: UNABLE TO HANDLE HYBRID MESHES IN ISOVALUE DISCRETIZATION MODE.\n");
636 fprintf(stdout,
" -- INPUT DATA COMPLETED. %s\n",stim);
645 fprintf(stdout,
"\n -- PHASE 1 : ISOSURFACE DISCRETIZATION\n");
648 fprintf(stdout,
" MAXIMUM NUMBER OF POINTS (NPMAX) : %8"MMG5_PRId
"\n",
mesh->
npmax);
649 fprintf(stdout,
" MAXIMUM NUMBER OF TRIANGLES (NTMAX) : %8"MMG5_PRId
"\n",
mesh->
ntmax);
716 fprintf(stdout,
" -- PHASE 1 COMPLETED. %s\n",stim);
720 fprintf(stdout,
"\n -- PHASE 2 : ANALYSIS\n");
753 fprintf(stdout,
" -- PHASE 2 COMPLETED. %s\n",stim);
758 fprintf(stdout,
"\n -- PHASE 3 : MESH IMPROVEMENT\n");
774 fprintf(stdout,
" -- PHASE 3 COMPLETED. %s\n",stim);
796 if (
mesh->
info.
imprim > 0 ) fprintf(stdout,
"\n -- MESH PACKED UP\n");
809 fprintf(stdout,
"\n MMG2DLS: ELAPSED TIME %s\n",stim);
810 fprintf(stdout,
"\n %s\n END OF MODULE MMG2D\n %s\n\n",
MG_STR,
MG_STR);
824 MMG5_int k,*invalidTris;
849 if (
mesh->
info.
imprim > 0 ) fprintf(stdout,
"\n -- MMG2DMOV: INPUT DATA\n");
855 fprintf(stderr,
"\n ## ERROR: YOU NEED TO COMPILE WITH THE USE_ELAS"
856 " CMake's FLAG SET TO ON TO USE THE RIGIDBODY MOVEMENT LIBRARY.\n");
861 fprintf(stdout,
"\n ## ERROR: NO TRIANGLES IN THE MESH \n");
864 else if ( !disp->
m ) {
865 fprintf(stdout,
"\n ## ERROR: A VALID SOLUTION FILE IS NEEDED \n");
868 else if ( disp->
size != 2 ) {
869 fprintf(stdout,
"\n ## ERROR: LAGRANGIAN MOTION OPTION NEED A VECTOR DISPLACEMENT.\n");
872 else if ( disp->
np && (disp->
np !=
mesh->
np) ) {
873 fprintf(stdout,
"\n ## WARNING: WRONG SOLUTION NUMBER. IGNORED\n");
879 printf(
"\n ## ERROR: OPTIM OPTION UNAVAILABLE IN LAGRANGIAN"
880 " MOVEMENT MODE.\n");
884 printf(
"\n ## ERROR: HSIZ OPTION UNAVAILABLE IN LAGRANGIAN"
885 " MOVEMENT MODE.\n");
890 printf(
"\n ## ERROR: UNABLE TO HANDLE HYBRID MESHES IN LAGRANGIAN MOVEMENT MODE.\n");
898 fprintf(stdout,
" -- INPUT DATA COMPLETED. %s\n",stim);
907 fprintf(stdout,
"\n -- PHASE 1 : ANALYSIS\n");
911 fprintf(stdout,
" MAXIMUM NUMBER OF POINTS (NPMAX) : %8" MMG5_PRId
"\n",
mesh->
npmax);
912 fprintf(stdout,
" MAXIMUM NUMBER OF TRIANGLES (NTMAX) : %8" MMG5_PRId
"\n",
mesh->
ntmax);
946 fprintf(stdout,
" -- PHASE 1 COMPLETED. %s\n",stim);
951 fprintf(stdout,
"\n -- PHASE 2 : LAGRANGIAN MOTION\n");
958 disp->
npi = disp->
np;
961 else if (
ier < 0 ) {
962 printf(
"\n ## Warning: Unable to perform any movement "
963 "(%d intersecting triangles).\n",-
ier);
965 printf(
" List of invalid trias: ");
966 for ( k=0; k<-
ier; ++k ) {
977 fprintf(stdout,
" -- PHASE 2 COMPLETED. %s\n",stim);
984 fprintf(stdout,
"\n -- PHASE 3 : MESH IMPROVEMENT\n");
995 fprintf(stdout,
" -- PHASE 3 COMPLETED. %s\n",stim);
1008 if (
mesh->
info.
imprim > 0 ) fprintf(stdout,
"\n -- MESH PACKED UP\n");
1018 fprintf(stdout,
"\n MMG2DMOV: ELAPSED TIME %s\n",stim);
1019 fprintf(stdout,
"\n %s\n END OF MODULE MMG2D\n %s\n\n",
MG_STR,
MG_STR);
int MMG5_Set_defaultTruncatureSizes(MMG5_pMesh mesh, int8_t sethmin, int8_t sethmax)
MMG5_pMesh MMG5_pSol * sol
int MMG2D_analys(MMG5_pMesh mesh)
int MMG2D_grad2metreq_ani(MMG5_pMesh mesh, MMG5_pSol met, MMG5_pTria pt, MMG5_int npmaster, MMG5_int npslave)
MMG5_int MMG2D_grad2met_ani(MMG5_pMesh mesh, MMG5_pSol met, MMG5_pTria pt, MMG5_int np1, MMG5_int np2)
int MMG5_mmg2dChkmsh(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 MMG2D_hashTria(MMG5_pMesh mesh)
int MMG2D_pack(MMG5_pMesh mesh, MMG5_pSol sol, MMG5_pSol met)
int MMG2D_prilen(MMG5_pMesh mesh, MMG5_pSol sol)
int MMG2D_mmg2dlib(MMG5_pMesh mesh, MMG5_pSol met)
Main "program" for the mesh adaptation library.
#define MMG2D_RETURN_AND_PACK(mesh, met, sol, val)
int MMG2D_mmg2dls(MMG5_pMesh mesh, MMG5_pSol sol, MMG5_pSol umet)
Main "program" for the level-set discretization library.
int MMG2D_mmg2dmesh(MMG5_pMesh mesh, MMG5_pSol met)
Main "program" for the mesh generation library.
static int MMG2D_restart(MMG5_pMesh mesh)
void MMG2D_Set_commonFunc(void)
Set common function pointers between mmgs and mmg2d to the matching mmg2d functions.
int MMG2D_mmg2dmov(MMG5_pMesh mesh, MMG5_pSol met, MMG5_pSol disp)
Main "program" for the rigid-body movement library.
API headers and documentation for the mmg2d library.
LIBMMG2D_EXPORT int(* MMG2D_doSol)(MMG5_pMesh mesh, MMG5_pSol met)
Compute unit tensor according to the lengths of the edges passing through a vertex.
LIBMMG2D_EXPORT int MMG2D_Set_constantSize(MMG5_pMesh mesh, MMG5_pSol met)
Compute a constant size map according to the hsiz, hmin and hmax parameters.
LIBMMG2D_EXPORT void MMG2D_setfunc(MMG5_pMesh mesh, MMG5_pSol met)
Set function pointers for length, caltri... depending if case is iso or aniso.
int MMG2D_mmg2d1n(MMG5_pMesh, MMG5_pSol)
MMG5_int MMG2D_indPt(MMG5_pMesh mesh, MMG5_int kp)
static void MMG2D_excfun(int sigid)
int MMG2D_mmg2d9(MMG5_pMesh, MMG5_pSol, MMG5_pSol, MMG5_int **)
int MMG2D_mmg2d2(MMG5_pMesh, MMG5_pSol)
MMG5_int MMG2D_indElt(MMG5_pMesh mesh, MMG5_int kel)
int MMG2D_outqua(MMG5_pMesh, MMG5_pSol)
void MMG2D_keep_only1Subdomain(MMG5_pMesh mesh, int nsd)
int MMG2D_mmg2d6(MMG5_pMesh, MMG5_pSol, MMG5_pSol)
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)
#define MMG5_STRONGFAILURE
#define MMG5_SAFE_CALLOC(ptr, size, type, law)
#define _LIBMMG5_RETURN(mesh, sol, met, val)
#define MMG5_ADD_MEM(mesh, size, message, law)
int MMG5_2dSolTruncature_ani(MMG5_pMesh mesh, MMG5_pSol met)
#define MMG5_SAFE_FREE(ptr)
#define MMG5_DEL_MEM(mesh, ptr)
Structure to store edges of am MMG mesh.
Structure to store triangles of a MMG mesh.