[Gmsh] Questions related to Extrusions
Christophe Geuzaine
cgeuzaine at ulg.ac.be
Thu Sep 15 22:35:58 CEST 2016
> On 15 Sep 2016, at 20:47, Jim Monte <jim.gmsh at gmail.com> wrote:
>
>
> On Thu, Sep 15, 2016 at 3:23 AM, Christophe Geuzaine <cgeuzaine at ulg.ac.be> wrote:
>
> > 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
>
> Thanks for the details on extrusion. But I am still not seeing how to determine which index will receive the ID for a particular surface. Perhaps I am trying to do something the hard way. My original interest in this question is that I want to know where specific surfaces will be put in the returned array so I can associate a physical surface with specific plane surfaces that get formed as part of the extrusion. Is there another approach to do this programatically (without looking at the GUI for information).
>
> I did more testing with a "brick" shape, made by two extrusions, line->square->brick. The Geometry.OldNewReg option did help to make the IDs closer to the expected values, but it is still confusing what is being done by the program. At a high level, the brick has 8 points, 12 lines, and 6 plane surfaces. But there are
>
> 49-1-8 = 40 unused points,
> 21-1-12 = 8 unused lines (9, 12, 13, 15, 16, 18, 19, 20), and
> 8-1-6 = 1 unused surface (2)
> generated as part of the extrusion. Is there some way to query what will be
> made by the extrusion?
>
The extrusion works by recursively extruding entities of lower dimension, so when you extrude a surface, you actually extrude the curves first; each curve extrusion creates a surface but also new curves and new points. Some of these are duplicates, and they are merged. Hence all the "unused" points, lines, etc.
You can retrieve the IDs programmatically: you just refer to the list returned by the command, by index in the list. Predicting the actual numbers is almost impossible, as many entities created in the process will be removed as duplicates.
> Jim Monte
>
>
>
> /*** start ***/
> Geometry.OldNewReg = 0;
> Printf("next point ID = %g; next line ID = %g; next surface ID = %g",
> newp, newl, news);
> Printf("Defining Point(1), Point(2), and Line(1)");
> Point(1) = {0, 0, 0};
> Point(2) = {0, 1, 0};
> Line(1) = {1, 2};
> Printf("next point ID = %g; next line ID = %g; next surface ID = %g",
> newp, newl, news);
>
> Printf("Extruding line in z direction");
> out[] = Extrude {0, 0, 1} {Line{1}; };
> For i In {1 : 4}
> xyz[] = Point{i};
> Printf("Point %g coordinates = (%g,%g,%g)",i, xyz[0], xyz[1], xyz[2]);
> EndFor
>
> n = #out[];
> Printf("Extrude (line) has returned %g elements", n);
> n -= 1;
> For i In {0 : n}
> Printf("Extrusion value[%g] = %g.", i, out[i]);
> EndFor
>
> Printf("next point ID = %g; next line ID = %g; next surface ID = %g",
> newp, newl, news);
>
> Printf("Extruding surface in x direction");
> out2[] = Extrude {2, 0, 0} {Surface{out[1]}; };
>
> n = #out2[];
> Printf("Extrude (surface) has returned %g elements", n);
> n -= 1;
> For i In {0 : n}
> Printf("Extrusion value[%g] = %g.", i, out2[i]);
> EndFor
>
> Printf("next point ID = %g; next line ID = %g; next surface ID = %g",
> newp, newl, news);
>
> For i In {1:49}
> xyz[] = Point{i};
> Printf("Point %g coordinates = (%g,%g,%g)",i, xyz[0], xyz[1], xyz[2]);
> EndFor
>
> /*** end ***/
>
>
>
> next point ID = 1; next line ID = 1; next surface ID = 1
> Defining Point(1), Point(2), and Line(1)
> next point ID = 3; next line ID = 2; next surface ID = 1
> Extruding line in z direction
> Point 1 coordinates = (0,0,0)
> Point 2 coordinates = (0,1,0)
> Point 3 coordinates = (0,0,1)
> Point 4 coordinates = (0,1,1)
> Extrude (line) has returned 4 elements
> Extrusion value[0] = 2.
> Extrusion value[1] = 1.
> Extrusion value[2] = 4.
> Extrusion value[3] = -3.
> next point ID = 9; next line ID = 5; next surface ID = 2
> Extruding surface in x direction
> Extrude (surface) has returned 6 elements
> Extrusion value[0] = 7.
> Extrusion value[1] = 1.
> Extrusion value[2] = 3.
> Extrusion value[3] = 4.
> Extrusion value[4] = 5.
> Extrusion value[5] = 6.
> next point ID = 49; next line ID = 21; next surface ID = 8
> Point 1 coordinates = (0,0,0)
> Point 2 coordinates = (0,1,0)
> Point 3 coordinates = (0,0,1)
> Point 4 coordinates = (0,1,1)
> Error : 'D:\data\SBIRs__and__projects\A15-087\Gmsh-Elmer tutorial\Tutorial_1\extrusion_test.geo', line 43 : Unknown point '5'
> Point 5 coordinates = (0,0,0)
> Error : 'D:\data\SBIRs__and__projects\A15-087\Gmsh-Elmer tutorial\Tutorial_1\extrusion_test.geo', line 43 : Unknown point '6'
> Point 6 coordinates = (0,0,0)
> Error : 'D:\data\SBIRs__and__projects\A15-087\Gmsh-Elmer tutorial\Tutorial_1\extrusion_test.geo', line 43 : Unknown point '7'
> Point 7 coordinates = (0,0,0)
> Error : 'D:\data\SBIRs__and__projects\A15-087\Gmsh-Elmer tutorial\Tutorial_1\extrusion_test.geo', line 43 : Unknown point '8'
> Point 8 coordinates = (0,0,0)
> Point 9 coordinates = (2,0,0)
> Point 10 coordinates = (2,1,0)
> Error : 'D:\data\SBIRs__and__projects\A15-087\Gmsh-Elmer tutorial\Tutorial_1\extrusion_test.geo', line 43 : Unknown point '11'
> Point 11 coordinates = (0,0,0)
> Error : 'D:\data\SBIRs__and__projects\A15-087\Gmsh-Elmer tutorial\Tutorial_1\extrusion_test.geo', line 43 : Unknown point '12'
> Point 12 coordinates = (0,0,0)
> Error : 'D:\data\SBIRs__and__projects\A15-087\Gmsh-Elmer tutorial\Tutorial_1\extrusion_test.geo', line 43 : Unknown point '13'
> Point 13 coordinates = (0,0,0)
> Point 14 coordinates = (2,1,1)
> Error : 'D:\data\SBIRs__and__projects\A15-087\Gmsh-Elmer tutorial\Tutorial_1\extrusion_test.geo', line 43 : Unknown point '15'
> Point 15 coordinates = (0,0,0)
> Error : 'D:\data\SBIRs__and__projects\A15-087\Gmsh-Elmer tutorial\Tutorial_1\extrusion_test.geo', line 43 : Unknown point '16'
> Point 16 coordinates = (0,0,0)
> Error : 'D:\data\SBIRs__and__projects\A15-087\Gmsh-Elmer tutorial\Tutorial_1\extrusion_test.geo', line 43 : Unknown point '17'
> Point 17 coordinates = (0,0,0)
> Point 18 coordinates = (2,0,1)
> Error : 'D:\data\SBIRs__and__projects\A15-087\Gmsh-Elmer tutorial\Tutorial_1\extrusion_test.geo', line 43 : Unknown point '19'
> Point 19 coordinates = (0,0,0)
> Error : 'D:\data\SBIRs__and__projects\A15-087\Gmsh-Elmer tutorial\Tutorial_1\extrusion_test.geo', line 43 : Unknown point '20'
> Point 20 coordinates = (0,0,0)
> Error : 'D:\data\SBIRs__and__projects\A15-087\Gmsh-Elmer tutorial\Tutorial_1\extrusion_test.geo', line 43 : Unknown point '21'
> Point 21 coordinates = (0,0,0)
> Error : 'D:\data\SBIRs__and__projects\A15-087\Gmsh-Elmer tutorial\Tutorial_1\extrusion_test.geo', line 43 : Unknown point '22'
> Point 22 coordinates = (0,0,0)
> Error : 'D:\data\SBIRs__and__projects\A15-087\Gmsh-Elmer tutorial\Tutorial_1\extrusion_test.geo', line 43 : Unknown point '23'
> Point 23 coordinates = (0,0,0)
> Error : 'D:\data\SBIRs__and__projects\A15-087\Gmsh-Elmer tutorial\Tutorial_1\extrusion_test.geo', line 43 : Unknown point '24'
> Point 24 coordinates = (0,0,0)
> Error : 'D:\data\SBIRs__and__projects\A15-087\Gmsh-Elmer tutorial\Tutorial_1\extrusion_test.geo', line 43 : Unknown point '25'
> Point 25 coordinates = (0,0,0)
> Error : 'D:\data\SBIRs__and__projects\A15-087\Gmsh-Elmer tutorial\Tutorial_1\extrusion_test.geo', line 43 : Unknown point '26'
> Point 26 coordinates = (0,0,0)
> Error : 'D:\data\SBIRs__and__projects\A15-087\Gmsh-Elmer tutorial\Tutorial_1\extrusion_test.geo', line 43 : Unknown point '27'
> Point 27 coordinates = (0,0,0)
> Error : 'D:\data\SBIRs__and__projects\A15-087\Gmsh-Elmer tutorial\Tutorial_1\extrusion_test.geo', line 43 : Unknown point '28'
> Point 28 coordinates = (0,0,0)
> Error : 'D:\data\SBIRs__and__projects\A15-087\Gmsh-Elmer tutorial\Tutorial_1\extrusion_test.geo', line 43 : Unknown point '29'
> Error : Too many errors: aborting parser...
>
>
>
>
> _______________________________________________
> 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