<div dir="ltr"><div><br></div><div class="gmail_extra"><div class="gmail_quote">On Thu, Sep 15, 2016 at 3:23 AM, Christophe Geuzaine <span dir="ltr"><<a href="mailto:cgeuzaine@ulg.ac.be" target="_blank">cgeuzaine@ulg.ac.be</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><br>
> On 14 Sep 2016, at 20:44, Jim Monte <<a href="mailto:jim.gmsh@gmail.com">jim.gmsh@gmail.com</a>> wrote:<br>
><br>
> Hi,<br>
><br>
> 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.<br>
<br>
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.<br>
<br>
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).<br>
<br>
Note that these resulting entities can be changed if they are found to duplicate existing entities, through the explicit or implicit call to "Coherence;".<br>
<br>
><br>
> Also, while doing some related testing, I saw some results that I could not explain from the script below.<br>
><br>
> /*** start ***/<br>
> Printf("next line ID = %g; next surface ID = %g", newl, news);<br>
> Point(1) = {0, 0, 0};<br>
> Point(2) = {0, 1, 0};<br>
> Line(1) = {1, 2};<br>
> Printf("next line ID = %g; next surface ID = %g", newl, news);<br>
><br>
> out[] = Extrude {0, 0, 1} {Line{1}; };<br>
><br>
> n = #out[];<br>
> Printf("Extrude has returned %g elements", n);<br>
> n -= 1;<br>
> For i In {0 : n}<br>
> Printf("Extrusion value[%g] = %g.", i, out[i]);<br>
> EndFor<br>
><br>
> Printf("next line ID = %g; next surface ID = %g", newl, news);<br>
> /*** end ***/<br>
><br>
> The output is<br>
><br>
> 1 next line ID = 1; next surface ID = 1<br>
> 2 next line ID = 2; next surface ID = 2<br>
> 3 Extrude has returned 4 elements<br>
> 4 Extrusion value[0] = 2.<br>
> 5 Extrusion value[1] = 5.<br>
> 6 Extrusion value[2] = 4.<br>
> 7 Extrusion value[3] = -3.<br>
> 8 next line ID = 6; next surface ID = 6<br>
><br>
> Here are the things that did not seem right:<br>
> • The value returned by news in line 2 is too high. No surface was created yet, so it should remain as 1.<br>
> • The next free surface has a value of 1, so line 5 should give the extruded surface a value of 1 instead of 5.<br>
<br>
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.<br>
<br>
> • I thought the IDs should all be positive, so line 7 seems wrong.<br>
<br>
Curves actually exist with both orientations in Gmsh; use "FAbs()" to get the ID.<br>
<br>
Christophe<br>
<br>
<br>
> I would appreciate some explanations of what Gmsh is doing in these instances.<br>
><br>
> Jim Monte<br>
><br>
> ______________________________<wbr>_________________<br>
> gmsh mailing list<br>
> <a href="mailto:gmsh@onelab.info">gmsh@onelab.info</a><br>
> <a href="http://onelab.info/mailman/listinfo/gmsh" rel="noreferrer" target="_blank">http://onelab.info/mailman/<wbr>listinfo/gmsh</a><br>
<span class="gmail-HOEnZb"><font color="#888888"><br>
</font></span></blockquote><div>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).</div><div><br></div><div>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</div><div><br></div><div>49-1-8 = 40 unused points,</div><div>21-1-12 = 8 unused lines (9, 12, 13, 15, 16, 18, 19, 20), and</div><div>8-1-6 = 1 unused surface (2)</div><div>generated as part of the extrusion. Is there some way to query what will be</div><div>made by the extrusion?</div><div><br></div><div>Jim Monte</div><div><br></div><div><br></div><div><br></div><div><div>/*** start ***/</div><div>Geometry.OldNewReg = 0;</div><div>Printf("next point ID = %g; next line ID = %g; next surface ID = %g",</div><div> newp, newl, news);</div><div>Printf("Defining Point(1), Point(2), and Line(1)");</div><div>Point(1) = {0, 0, 0};</div><div>Point(2) = {0, 1, 0};</div><div>Line(1) = {1, 2};</div><div>Printf("next point ID = %g; next line ID = %g; next surface ID = %g",</div><div> newp, newl, news);</div><div><br></div><div>Printf("Extruding line in z direction");</div><div>out[] = Extrude {0, 0, 1} {Line{1}; };</div><div>For i In {1 : 4}</div><div> xyz[] = Point{i};</div><div> Printf("Point %g coordinates = (%g,%g,%g)",i, xyz[0], xyz[1], xyz[2]);</div><div>EndFor</div><div><br></div><div>n = #out[];</div><div>Printf("Extrude (line) has returned %g elements", n);</div><div>n -= 1;</div><div>For i In {0 : n}</div><div> Printf("Extrusion value[%g] = %g.", i, out[i]);</div><div>EndFor</div><div><br></div><div>Printf("next point ID = %g; next line ID = %g; next surface ID = %g",</div><div> newp, newl, news);</div><div><br></div><div>Printf("Extruding surface in x direction");</div><div>out2[] = Extrude {2, 0, 0} {Surface{out[1]}; };</div><div><br></div><div>n = #out2[];</div><div>Printf("Extrude (surface) has returned %g elements", n);</div><div>n -= 1;</div><div>For i In {0 : n}</div><div> Printf("Extrusion value[%g] = %g.", i, out2[i]);</div><div>EndFor</div><div><br></div><div>Printf("next point ID = %g; next line ID = %g; next surface ID = %g",</div><div> newp, newl, news);</div><div><br></div><div>For i In {1:49}</div><div> xyz[] = Point{i};</div><div> Printf("Point %g coordinates = (%g,%g,%g)",i, xyz[0], xyz[1], xyz[2]);</div><div>EndFor</div><div><br></div><div>/*** end ***/</div><div><br></div></div><div><br></div><div><br></div><div><div>next point ID = 1; next line ID = 1; next surface ID = 1</div><div>Defining Point(1), Point(2), and Line(1)</div><div>next point ID = 3; next line ID = 2; next surface ID = 1</div><div>Extruding line in z direction</div><div>Point 1 coordinates = (0,0,0)</div><div>Point 2 coordinates = (0,1,0)</div><div>Point 3 coordinates = (0,0,1)</div><div>Point 4 coordinates = (0,1,1)</div><div>Extrude (line) has returned 4 elements</div><div>Extrusion value[0] = 2.</div><div>Extrusion value[1] = 1.</div><div>Extrusion value[2] = 4.</div><div>Extrusion value[3] = -3.</div><div>next point ID = 9; next line ID = 5; next surface ID = 2</div><div>Extruding surface in x direction</div><div>Extrude (surface) has returned 6 elements</div><div>Extrusion value[0] = 7.</div><div>Extrusion value[1] = 1.</div><div>Extrusion value[2] = 3.</div><div>Extrusion value[3] = 4.</div><div>Extrusion value[4] = 5.</div><div>Extrusion value[5] = 6.</div><div>next point ID = 49; next line ID = 21; next surface ID = 8</div><div>Point 1 coordinates = (0,0,0)</div><div>Point 2 coordinates = (0,1,0)</div><div>Point 3 coordinates = (0,0,1)</div><div>Point 4 coordinates = (0,1,1)</div><div>Error : 'D:\data\SBIRs__and__projects\A15-087\Gmsh-Elmer tutorial\Tutorial_1\extrusion_test.geo', line 43 : Unknown point '5'</div><div>Point 5 coordinates = (0,0,0)</div><div>Error : 'D:\data\SBIRs__and__projects\A15-087\Gmsh-Elmer tutorial\Tutorial_1\extrusion_test.geo', line 43 : Unknown point '6'</div><div>Point 6 coordinates = (0,0,0)</div><div>Error : 'D:\data\SBIRs__and__projects\A15-087\Gmsh-Elmer tutorial\Tutorial_1\extrusion_test.geo', line 43 : Unknown point '7'</div><div>Point 7 coordinates = (0,0,0)</div><div>Error : 'D:\data\SBIRs__and__projects\A15-087\Gmsh-Elmer tutorial\Tutorial_1\extrusion_test.geo', line 43 : Unknown point '8'</div><div>Point 8 coordinates = (0,0,0)</div><div>Point 9 coordinates = (2,0,0)</div><div>Point 10 coordinates = (2,1,0)</div><div>Error : 'D:\data\SBIRs__and__projects\A15-087\Gmsh-Elmer tutorial\Tutorial_1\extrusion_test.geo', line 43 : Unknown point '11'</div><div>Point 11 coordinates = (0,0,0)</div><div>Error : 'D:\data\SBIRs__and__projects\A15-087\Gmsh-Elmer tutorial\Tutorial_1\extrusion_test.geo', line 43 : Unknown point '12'</div><div>Point 12 coordinates = (0,0,0)</div><div>Error : 'D:\data\SBIRs__and__projects\A15-087\Gmsh-Elmer tutorial\Tutorial_1\extrusion_test.geo', line 43 : Unknown point '13'</div><div>Point 13 coordinates = (0,0,0)</div><div>Point 14 coordinates = (2,1,1)</div><div>Error : 'D:\data\SBIRs__and__projects\A15-087\Gmsh-Elmer tutorial\Tutorial_1\extrusion_test.geo', line 43 : Unknown point '15'</div><div>Point 15 coordinates = (0,0,0)</div><div>Error : 'D:\data\SBIRs__and__projects\A15-087\Gmsh-Elmer tutorial\Tutorial_1\extrusion_test.geo', line 43 : Unknown point '16'</div><div>Point 16 coordinates = (0,0,0)</div><div>Error : 'D:\data\SBIRs__and__projects\A15-087\Gmsh-Elmer tutorial\Tutorial_1\extrusion_test.geo', line 43 : Unknown point '17'</div><div>Point 17 coordinates = (0,0,0)</div><div>Point 18 coordinates = (2,0,1)</div><div>Error : 'D:\data\SBIRs__and__projects\A15-087\Gmsh-Elmer tutorial\Tutorial_1\extrusion_test.geo', line 43 : Unknown point '19'</div><div>Point 19 coordinates = (0,0,0)</div><div>Error : 'D:\data\SBIRs__and__projects\A15-087\Gmsh-Elmer tutorial\Tutorial_1\extrusion_test.geo', line 43 : Unknown point '20'</div><div>Point 20 coordinates = (0,0,0)</div><div>Error : 'D:\data\SBIRs__and__projects\A15-087\Gmsh-Elmer tutorial\Tutorial_1\extrusion_test.geo', line 43 : Unknown point '21'</div><div>Point 21 coordinates = (0,0,0)</div><div>Error : 'D:\data\SBIRs__and__projects\A15-087\Gmsh-Elmer tutorial\Tutorial_1\extrusion_test.geo', line 43 : Unknown point '22'</div><div>Point 22 coordinates = (0,0,0)</div><div>Error : 'D:\data\SBIRs__and__projects\A15-087\Gmsh-Elmer tutorial\Tutorial_1\extrusion_test.geo', line 43 : Unknown point '23'</div><div>Point 23 coordinates = (0,0,0)</div><div>Error : 'D:\data\SBIRs__and__projects\A15-087\Gmsh-Elmer tutorial\Tutorial_1\extrusion_test.geo', line 43 : Unknown point '24'</div><div>Point 24 coordinates = (0,0,0)</div><div>Error : 'D:\data\SBIRs__and__projects\A15-087\Gmsh-Elmer tutorial\Tutorial_1\extrusion_test.geo', line 43 : Unknown point '25'</div><div>Point 25 coordinates = (0,0,0)</div><div>Error : 'D:\data\SBIRs__and__projects\A15-087\Gmsh-Elmer tutorial\Tutorial_1\extrusion_test.geo', line 43 : Unknown point '26'</div><div>Point 26 coordinates = (0,0,0)</div><div>Error : 'D:\data\SBIRs__and__projects\A15-087\Gmsh-Elmer tutorial\Tutorial_1\extrusion_test.geo', line 43 : Unknown point '27'</div><div>Point 27 coordinates = (0,0,0)</div><div>Error : 'D:\data\SBIRs__and__projects\A15-087\Gmsh-Elmer tutorial\Tutorial_1\extrusion_test.geo', line 43 : Unknown point '28'</div><div>Point 28 coordinates = (0,0,0)</div><div>Error : 'D:\data\SBIRs__and__projects\A15-087\Gmsh-Elmer tutorial\Tutorial_1\extrusion_test.geo', line 43 : Unknown point '29'</div><div>Error : Too many errors: aborting parser...</div></div><div><br></div><div><br></div><div> </div></div><br></div></div>