[Gmsh] Questions related to Extrusions

Christophe Geuzaine cgeuzaine at ulg.ac.be
Thu Sep 15 09:23:19 CEST 2016

```> On 14 Sep 2016, at 20:44, Jim Monte <jim.gmsh at gmail.com> wrote:
>
> Hi,
>
> I would like to know how to find the order of the "side" elements (lines or surfaces) that are generated during an extrusion. Thanks for any information.

When you extrude a line, the surface is created from a line loop defined by the original line, the line extruded from the end point, the (reversed) "top" line and (reversed) lines extruded from the starting point.

When you extrude a surface, the surface loop is created with the original surface, the "top" surface, then all the surfaces extruded from the sides of the original surface (in the order they appear in the surface definitions).

Note that these resulting entities can be changed if they are found to duplicate existing entities, through the explicit or implicit call to "Coherence;".

>
> Also, while doing some related testing, I saw some results that I could not explain from the script below.
>
> /*** start ***/
> Printf("next line ID = %g; next surface ID = %g", newl, news);
> Point(1) = {0, 0, 0};
> Point(2) = {0, 1, 0};
> Line(1) = {1, 2};
> Printf("next line ID = %g; next surface ID = %g", newl, news);
>
> out[] = Extrude {0, 0, 1} {Line{1}; };
>
> n = #out[];
> Printf("Extrude has returned %g elements", n);
> n -= 1;
> For i In {0 : n}
>     Printf("Extrusion value[%g] = %g.", i, out[i]);
> EndFor
>
> Printf("next line ID = %g; next surface ID = %g", newl, news);
> /*** end ***/
>
> The output is
>
> 1  next line ID = 1; next surface ID = 1
> 2  next line ID = 2; next surface ID = 2
> 3  Extrude has returned 4 elements
> 4  Extrusion value[0] = 2.
> 5  Extrusion value[1] = 5.
> 6  Extrusion value[2] = 4.
> 7  Extrusion value[3] = -3.
> 8  next line ID = 6; next surface ID = 6
>
> Here are the things that did not seem right:
> 	• The value returned by news in line 2 is too high. No surface was created yet, so it should remain as 1.
> 	• The next free surface has a value of 1, so line 5 should give the extruded surface a value of 1 instead of 5.

This is for backward compatibility with old Gmsh versions: if you prefer a more natural numbering, you can set "Geometry.OldNewReg=0;" at te beginning of your script.

> 	• I thought the IDs should all be positive, so line 7 seems wrong.

Curves actually exist with both orientations in Gmsh; use "FAbs()" to get the ID.

Christophe

> I would appreciate some explanations of what Gmsh is doing in these instances.
>
> Jim Monte
>
> _______________________________________________
> 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

```