Issues with library after 5.5.1 update

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");

Dear Karl,

Thank you for this feedback. Is it possible to attach the input mesh file? So I can try to run the script and understand what happens.

Thank you by advance,

Algiane

Dear Algiane,

Sorry I have taken so long to reply. In the file attached bellow you will find a minimal problem that displays the issue. The sample problem should result in the meshes bellow for the two versions of mmg I mentioned previously (hotfix-mmgd3ls-restart & 5.5.1):


You will see besides the minimal code file there are three input files in the zip, the mesh file and two solution files. At the moment I have set the Met sol file to NULL as it seems to make no difference when it comes to the problem I am experiencing. In case it matters I am compiling mmg with scotch.

mmg_test.zip (72.6 KB)

Thanks for the help!

Kind regards,
K

Hello Karl,
Thank you for sharing.
I do reproduce the mesh on the left with v5.5.1 (commit 6ff181f23efe55e65419c5d67709ebb48faaf8c6)
Is there any boundary parameter missing to trigger the problem?

Thanks,
Luca

Dear Luca,

Given that it was working on your end I checked everything again and discovered there was an old version of mmg installed on the system which I was not aware of (I always use local builds). It seems that while I was using the local headers for the new version of mmg it was linking to some old version of it that was present in the system as the system location had precedence and this was causing the problem. I have removed the old version installed on the system and ensured that it links to the local install and now everything is working as expected.

Thanks,
K

Dear Karl,
Glad it works now in any case :slight_smile:

I have checked that I am able to save the subdomain I want by setting MMG3D_IPARAM_numsubdomain in your program, can you confirm please that you can too, and that all the issues in this thread are now OK?

Thanks,
Luca

Dear Luca,

Yes, all issues were solved including saving the domains!

Regards,
K

1 Like