Modulefpreviousupnextcontentsindex[BIG][Normal][small]
Next: 1.5 Dynamic arrays Up: 1 General Prev: 1.3 Free format Index Contents


1.4 Function interpreter

   

The free format mechanisms discussed above allow us to input classical data types: integers, reals, character strings, etc. Certain programs, however, also depends on algebraic functions. For example, a mesh generator requires the analytical expression of each curved boundary, and a curve plotting program needs the equations of the curves. Due to the static character of Fortran this problem cannot be solved directly. MODULEF has therefore defined a set of utilities [94] capable of parsing an algebraic function dynamically, and interpreting it (i.e. evaluating it).

The function definition may be split over several lines and must end with an obligatory semi-colon (not to be forgotten!). The syntax closely resembles that of "statement functions" in Fortran. For example:

F(X,Y,Z) = X**2 + Y**2 + Z**2
+ X / (1 - COS(X+Y+Z)) ;

The parsing of a function is performed by utility FONDES (p. gif).

The interpretation of a function is performed by one of the following utilities: FON0RR (p. gif), FON1RR (p. gif), FON2RR (p. gif), or FON3RR (p. gif). A real value is returned for 0, 1, 2 or 3 real parameters.

It is sometimes necessary for a programs to manipulate numbered functions. In this case, the user must input functions with names consisting of one or several letters, followed by the function number. For example, in order to define the equations of reference curves 3 and 5 for preprocessor APNOXX, the user specifies:

COURBE3(X,Y) = X**2 + Y**2 - 1 ;
COURBE5(X,Y) = (X-1.2)**2 + (Y-3.4)**2 - 6.25 ;
FIN

These functions are manipulated by utility FONDEN (p. gif).


Modulefpreviousupnextcontentsindex[BIG][Normal][small]
Next: 1.5 Dynamic arrays Up: 1 General Prev: 1.3 Free format Index Contents