51#define MMG5_RETURN_AND_PACK(mesh,met,sol,val)do \
53 if ( !MMG3D_packMesh(mesh,met,sol) ) { \
54 mesh->npi = mesh->np; \
55 mesh->nti = mesh->nt; \
56 mesh->nai = mesh->na; \
57 mesh->nei = mesh->ne; \
59 if ( met ) { met->npi = met->np; } \
60 if ( sol ) { sol->npi = sol->np; } \
61 return MMG5_STRONGFAILURE; \
63 _LIBMMG5_RETURN(mesh,met,sol,val); \
84 for(k=1; k <=
mesh->
np; k++) {
112 fprintf(stderr,
"\n ## Error: %s: unable to rebuild triangles\n",__func__);
128 for (k=1; k<=
mesh->
ne; k++) {
131 for (i=0; i<6; i++) {
145 if ( !(ph->
a) )
continue;
151 printf(
" ## Warning: uncomplete mesh\n"));
160 if ( !ph->
a )
continue;
180 fprintf(stdout,
" NUMBER OF EDGES %8" MMG5_PRId
" RIDGES %8" MMG5_PRId
"\n",
mesh->
na,nr);
182 fprintf(stdout,
" NUMBER OF TRIANGLES %8" MMG5_PRId
"\n",
mesh->
nt);
204 for ( k=1; k<=
mesh->
np; ++k ) {
220 while ( !
MG_VOK(ppt) && k < *np ) {
241 ppt->
tag &= ~MG_NOSURF;
247 ppt->
ref = MMG5_abs(ppt->
ref);
249 while ( ++k < (*np) );
255 for ( k=1; k<=
mesh->
np; ++k ) {
277 MMG5_int k,iadr,iadr1,iadrv,*adjav,*adja,*adja1;
289 assert( pt && pt1 &&
MG_EOK(pt1) );
295 iadr1 = 4*(
mesh->
ne-1) + 1;
297 for(i=0 ; i<4 ; i++) {
299 if(!adja1[i])
continue;
300 iadrv = 4*(adja1[i]/4-1) + 1;
303 adjav[adja1[i]%4] = 4*k + voy;
309 while ( ++k < mesh->ne );
349 assert( pt && pt1 &&
MG_EOK(pt1) );
354 while ( ++k < mesh->ne );
390 assert( pp && pp1 &&
MG_EOK(pp1) );
395 while ( ++k < mesh->nprism );
404 assert( pq && pq1 &&
MG_EOK(pq1) );
409 while ( ++k < mesh->nquad );
425 MMG5_int np,k,isol,isol1;
440 isol = k *
sol->size;
441 isol1 = np *
sol->size;
445 for (i=0; i<
sol->size; i++) {
446 sol->m[isol + i] =
sol->m[isol1 + i];
454 while ( !
MG_VOK(ppt1) && k < np );
486 assert( ppt && ppt1 &&
MG_VOK(ppt1) );
507 while ( ++k < mesh->np );
510 for(k=1 ; k<=
mesh->
np ; k++)
546 for (k=1; k<=
mesh->
np; k++) {
548 if ( !
MG_VOK(ppt) )
continue;
552 ppt->
tag &= ~MG_NOSURF;
558 ppt->
ref = MMG5_abs(ppt->
ref);
574 MMG5_int ne,nbl,k,iadr,iadrnew,iadrv,*adjav,*adja,*adjanew;
579 for (k=1; k<=
mesh->
ne; k++) {
581 if ( !
MG_EOK(pt) )
continue;
590 iadrnew = 4*(nbl-1) + 1;
592 for(i=0 ; i<4 ; i++) {
593 adjanew[i] = adja[i];
594 if(!adja[i])
continue;
595 iadrv = 4*(adja[i]/4-1) +1;
598 adjav[adja[i]%4] = 4*nbl + voy;
633 for (k=1; k<=
mesh->
ne; k++) {
635 if ( !
MG_EOK(pt) )
continue;
676 if ( !
MG_EOK(pp) )
continue;
691 if ( !
MG_EOK(pq) )
continue;
715 MMG5_int k,isol,isolnew,np,nbl;
721 for (k=1; k<=
mesh->
np; k++) {
723 if ( !
MG_VOK(ppt) )
continue;
728 isol = k *
sol->size;
729 isolnew = nbl *
sol->size;
731 for (i=0; i<
sol->size; i++)
732 sol->m[isolnew + i] =
sol->m[isol + i];
756 for (k=1; k<=
mesh->
np; k++) {
758 if ( !
MG_VOK(ppt) )
continue;
781 for(k=1 ; k<=
mesh->
np ; k++)
813 for (k=1; k<=
mesh->
ne; k++) {
815 if ( !
MG_EOK(pt) )
continue;
824 if ( !
MG_EOK(pp) )
continue;
835 if ( !
MG_EOK(pq) )
continue;
880 for (k=1; k<=
mesh->
ne; k++) {
884 for (i=0; i<6; i++) {
913 fprintf(stderr,
"\n ## Error: %s: points array not allocated.\n",
918 fprintf(stderr,
"\n ## Error: %s: tetra array not allocated.\n",
943 if ( nc<0 )
return 0;
945 if ( met && met->
m ) assert(met->
np ==
mesh->
np);
950 fprintf(stderr,
"\n ## Error: %s: prism hashing problem. Exit program.\n",
959 fprintf(stdout,
" NUMBER OF VERTICES %8" MMG5_PRId
" CORNERS %8" MMG5_PRId
"\n",
mesh->
np,nc);
960 fprintf(stdout,
" NUMBER OF TETRAHEDRA %8" MMG5_PRId
"\n",
mesh->
ne);
964 if ( nr < 0 )
return 0;
968 fprintf(stderr,
"\n ## Warning: %s: invalid mesh.\n",__func__);
1009 fprintf(stderr,
"\n ## ERROR: LAGRANGIAN MODE UNAVAILABLE (MMG3D_IPARAM_lag):\n"
1010 " YOU MUST CALL THE MMG3D_MMG3DMOV FUNCTION TO MOVE A RIGIDBODY.\n");
1014 fprintf(stderr,
"\n ## ERROR: LEVEL-SET DISCRETISATION UNAVAILABLE"
1015 " (MMG3D_IPARAM_iso or MMG3D_IARAM_isosurf ):\n"
1016 " YOU MUST CALL THE MMG3D_MMG3DMOV FUNCTION TO USE THIS OPTION.\n");
1020 fprintf(stdout,
"\n ## ERROR: STRONG MESH OPTIMIZATION FOR LES METHODS"
1021 " UNAVAILABLE (MMG3D_IPARAM_optimLES) WITH AN ANISOTROPIC METRIC.\n");
1025 if (
mesh->
info.
imprim > 0 ) fprintf(stdout,
"\n -- MMG3DLIB: INPUT DATA\n");
1031 fprintf(stdout,
"\n ## WARNING: WRONG SOLUTION NUMBER. IGNORED\n");
1035 else if ( met->
size!=1 && met->
size!=6 ) {
1036 fprintf(stderr,
"\n ## ERROR: WRONG DATA TYPE.\n");
1043 printf(
"\n ## ERROR: MISMATCH OPTIONS: OPTIM OPTION CAN NOT BE USED"
1044 " WITH AN INPUT METRIC.\n");
1049 printf(
"\n ## ERROR: MISMATCH OPTIONS: HSIZ OPTION CAN NOT BE USED"
1050 " WITH AN INPUT METRIC.\n");
1056 printf(
"\n ## ERROR: MISMATCH OPTIONS: HSIZ AND OPTIM OPTIONS CAN NOT BE USED"
1068 fprintf(stdout,
" -- INPUT DATA COMPLETED. %s\n",stim);
1073 fprintf(stdout,
"\n -- PHASE 1 : ANALYSIS\n");
1119 fprintf(stdout,
" -- PHASE 1 COMPLETED. %s\n",stim);
1124 fprintf(stdout,
"\n -- PHASE 2 : %s MESHING\n",met->
size < 6 ?
"ISOTROPIC" :
"ANISOTROPIC");
1137 fprintf(stderr,
"\n ## Hashing problem. Invalid mesh.\n");
1146 fprintf(stderr,
"\n ## Hashing problem. Invalid mesh.\n");
1157 fprintf(stdout,
" -- PHASE 2 COMPLETED. %s\n",stim);
1177 if (
mesh->
info.
imprim > 0 ) fprintf(stdout,
"\n -- MESH PACKED UP\n");
1185 fprintf(stdout,
"\n MMG3DLIB: ELAPSED TIME %s\n",stim);
1186 fprintf(stdout,
"\n %s\n END OF MODULE MMG3D\n %s\n\n",
MG_STR,
MG_STR);
1196 int8_t mettofree = 0;
1205 fprintf(stdout,
"\n ## WARNING: ISO MODE NOT PROVIDED: ENABLING ISOVALUE DISCRETIZATION MODE (-ls) \n");
1233 fprintf(stderr,
"\n ## ERROR: LAGRANGIAN MODE UNAVAILABLE (MMG3D_IPARAM_lag):\n"
1234 " YOU MUST CALL THE MMG3D_MMG3DMOV FUNCTION TO MOVE A RIGIDBODY.\n");
1239 fprintf(stdout,
"\n ## ERROR: STRONG MESH OPTIMIZATION FOR LES METHODS"
1240 " UNAVAILABLE (MMG3D_IPARAM_optimLES) IN ISOSURFACE"
1241 " DISCRETIZATION MODE.\n");
1247 if ( met && met->
np ) {
1249 printf(
"\n ## ERROR: MISMATCH OPTIONS: OPTIM OPTION CAN NOT BE USED"
1250 " WITH AN INPUT METRIC.\n");
1256 printf(
"\n ## ERROR: MISMATCH OPTIONS: HSIZ OPTION CAN NOT BE USED"
1257 " WITH AN INPUT METRIC.\n");
1264 printf(
"\n ## ERROR: MISMATCH OPTIONS: HSIZ AND OPTIM OPTIONS CAN NOT BE USED"
1274 if (
mesh->
info.
imprim > 0 ) fprintf(stdout,
"\n -- MMG3DLS: INPUT DATA\n");
1287 else if (
sol->size!=1 ) {
1288 fprintf(stderr,
"\n ## ERROR: WRONG DATA TYPE.\n");
1292 if ( met && met->
np && (met->
np !=
mesh->
np) ) {
1293 fprintf(stdout,
"\n ## WARNING: WRONG METRIC NUMBER. IGNORED\n");
1300 fprintf(stderr,
"\n ## Unable to clean old isosurface.\n");
1307 fprintf(stdout,
" -- INPUT DATA COMPLETED. %s\n",stim);
1312 fprintf(stdout,
"\n -- PHASE 1 : ISOSURFACE DISCRETIZATION\n");
1342 fprintf(stderr,
"\n ## ERROR: A VALID SOLUTION FILE IS NEEDED \n");
1367 fprintf(stdout,
" -- PHASE 1 COMPLETED. %s\n",stim);
1371 fprintf(stdout,
"\n -- PHASE 2 : ANALYSIS\n");
1394 fprintf(stdout,
" -- PHASE 2 COMPLETED. %s\n",stim);
1399 fprintf(stdout,
"\n -- PHASE 3 : MESH IMPROVEMENT\n");
1414 fprintf(stderr,
"\n ## Hashing problem. Invalid mesh.\n");
1424 fprintf(stderr,
"\n ## Hashing problem. Invalid mesh.\n");
1435 fprintf(stdout,
" -- PHASE 3 COMPLETED. %s\n",stim);
1453 if (
mesh->
info.
imprim > 0 ) fprintf(stdout,
"\n -- MESH PACKED UP\n");
1467 fprintf(stdout,
"\n MMG3DLS: ELAPSED TIME %s\n",stim);
1468 fprintf(stdout,
"\n %s\n END OF MODULE MMG3D\n %s\n\n",
MG_STR,
MG_STR);
1478 MMG5_int *invalidTets;
1504 fprintf(stderr,
"\n ## ERROR: LEVEL-SET DISCRETISATION UNAVAILABLE"
1505 " (MMG3D_IPARAM_iso || MMG3D_IPARAM_isosurf ):\n"
1506 " YOU MUST CALL THE MMG3D_mmg3dls FUNCTION TO USE THIS OPTION.\n");
1510 fprintf(stdout,
"\n ## ERROR: STRONG MESH OPTIMIZATION FOR LES METHODS"
1511 " UNAVAILABLE (MMG3D_IPARAM_optimLES) IN LAGRANGIAN MODE.\n");
1515 printf(
"\n ## ERROR: OPTIM OPTION UNAVAILABLE IN LAGRANGIAN MODE\n");
1519 printf(
"\n ## ERROR: HSIZ OPTION UNAVAILABLE IN LAGRANGIAN MODE\n");
1527 if (
mesh->
info.
imprim > 0 ) fprintf(stdout,
"\n -- MMG3DMOV: INPUT DATA\n");
1538 fprintf(stdout,
"\n ## Warning: displacement mode for the rigidbody"
1539 " movement is not set.\n"
1540 " Lagrangian displacement computed according"
1546 fprintf(stderr,
"\n ## ERROR: YOU NEED TO COMPILE WITH THE USE_ELAS"
1547 " CMake's FLAG SET TO ON TO USE THE RIGIDBODY MOVEMENT LIBRARY.\n");
1552 fprintf(stderr,
"\n ## ERROR: IN LAGRANGIAN MODE, A STRUCTURE OF TYPE"
1553 " \"MMG5_pSoL\" IS NEEDED TO STORE THE DISPLACEMENT FIELD.\n"
1554 " THIS STRUCTURE MUST BE DIFFERENT FROM THE ONE USED"
1555 " TO STORE THE METRIC.\n");
1559 fprintf(stdout,
"\n ## WARNING: WRONG SOLUTION NUMBER. IGNORED\n");
1563 else if (disp->
size!=3) {
1564 fprintf(stderr,
"\n ## ERROR: LAGRANGIAN MOTION OPTION NEED A VECTORIAL DISPLACEMENT\n");
1571 fprintf(stdout,
" -- INPUT DATA COMPLETED. %s\n",stim);
1577 fprintf(stdout,
"\n -- PHASE 1 : ANALYSIS\n");
1609 fprintf(stdout,
" -- PHASE 1 COMPLETED. %s\n",stim);
1614 fprintf(stdout,
"\n -- PHASE 2 : LAGRANGIAN MOTION\n");
1628 disp->
npi = disp->
np;
1631 else if (
ier < 0 ) {
1632 printf(
"\n ## Warning: Unable to perform any movement "
1633 "(%" MMG5_PRId
" intersecting tetrahedra).\n",-
ier);
1635 printf(
" List of invalid tets: ");
1636 for ( k=0; k<-
ier; ++k ) {
1643 disp->
npi = disp->
np;
1655 fprintf(stdout,
" -- PHASE 2 COMPLETED. %s\n",stim);
1662 fprintf(stdout,
"\n -- PHASE 3 : MESH IMPROVEMENT\n");
1675 fprintf(stderr,
"\n ## Hashing problem. Invalid mesh.\n");
1684 fprintf(stderr,
"\n ## Hashing problem. Invalid mesh.\n");
1695 fprintf(stdout,
" -- PHASE 3 COMPLETED. %s\n",stim);
1709 disp->
npi = disp->
np;
1719 if (
mesh->
info.
imprim > 0 ) fprintf(stdout,
"\n -- MESH PACKED UP\n");
1721 disp->
npi = disp->
np;
1725 disp->
npi = disp->
np;
1734 fprintf(stdout,
"\n MMG3DMOV: ELAPSED TIME %s\n",stim);
1735 fprintf(stdout,
"\n %s\n END OF MODULE MMG3D\n %s\n\n",
MG_STR,
MG_STR);
1737 disp->
npi = disp->
np;
MMG5_pMesh MMG5_pSol * sol
if(!ier) exit(EXIT_FAILURE)
int MMG3D_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_mmg3dBezierCP(MMG5_pMesh mesh, MMG5_Tria *pt, MMG5_pBezier pb, int8_t ori)
int MMG5_mmg3dChkmsh(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 MMG3D_hashTetra(MMG5_pMesh mesh, int pack)
Create array of adjacency.
int MMG5_hEdge(MMG5_pMesh mesh, MMG5_HGeom *hash, MMG5_int a, MMG5_int b, MMG5_int ref, uint16_t tag)
int MMG5_hNew(MMG5_pMesh mesh, MMG5_HGeom *hash, MMG5_int hsiz, MMG5_int hmax)
int MMG3D_hashPrism(MMG5_pMesh mesh)
int MMG5_chkBdryTria(MMG5_pMesh mesh)
int MMG3D_pack_sol(MMG5_pMesh mesh, MMG5_pSol sol)
int MMG3D_mark_packedPoints(MMG5_pMesh mesh, MMG5_int *np, MMG5_int *nc)
int MMG3D_packMesh(MMG5_pMesh mesh, MMG5_pSol sol, MMG5_pSol met)
void MMG3D_Free_topoTables(MMG5_pMesh mesh)
void MMG3D_Set_commonFunc(void)
int MMG3D_pack_tetra(MMG5_pMesh mesh)
int MMG3D_mmg3dls(MMG5_pMesh mesh, MMG5_pSol sol, MMG5_pSol umet)
Main "program" for the level-set discretization library.
int MMG3D_mmg3dlib(MMG5_pMesh mesh, MMG5_pSol met)
Main "program" for the mesh adaptation library.
int MMG3D_update_eltsVertices(MMG5_pMesh mesh)
MMG5_int MMG3D_bdryBuild(MMG5_pMesh mesh)
MMG5_int MMG3D_pack_points(MMG5_pMesh mesh)
int MMG3D_pack_tetraAndAdja(MMG5_pMesh mesh)
#define MMG5_RETURN_AND_PACK(mesh, met, sol, val)
int MMG3D_mmg3dmov(MMG5_pMesh mesh, MMG5_pSol met, MMG5_pSol disp)
Main program for the rigid-body movement library.
int MMG3D_pack_prismsAndQuads(MMG5_pMesh mesh)
int MMG3D_pack_pointArray(MMG5_pMesh mesh)
void MMG3D_unset_reqBoundaries(MMG5_pMesh mesh)
API headers and documentation for the mmg3d library, for volumetric meshes in 3D.
LIBMMG3D_EXPORT int MMG3D_Clean_isoSurf(MMG5_pMesh mesh)
Clean data (triangles and edges) linked to isosurface.
LIBMMG3D_EXPORT int MMG3D_Set_constantSize(MMG5_pMesh mesh, MMG5_pSol met)
Compute a constant size map according to the hsiz, hmin and hmax parameters.
LIBMMG3D_EXPORT int(* MMG3D_doSol)(MMG5_pMesh mesh, MMG5_pSol met)
Compute isotropic size map according to the mean of the length of the edges passing through a vertex.
LIBMMG3D_EXPORT void MMG3D_setfunc(MMG5_pMesh mesh, MMG5_pSol met)
Set function pointers for caltet, lenedg, lenedgCoor defsiz, gradsiz... depending if the metric that ...
int MMG5_mmg3dRenumbering(int, MMG5_pMesh, MMG5_pSol, MMG5_pSol, MMG5_int *)
int MMG5_mmg3d3(MMG5_pMesh, MMG5_pSol, MMG5_pSol, MMG5_int **)
void MMG3D_keep_only1Subdomain(MMG5_pMesh mesh, int nsd)
void MMG5_freeXPrisms(MMG5_pMesh mesh)
void MMG3D_delPt(MMG5_pMesh mesh, MMG5_int ip)
void MMG5_freeXTets(MMG5_pMesh mesh)
MMG5_int MMG3D_indPt(MMG5_pMesh mesh, MMG5_int kp)
int MMG3D_mmg3d2(MMG5_pMesh, MMG5_pSol, MMG5_pSol)
int MMG3D_delElt(MMG5_pMesh mesh, MMG5_int iel)
int MMG3D_tetraQual(MMG5_pMesh mesh, MMG5_pSol met, int8_t metRidTyp)
static const uint8_t MMG5_iare[6][2]
vertices of extremities of the edges of the tetra
int MMG5_mmg3d1_pattern(MMG5_pMesh, MMG5_pSol, MMG5_int *)
int MMG3D_outqua(MMG5_pMesh mesh, MMG5_pSol met)
int MMG5_mmg3d1_delone(MMG5_pMesh, MMG5_pSol, MMG5_int *)
int MMG3D_inqua(MMG5_pMesh mesh, MMG5_pSol met)
int MMG3D_prilen(MMG5_pMesh mesh, MMG5_pSol met, int8_t)
static void MMG5_warnOrientation(MMG5_pMesh mesh)
MMG5_int MMG3D_indElt(MMG5_pMesh mesh, MMG5_int kel)
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
int MMG5_scotchCall(MMG5_pMesh mesh, MMG5_pSol met, MMG5_pSol fields, MMG5_int *permNodGlob)
#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 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 prsim of a MMG mesh.
Structure to store quadrangles of an MMG mesh.
Structure to store tetrahedra of an MMG mesh.
Cell of the hash table of geometric edges.