GFem language documentation -- 5.1 Triangulations examples

Up: 5 Examples
Next: 5.2 Scalar examples

## 5.1 Triangulations examples

- A UNIT RING (INNER RADIUS IS 0.25)

      twopi := 2*pi;
      border(1,0,twopi,60) { x := cos(t); y := sin(t) };
      border(2,0,twopi,20) { x := 0.25*cos(-t); y := 0.25*sin(-t) };
      buildmesh(400);

- THE RECTANGLE [(0,0),(0,2),(2,1),(0,10)]

      border(1,0,2,20) { x:= t; y:= 0 };
      border(1,0,1,10) { x:= 1; y:= t };
      border(1,0,2,20) { x:= 2-t; y:= 1 };
      border(1,0,1,10) { x:= 0; y:= 1-t };

- A SQUARE WITH WELL IDENTIFIED SIDES AND CONTROL OF IB AT CORNERS

      border(1,0,4,41)
      {
        if(t<=1) then  {  x:=t; y:=0 };
        if((t>1)and(t<2)) then {  x:=1; y:=t-1; ib:= 2 };
        if((t>=2)and(t<=3)) then { x:=3-t; y:=1; ib:= 3 };
        if(t>3) then { x:=0; y:=4-t; ib:= 4 }
      };
      buildmesh(400);

- MULTI-REGIONS CIRCLE

      border(1,0,2,17) {x:= cos(pi*t); y:= sin(pi*t)};
      border(0,-1,1,7) { x:= t; y:=0; };
      border(0,0,1,4) { x:=0;y:=t };
      buildmesh(300);
      /* observe the value of "region" by using "show triangle numbers */