Overview and tutorial on the Fortran Application Program Interface (API) to the Data Dictionary System.

INCLUDE FILES

Fortran application programs need to have declaraions for the many DDS API functions and named constants. This is done by include file "fdds.h" or "f90dds.h", or by using the dds module. The DDS application makefiles set up the appropriate include path. When using the ".F" or ".F90" extension, the Fortran preprocessor will determine the path to the include files and modules, allowing a common source file for multiple platforms.

#include "fdds.h"   Use with fixed-format sources.
#include "f90dds.h"   Use with free-format sources.
use dds   A module with most of DDS defined.
Module read/write functions support 1D buffers only.

Strong type checking of API function calls is only available with use dds, but the module does not define interfaces for all the sample types and only understands 1 dimensional I/O buffers.

These header files provide the declarations for all DDS API functions except for fdds_initopenmp and fdds_initmpi. These two should be declared manually when they are needed. Many named constants are also defined by the header files and module. The meaning of these is shown in the following examples:

#include <fdds.h>
      integer ier,i,bin,tag,ndx,rank,size(RANK_MAX)
      character*(PATHNAME_MAX) out_dict, name
      integer out_bin
      real data(*)
      pointer (ptr_data,data)
      ...
      rank=fdds_scank('axis',' ')
      ier=fdds_scanf('size','\0')
      do i=1,rank
         ier=fdds_scanf(' ','%d\0',size(i))
      enddo
      ...
!     enforce array limits when reading
      ier=fdds_scanf(data,'%'//PATHNAME_MAXQ//'s\0',name)
      ...
!     get index to trace header
      tag=fdds_member(bin,0,'SrPtXC')
      ndx=fdds_index(bin,tag,DDS_REAL)
      ptr_data=fdds_malloc(size(1)*SIZEOF_REAL)
      ...
!     open binary output stream
      bin=fdds_open(out_dict,'out_format','out_data','w+')
    

use dds - I/O buffer limitation

Despite the DDS module restriction that I/O buffers must be 1D, some compilers are known to create functional executables when a single trace is passed to the DDS I/O function with a trace count greater than 1. This practice is discouraged because Fortran compilers are allowed to pass copies of array sections when they choose.

      use dds
      integer :: nsmp, ntrc, fd_out
      real, allocatable :: data(:,:)
      ...
      allocate(data(nsmp, ntrc))
      ...
      ! When using #include "*.h" files
      ! ier = fddx_write(fd_out, data, ntrc)

      ! When using the dds module as intended:
      do itrc=1,ntrc
        ier = fddx_write(fd_out, data(:,itrc), 1)
      enddo

      ! A risky multi-trace write when using the dds module
      ier = fddx_write(fd_out, data(:,1), ntrc)
    

FFT wrappers

fft.h (or f90fft.h) provides definitions needed for the fft wrapper routines.

LIBRARY FILES

The DDS application makefiles will setup the appropriate library paths and libraries. libdds3.a contains all the DDS API routines; libgio.a contains the routines for the GIO I/O routines; libfhost.a contains the fortran host-dependent routines.

FILES

$DDSROOT/include/fdds.h          Fixed-format Fortran declarations
$DDSROOT/include/f90dds.h        Free-format Fortran declarations
$DDSROOT/include/fft.h           Fixed-format Fortran FFT interface
$DDSROOT/include/f90fft.h        Free-format Fortran FFT interface
$DDSROOT/src/lib/dds3/dds.F90    Fortran 90 DDS/FFT module

$DDSROOT/lib/$TARCH/libdds3.a    DDS library
$DDSROOT/lib/$TARCH/libgio.a     GIO library
$DDSROOT/lib/$TARCH/libfhost.a   Fortran Host-dependent lib