The module does some field mathematics -- I am intended to talk 
about it at the AVS94.

Krzysztof (Chris) S. Nowinski     
Inst. of Applied Math.
Warsaw University
Banacha 2 Warsaw, Poland
ph (48)(2)6583236
know@helium.appli.mimuw.edu.pl


NAME
	Field Math - an interpreter of AVSFOL programming language
			for creation or modification of float fields


DESCRIPTION

The module interprets a short (up to 60 lines) program written in 
AVSFOL (A Very Simple Field Operation Language) conforming to the 
following syntax:

<program> 		:= <declaration lines><instruction_lines>
<declaration lines>     := !dimensions <dim0> <dim1> ...          
                           !veclen=<veclen>
                           !nspace=<nspace>

<instruction_line>	:= <comment line>|<substitution line>|
			   <structural instruction line>|
			   <output statement line>
<comment line>          := #<any text>
<substitution line>     := <left_hand_side>=<expression>
<left_hand_side>	:= <output_var>|<temporary_var>
<output_var>		:= w0 | w1 ...   (output field components)
			   y0 | y1 ...   (output field coordinates)
<temporary_var>		:= any valid C variable name (up to 20 chars)
<expression>		:= any valid algebraic expression formed form:
			   <input_vars>,<temporary_vars>,<parameters>,
			   <functions>,<scalars>,
			   <algebraic_operators>,<delimiters>
<input_var>		:= [a0 | a1 ...   (input field 1 components)]
                           ..............
			   [f0 | f1 ...   (input field 2 components)]
			   [x0 | x1 ...   (input field coordinates)]
			    i0 | i1 ...   (output field indexes)
<parameter>		:= p0 | p1 | p2 | p3 | p4 | p5 
<function>		:= <unary field function>|<binary field function>
			   <folding function>|<convolution function>
<unary function>  	:= sin | cos | tan | exp | ln | log | sqr | sqrt | abs 
<binary function> 	:= min | max 
<folding function>	:= fmin | fmax | avg
<convolution function> 	:= cnv
<scalar>		:= any C float
<algebraic_operator>	:= + | - | * | / | ^
<delimiter>		:= ( | )
<structural instruction line> :=while <expression>|end while
<output statement line>	:= flush

AVSSPL admits two types of variables: 
simple variables with values being single float numbers;
field variables with values being float arrays of dimensions
determined by the output field.

Unary function can have arguments of arbitrary type, result has the type 
of the argument. 
	sin(3.14159) is scalar 1,
	sqrt(a0) is the array of square roots of elements of first component
	of infield.

Binary operations and binary functions pmin (pointwise minimum)
and pmax (pointwise maximum) allow for any combination of argument types 
with result being simple if both arguments were simple, and result 
of array type otherwise.
	3^3 is scalar 27, 
	a0*5 is the arrray of values of infield multiplied by 5.

Folding functions return always scalars being maximum, minimum and average
taken over all matrix - respectively.
	avg(a0^3) is average of cubes of first component of infield.

Convolution functions take two field variables as arguments and return
convolution or local (masked) minima or maxima.
    	cnv(a0,f0) is convolution.

The parameters p0,...,p5 can be used both as inputs (e.g. w0=p0*a0+(1-p0)*b0
will evaluate a weighted average of two fields) and as outputs (e.g.
p0=sqrt(avg((a0-avg(a0))^2) will output standard deviation of infield).


while <expr>/ end while pair encloses a series of statements that will be
executed as long as the value of (scalar) expr is non-0.
	while 1   will loop forever 
	.......
	end while

	t0=10
	while t0
	t0=t0-1
	........
	end while  will loop 10 times.

flush statement causes output of <outfield> when all of its components
and co-ordinates are defined.


Examples:

	p0=avg(a0)
	p1=sqrt(avg(sqr(a0-p0)))


evaluates (numerical) laplacian of the field

	!dimensions 50 50
	!min_ext -5 -5
	!max_ext 5 5
	!veclen=2
	w0=0
	p2=0
	while 1
	p2=p2+p0
	u0=p1*cos(p2)
	u1=p1*sin(p2)
	w1=1/(0.3+sqr(y0-u0)+sqr(y1-u1))
	w0=cnv(w0,f0)+w1
	flush
	end while

with f0= [[0 0.25 0][0.25 0 0.25][0 0.25 0]] 
starts a continuous simulation of temperature distribution in 
a square plate heatened by a source rotating at a radius p1
with rotation speed p0.

Programs can be edited with a primitive line editor, saved and loaded.

New fields can be created. The module waits for dimensions
parameter to create outfield.


INPUTS
	infield - field float
	................
	infield6 - field float

PARAMETERS


Output dimensions (typein)
     requires input of the form  dim0 dim1 dim2 ...
     (a list of <ndim> integers separated by blanks);
     together with Output ndim determine dimensionality
     of outfield 

Output veclen (islider)
     determines veclen of the output field

Make points (toggle)
     if on, outfield will be irregular with user-defined 
     point coordinates; otherwise, coordinates of infield
     will be copied to outfield or, if Create field is on,
     an uniform outfield is created

Output space dimension (islider)
     active when Make points is on

variables (textblock)
     output only -- shows the list of all predefined variables
     (input field components and coordinates - when present, 
     indexes and output field components and coordinates - to be
     determined

functions (textblock)
     output only -- shows the list of all available functions

input line (typein)
     currently edited program line

program (choice_browser)
     displays current program

execute (boolean)
     starts/stops parsing and execution of the program

clear (oneshot)
     clears all program (does not clear temporary variables
     and outputs)

reset (oneshot)
     clear temporary variables and outputs

edit (choice_browser)
     Append -- add current input line after the highlighted line
     Insert -- add current input line before the highlighted line
     Edit   -- the highlighted line
     Delete -- the highlighted line

Formula file (browser)
Read formula (oneshot)
Write formula (oneshot)
     control writing/reading of the program to/from disk file;
     program files use .fmla extension and are easily editable

OUTPUTS
outfield - field float
     the module outputs only after all outfield components and 
     coordinates are evaluated
