Skip to content
This repository was archived by the owner on Aug 28, 2024. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
Made user subroutine interfaces explicit in the submodule
  • Loading branch information
daminton committed May 25, 2021
1 parent 5004848 commit 3277b18
Show file tree
Hide file tree
Showing 5 changed files with 260 additions and 222 deletions.
12 changes: 8 additions & 4 deletions src/user/user_dump_param.f90
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
submodule(user) s_user_dump_param
contains
module procedure user_dump_param
module subroutine user_dump_param(param,t)
!! author: David A. Minton
!!
!! Dump integration parameters to file
!!
!! Adapted from David E. Kaufmann's Swifter routine io_dump_param.f90
!! Adapted from Martin Duncan's Swift routine io_dump_param.f
use swiftest
use module_interfaces
use swiftest, except_this_one => user_dump_param
implicit none

! Arguments
class(user_input_parameters),intent(in) :: param !! Output collection of user-defined parameters
real(DP),intent(in) :: t !! Current simulation tim

! Internals
type(user_input_parameters) :: param_dump !! Data type of dumped parameter file
integer(I4B), parameter :: LUN = 7 !! Unit number of output file
integer(I4B) :: ierr !! Error code
Expand Down Expand Up @@ -44,5 +48,5 @@

return

end procedure user_dump_param
end subroutine user_dump_param
end submodule s_user_dump_param
15 changes: 11 additions & 4 deletions src/user/user_get_token.f90
Original file line number Diff line number Diff line change
@@ -1,16 +1,23 @@
submodule(user) s_user_get_token
contains
module procedure user_get_token
module function user_get_token(buffer, ifirst, ilast, ierr) result(token)
!! author: David A. Minton
!!
!! Retrieves a character token from an input string. Here a token is defined as any set of contiguous non-blank characters not
!! beginning with or containing "!". If "!" is present, any remaining part of the buffer including the "!" is ignored
!!
!! Adapted from David E. Kaufmann's Swifter routine user_get_token.f90
use swiftest
use module_interfaces
use swiftest, except_this_one => user_get_token
implicit none

! Arguments
character(len=*), intent(in) :: buffer !! Input string buffer
integer(I4B), intent(inout) :: ifirst !! Index of the buffer at which to start the search for a token
integer(I4B), intent(out) :: ilast !! Index of the buffer at the end of the returned token
integer(I4B), intent(out) :: ierr !! Error code
character(len=:),allocatable :: token !! Returned token stringn

! Internals
integer(I4B) :: i,ilength

ilength = len(buffer)
Expand Down Expand Up @@ -42,5 +49,5 @@

return

end procedure user_get_token
end function user_get_token
end submodule s_user_get_token
13 changes: 8 additions & 5 deletions src/user/user_read_param_in.f90
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@
submodule (user) s_user_read_param_in
contains
module procedure user_read_param_in
module subroutine user_read_param_in(param,inparfile)
!! author: The Purdue Swiftest Team - David A. Minton, Carlisle A. Wishard, Jennifer L.L. Pouplin, and Jacob R. Elliott
!!
!! Read in parameters for the integration
!!
!! Adapted from David E. Kaufmann's Swifter routine io_init_param.f90
!! Adapted from Martin Duncan's Swift routine io_init_param.f
!$ use omp_lib
!use util, only: util_exit ! IMPLEMENTATION TBD
use swiftest
use module_interfaces
use swiftest, except_this_one => user_read_param_in
implicit none

! Arguments
class(user_input_parameters),intent(out) :: param !! Input collection of user-defined parameters
character(*), intent(in) :: inparfile !! Parameter input file name (i.e. param.in)

! Internals
integer(I4B), parameter :: LUN = 7 !! Unit number of input file
integer(I4B) :: ierr = 0 !! Input error code
character(STRMAX) :: error_message !! Error message in UDIO procedure
Expand Down Expand Up @@ -113,6 +116,6 @@

return

end procedure user_read_param_in
end subroutine user_read_param_in

end submodule s_user_read_param_in
Loading

0 comments on commit 3277b18

Please sign in to comment.