Evan VanderZee - 2014-11-05

I am working with meshing OCC geometry surfaces in netgen version 5.2. I've made some modifications to the code as discussed in an earlier help thread to get OCC surface meshing working in netgen version 5.2. With those fixes made, when I write code along the lines of the following

nglib::NG_OCC_Geometry* occGeom = nglib::Ng_OCC_Load_STEP("file.stp");
nglib::Ng_Meshing_Parameters* meshParams = new nglib::Ng_Meshing_Parameters();
meshParams->uselocalh = 0;
meshParams->optsurfmeshenable = 1;
meshParams->maxh = 0.25;
nglib::Ng_Mesh* mesh = nglib::Ng_NewMesh();
nglib::Ng_OCC_SetLocalMeshSize(occGeom, mesh, meshParams);
nglib::Ng_OCC_GenerateEdgeMesh(occGeom, mesh, meshParams);
nglib::Ng_OCC_GenerateSurfaceMesh(occGeom, mesh, meshParams);

and compile and run the code, I get a segmentation fault.

In my case the stack trace is
#0 netgen::MeshOptimize2d::ImproveMesh (this=0x7fffffffe0b0, mesh=..., mp=...)
at smoothing2.cpp:1016
#1 0x00007ffff673bc33 in netgen::OCCMeshSurface (geom=..., mesh=...,
perfstepsend=4) at occgenmesh.cpp:947
#2 0x00007ffff7bd53f7 in nglib::Ng_OCC_GenerateSurfaceMesh (geom=0x8bf440,
mesh=0x88b2e0, mp=0x891380) at nglib.cpp:917

It appears that most uses of the Array<double> lochs are conditioned on uselocalh = 1; however, the use on line 1016 of smoothing2.cpp is not conditional on uselocalh = 1.

I would like to have the ability to use smoothing even when uselocalh = 0. I think this issue could affect other users, since ImproveMesh appears to be called from STL meshing as well as OCC meshing. I have verified that the line of code that is throwing the segmentation fault has not yet been changed in the master branch.

Does anyone know of a workaround for this problem? I know that setting optsurfmeshenable = 0 avoids the issue, but if I do that the mesh is not smoothed.