Seg fault on separating multimaterial meshes

I am using mmg3d to remesh and then separate parts of different material meshes. The mesh I’m using now for remeshing has phase 1 quality analysis as below:
– PHASE 1 : ANALYSIS

– MESH QUALITY 58264
BEST 0.998888 AVRG. 0.703198 WRST. 0.231489 (33471)
– PHASE 1 COMPLETED. 0.079s
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Then after remeshing I separate different parts of the mesh by running:
temp.o.mesh -noinsert -noswap -nomove -nsd 2
And the input mesh for this step (which is the same mesh as the output of the remeshed step) has phase 1 analysis:
– PHASE 1 : ANALYSIS

– MESH QUALITY 87104
BEST 0.995322 AVRG. 0.449190 WRST. 0.096198 (23291)
– PHASE 1 COMPLETED. 0.667s
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
The first step (remeshing step) is completed successfully. But the second step (mesh separation step) is interrupted by seg fault.
I have seen that large meshes can cause seg fault. Since the meshes I am using composed of parts, so I did try using meshes with fewer parts and it seems to be alright. However, using the solution of changing the default MEMPERCENT in file MmgTools/mmg/blob/a9b8d561f58a781847e97e7942b73598c5ba17a9/src/common/mmgcommon.h to 1.0 did not help solving seg fault problem with the big file I am using.
Can there be other possible reasons that caused seg fault problem?

Hi,

From my experience, the segfault on large meshes occurs for meshes with more than 150 million tetrahedra (I think that it happens around 200 millions) so I don’t think that your issue is related to this (as the mesh that you provide for the separation step contains 87104 tetrahedra).

I think that you are facing another bug: can you please provide the mesh that you give for the splitting step?
If not possible, it can be useful to build Mmg in Debug mode and to add falgs to check memory errors:

cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_FLAGS="-fsanitize=address -fno-omit-frame-pointer" -DCMAKE_EXE_LINKER_FLAGS="-fsanitize=address -fno-omit-frame-pointer" 

Best regards,
Algiane

Hi Algiane, thank you for answering. I forgot to update here. Yes I figured there is a step in my pipline that changed the tetrahedron tags after remeshing. And using the old tags for separation caused problem. Sorry for my misunderstanding of the problem.

Hi,

It will be useful if I can access your mesh to find the bug: did you have an issue with the forum to attach it?

Thank you by advance,
Best Regards,

Algiane

The bug is already resolved. And it was caused by reasons on my end, not mmg. Sorry for being not clear in my previous message. Thanks again.

Thank you for the feedback!