MmgTools / mmg

open source software for bidimensional and tridimensional remeshing
http://www.mmgtools.org
Other
362 stars 117 forks source link

Level set option with level set != 0 creates false reference splits and wrong implicit surface #218

Closed jenom closed 1 year ago

jenom commented 1 year ago

I think I found a bug with the level set option. The setup is as follow (top row images):

After the level set adaptation we get false split volume parts for the lower cube (lower left image). If I shift the level set by -0.5 and set the level set level to 0 (instead of 0.5) in the mmg call, I get the correct result (lower right image). The reference boundary itself is always correctly preserved.

compare

The following shows the resulting interior implicit shapes compare_2

The above pictures are based on this simplified example: example.zip

I have used the following commands:

mmg3d_O3 -ls 0.5 -hausd 1e-04 -hgrad 1.2 -hmin 2e-05 -nreg -nr -in input.mesh -out output.mesh -sol input_0.5.sol
mmg3d_O3 -ls 0 -hausd 1e-04 -hgrad 1.2 -hmin 2e-05 -nreg -nr -in input.mesh -out output.mesh -sol input_0.0.sol

I hope this explains the issue and helps testing/debugging.

  -- MMG3D, Release 5.7.1 (Dec. 20, 2022)
     Copyright (c) Bdx INP/CNRS/Inria/UPMC, 2004-
     May 24 2023 14:21:10
Algiane commented 1 year ago

Thanks for this feedback.

Can you check if the branch feature/fix-non0-ls-splitting solves your issue please?

thanks by advance,

jenom commented 1 year ago

thanks a lot for the effort!. Both ls values seem to work for me. They give slightly different results but I guess that is expected given the nature of the algorithm.

image

Algiane commented 1 year ago

Hi,

In fact, it seems odd to me that the results are not totally identical but I have not been able to reproduce the differences between the runs (I obtain the same final meshes and the same terminal outputs in my case).

In any case, this PR fixes a major bug so I will merge it.

Thanks for your feedback, Best