next up previous print clean
Next: Parameter handling Up: Fomel: ``SEP'' module Previous: Introduction

Using the module

To use the sep module, simply put
use sep
in your program. All operations with parameter and header files should be enclosed in two subroutine calls:
call sep_init ()
and
call sep_close ()
Essentially, sep_init sep_init initialize header and parameter interface just calls initpar, and sep_close sep_close close header interface calls hclose, but the new names make them look more like a constructor-destructor pair, typical for the object-based style of programming. The calls to data access functions (sep_read and sep_write), described below, can be placed anywhere in the program.

My typical main-program style is

1.
get parameters
2.
allocate storage
3.
read the input
4.
do processing (sometimes by using other modules)
5.
write the output
6.
free storage
Sometimes it is more convenient to do it in a different order (for example, when some of your parameters are defined in the processing step).

An example main program is Clip [*]. Next sections explain the function interface used in this example.

 

program Clip
  use sep

implicit none integer :: n1, n2, i2 real :: c real, dimension (:), allocatable :: data

call sep_init() call from_history (n1,n2,compress=.true.) call from_par ("clip", c) call sep_close ()

allocate (data (n1)) do i2 = 1, n2 call sep_read (data) where (data > c) data = c call sep_write (data) end do deallocate (data)

call exit (0) end program Clip


next up previous print clean
Next: Parameter handling Up: Fomel: ``SEP'' module Previous: Introduction
Stanford Exploration Project
2/3/1998