[Gmsh] 2D Meshing using API. SPoint2 or SPoint3

Christophe Geuzaine cgeuzaine at ulg.ac.be
Tue Oct 10 17:25:12 CEST 2017



> On 8 Oct 2017, at 04:35, phillip mobley <phillipmobley2 at gmail.com> wrote:
> 
> Hello all,
> 
> I am attmepting to extract the code from the GMSH API that will be able to create a 2D mesh. After looking through the code for a couple of days now, I have a question about how the code is structed.
> 
> So far, I have been commenting out the sections that deal with 3D. For instance, removing any headers that include the SPoint3.h becuase I ma only dealing with 2D.

I wouldn't do that. "2D" meshes in Gmsh are also generated on general (3D) surfaces.

> 
> However, I have been getting the impression that the 2D case utilizes some of the 3D data structures. At first, I thought that the data structures for 2D are seperate from the 3D data structures. As in, if I wanted to mesh in 2D, then I would only be worried about the data structures related to 2D meshing (such as SPoint2.h). After examining the code for a bit though, I am worried that this may not be the case. I am starting to get the feeling that the data structures for the 3D (ex. SPoint3.h and SVector3.h) are also used in the 2D meshing execpt, the z value is set to 0 (or another constant number if the surface that the created mesh is on is an extruded surface).
> 
> My question to the community or whoso ever may be able to answer is, does GMSH utilize the data structures for 3D in a 2D meshing case? Even if the mesh will always be in the x-y plane?

Yes.

As a general rule, with the current version of Gmsh I would only advise to use it as a library if you really need to, as there is no documented API. A stable API for programmers will be made available in the future (our goal is Gmsh 4.0); and this API will not expose any of the internal C++ classes that the algorithms use.

Christophe


> Or, does a 3D mesh exclusively use the 3D data structures (ex. SPoint3.h) and a 2D mesh exclusivly uses the 2D data structures (ex. SPoint2)?
> 
> Let me give another example to hopefully explain what I am asking. If you look at the SOrientedBoundingBox.h (and corresponding .cpp file), there is a class called SOrientedBoundingBox. The constructor for this class takes the SVector3 class. In the GEntity class, there is an instance of the SOrientedBoundaingBox. The constructor for the GEntity class even calls the contructor of the SOrientedBoundingBox object. Since the SOrientedBoundingBox class uses the SVector3 data type, I conclude that this class is used when you need to create a 3D mesh. However, I am creating a 2D mesh. Will there every be a case that the 2D mesher calls or utilizes the SOrientedBoundingBox. Or, would the 2D mesher utilize the SOrientedBoundingRectangle class?
> 
> Also, as a bonus question, what is the purpose of the SOrientedBoundingRectangle/SOrientedBoundingBox? Is this used for meshing or is this mainly used in the GUI? How are these classes and what are their purpose? I
> 
> I will give a third example, in the GEdge class, there is a variable called _normals. This is a mutable map of MVertex *and SVector3. Will the 2D meshing case every need access to this data type? Or will this only be used in the 3D meshing case?
> 
> I hope that my explanation clearly explains the issue that I am having. If not, please let me know. I would very much to make sure that I am clearly explaining the issue that I am having.
> 
> Thank you all for your time and I look forward to who so ever replies.
> 
> 
> _______________________________________________
> 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

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




More information about the gmsh mailing list