[Gmsh] Creation of simple surface mesh

Florian Lindner mailinglists at xgm.de
Wed Jun 5 14:11:44 CEST 2019


Hey,

thanks again four your explanation. The Resclassify 2D in the GUI works fine

The meshing, both GUI and command line gives me segfaults on the original Stanford bunny.

When doing 2D meshing with automatic algorithm:

Thread 1 "gmsh" received signal SIGSEGV, Segmentation fault.
0x0000555555a8b15c in getColorByElement (ele=0x5555573e0530) at /home/lindnefn/software/gmsh/Geo/GModelVertexArrays.cpp:75
75            if(e && (e->dim() == ele->getDim())) return getColorByEntity(e);
(gdb) bt
#0  0x0000555555a8b15c in getColorByElement (ele=0x5555573e0530) at /home/lindnefn/software/gmsh/Geo/GModelVertexArrays.cpp:75
#1  getColorByElement (ele=0x5555573e0530) at /home/lindnefn/software/gmsh/Geo/GModelVertexArrays.cpp:46
#2  0x0000555555a8b6d2 in addElementsInArrays<MTriangle> (e=e at entry=0x555558f32880, elements=std::vector of length 17353, capacity 32768 = {...}, edges=edges at entry=true, faces=faces at entry=false)
    at /usr/include/c++/8.3.0/bits/stl_vector.h:930
#3  0x0000555555a8d51d in initMeshGFace::operator() (f=0x555558f32880, this=<synthetic pointer>) at /home/lindnefn/software/gmsh/Geo/GModelVertexArrays.cpp:348
#4  std::for_each<std::_Rb_tree_const_iterator<GFace*>, initMeshGFace> (__f=..., __last=..., __first=0x555558f32880) at /usr/include/c++/8.3.0/bits/stl_algo.h:3882
#5  GModel::fillVertexArrays (this=this at entry=0x5555568a5260) at /home/lindnefn/software/gmsh/Geo/GModelVertexArrays.cpp:471
#6  0x0000555555f76cb7 in drawContext::drawMesh (this=this at entry=0x5555568d5330) at /home/lindnefn/software/gmsh/Graphics/drawMesh.cpp:712
#7  0x0000555555f74855 in drawContext::draw3d (this=0x5555568d5330) at /home/lindnefn/software/gmsh/Graphics/drawContext.cpp:321
#8  0x0000555555ebcd60 in openglWindow::draw (this=0x5555568d5010) at /home/lindnefn/software/gmsh/Fltk/openglWindow.cpp:355
#9  openglWindow::draw (this=0x5555568d5010) at /home/lindnefn/software/gmsh/Fltk/openglWindow.cpp:172
#10 0x00007ffff7c79186 in Fl_Gl_Window::flush() () from /usr/lib/libfltk_gl.so.1.3
#11 0x00007ffff7877218 in Fl::flush() () from /usr/lib/libfltk.so.1.3
#12 0x00007ffff7878352 in Fl::wait(double) () from /usr/lib/libfltk.so.1.3
#13 0x00007ffff787842e in Fl::check() () from /usr/lib/libfltk.so.1.3
#14 0x00007ffff78ce872 in Fl_Widget::do_callback(Fl_Widget*, void*) () from /usr/lib/libfltk.so.1.3
#15 0x00007ffff787ebf5 in Fl_Button::handle(int) () from /usr/lib/libfltk.so.1.3
#16 0x00007ffff7876a8a in ?? () from /usr/lib/libfltk.so.1.3
#17 0x00007ffff787896e in Fl::handle_(int, Fl_Window*) () from /usr/lib/libfltk.so.1.3
#18 0x00007ffff78d596b in fl_handle(_XEvent const&) () from /usr/lib/libfltk.so.1.3
#19 0x00007ffff78d7206 in ?? () from /usr/lib/libfltk.so.1.3
#20 0x00007ffff78d7522 in fl_wait(double) () from /usr/lib/libfltk.so.1.3
#21 0x00007ffff78782d6 in Fl::wait(double) () from /usr/lib/libfltk.so.1.3
#22 0x00007ffff78783de in Fl::run() () from /usr/lib/libfltk.so.1.3
#23 0x0000555555e90cdb in FlGui::run () at /home/lindnefn/software/gmsh/Fltk/FlGui.cpp:655
#24 0x00005555558aac9c in GmshFLTK (argc=<optimized out>, argv=<optimized out>) at /home/lindnefn/software/gmsh/Common/GmshGlobal.cpp:438
#25 0x00005555558ab04d in GmshMainFLTK (argc=2, argv=0x7fffffffd878) at /home/lindnefn/software/gmsh/Common/GmshGlobal.cpp:494
#26 0x00007ffff47d9ce3 in __libc_start_main () from /usr/lib/libc.so.6
#27 0x00005555558a958e in _start () at /usr/include/c++/8.3.0/bits/char_traits.h:287


or when selecting the frontal-delauney algo:

Thread 1 "gmsh" received signal SIGSEGV, Segmentation fault.
0x000055555762a0b0 in ?? ()
(gdb) bt
#0  0x000055555762a0b0 in ?? ()
#1  0x000055555609481c in Patch::Patch (this=0x7fffffffb9d0, element2entity=std::map with 0 elements, bndEl2Ent=std::map with 0 elements, els=std::set with 342 elements = {...}, toFix=std::set with 110 elements = {...}, 
    bndEls=std::set with 0 elements, fixBndNodes=false) at /home/lindnefn/software/gmsh/contrib/MeshOptimizer/Patch.cpp:69
#2  0x000055555608bdaf in MeshOpt::MeshOpt (this=0x7fffffffb9d0, element2entity=..., bndEl2Ent=..., els=..., toFix=..., bndEls=..., par=...) at /home/lindnefn/software/gmsh/contrib/MeshOptimizer/MeshOpt.cpp:45
#3  0x0000555556085132 in (anonymous namespace)::optimizeDisjointPatches (vertex2elements=..., element2entity=..., el2BndEl=..., bndEl2Ent=std::map with 0 elements, badasses=..., par=...)
    at /home/lindnefn/software/gmsh/contrib/MeshOptimizer/MeshOptimizer.cpp:484
#4  0x00005555560879f7 in MeshOptimizer (entities=std::vector of length 102, capacity 152 = {...}, par=...) at /home/lindnefn/software/gmsh/contrib/MeshOptimizer/MeshOptimizer.cpp:785
#5  0x000055555605855e in HighOrderMeshOptimizer (entities=std::vector of length 102, capacity 152 = {...}, p=...) at /home/lindnefn/software/gmsh/contrib/HighOrderMeshOptimizer/HighOrderMeshOptimizer.cpp:380
#6  0x0000555556058a0e in HighOrderMeshOptimizer (gm=<optimized out>, p=...) at /home/lindnefn/software/gmsh/contrib/HighOrderMeshOptimizer/HighOrderMeshOptimizer.cpp:393
#7  0x0000555555bb5e21 in OptimizeHighOrderMesh (m=<optimized out>) at /home/lindnefn/software/gmsh/Mesh/Generator.cpp:1011
#8  0x0000555555bbb882 in GenerateMesh (m=m at entry=0x5555568a5260, ask=ask at entry=2) at /home/lindnefn/software/gmsh/Mesh/Generator.cpp:1147
#9  0x0000555555a5e959 in GModel::mesh (this=0x5555568a5260, dimension=dimension at entry=2) at /home/lindnefn/software/gmsh/Geo/GModel.cpp:890
#10 0x0000555555e962cb in mesh_2d_cb (w=<optimized out>, data=<optimized out>) at /home/lindnefn/software/gmsh/Fltk/graphicWindow.cpp:1919
#11 0x00007ffff78ce872 in Fl_Widget::do_callback(Fl_Widget*, void*) () from /usr/lib/libfltk.so.1.3
#12 0x00007ffff787ebf5 in Fl_Button::handle(int) () from /usr/lib/libfltk.so.1.3
#13 0x00007ffff7876a8a in ?? () from /usr/lib/libfltk.so.1.3
#14 0x00007ffff787896e in Fl::handle_(int, Fl_Window*) () from /usr/lib/libfltk.so.1.3
#15 0x00007ffff78d596b in fl_handle(_XEvent const&) () from /usr/lib/libfltk.so.1.3
#16 0x00007ffff78d7206 in ?? () from /usr/lib/libfltk.so.1.3
#17 0x00007ffff78d7522 in fl_wait(double) () from /usr/lib/libfltk.so.1.3
#18 0x00007ffff78782d6 in Fl::wait(double) () from /usr/lib/libfltk.so.1.3
#19 0x00007ffff78783de in Fl::run() () from /usr/lib/libfltk.so.1.3
#20 0x0000555555e90cdb in FlGui::run () at /home/lindnefn/software/gmsh/Fltk/FlGui.cpp:655
#21 0x00005555558aac9c in GmshFLTK (argc=<optimized out>, argv=<optimized out>) at /home/lindnefn/software/gmsh/Common/GmshGlobal.cpp:438
#22 0x00005555558ab04d in GmshMainFLTK (argc=2, argv=0x7fffffffd878) at /home/lindnefn/software/gmsh/Common/GmshGlobal.cpp:494
#23 0x00007ffff47d9ce3 in __libc_start_main () from /usr/lib/libc.so.6
#24 0x00005555558a958e in _start () at /usr/include/c++/8.3.0/bits/char_traits.h:287


Using the command line works better:

gmsh -2 -algo frontal -clscale 0.1 bun_zipper.msh -o bunny.msh

works. However, when I want to ouput VTK

gmsh -2 -algo frontal -clscale 0.1 bun_zipper.msh -o bunny.vtk


Info    : Writing 'bunny.vtk'...

Thread 1 "gmsh" received signal SIGSEGV, Segmentation fault.
0x0000555555a5d2f1 in GModel::indexMeshVertices (this=this at entry=0x5555568a5260, all=true, singlePartition=singlePartition at entry=0, renumber=renumber at entry=true) at /home/lindnefn/software/gmsh/Geo/MVertex.h:86
86        long int getIndex() const { return _index; }
(gdb) bt
#0  0x0000555555a5d2f1 in GModel::indexMeshVertices (this=this at entry=0x5555568a5260, all=true, singlePartition=singlePartition at entry=0, renumber=renumber at entry=true) at /home/lindnefn/software/gmsh/Geo/MVertex.h:86
#1  0x0000555555ac88d1 in GModel::writeVTK (this=this at entry=0x5555568a5260, name="bunny.vtk", binary=false, saveAll=true, saveAll at entry=false, scalingFactor=scalingFactor at entry=1, bigEndian=bigEndian at entry=false)
    at /home/lindnefn/software/gmsh/Geo/GModelIO_VTK.cpp:31
#2  0x000055555590298c in CreateOutputFile (fileName=..., format=<optimized out>, status=<optimized out>, redraw=<optimized out>) at /home/lindnefn/software/gmsh/Common/CreateFile.cpp:355
#3  0x0000555555901ead in CreateOutputFile (fileName="bunny.vtk", format=10, status=status at entry=true, redraw=redraw at entry=true) at /home/lindnefn/software/gmsh/Common/CreateFile.cpp:295
#4  0x00005555558aa1cd in GmshBatch () at /home/lindnefn/software/gmsh/Common/GmshGlobal.cpp:354
#5  0x00005555558ab0cf in GmshMainFLTK (argc=9, argv=0x7fffffffd808) at /home/lindnefn/software/gmsh/Common/GmshGlobal.cpp:488
#6  0x00007ffff47d9ce3 in __libc_start_main () from /usr/lib/libc.so.6
#7  0x00005555558a958e in _start () at /usr/include/c++/8.3.0/bits/char_traits.h:287

Saving as STL file works, but according to paraview the STL file in no way reflects the actual geometry.

The .msh file you sent me, however, seems to work and produce fine VTKs.

If I can help debugging the segfaults above, I am happy to provide any help. The Bunny STLs are from http://graphics.stanford.edu/data/3Dscanrep/

Best Regards,
Florian

Am 04.06.19 um 17:13 schrieb Christophe Geuzaine:
> 
> 
>> On 3 Jun 2019, at 16:04, Florian Lindner <mailinglists at xgm.de> wrote:
>>
>> Hi Christophe,
>>
>> thanks for your help! I have compiled gmsh from git to try it.
>>
>> I am able to successfully remesh (double click on viewport -> change Global Mesh Size Factor), then click Mesh -> 2D to remesh.
>>
>> Some questions:
>>
>> * How can I change the meshing algorithm?
> 
> The same as for CAD surfaces: Tool->Options->Mesh->General and choose the 2D algo you want. You can also do all of this from the command line, e.g. 'gmsh file.msh -2 -clscale 0.1 -algo frontal', or in a script.
> 
>>
>> * Is there a way to achieve a smiliar semi-automatic meshing on the STL file of the bunny? Or is underlying parametrization you provided required?
>>
> 
> You need to create the parametrization. With the current development version you can do it this way:
> 
> - open the stl
> - launch the "Reclassify 2D" tool (in the module tree, under Mesh)
> - select all elements, check "Create parametrized discrete model" then "Reclassify"
> - 'File->Save as' and choose a filename with an '.msh' extension
> 
> This procedure will change (will be made simpler! :-) in the final release.
> 
> Christophe
> 
> 
>> Thanks a lot!
>> Florian
>>
>> Am 29.05.19 um 16:07 schrieb Christophe Geuzaine:
>>>
>>> Hi Florian,
>>>
>>> This is a nice test-case for our new remeshing pipeline. It's still quite experimental, but you can give it a try with the latest development snapshot: just open the attached .msh file, which contains a mesh of the bunny as well as an underlying parametrization. You can remesh this file simply by selecting the algorithm ("Frontal-Delaunay" in the attached picture) and the mesh size you want (e.g. by double-clicking in the window and changing the global mesh size factor).
>>>
>>> Nothing about the new remeshing features is documented yet, but feel free to play around with it and report your findings ;-)
>>>
>>> Christophe
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>> On 29 May 2019, at 15:25, Florian Lindner <mailinglists at xgm.de> wrote:
>>>>
>>>> Hello,
>>>>
>>>> I have an existing surface geometry, which is the Stanford bunny [1] as PLY format.
>>>>
>>>> My goal is too evaluate a mapping algorithm on a non-trivial geometry. The algorithm works only on point data, therefore I don't need an triangulation.
>>>>
>>>> From the existing surface data I want to generate sampled points of various densities on the surface of the geometry and save these as a standard data format (e.g. VTK).
>>>>
>>>> As I want to generate different mesh sizes, I need something like a background mesh size or a characteristic length which controls the sampling frequency. The exact placement of the points is not important, it should "make sense", i.e. be roughly equidistant or maybe influenced by the curvature.
>>>>
>>>> So far I have only Merge "bun_zipper.ply"; in my .geo file. 
>>>>
>>>> I think you can feel, that I am very uncertain how to progress and I would be very happy for guidance!
>>>>
>>>> Thanks!
>>>> Florian
>>>>
>>>>
>>>> [1] http://graphics.stanford.edu/pub/3Dscanrep/bunny.tar.gz
>>>>
>>>> _______________________________________________
>>>> gmsh mailing list
>>>> gmsh at onelab.info
>>>> http://onelab.info/mailman/listinfo/gmsh
>>>
>>>>>> Prof. Christophe Geuzaine
>>> University of Liege, Electrical Engineering and Computer Science 
>>> http://www.montefiore.ulg.ac.be/~geuzaine
>>>
>>>
>>>
> 
>> Prof. Christophe Geuzaine
> University of Liege, Electrical Engineering and Computer Science 
> http://www.montefiore.ulg.ac.be/~geuzaine
> 
> 
> 



More information about the gmsh mailing list