[Gmsh] Line of multiple segments

Geordie McBain gdmcbain at freeshell.org
Fri Sep 18 10:12:38 CEST 2009


I just noticed that the Line command accepts more than two points.  In fact, it behaves like BSpline and Spline and accepts an expression-list.  This behaviour is quite useful in my application, but is undocumented (S. 5.1.2 `Lines' <http://geuz.org/gmsh/doc/texinfo/gmsh.html#Lines>).  Should and may I rely on this behaviour?
   The behaviour is useful because I only need one line command for each chain of line segments, and because it applies a single identifier to the whole chain it is much easier to refer to the chain later, e.g. in the Line Loop and Physical Line commands.  It's also useful because I can simply swap Line, Spline, and BSpline in the input file without any other modification.  I attach three examples, differing only in this command.
   If the behaviour is intended and may be relied on, perhaps the documentation for Line could be amended to read something like:

%<---OLD
Line ( expression ) = { expression, expression };
    Creates a straight line segment. The expression inside the parentheses is the line segment's identification number; the two expressions inside the braces on the right hand side give identification numbers of the start and end points of the segment. 
%<---PROPOSED
Line ( expresison ) = { expression-list };
    Creates a polygonal line.  The expression inside the parenthesis is the polygonal line's identification number; the expression-list on the right hand side should contain the identification numbers of all the polygonal line's vertices.
%<---END
-------------- next part --------------
Point (1) = {0, 0, 0.0};
Point (2) = {2, 0, 0.0};
Point (3) = {2, 3, 0.0};

Line (1) = {1, 2, 3, 1};
Line Loop (2) = {1};
Plane Surface (3) = {2};
Physical Line (1) = {1};
Physical Surface (2) = {3};
-------------- next part --------------
Point (1) = {0, 0, 0.0};
Point (2) = {2, 0, 0.0};
Point (3) = {2, 3, 0.0};

Spline (1) = {1, 2, 3, 1};
Line Loop (2) = {1};
Plane Surface (3) = {2};
Physical Line (1) = {1};
Physical Surface (2) = {3};
-------------- next part --------------
Point (1) = {0, 0, 0.0};
Point (2) = {2, 0, 0.0};
Point (3) = {2, 3, 0.0};

BSpline (1) = {1, 2, 3, 1};
Line Loop (2) = {1};
Plane Surface (3) = {2};
Physical Line (1) = {1};
Physical Surface (2) = {3};