Skip to content

Commit

Permalink
Merge pull request ESMCI#1565 from NCAR/ejh_fncint_more
Browse files Browse the repository at this point in the history
converted nf_ procedures into functions
  • Loading branch information
edhartnett authored Jul 14, 2019
2 parents c8e5381 + f1a3fe7 commit 9566912
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 19 deletions.
24 changes: 7 additions & 17 deletions src/flib/ncint_mod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -34,21 +34,9 @@ module ncint_mod
#ifdef NO_MPIMOD
include 'mpif.h' ! _EXTERNAL
#endif
! !public member functions:

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 @@ -73,8 +61,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)
function nf_init_intracom(comp_rank, comp_comm, num_iotasks, &
num_aggregator, stride, rearr, iosystem, base, rearr_opts) result(ierr)
use pio_types, only : pio_internal_error, pio_rearr_opt_t
use iso_c_binding

Expand Down Expand Up @@ -102,7 +90,7 @@ end function nc_set_iosystem

ierr = nc_set_iosystem(iosystem%iosysid)

end subroutine nf_init_intracom
end function nf_init_intracom

!>
!! @public
Expand All @@ -113,9 +101,10 @@ end subroutine nf_init_intracom
!! @retval ierr @copydoc error_return
!! @author Ed Hartnett
!<
subroutine nf_free_iosystem()
function nf_free_iosystem() result(status)
integer(i4) :: ierr
integer(i4) :: iosysid;
integer :: status

interface
integer(C_INT) function nc_get_iosystem(iosysid) &
Expand All @@ -135,6 +124,7 @@ end function PIOc_finalize

ierr = nc_get_iosystem(iosysid)
ierr = PIOc_finalize(iosysid)
end subroutine nf_free_iosystem
status = ierr
end function nf_free_iosystem

end module ncint_mod
4 changes: 2 additions & 2 deletions tests/fncint/ftst_pio.f90
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@ program ftst_pio

ierr = pio_set_log_level(2)
ierr = nf_set_log_level(2)
call nf_init_intracom(myRank, MPI_COMM_WORLD, niotasks, numAggregator, &
ierr = nf_init_intracom(myRank, MPI_COMM_WORLD, niotasks, numAggregator, &
stride, PIO_rearr_subset, ioSystem, base)

ierr = nf_create(FILE_NAME, 64, ncid)
ierr = nf_close(ncid)

call nf_free_iosystem()
ierr = nf_free_iosystem()
call MPI_Finalize(ierr)
if (myRank .eq. 0) then
print *, '*** SUCCESS running ftst_pio!'
Expand Down

0 comments on commit 9566912

Please sign in to comment.