Previous Up Next
Previous: 3.4.1 Functions and scalars
Up: 3.4 Functions
Next: 3.4.3 Value of a function at one point

3.4.2 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

Previous Up Next