I cannot reproduce the crash with the latest snapshot.

Instead of generating a .geo file and using the undocumented private api, I 
would encourage you to try the new stable api - it's available in C++, C, 
Python and Julia.

Here's your example written using the Python api :

*** test.py ***

import gmsh

gmsh.initialize()

gmsh.option.setNumber("General.Terminal", 1)
gmsh.option.setNumber("Mesh.Algorithm", 5) # delquad
gmsh.option.setNumber("Mesh.RecombineAll", 1)

gmsh.model.geo.addPoint(2.0, 3.0, 0.0)
gmsh.model.geo.addPoint(1.0, 3.0, 0.0)
gmsh.model.geo.addPoint(0.0, 3.0, 0.0)
gmsh.model.geo.addPoint(0.0, 1.5, 0.0)
gmsh.model.geo.addPoint(0.0, 0.0, 0.0)
gmsh.model.geo.addPoint(1.0, 0.0, 0.0)
gmsh.model.geo.addPoint(2.0, 0.0, 0.0)
gmsh.model.geo.addPoint(2.0, 1.5, 0.0)
gmsh.model.geo.addLine(1, 2)
gmsh.model.geo.addLine(2, 3)
gmsh.model.geo.addLine(3, 4)
gmsh.model.geo.addLine(4, 5)
gmsh.model.geo.addLine(5, 6)
gmsh.model.geo.addLine(6, 7)
gmsh.model.geo.addLine(7, 8)
gmsh.model.geo.addLine(8, 1)
gmsh.model.geo.addCurveLoop([1, 2, 3, 4, 5, 6, 7, 8])
gmsh.model.geo.addPlaneSurface([1], 1)

gmsh.model.geo.synchronize()

for i in range(1,9):
    gmsh.model.mesh.setTransfiniteCurve(i, 2)

gmsh.fltk.run()

gmsh.finalize()

***



> On 13 Jun 2018, at 15:12, Konstantinos Iatridis <k.iatri...@itech-soft.com> 
> wrote:
> 
> Hello gmsh developers and community
>  
> First of all “thank you” to the developers and researchers of gmsh for this 
> great project.
>  
> I have built gmsh 3.0.6 as windows DLL and use it to generate 2d quad meshes 
> from a C++ test application.
> I create programmatically a .geo file and send it for meshing using the gmsh 
> API.
> All 2d mesh algorithms are working (BAMG produces bad results but it doesn’t 
> crash) with the exception of DelQuad which crashes in function:
> backgroundMesh::updateSizes() in these lines:
>       if (s0->second < s1->second)s1->second = 
> std::min(s1->second,_beta*s0->second);
>       else s0->second = std::min(s0->second,_beta*s1->second);
> Following the debugger I realized that backgroundMesh is called only for 
> DelQuad algorithm.
> However, the same .geo file, is meshed correctly using the gmsh stand-alone 
> application with DelQuad enabled and produces a very good result.
> I would appreciate any help on how to achieve the same result using DelQuad 
> from the own test application.
>  
> The code used to mesh the geo file is:
>  
> std::string geofile; //..
> std::string mshfile; //..
> GmshInitialize();
> GmshSetOption("General", "Verbosity", 100.);
> //(1=MeshAdapt, 2=Automatic, 5=Delaunay, 6=Frontal, 7 = BAMG, 8 = DelQuad)
> GmshSetOption("Mesh", "Algorithm", 8.0);
> GmshSetOption("Mesh", "RecombineAll", 1.0);
> GmshSetOption("Mesh", "RecombinationAlgorithm", 1.0);
> GModel *m = new GModel();
> if (m->readGEO(geofile.c_str()) == 1) {
>     m->mesh(2);
>     m->indexMeshVertices(true);
>     m->writeMSH(mshfile.c_str());
> }
> delete m;
> GmshFinalize();
>  
> An example Geo file as produced by my program is:
>  
> Point(1) = {2.0000000000, 3.0000000000, 0.0000000000} ;
> Point(2) = {1.0000000000, 3.0000000000, 0.0000000000} ;
> Point(3) = {0.0000000000, 3.0000000000, 0.0000000000} ;
> Point(4) = {0.0000000000, 1.5000000000, 0.0000000000} ;
> Point(5) = {0.0000000000, 0.0000000000, 0.0000000000} ;
> Point(6) = {1.0000000000, 0.0000000000, 0.0000000000} ;
> Point(7) = {2.0000000000, 0.0000000000, 0.0000000000} ;
> Point(8) = {2.0000000000, 1.5000000000, 0.0000000000} ;
> Line(1) = {1, 2} ;
> Line(2) = {2, 3} ;
> Line(3) = {3, 4} ;
> Line(4) = {4, 5} ;
> Line(5) = {5, 6} ;
> Line(6) = {6, 7} ;
> Line(7) = {7, 8} ;
> Line(8) = {8, 1} ;
> Line Loop(1) = { 1,2,3,4,5,6,7,8} ;
> Plane Surface(1) = {1} ;
> Transfinite Line {1} = 2 Using Progression 1 ;
> Transfinite Line {2} = 2 Using Progression 1 ;
> Transfinite Line {3} = 2 Using Progression 1 ;
> Transfinite Line {4} = 2 Using Progression 1 ;
> Transfinite Line {5} = 2 Using Progression 1 ;
> Transfinite Line {6} = 2 Using Progression 1 ;
> Transfinite Line {7} = 2 Using Progression 1 ;
> Transfinite Line {8} = 2 Using Progression 1 ;
>  
> Thank you in advance
>  
> Konstantinos Iatridis
> -itech-
>  
> _______________________________________________
> gmsh mailing list
> gmsh@onelab.info <mailto:gmsh@onelab.info>
> http://onelab.info/mailman/listinfo/gmsh 
> <http://onelab.info/mailman/listinfo/gmsh>
— 
Prof. Christophe Geuzaine
University of Liege, Electrical Engineering and Computer Science 
http://www.montefiore.ulg.ac.be/~geuzaine

Free software: http://gmsh.info | http://getdp.info | http://onelab.info

_______________________________________________
gmsh mailing list
gmsh@onelab.info
http://onelab.info/mailman/listinfo/gmsh

Reply via email to