Skip to content

Commit

Permalink
Merge pull request ESMCI#1481 from NCAR/ejh_cleanup_2
Browse files Browse the repository at this point in the history
Cleanup of pio_types.F90
  • Loading branch information
edhartnett authored Jun 9, 2019
2 parents 0bf6599 + e0b1d8a commit 4f814ad
Showing 1 changed file with 19 additions and 84 deletions.
103 changes: 19 additions & 84 deletions src/flib/pio_types.F90
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
!>
!! @file
!! Derived datatypes and constants for PIO Fortran API.
!!
!! @author Jim Edwards
!<
!>
!! @private
Expand Down Expand Up @@ -39,67 +39,43 @@
!! - PIO_real : 4-byte reals
!! - PIO_int : 4-byte integers
!! - PIO_char : character
!<

module pio_types
use pio_kinds
use iso_c_binding
implicit none
private
!-------------------------------------------
! data structure to describe decomposition
!-------------------------------------------
type, public :: DecompMap_t
type, public :: DecompMap_t !< data structure to describe decomposition.
#ifdef SEQUENCE
sequence
#endif
integer(i4) :: start !< start
integer(i4) :: length !< length
end type DecompMap_t

!------------------------------------
! a file descriptor data structure
!------------------------------------
!>
!! @struct iosystem_desc_t
!! @brief A defined PIO system descriptor created by @ref PIO_init (see pio_types)
!<
!! A defined PIO system descriptor created by @ref PIO_init (see
!! pio_types).
type, public :: IOSystem_desc_t
integer(kind=c_int) :: iosysid = -1 !< iosysid
end type IOSystem_desc_t

!>
!! @private
!! @struct io_data_list
!! @brief Linked list of buffers for pnetcdf non-blocking interface
!>
! type, public :: io_data_list
! integer :: request
! real(r4), pointer :: data_real(:) => null()
! integer(i4), pointer :: data_int(:) => null()
! real(r8), pointer :: data_double(:) => null()
! type(io_data_list), pointer :: next => null()
! end type io_data_list


!>
!! @public
!! @struct file_desc_t
!! @brief File descriptor returned by \ref PIO_openfile or \ref PIO_createfile (see pio_types)
!!
!>
!! File descriptor returned by \ref PIO_openfile or \ref
!! PIO_createfile (see pio_types).
type, public :: File_desc_t
integer(kind=c_int) :: fh !< file handle
type(iosystem_desc_t), pointer :: iosystem => null() !< iosystem
end type File_desc_t


!>
!! @public
!! @struct io_desc_t
!! @brief An io descriptor handle that is generated in @ref PIO_initdecomp
!! An decomposition handle that is generated in @ref PIO_initdecomp.
!! (see pio_types)
!<
type, public :: io_desc_t
#ifdef SEQUENCE
sequence
Expand All @@ -110,8 +86,8 @@ module pio_types
!>
!! @public
!! @struct var_desc_t
!! @brief A variable descriptor returned from @ref PIO_def_var (see pio_types)
!<
!! A variable descriptor returned from @ref PIO_def_var (see
!! pio_types).
type, public :: Var_desc_t
#ifdef SEQUENCE
sequence
Expand All @@ -124,7 +100,7 @@ module pio_types
PIO_iotype_pnetcdf = 1, & !< parallel read/write of pNetCDF files
PIO_iotype_netcdf = 2, & !< serial read/write of NetCDF file using 'base_node'
PIO_iotype_netcdf4c = 3, & !< netcdf4 (hdf5 format) file opened for compression (serial write access only)
PIO_iotype_netcdf4p = 4 !< netcdf4 (hdf5 format) file opened in parallel (all netcdf4 files for read will be opened this way)
PIO_iotype_netcdf4p = 4 !< netcdf4 (hdf5 format) file opened in parallel


! These are for backward compatability and should not be used or expanded upon
Expand All @@ -144,35 +120,17 @@ module pio_types

!>
!! @struct use_PIO_kinds
!! @brief The type of variable(s) associated with this iodesc.
!! The type of variable(s) associated with this iodesc.
!! @copydoc PIO_kinds
!<

#ifdef _PNETCDF
#include <pnetcdf.inc> /* _EXTERNAL */
integer, public, parameter :: PIO_global = nf_global !< global atts
integer, public, parameter :: PIO_unlimited = nf_unlimited !< unlimited dimension
integer, public, parameter :: PIO_double = nf_double !< double type
integer, public, parameter :: PIO_real = nf_real !< real type
integer, public, parameter :: PIO_int = nf_int !< int type
integer, public, parameter :: PIO_char = nf_char !< char type
integer, public, parameter :: PIO_noerr = nf_noerr !< no error
integer, public, parameter :: PIO_WRITE = nf_write !< read-write
integer, public, parameter :: PIO_nowrite = nf_nowrite !< read-only
integer, public, parameter :: PIO_CLOBBER = nf_clobber !< clobber existing file
integer, public, parameter :: PIO_NOCLOBBER = nf_NOclobber !< do not clobber existing file
integer, public, parameter :: PIO_NOFILL = nf_nofill !< do not use fill values
integer, public, parameter :: PIO_MAX_NAME = nf_max_name !< max name len
integer, public, parameter :: PIO_MAX_VAR_DIMS = min(6,nf_max_var_dims) !< max dims for a var
integer, public, parameter :: PIO_64BIT_OFFSET = nf_64bit_offset !< 64bit offset format
#include <pnetcdf.inc>
integer, public, parameter :: PIO_64BIT_DATA = nf_64bit_data !< CDF5 format
integer, public, parameter :: PIO_FILL_INT = nf_fill_int; !< int fill value
real, public, parameter :: PIO_FILL_FLOAT = nf_fill_float; !< float fill value
double precision, public, parameter :: PIO_FILL_DOUBLE = nf_fill_double; !< double fill value

#else
#ifdef _NETCDF
#include <netcdf.inc> /* _EXTERNAL */
#include <netcdf.inc>
integer, public, parameter :: PIO_64BIT_DATA = 0 !< CDF5 format
#endif
integer, public, parameter :: PIO_num_OST = 16 !< num ost
integer, public, parameter :: PIO_global = nf_global !< global atts
integer, public, parameter :: PIO_unlimited = nf_unlimited !< unlimited dimension
integer, public, parameter :: PIO_double = nf_double !< double type
Expand All @@ -181,38 +139,16 @@ module pio_types
integer, public, parameter :: PIO_char = nf_char !< char type
integer, public, parameter :: PIO_noerr = nf_noerr !< no error
integer, public, parameter :: PIO_WRITE = nf_write !< read-write
integer, public, parameter :: PIO_nowrite = nf_nowrite !< read-only
integer, public, parameter :: PIO_nowrite = nf_nowrite !< read-only
integer, public, parameter :: PIO_CLOBBER = nf_clobber !< clobber existing file
integer, public, parameter :: PIO_NOCLOBBER = nf_NOclobber !< do not clobber existing file
integer, public, parameter :: PIO_NOFILL = nf_nofill !< do not use fill values
integer, public, parameter :: PIO_MAX_NAME = nf_max_name !< max name len
integer, public, parameter :: PIO_MAX_VAR_DIMS = min(6,nf_max_var_dims) !< max dims for a var
integer, public, parameter :: PIO_64BIT_OFFSET = nf_64bit_offset !< 64bit offset format
integer, public, parameter :: PIO_64BIT_DATA = 0 !< CDF5 format
integer, public, parameter :: PIO_FILL_INT = nf_fill_int; !< int fill value
real, public, parameter :: PIO_FILL_FLOAT = nf_fill_float; !< float fill value
double precision, public, parameter :: PIO_FILL_DOUBLE = nf_fill_double; !< double fill value
#else
integer, public, parameter :: PIO_global = 0 !< global atts
integer, public, parameter :: PIO_double = 6 !< double type
integer, public, parameter :: PIO_real = 5 !< real type
integer, public, parameter :: PIO_int = 4 !< int type
integer, public, parameter :: PIO_char = 2 !< char type
integer, public, parameter :: PIO_noerr = 0 !< no error
integer, public, parameter :: PIO_MAX_NAME = 25 !< max name len
integer, public, parameter :: PIO_MAX_VAR_DIMS = 6 !< max dims for a var
integer, public, parameter :: PIO_CLOBBER = 10 !< clobber existing file
integer, public, parameter :: PIO_NOCLOBBER = 11 !< do not clobber existing file
integer, public, parameter :: PIO_WRITE = 20 !< read-write
integer, public, parameter :: PIO_NOWRITE = 21 !< read-only
integer, public, parameter :: PIO_64BIT_OFFSET = 0 !< 64bit offset format
integer, public, parameter :: PIO_64BIT_DATA = 0 !< CDF5 format
integer, public, parameter :: PIO_FILL_INT = -2147483647; !< int fill value
real, public, parameter :: PIO_FILL_FLOAT = 9.9692099683868690e+36; !< float fill value
double precision, public, parameter :: PIO_FILL_DOUBLE = 9.9692099683868690e+36; !< double fill value
#endif
#endif
integer, public, parameter :: PIO_num_OST = 16 !< num ost

enum, bind(c)
enumerator :: PIO_rearr_comm_p2p = 0
Expand Down Expand Up @@ -243,13 +179,12 @@ module pio_types
!! number of requests use PIO_REARR_COMM_UNLIMITED_PEND_REQ)
!!
!! @defgroup PIO_rearr_options Rearranger Options
!! @brief Type that defines the PIO rearranger options
!! @details
!! Type that defines the PIO rearranger options.
!!
!! - comm_type : @copydoc PIO_rearr_comm_t
!! - fcd : @copydoc PIO_rearr_comm_dir
!! - comm_fc_opts_comp2io : @copydoc PIO_rearr_comm_fc_options
!! - comm_fc_opts_io2comp : @copydoc PIO_rearr_comm_fc_options
!>
enum, bind(c)
enumerator :: PIO_rearr_comm_fc_2d_enable = 0 !< COMM procs to IO procs and vice versa.
enumerator :: PIO_rearr_comm_fc_1d_comp2io !< COMM procs to IO procs only.
Expand Down

0 comments on commit 4f814ad

Please sign in to comment.