[Gmsh] C++ API for using GMSH::Mesher

Josef Weinbub weinbub at gmail.com
Wed Jan 14 11:26:28 CET 2009


hi robert, thx for your reply!

i think that this is the right direction but still no success.

due to your hint about the surface loop and the corresponding volume, i
rechecked the gmsh::manual again, regarding surface loop and relation to
volume objects. i skipped the implementation of the surface loop object,
as the list of incident surfaces is interally copied to the volumes
surface list. hence i directly assembled the volumes object surface
list:

--------------------------------------------------
I.   create new volume 
II.  set volume properties:
     Num          = 0   // there is only one volume to be meshed ..
     Color.type   = 0
     Visible      = 1
     Typ          = MSH_VOLUME
     Method       = MESH_UNSTRUCTURED

for_each(boundary_triangle)
   1. setup 3 Curves for each boundary triangle representing the 
      the edges of the boundary triangle
   2. -) create a Surface, and add the Curve objects to the 
      Generatrices List. 
      -) increase surface id
   3. add the Surface object to the Volume->Surface list. 


// add the volume to the GModel
Tree_Add(m->getGEOInternals()->Volumes, &vol);

// start meshing
m->mesh(3);
--------------------------------------------------

unfortunatly, still the same. I get the input surface mesh by viewing
the plotted *msh or *.unv file. (see attachment ..)

hints of any kind would be great!

thank you very much!

regards, josef



On Tue, 2009-01-13 at 08:11 -0500, Robert Funnell wrote:
> Josef -
> 
> I'm quite fuzzy about this, but are you doing the equivalent of the
>     Surface Loop(1) = {1};
>     Volume(1) = {1};
> seen in demos/sphere-discrete.geo?
> 
> - Robert
> 
> On Tue, 13 Jan 2009, Josef Weinbub wrote:
> 
> > Hi all!
> > 
> > What I am working on:
> > ---------------------
> > I am working on an C++ API which should allow my application to use the
> > 3D mesher capabilities of GMSH. The goal is to feed the GMSH::Mesher
> > with geometry information (boundary points and interior points) and
> > topology (the boundary facets/triangles as in this case). As a result
> > the mesher should provide me with a 3D tet mesh where the interior
> > points and the given boundary(points/facets) should be respected. After
> > a successful mesh is created the GMSH::Mesh domain should be written
> > back to my domain via some kind of writeback() function, which copies
> > the geometry(the points) and the topology(of the meshed tetrahedras)
> > back.
> > 
> > The following parts describe my approach. It would be great if someone
> > can look it through and give me some hints.
> > 
> > The problem:
> > ------------
> > The problem is that the mesher doesn't mesh anything. The *.msh output
> > after calling mesh(3) only contains the previously entered points and
> > the triangles(which should act as the boundary of the volume).
> > 
> > The approach:
> > -------------
> > So far I've used the readMSH() function within GModelIO_Mesh.cpp as a
> > basis for the API implementation. I tried to copy the mechanisms within
> > the readMSH() function. 
> > 
> > the key steps are:
> >  -) setting up geometry: creating MVertex objects and store them on the
> >                          GModel object via "_storeVerticesInEntities()"
> >  -) setting up topology: creating MElement objects of type 2 (triangles
> >                          as these triangles should bound my 3D volume).
> >                          (note that reg=physical=part=0)
> >                          the elements are stored on the GModel object
> >                          via "_storeElementsInEntities()"
> >  -) associateEntityWithMeshVertices: calling the function
> >                          _associateEntityWithMeshVertices()
> >
> >  -) mesh(3): call the mesh algorithm ...
> > 
> > 
> > Thank you very much for your time,
> > yours Josef
> 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: gmsh_api_output.jpg
Type: image/jpeg
Size: 468682 bytes
Desc: not available
URL: <http://www.geuz.org/pipermail/gmsh/attachments/20090114/05a13d4b/attachment.jpg>