Forum Message

 

 

We have moved the forum to https://forum.ngsolve.org . This is an archived version of the topics until 05/05/23. All the topics were moved to the new forum and conversations can be continued there. This forum is just kept as legacy to not invalidate old links. If you want to continue a conversation just look for the topic in the new forum.

Notice

The forum is in read only mode.

Seg fault curving 2D mesh in Netgen

More
5 years 3 months 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
More
5 years 3 months 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
More
5 years 3 months 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
More
5 years 3 months 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
More
5 years 3 months 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():
Code:
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
More
5 years 3 months 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
Time to create page: 0.129 seconds