next up previous print clean
Next: References Up: RATional FORtran == Ratfor90 Previous: Memory allocation in subroutines

The main program environment

Ratfor90 includes some traditional SEP local-memory-allocation and data-base-I/O statements that are described below. It calls an essential seplib initialization routine initpar(), organizes the self-doc, and simplifies data-cube input. The basic syntax for memory allocation is allocate: real x(n1,n2). Ratfor90 translates this syntax into a call to dynamically allocate a allocatable array. See the on-line self-documentation or the manual pages for full details. Following is a complete Ratfor program for a simple task:

# <in.H  Scale scaleval=1. > out.H
#
#	Copy input to output and scale by scaleval
# keyword generic scale
#%
integer n1, n2, n3, esize
from history:	integer n1, n2, n3, esize
if (esize !=4)	call erexit('esize != 4')
allocate:	real x(n1,n2)

subroutine scaleit( n1,n2, x)
integer	i1,i2, n1,n2
real	x(n1,n2), scaleval
from par:	real scaleval=1.
call hclose()			# no more parameter handling.
call sreed('in', x, 4*n1*n2)
do i1=1,n1
        do i2=1,n2
                x(i1,i2) = x(i1,i2) * scaleval
call srite( 'out', x, 4*n1*n2) 
return;        end


next up previous print clean
Next: References Up: RATional FORtran == Ratfor90 Previous: Memory allocation in subroutines
Stanford Exploration Project
2/27/1998