Previous Up Next
Up: 3 The Gory Details
Next: 3.2 List of reserved words

3.1 Programs

Gfem is a small language which generally follows the syntax of the language Pascal. See the list below for the reserved words of this language.

The reserved word begin can be replaced by { and end by }.

C programmers: caution the syntax is "...};" while most C constructs use " ...;}"

Example 1: Triangulates a circle and plot f = x*y

border(1,0,6.28,20)  
 begin 
  x:=cos(t);
  y:=sin(t);
 end; 
buildmesh(200); 
f=x*y; plot(f);

Example 2: on the circle solve the Dirichlet problem

-Delta(u) = x*y with u=0 on pdOmega

border(1,0,6.28,20) 
 begin 
  x:=cos(t); 
  y:=sin(t);
 end; 
buildmesh(200);
solve(u) begin 
 onbdy(1) u =0; 
 pde(u) -laplace(u) = x*y ; 
end; 
plot(u);

Christophe Prud'homme

Previous Up Next