[Gmsh] Gmsh API run-time crash

Tommy Binford tbinford at gmail.com
Tue Apr 19 18:50:16 CEST 2011


I have been using the Gmsh API for about two weeks now on Windows.  I ran into
some trouble with a library conflict using Trilinos and Gmsh together
in the same
project in Release mode.  Before that, Gmsh was working fine.

I purged Gmsh and started a separate project to test my hypothesis against all
the Trilinos libraries.  After finding that one particular library
seemed to cause the
problem, I started putting things back together.

Once again, I purged Gmsh, untarred the source, ran cmake-gui, and generated
a VS2010 project.  There were no errors in the build, as before.  However, now
Gmsh crashes during the call to meshGenerator() [meshGFace.cpp] attempting
to loop over doc.numTriangles.  Debugging shows doc.points is empty.  No errors
were thrown except what amounts to a segfault.  If I skip this section
in the debugger,
the mesh file is generated.

Can you suggest what I may have missed when configuring and building the Gmsh
lib on my second time around?  Perhaps I added a package or removed a package
that causes this error?  Everything works perfectly in Linux.

List of enabled options (need 2d mesh generation only):
ACIS
ANN
BAMG
GMM
MATHEX
MESH
OCC
PLUGINS
PARSER
POST

Offending section of code with annotation:
====================================================
// Builds An initial triangular mesh that respects the boundaries of
// the domain, including embedded points and surfaces
static bool meshGenerator(GFace *gf, int RECUR_ITER,
                          bool repairSelfIntersecting1dMesh,
                          bool debug = true)
.
.
.
    Msg::Debug("Meshing of the convex hull (%d points)", points.size());
    doc.MakeMeshWithPoints();
    Msg::Debug("Meshing of the convex hull (%d points) done", points.size());

//// CRASHES IN THIS LOOP
    for(int i = 0; i < doc.numTriangles; i++) {
      BDS_Point *p1 = (BDS_Point*)doc.points[doc.triangles[i].a].data;
      BDS_Point *p2 = (BDS_Point*)doc.points[doc.triangles[i].b].data;
      BDS_Point *p3 = (BDS_Point*)doc.points[doc.triangles[i].c].data;
      m->add_triangle(p1->iD, p2->iD, p3->iD);
    }
.
.
.
====================================================