Segment
#
A segment is a straight line between 2 distinct points.
The general case is to give points through parameters _v1
and _v2
, but when 1D, the real coordinates can be given:
Segment s1(_v1=Point(0.,0.,0.), _v2=Point(0.,1.,-1.), _nnodes=11, _domain_name="Omega");
Segment s2(_v1=Point(0.,0.), _v2=Point(0.,1.), _hsteps=0.1, _domain_name="Omega");
Segment s3(_v1=Point(0.), _v2=Point(1.), _hsteps={0.1,0.2}, _domain_name="Omega");
Segment s4(_v1=0., _v2=1.,_nnodes=11, _domain_name="Omega");
In previous examples \(s3\) and \(s4\) are identical.
A better comprehensive way for \(s4\) construction is to use parameters _xmin
and _xmax
instead of _v1
and _v2
:
Segment s4(_xmin=0., _xmax=1., _nnodes=11, _domain_name="Omega");
One of the combination _xmin
and _xmax
or _v1
and _v2
is needed.
In previous examples, note that _nnodes
take only a single integer value and _hsteps
can take one real value or an explicit list of 2 real values ( or a Reals
object).
If required, give the names of main domain and side domains as explained in Geometry definition:
// segment [-2,5] with 50 points when meshing
Segment s1(_xmin=-2, _xmax=5, _nnodes=50);
// segment linking A(1,2,3) and B(-2,5,0) with 20 points
// when meshing and domain is "Omega1"
Point a(1.,2.,3.);
Point b(-2.,5.,0.)
Segment s2(_v1=a, _v2=b, _nnodes=20, _domain_name="Omega1");
// segment [0,1] with 20 points when meshing
// and side domains are "Gamma1" and "Gamma2"
Segment s3(_xmin=0., _xmax=1., _nnodes=20, _side_names={"Gamma1","Gamma2"});
// segment [0,1] with 10 points when meshing and domain is "Omega"
// and side domains are "Gamma1" and "Gamma2"
Segment s4(_xmin=0., _xmax=1., _nnodes=10, _domain_name="Omega",
_side_names={"Gamma1","Gamma2"});
// segment [0,1] with 10 points when meshing
//and domain is "Omega" and side domain is "Gamma"
Segment s4(_xmin=0., _xmax=1., _nnodes=10, _domain_name="Omega", _side_names="Gamma");
The orientation of a segment can be reversed by using one of the following:
Segment s1(_xmin=-2, _xmax=5, _nnodes=50);
s1.reverse(); // s1 is modified
Segment s2=~s1; // s1 is not modified
Warning
When defining composite or loop geometries, do not use the reverse
method, but only the \(\sim\) operator.
Let’s summarize information about geometrical keys for segments:
key(s) |
authorized types |
examples |
---|---|---|
|
single integer or real value, or |
|
|
single integer or real value |
|
Hint
Parametrization of the segment \([S_1,S_2]\): \(t\in[0,1] \longmapsto (1-t)S_1+tS_2\).