Skip to content

Commit

Permalink
Merge branch 'develop' of github.com:MmgTools/mmg into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
Algiane committed Sep 28, 2021
2 parents 0a35f29 + 1e26c55 commit ec74d30
Show file tree
Hide file tree
Showing 12 changed files with 478 additions and 120 deletions.
6 changes: 6 additions & 0 deletions cmake/testing/mmg3d_tests.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -544,6 +544,12 @@ ADD_TEST(NAME mmg3d_LSMultiMat
-sol ${MMG3D_CI_TESTS}/LSMultiMat/step.0.phi.sol
${CTEST_OUTPUT_DIR}/mmg3d_LSMultiMat.o.meshb)

#multi-mat + opnbdy + non-manifold check
ADD_TEST(NAME mmg3d_LSMultiMat_nm
COMMAND ${EXECUT_MMG3D} -v 5 -ls -0.1 -hausd 0.05 -hgrad 1.8 -nr -opnbdy
${MMG3D_CI_TESTS}/LSMultiMat/3d-opn
${CTEST_OUTPUT_DIR}/mmg3d_3d-opn.o.meshb)

ADD_TEST(NAME mmg3d_OptLs_plane_val
COMMAND ${EXECUT_MMG3D} -v 5 -ls -val
${MMG3D_CI_TESTS}/OptLs_plane/plane
Expand Down
15 changes: 15 additions & 0 deletions src/common/API_functions.c
Original file line number Diff line number Diff line change
Expand Up @@ -485,6 +485,13 @@ void MMG5_Free_structures(MMG5_pMesh mesh,MMG5_pSol sol){
if ( mesh->info.npar && mesh->info.par )
MMG5_DEL_MEM(mesh,mesh->info.par);

if ( mesh->info.nmat ) {
if( mesh->info.mat )
MMG5_DEL_MEM(mesh,mesh->info.mat);
if( mesh->info.invmat.lookup )
MMG5_DEL_MEM(mesh,mesh->info.invmat.lookup);
}

if ( mesh->info.imprim>5 || mesh->info.ddebug ) {
printf(" MEMORY USED AT END (Bytes) %zu\n",mesh->memCur);
}
Expand Down Expand Up @@ -708,5 +715,13 @@ int MMG5_Set_multiMat(MMG5_pMesh mesh,MMG5_pSol sol,int ref,

mesh->info.nmati++;

/* Invert the table if all materials have been set */
if( mesh->info.nmati == mesh->info.nmat )
if( !MMG5_MultiMat_init(mesh) ) {
fprintf(stderr,"\n ## Error: %s: unable to create lookup table for multiple materials.\n",
__func__);
return 0;
}

return 1;
}
12 changes: 12 additions & 0 deletions src/common/libmmgtypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -467,6 +467,17 @@ typedef struct {
} MMG5_Mat;
typedef MMG5_Mat * MMG5_pMat;

/**
* \struct MMG5_InvMat
* \brief To store lookup table for references in the mesh (useful in LS mode)
*/
typedef struct {
int offset;
int size;
int *lookup;
} MMG5_InvMat;
typedef MMG5_InvMat * MMG5_pInvMat;

/**
* \struct MMG5_Info
* \brief Store input parameters of the run.
Expand Down Expand Up @@ -500,6 +511,7 @@ typedef struct {
uint8_t optim, optimLES, noinsert, noswap, nomove, nosurf, nosizreq;
uint8_t metRidTyp; /*!< 0 for a classical storage of the aniso metric at ridge, 1 for the Mmg storage (modified by defsiz) */
MMG5_pMat mat;
MMG5_InvMat invmat;
} MMG5_Info;

/**
Expand Down
Loading

0 comments on commit ec74d30

Please sign in to comment.