BrunoLevy / geogram

a programming library with geometric algorithms
Other
1.8k stars 122 forks source link

Segmentation fault when running manifold_harmonics sample program #166

Closed megawattfs closed 1 month ago

megawattfs commented 1 month ago

This is a Windows debug build of version 1.9.0 using the dynamic libraries. I have attached a .zip archive containing the .obj file I used. It has 500 vertices and 983 triangles.

To reproduce (from the build\Windows\bin\Debug directory): manifold_harmonics.exe path/to/test.obj nb_eigens=4 discretization=UNIFORM works manifold_harmonics.exe path/to/test.obj nb_eigens=24 discretization=UNIFORM gives a segmentation fault

After tracing the issue, I discovered that with some starting values of nb_eigens (nb_eigens=24 in this example), there is an ARPack routine (I think dseupd) that increments nev (number of eigenvalues) by one, so later when the eigenvectors are being written to the buffer at the end of solving, there is a segmentation fault.

EDIT: Worked around it, working on a PR

test.zip

BrunoLevy commented 1 month ago

I just tested on my machine (Linux) with a memory debugger it worked and did not detect anything. I'll try on a Windows machine as soon as I have time (and yes, I'll be interested in a PR if you found a workaround)

Note: it was not the origin of the problem, but your mesh has a very small number of vertices, you may need to remesh it in order to have sufficient degrees of freedom to accurately represent the MHs. You can use:

$ vorpalite test.obj remesh:nb_pts=10000 remeshed.obj