Back to OASIS4 home


Modules of MPP_IO with their different routines

Structure :
module mod_kinds_mpp then module mpp_mod_oa then module mpp_domains_mod_oa and then module mpp_io_mod_oa

This modules contains the parameters defining the precision used for real and integer variables
use mod_kinds_mpp

type, private :: communicator
     character(len=32) :: name
     integer, pointer :: list(:)
     integer :: count
#ifdef use_libSMA
     integer :: start, log2stride
#elif use_libMPI
     integer :: id, group    !MPI communicator and group id for this PE set
#endif
end type
type, private :: event
     character(len=16)  :: name
     integer(LONG_KIND) :: ticks(MAX_EVENTS), bytes(MAX_EVENTS)
     integer            :: calls
end type event
type, private :: clock
     character(len=32) :: name
#if defined(__sgi) || defined(use_libMPI)
     integer(LONG_KIND) :: tick
#else
     integer :: tick
#endif
     integer(LONG_KIND) :: total_ticks
     integer :: peset_num
     logical :: sync_on_begin, detailed
     type(event), pointer :: events(:) !if needed, allocate to MAX_EVENT_TYPES
end type
TYPE :: Clock_Data_Summary
    character(len=16) :: name
    real(DOUBLE_KIND) :: msg_size_sums(MAX_BINS)
    real(DOUBLE_KIND) :: msg_time_sums(MAX_BINS)
    real(DOUBLE_KIND) :: total_data
    real(DOUBLE_KIND) :: total_time
    integer(LONG_KIND) :: msg_size_cnts(MAX_BINS)
    integer(LONG_KIND) :: total_cnts
END TYPE Clock_Data_Summary
TYPE :: Summary_Struct
    character(len=16)         :: name
    type (Clock_Data_Summary) :: event(MAX_EVENT_TYPES)
END TYPE Summary_Struct

subroutine mpp_init( flags,mpp_comm ,logfile)
function stdin()
function stdout()
function stderr()
function stdlog()
subroutine mpp_exit()
function mpp_pe()
function mpp_node()
function mpp_npes()
function mpp_root_pe()
subroutine mpp_set_root_pe(num)
subroutine mpp_declare_pelist( pelist, name )
subroutine mpp_set_current_pelist( pelist )
subroutine mpp_get_current_pelist( pelist, name )
function get_peset(pelist)
=> recursive function ascend_sort(a) result(a_sort)

subroutine mpp_clock_set_grain( grain )
function mpp_clock_id( name, flags, grain )
subroutine mpp_clock_begin(id)
subroutine mpp_clock_end(id)
subroutine increment_current_clock( event_id, bytes )
subroutine dump_clock_summary()
integer function get_unit()
subroutine sum_clock_data()
=> integer function find_bin(event_size)
subroutine clock_init(id,name,flags)
subroutine system_clock_mpi( count, count_rate, count_max )
subroutine mpp_sync( pelist )
subroutine mpp_sync_self( pelist )

subroutine mpp_error_basic( errortype, errormsg )
subroutine mpp_error_mesg( routine, errormsg, errortype )
subroutine mpp_error_noargs()
subroutine mpp_set_warn_level(flag)
function mpp_error_state()
subroutine mpp_set_stack_size(n)

use mod_kinds_mpp
use mpp_mod_oa

type, public :: domain_axis_spec        !type used to specify index limits along an axis of a domain
     private
     integer :: begin, end, size, max_size      !start, end of domain axis, size, max size in set
     logical :: is_global       !TRUE if domain axis extent covers global domain
end type domain_axis_spec
type, public :: domain1D
     private
     type(domain_axis_spec) :: compute, data, global
     logical :: cyclic
     type(domain1D), pointer :: list(:)
     integer :: pe              !PE to which this domain is assigned
     integer :: pos             !position of this PE within link list, i.e domain%list(pos)%pe = pe
end type domain1D
type, private :: rectangle
     integer :: is, ie, js, je
     logical :: overlap, folded
end type rectangle
type, public :: domain2D
     private
     type(domain1D) :: x
     type(domain1D) :: y
     type(domain2D), pointer :: list(:)
     integer :: pe              !PE to which this domain is assigned
     integer :: pos             !position of this PE within link list, i.e domain%list(pos)%pe = pe
     integer :: fold, gridtype
     logical :: overlap
     type(rectangle) :: recv_e, recv_se, recv_s, recv_sw, &
                        recv_w, recv_nw, recv_n, recv_ne
     type(rectangle) :: send_e, send_se, send_s, send_sw, &
                        send_w, send_nw, send_n, send_ne
     logical :: remote_domains_initialized
     type(rectangle) :: recv_e_off, recv_se_off, recv_s_off, recv_sw_off, &
                        recv_w_off, recv_nw_off, recv_n_off, recv_ne_off
     type(rectangle) :: send_e_off, send_se_off, send_s_off, send_sw_off, &
                        send_w_off, send_nw_off, send_n_off, send_ne_off
     logical :: remote_off_domains_initialized
end type domain2D

subroutine mpp_domains_init(flags)
subroutine mpp_domains_set_stack_size(n)
subroutine mpp_domains_exit()
function mpp_domain1D_eq( a, b )
function mpp_domain1D_ne( a, b )
function mpp_domain2D_eq( a, b )
function mpp_domain2D_ne( a, b )
subroutine mpp_copy_domains1D(domain_in, domain_out, halo)
subroutine mpp_copy_domains2D(domain_in, domain_out, xhalo, yhalo)
subroutine mpp_define_domains1D( global_indices, ndivs, domain, pelist, flags, halo, extent, maskmap,offset)
=> function if_overlap( hs, he, cs, ce, os, oe )
subroutine mpp_define_domains2D( global_indices, layout, domain, pelist, xflags, yflags, xhalo, yhalo, xextent, yextent, maskmap,offsetx,offsety, name )
subroutine mpp_broadcast_domain( domain )
subroutine compute_overlaps( domain )
subroutine mpp_define_layout2D( global_indices, ndivs, layout )
subroutine mpp_get_compute_domain1D( domain, begin, end, size, max_size, is_global )
subroutine mpp_get_data_domain1D( domain, begin, end, size, max_size, is_global )
subroutine mpp_get_global_domain1D( domain, begin, end, size, max_size )
subroutine mpp_get_compute_domain2D( domain, xbegin, xend, ybegin, yend, xsize, xmax_size, ysize, ymax_size, x_is_global, y_is_global )
subroutine mpp_get_data_domain2D( domain, xbegin, xend, ybegin, yend, xsize, xmax_size, ysize, ymax_size, x_is_global, y_is_global )
subroutine mpp_get_global_domain2D( domain, xbegin, xend, ybegin, yend, xsize, xmax_size, ysize, ymax_size )
subroutine mpp_get_domain_components( domain, x, y )
subroutine mpp_get_compute_domains1D( domain, begin, end, size )
subroutine mpp_get_compute_domains2D( domain, xbegin, xend, xsize, ybegin, yend, ysize )
subroutine mpp_get_pelist1D( domain, pelist, pos )
subroutine mpp_get_pelist2D( domain, pelist, pos )
subroutine mpp_get_layout1D( domain, layout )
subroutine mpp_get_layout2D( domain, layout )
PARNETCDF : librairie netcdf parallele

use mod_kinds_mpp
use mpp_mod_oa
use mpp_domains_mod_oa

type, public :: axistype
     private
     character(len=128) :: name
     character(len=128) :: units
     character(len=256) :: longname
     character(len=8) :: cartesian
     integer :: sense, len           !+/-1, depth or height?
     type(domain1D) :: domain !if pointer is associated, it is a distributed data axis
     real, pointer :: data(:)   !axis values (not used if time axis)
     character(len=64), pointer :: cdata(:)  !RV,bundles
     integer :: clenid                       !RV,bundles
     integer :: id, did, type, natt         !id is the "variable ID", did is the "dimension ID": netCDF requires 2 IDs for axes
     type(atttype), pointer :: Att(:)
end type axistype
type, public :: atttype
     integer :: type, len
     character(len=128) :: name
     character(len=256) :: catt
! just use type conversion for integers
     real, pointer :: fatt(:)
end type atttype
type, public :: fieldtype
     private
     character(len=128) :: name
     character(len=128) :: units
     character(len=256) :: longname
     real :: min, max, missing, fill, scale, add
     integer :: pack
     type(axistype), pointer :: axes(:) !axes associated with field
!size, time_axis_index redundantly hold info already contained in axes
!it's clunky and inelegant, but required so that axes can be shared among multiple files
     integer, pointer :: size(:)
     integer :: time_axis_index
     integer :: id, type, natt, ndim
     type(atttype), pointer :: Att(:)
end type fieldtype
type, private :: filetype
     character(len=256) :: name
     integer :: action, format, access, threading, fileset, record, ncid
     logical :: opened, initialized, nohdrs
     integer :: time_level
     real(DOUBLE_KIND) :: time
     integer :: id             !variable ID of time axis associated with file (only one time axis per file)
     integer :: recdimid             !dim ID of time axis associated with file (only one time axis per file)
! time axis values are stored here instead of axis%data since mpp_write
! assumes these values are not time values. Not used in mpp_write
     real(DOUBLE_KIND), pointer :: time_values(:)
! additional elements of filetype for mpp_read (ignored for mpp_write)
     integer :: ndim, nvar, natt  ! number of dimensions, non-dimension variables and global attributes
! redundant axis types stored here and in associated fieldtype
! some axes are not used by any fields, i.e. "edges"
     type(axistype), pointer  :: axis(:)
     type(fieldtype), pointer :: var(:)
     type(atttype), pointer   :: att(:)
end type filetype

subroutine mpp_io_init( flags, maxunit,maxresunit )
subroutine mpp_io_exit()
subroutine mpp_io_set_stack_size(n)
subroutine mpp_open( unit, file, action, form, access, threading, fileset, iospec, nohdrs, recl, pelist )
subroutine mpp_close( unit, action )
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!  MPP_WRITE_META
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
subroutine mpp_write_meta_global( unit, name, rval, ival, cval, pack )
subroutine mpp_write_meta_global_scalar_r( unit, name, rval, pack )
subroutine mpp_write_meta_global_scalar_i( unit, name, ival )
subroutine mpp_write_meta_var( unit, id, name, rval, ival, cval, pack )
subroutine mpp_write_meta_scalar_r( unit, id, name, rval, pack )
subroutine mpp_write_meta_scalar_i( unit, id, name, ival )
subroutine mpp_write_meta_axis( unit, axis, name, units, longname, cartesian, sense, domain, data, cdata) !RV,bundles
subroutine mpp_write_meta_field( unit, field, axes, name, units, longname, min, max, missing, fill, scale, add, pack )
subroutine write_attribute( unit, name, rval, ival, cval, pack ) !called to write metadata for non-netCDF I/O
subroutine write_attribute_netcdf( unit, id, name, rval, ival, cval, pack ) !called to write metadata for netCDF I/O
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!  MPP_WRITE
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
subroutine mpp_write_axis( unit, axis )
subroutine write_record_c( unit, field, nwords, cdata, time_in, domain ) !!RV,bundles
subroutine write_record_b( unit, field, nwords, data, time_in, domain,block_id )
subroutine write_record( unit, field, nwords, data, time_in, domain ) !routine that is finally called by all mpp_write routines to perform the write
subroutine mpp_copy_meta_global( unit, gatt )
subroutine mpp_copy_meta_axis( unit, axis, domain )
subroutine mpp_copy_meta_field( unit, field, axes )
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!  MPP_READ
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
subroutine read_record( unit, field, nwords, data, time_level, domain )
subroutine read_record_b(unit,field,nwords,data,time_level,domain,block_id)
subroutine mpp_read_r4D( unit, field, data, tindex,blockid)
subroutine mpp_read_r3D( unit, field, data, tindex,blockid)
subroutine mpp_read_r2D( unit, field, data, tindex )
subroutine mpp_read_r1D( unit, field, data, tindex )
subroutine mpp_read_r0D( unit, field, data, tindex )
subroutine mpp_read_meta(unit)
subroutine mpp_get_info( unit, ndim, nvar, natt, ntime )
subroutine mpp_get_global_atts( unit, global_atts )
subroutine mpp_get_field_atts( field, name, units, longname, min, max, missing, ndim, siz, axes, atts )
subroutine mpp_get_axis_atts( axis, name, units, longname, cartesian, sense, len, natts, atts )
subroutine mpp_get_fields( unit, variables )
subroutine mpp_get_axes( unit, axes, time_axis )
subroutine mpp_get_times( unit, time_values )
function mpp_get_field_index(fields,fieldname)
function mpp_get_field_size(field)
subroutine mpp_get_axis_data( axis, data )
function mpp_get_recdimid(unit)

subroutine mpp_flush(unit)
subroutine mpp_get_iospec( unit, iospec )

function mpp_get_ncid(unit) ! netCDF-specific routines
function mpp_get_axis_id(axis) ! netCDF-specific routines
function mpp_get_field_id(field) ! netCDF-specific routines
subroutine netcdf_err(err) ! netCDF-specific routines

subroutine mpp_get_unit_range( unit_begin_out, unit_end_out )
subroutine mpp_set_unit_range( unit_begin_in, unit_end_in )
subroutine mpp_modify_axis_meta( axis, name, units, longname, cartesian, data )
subroutine mpp_modify_field_meta( field, name, units, longname, min, max, missing, axes )
function lowercase (cs)
subroutine mpp_nullify_axistype(axis)
subroutine mpp_nullify_axistype_array(axis)