That would be great. If references are basically tags of “sub-domains” or materials, it would make sense to set hmin, hmax and hsiz differently on each reference isomesh.
Is there a way to do that, ideally through the API of mmgs?
Hello Mathias,
I think that what you want to do is to impose local parameters by references : https://www.mmgtools.org/local-parameters-for-boundaries
The linked example explain how to set local parameters using a “parameter” file (*.mmgs extension) but you can obtain the same behaviour using the following API call:
/* Set the number of tags references on which you will impose local parameters*/
if ( MMGS_Set_iparameter(mmgMesh,mmgSol,MMGS_IPARAM_numberOfLocalParam,3) != 1 )
exit(EXIT_FAILURE);
/* For each local parameter, set the type of the entity on wich the parameter will apply (triangle or tetra), the reference of these entities and the hmin, hmax and hausdorff values to apply */
if ( MMGS_Set_localParameter(mmgMesh,mmgSol,MMG5_Triangle,38,1.8,2.2,0.01) != 1 )
exit(EXIT_FAILURE);
if ( MMGS_Set_localParameter(mmgMesh,mmgSol,MMG5_Triangle,36,0.098,0.12,0.1) != 1 )
exit(EXIT_FAILURE);
if ( MMGS_Set_localParameter(mmgMesh,mmgSol,MMG5_Triangle,37,4.8,5.2,1) != 1 )
exit(EXIT_FAILURE);
Few remarks:
- You can’t impose local parameters over vertices;
- The global parameters are applied on entites without local parameters;
- If you call the library twice and want to change the local parameters you will need to delete the output metric of Mmg (it is not possible to use it anymore because the local parameters have been used to truncate the sizes);
- Using constant local parameters over your mesh is slower than using equivalent global parmeters;
Regards,
Algiane
Thank you very much, that’s what I was looking for! Seems to work.