Segfault when generating a mesh from an implicit surface

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Segfault when generating a mesh from an implicit surface

Grimm, Raphael (IAR)
Hi,

I wanted to compare different methods to turn implicit surfaces into a mesh.

In the attached code I compared CGAL::make_mesh_3 with
CGAL::make_surface_mesh.
I can deactivate the code using either of these functions using the
defines at the top of the file.

If  I activate only one of these functions, the executable generates the
meshes.
So far all is good.

If I activate both functions to do the conversion, the executable segfaults:

void impl_mesh_via_all(double) 4
void impl_mesh_via_make_surface_mesh(double) 4
     impl
     convert
     save
void impl_mesh_via_make_mesh_3(double) 4
     impl
     convert
Segmentation fault (core dumped)


I do not understand this, since both functions work if I only use one in
the executable.
Can anyone tell me what the reason for this is?

Best Regards,
Raphael

--
Karlsruhe Institute of Technology (KIT)
Institute for Anthropomatics and Robotics (IAR)
High Performance Humanoid Technologies (H2T)

Raphael Grimm (M.Sc.)
Research Scientist

Adenauerring 2
Building 50.20, Room 334
76131 Karlsruhe, Germany

Phone: +49 721 608-47133
Fax: +49 721 608-48270
Email: [hidden email]
Web: http://h2t.anthropomatik.kit.edu/

KIT - The Research University in the Helmholtz Association


main.cpp (4K) Download Attachment
smime.p7s (6K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Segfault when generating a mesh from an implicit surface

MaelRL

Hello,

The issue actually entirely comes from Mesh_3 and the Surface_mesher never needs to be included (but it is exclusive to 'Release' mode for me). It stems from your 'Function' type alias:

using Function = double (*)(const Point_3&);

which is an alias to a function pointer. There is actually a known bug in a mesh domain wrapper class when pointer functions are used. This will be fixed very soon in our master branch (and will be in the release CGAL 4.13) by the following pull request (which will rework the API for Mesh_3 domains): https://github.com/CGAL/cgal/pull/2739.

In the meantime, you can use the type alias that we use in the examples:

typedef double (Function)(const Point_3&);

or

using Function = double (const Point_3&);

Using either, the program runs just fine for me.

Best,
Mael

PS: Note that the Surface_mesher is eventually going to be replaced by Mesh_3 (which is more developed).

On 26/05/2018 21:01, Raphael Grimm wrote:
Hi,

I wanted to compare different methods to turn implicit surfaces into a mesh.

In the attached code I compared CGAL::make_mesh_3 with CGAL::make_surface_mesh.
I can deactivate the code using either of these functions using the defines at the top of the file.

If  I activate only one of these functions, the executable generates the meshes.
So far all is good.

If I activate both functions to do the conversion, the executable segfaults:

void impl_mesh_via_all(double) 4
void impl_mesh_via_make_surface_mesh(double) 4
    impl
    convert
    save
void impl_mesh_via_make_mesh_3(double) 4
    impl
    convert
Segmentation fault (core dumped)


I do not understand this, since both functions work if I only use one in the executable.
Can anyone tell me what the reason for this is?

Best Regards,
Raphael