next up previous
Next: Expressions Up: Program Structure Previous: Loop Driver

Updates

 

Update declarations can take many forms. Here are some examples:

auto update phi,pi,beta

stub evolver updates A,B,C 
  header A, B[Bnp1,Bn,Bnm1], C[C], x,y,z,dt,auto work#0(5*Nx*Ny*Nz),
         static work#1(3*Nx*Ny-.5*Nz)

myroutine.inc myupdate update A,B header A,B,dt

The first form defines an automatic update. The declaration above would cause the compiler to produce a routine to update the grid functions phi, pi, and beta if residuals have been declared for them. Otherwise, the compiler has no idea how to update the grid functions and will produce an error message.

The second declaration will cause the compiler to produce the header for a routine called evolver which is expected to update grid functions A, B, and C. The body of the routine is left blank, to be filled in by the user. Following the reserved word header, comes a list of things to appear in the calling sequence for the function. A grid function name such as A above will cause all the time levels of A to be passed to the function. If A has three time levels (1,0,-1), then they will be named A_np1, A_n, and A_nm1 by default. The user can provide his own names to override the defaults as in the case of B. If only one name is provided (as for C), the time levels will be passed in as the elements of a single vector, the first component of which will be the advanced time level.

Other things that can appear in the header list are coordinates (such as x,y,z above) and coordinate differentials (such as dt). Parameters can also be included in the list. Work arrays are declared like the final two parameters. First comes auto or static. Static work arrays are declared at the start of the program and persist throughout. Auto work arrays are allocated before the call to the update routine and are destroyed afterwards. Next comes the word work followed by the # symbol and an integer. This integer is tacked onto the end of the word work to form the name of the array. Finally comes an expression for the size of the work array enclosed in parentheses.



next up previous
Next: Expressions Up: Program Structure Previous: Loop Driver



Robert Marsa
Thu Jun 1 09:34:30 CDT 1995