next up previous contents index
Next: Value of a function Up: Functions Previous: Functions and scalars   Contents   Index

Building functions

There are 6 predefined functions: x,y,ib,region, nx, ny .

The usual if... then ... else statement can be used with an important restriction on the logical expression which must return a scalar value:

if( logical  expression) then
 {
   statement;
   ....;
   statement;
 } 
else
 {
   .....
 };
The logical expression controls the if by its return being 0 or >0, it is evaluated only once (i.e. with x, y being the coordinates of the first vertex, if there are functions inside the logical expression). Auxiliary variables can be used.

In order to minimize the memory the symbol := tells the compiler not to allocate a data array to this variable. Thus v=sin(a*pi*x); generates an array for v but no array is assigned to a in the statement a:=2 .



Christophe Prud'homme 2001-10-20