Dear Algiane,
I downloaded the newest version of mmg (5.5.1) and am having a few issues that I and can’t seem to figure out. Before I was using the mmg hotfix-mmgd3ls-restart where I had no issues.
- The first issue is that the mesh is being refined more than expected, and than before, for the same settings.
- The second issue is that when I try to save only one subdomain it fails to do so.
Bellow I have included an image of the output I get with the two versions of mmg in which both issues can be seen. I have also added the section of the code I figured is relevant at the end.
Kind regards,
K
MMG3D_Init_mesh(MMG5_ARG_start,
MMG5_ARG_ppMesh, &mmgMesh,
MMG5_ARG_ppLs, &mmgLs,
MMG5_ARG_ppMet, &mmgMet,
MMG5_ARG_end);
/* ------------------------------- Step 1 ------------------------------- */
//...
/* ------------------------------- Step 2 ------------------------------- */
// Remesh the volume such that the elements have a size appropriate to capture
// the level-set describing the infill geometry.
// Read .mesh(b) file
if ( MMG3D_loadMesh(mmgMesh, tempFile) != 1 ) exit(EXIT_FAILURE);
// Set met size
MMG3D_Get_meshSize(mmgMesh, &np, &ne, NULL, &nt, NULL, &na);
if ( MMG3D_Set_solSize(mmgMesh, mmgMet, MMG5_Vertex,np, MMG5_Scalar) != 1 )
exit(EXIT_FAILURE);
// Set met values
std::cout << " Computing the metValues..." << std::endl;
for (size_t i=1 ; i<=np ; i++) {
// Get the current point
double point[3];
MMG3D_Get_vertex(mmgMesh, &(point[0]), &(point[1]), &(point[2]), NULL, NULL, NULL);
Point p(point[0], point[1], point[2]);
// Compute met value for current point
double solValueMet;
featureSize localFeatureSize;
localFeatureSize = sizing_function(p);
solValueMet = me_settings.MMG_hinitial * localFeatureSize.min;
if ( MMG3D_Set_scalarSol(mmgMet, solValueMet, i) != 1 ) exit(EXIT_FAILURE);
// Determine minimum and maximum feature size in model
minFeatureSize = std::min(minFeatureSize, localFeatureSize.min);
maxFeatureSize = std::max(maxFeatureSize, localFeatureSize.max);
}
// Remesh volume
ierr = MMG3D_mmg3dlib(mmgMesh, mmgMet);
if ( ierr == MMG5_STRONGFAILURE ) {
fprintf(stdout,"BAD ENDING OF MMG3DLIB: UNABLE TO SAVE MESH\n");
return(ierr);
} else if ( ierr == MMG5_LOWFAILURE )
fprintf(stdout,"BAD ENDING OF MMG3DLIB\n");
/* ------------------------------- Step 3 ------------------------------- */
// Discretize the level-set
// Get mesh info
MMG3D_Get_meshSize(mmgMesh, &np, &ne, NULL, &nt, NULL, &na);
// Set sol size
if ( MMG3D_Set_solSize(mmgMesh, mmgLs, MMG5_Vertex,np, MMG5_Scalar) != 1 )
exit(EXIT_FAILURE);
// Compute the signed distances within the volume
std::cout << " Computing the level-set solValues..." << std::endl;
for (size_t i=0 ; i<np ; i++) {
// Get the current point value
double point[3];
MMG3D_Get_vertex(mmgMesh, &(point[0]), &(point[1]), &(point[2]), NULL, NULL, NULL);
Point p(point[0], point[1], point[2]);
// Compute the sol value for current point
double solValueLs;
solValueLs = myFunction(p);
// Set sol value
if ( MMG3D_Set_scalarSol(mmgLs, solValueLs, i+1) != 1 )
exit(EXIT_FAILURE);
}
// Set global meshing parameters
if ( MMG3D_Set_iparameter(mmgMesh, mmgLs, MMG3D_IPARAM_iso, 1) != 1 ) exit(EXIT_FAILURE); // Use level-set
if ( MMG3D_Set_iparameter(mmgMesh, mmgLs, MMG3D_IPARAM_nofem, 1) != 1 ) exit(EXIT_FAILURE); // No finite element mesh
if ( MMG3D_Set_dparameter(mmgMesh, mmgLs, MMG3D_DPARAM_hausd, MMG_hausd) != 1 ) exit(EXIT_FAILURE);
if ( MMG3D_Set_dparameter(mmgMesh, mmgLs, MMG3D_DPARAM_hgrad, MMG_hgrad) != 1 ) exit(EXIT_FAILURE); //
if ( MMG3D_Set_iparameter(mmgMesh, mmgLs, MMG3D_IPARAM_numsubdomain, 3) != 1 ) exit(EXIT_FAILURE);
// Dicretize the level-set
ierr = MMG3D_mmg3dls(mmgMesh, mmgLs, NULL);
if ( ierr == MMG5_STRONGFAILURE ) {
fprintf(stdout,"BAD ENDING OF MMG3DLS: UNABLE TO SAVE MESH\n");
return(ierr);
} else if ( ierr == MMG5_LOWFAILURE )
fprintf(stdout,"BAD ENDING OF MMG3DLS\n");