Seg fault curving 2D mesh in Netgen

5 months 2 weeks ago #1379 by ddrake
Hi,

I'm running the latest version of NGSolve (NGSolve-6.2.1810-50-g655161c)

When I call the method:

mesh.curve(max(p,2)) with p = 2, I'm getting a segfault in Netgen:

netgen/libsrc/geom2d/genmesh2d.cpp:403
403 if (bbox.Diam() < mp.maxh)

Thread 1 "python3" received signal SIGSEGV, Segmentation fault.
0x00007fffdca3f8ac in netgen::MeshFromSpline2D (geometry=...,
mesh=<error reading variable: Cannot access memory at address 0xa>, mp=...)
at /home/dow/ngsuite/ngsolve-src/external_dependencies/netgen/libsrc/geom2d/genmesh2d.cpp:403

Our code is rather complex, but was working before Christmas and hasn't changed since. I'm not seeing this issue with versions of NGSolve/Netgen built more than a week or two ago. If you have trouble reproducing it, I can try to provide more details.

Thanks,
Dow

Please Log in or Create an account to join the conversation.

5 months 2 weeks ago #1381 by ddrake
The following change seems to have fixed the problem:

swap the base classes in netgen/libsrc/geom2d/geometry2d.hpp as follows

class SplineGeometry2d : public NetgenGeometry, public SplineGeometry<2>

Best,
Dow

Please Log in or Create an account to join the conversation.

5 months 2 weeks ago #1384 by christopher
Hi,
I cannot reproduce the Segfault, I do not see a problem in changing the base classes but don't really understand why this fixes the problem and I would assume that it is more or less a coincidence and an explanation would be nice... If you have time to create a reproducible case I would be interested.
Best
Christopher

Please Log in or Create an account to join the conversation.

5 months 2 weeks ago #1390 by ddrake
Hi Christopher,

Swapping the order of the base classes was a suggestion from Joachim, passed along by Jay -- not something I would have thought of myself. I'll try to post a reproducible case soon.

Best,
Dow

Please Log in or Create an account to join the conversation.

5 months 2 weeks ago #1391 by christopher
Ah, I think I know, try in the python_geom2d.cpp in the export of the SplineGeometry adding py::multiple_inheritance():
py::class_<SplineGeometry2d, NetgenGeometry, shared_ptr<SplineGeometry2d>>
    (m, "SplineGeometry",
     "a 2d boundary representation geometry model by lines and splines",
py::multiple_inheritance())
If this fixes your problem then we already know the problem and you don't need to create a test case. I thought we already fixed that.

Best
Christopher
The following user(s) said Thank You: ddrake

Please Log in or Create an account to join the conversation.

5 months 1 week ago #1392 by ddrake
Hi Christopher,

I restored the original order of the base classes in netgen/libsrc/geom2d/geometry2d.hpp and added the py:multiple_inheritance() argument to python_geom2d.cpp as you suggested. I'm not seeing any seg faults or other issues after making those changes.

Best,
Dow

Please Log in or Create an account to join the conversation.

© 2019 Netgen/NGSolve