Skip to content

Commit ec74d30

Browse files
committed
Merge branch 'develop' of github.com:MmgTools/mmg into develop
2 parents 0a35f29 + 1e26c55 commit ec74d30

File tree

12 files changed

+478
-120
lines changed

12 files changed

+478
-120
lines changed

cmake/testing/mmg3d_tests.cmake

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -544,6 +544,12 @@ ADD_TEST(NAME mmg3d_LSMultiMat
544544
-sol ${MMG3D_CI_TESTS}/LSMultiMat/step.0.phi.sol
545545
${CTEST_OUTPUT_DIR}/mmg3d_LSMultiMat.o.meshb)
546546

547+
#multi-mat + opnbdy + non-manifold check
548+
ADD_TEST(NAME mmg3d_LSMultiMat_nm
549+
COMMAND ${EXECUT_MMG3D} -v 5 -ls -0.1 -hausd 0.05 -hgrad 1.8 -nr -opnbdy
550+
${MMG3D_CI_TESTS}/LSMultiMat/3d-opn
551+
${CTEST_OUTPUT_DIR}/mmg3d_3d-opn.o.meshb)
552+
547553
ADD_TEST(NAME mmg3d_OptLs_plane_val
548554
COMMAND ${EXECUT_MMG3D} -v 5 -ls -val
549555
${MMG3D_CI_TESTS}/OptLs_plane/plane

src/common/API_functions.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -485,6 +485,13 @@ void MMG5_Free_structures(MMG5_pMesh mesh,MMG5_pSol sol){
485485
if ( mesh->info.npar && mesh->info.par )
486486
MMG5_DEL_MEM(mesh,mesh->info.par);
487487

488+
if ( mesh->info.nmat ) {
489+
if( mesh->info.mat )
490+
MMG5_DEL_MEM(mesh,mesh->info.mat);
491+
if( mesh->info.invmat.lookup )
492+
MMG5_DEL_MEM(mesh,mesh->info.invmat.lookup);
493+
}
494+
488495
if ( mesh->info.imprim>5 || mesh->info.ddebug ) {
489496
printf(" MEMORY USED AT END (Bytes) %zu\n",mesh->memCur);
490497
}
@@ -708,5 +715,13 @@ int MMG5_Set_multiMat(MMG5_pMesh mesh,MMG5_pSol sol,int ref,
708715

709716
mesh->info.nmati++;
710717

718+
/* Invert the table if all materials have been set */
719+
if( mesh->info.nmati == mesh->info.nmat )
720+
if( !MMG5_MultiMat_init(mesh) ) {
721+
fprintf(stderr,"\n ## Error: %s: unable to create lookup table for multiple materials.\n",
722+
__func__);
723+
return 0;
724+
}
725+
711726
return 1;
712727
}

src/common/libmmgtypes.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -467,6 +467,17 @@ typedef struct {
467467
} MMG5_Mat;
468468
typedef MMG5_Mat * MMG5_pMat;
469469

470+
/**
471+
* \struct MMG5_InvMat
472+
* \brief To store lookup table for references in the mesh (useful in LS mode)
473+
*/
474+
typedef struct {
475+
int offset;
476+
int size;
477+
int *lookup;
478+
} MMG5_InvMat;
479+
typedef MMG5_InvMat * MMG5_pInvMat;
480+
470481
/**
471482
* \struct MMG5_Info
472483
* \brief Store input parameters of the run.
@@ -500,6 +511,7 @@ typedef struct {
500511
uint8_t optim, optimLES, noinsert, noswap, nomove, nosurf, nosizreq;
501512
uint8_t metRidTyp; /*!< 0 for a classical storage of the aniso metric at ridge, 1 for the Mmg storage (modified by defsiz) */
502513
MMG5_pMat mat;
514+
MMG5_InvMat invmat;
503515
} MMG5_Info;
504516

505517
/**

0 commit comments

Comments
 (0)