Skip to content

Commit

Permalink
Merge pull request ESMCI#1563 from NCAR/ejh_ncint_next
Browse files Browse the repository at this point in the history
more work on netcdf fortran pio integration - adding nf_free_iosystem()
  • Loading branch information
edhartnett authored Jul 14, 2019
2 parents 227a81c + cc3d531 commit 94d4b87
Showing 1 changed file with 32 additions and 8 deletions.
40 changes: 32 additions & 8 deletions src/flib/ncint_mod.F90
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
#include "config.h"
!>
!! @file
!! Initialization Routines for PIO.
!! These are the extra functions added to support netCDF
!! integration. In most cases these functions are wrappers for
!! existing PIO_ functions, but with names that start with nf_.
!!
!! @author Ed Hartnett
!<

!>
Expand All @@ -20,12 +23,9 @@ module ncint_mod
!--------------
use pio_support, only : piodie, debug, debugio, debugasync, checkmpireturn
use pio_nf, only : pio_set_log_level
use piolib_mod, only : pio_init
use piolib_mod, only : pio_init, pio_finalize
!

#ifdef TIMING
use perf_mod, only : t_startf, t_stopf ! _EXTERNAL
#endif
#ifndef NO_MPIMOD
use mpi ! _EXTERNAL
#endif
Expand All @@ -36,12 +36,19 @@ module ncint_mod
#endif
! !public member functions:

public :: nf_init_intracom
public :: nf_init_intracom, nf_free_iosystem

interface nf_init_intracom
module procedure nf_init_intracom
end interface nf_init_intracom

!>
!! Shuts down an IOSystem and associated resources.
!<
interface nf_free_iosystem
module procedure nf_free_iosystem
end interface nf_free_iosystem

contains

!>
Expand All @@ -66,7 +73,8 @@ module ncint_mod
!! @param rearr_opts the rearranger options.
!! @author Ed Hartnett
!<
subroutine nf_init_intracom(comp_rank, comp_comm, num_iotasks, num_aggregator, stride, rearr, iosystem,base, rearr_opts)
subroutine nf_init_intracom(comp_rank, comp_comm, num_iotasks, &
num_aggregator, stride, rearr, iosystem, base, rearr_opts)
use pio_types, only : pio_internal_error, pio_rearr_opt_t
use iso_c_binding

Expand All @@ -89,10 +97,26 @@ integer(C_INT) function nc_set_iosystem(iosystemid) &
end function nc_set_iosystem
end interface

call PIO_init(comp_rank, comp_comm, num_iotasks, num_aggregator, stride, rearr, iosystem,base, rearr_opts)
call PIO_init(comp_rank, comp_comm, num_iotasks, num_aggregator, &
stride, rearr, iosystem, base, rearr_opts)

ierr = nc_set_iosystem(iosystem%iosysid)

end subroutine nf_init_intracom

!>
!! @public
!! @ingroup PIO_finalize
!! Finalizes an IO System. This is a collective call.
!!
!! @param iosystem @copydoc io_desc_t
!! @retval ierr @copydoc error_return
!! @author Ed Hartnett
!<
subroutine nf_free_iosystem(iosystem, ierr)
type (iosystem_desc_t), intent(inout) :: iosystem
integer(i4), intent(out) :: ierr
call PIO_finalize(iosystem, ierr)
end subroutine nf_free_iosystem

end module ncint_mod

0 comments on commit 94d4b87

Please sign in to comment.