From fc506a335f736ff2d08f839d3605f5593f7ac50a Mon Sep 17 00:00:00 2001 From: svahl991 Date: Tue, 26 Jan 2021 11:47:25 -0700 Subject: [PATCH 1/3] Add params to mpas_init --- src/driver/mpas_subdriver.F | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/driver/mpas_subdriver.F b/src/driver/mpas_subdriver.F index 2705777a25..caf0ee5170 100644 --- a/src/driver/mpas_subdriver.F +++ b/src/driver/mpas_subdriver.F @@ -39,7 +39,7 @@ module mpas_subdriver contains - subroutine mpas_init(corelist, domain_ptr, mpi_comm) + subroutine mpas_init(corelist, domain_ptr, mpi_comm, namelistFileParam, streamsFileParam) use mpas_stream_manager, only : MPAS_stream_mgr_init, MPAS_build_stream_filename, MPAS_stream_mgr_validate_streams use iso_c_binding, only : c_char, c_loc, c_ptr, c_int @@ -53,6 +53,9 @@ subroutine mpas_init(corelist, domain_ptr, mpi_comm) type (core_type), intent(inout), pointer :: corelist type (domain_type), intent(inout), pointer :: domain_ptr integer, intent(in), optional :: mpi_comm + character(len=StrKIND), intent(in), optional :: namelistFileParam + character(len=StrKIND), intent(in), optional :: streamsFileParam + integer :: iArg, nArgs logical :: readNamelistArg, readStreamsArg @@ -109,6 +112,15 @@ end subroutine xml_stream_get_attributes readNamelistArg = .false. readStreamsArg = .false. + if (present(namelistFileParam)) then + readNamelistArg = .true. + namelistFile = trim(namelistFileParam) + endif + if (present(streamsFileParam)) then + readStreamsArg = .true. + streamsFile = trim(streamsFileParam) + endif + nArgs = command_argument_count() iArg = 1 do while (iArg < nArgs) From ef3efaae0789cf9f808027b68272117e914a6518 Mon Sep 17 00:00:00 2001 From: svahl991 Date: Tue, 26 Jan 2021 15:56:22 -0700 Subject: [PATCH 2/3] Check for empty string --- src/driver/mpas_subdriver.F | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/driver/mpas_subdriver.F b/src/driver/mpas_subdriver.F index caf0ee5170..2f57fcf221 100644 --- a/src/driver/mpas_subdriver.F +++ b/src/driver/mpas_subdriver.F @@ -53,8 +53,8 @@ subroutine mpas_init(corelist, domain_ptr, mpi_comm, namelistFileParam, streamsF type (core_type), intent(inout), pointer :: corelist type (domain_type), intent(inout), pointer :: domain_ptr integer, intent(in), optional :: mpi_comm - character(len=StrKIND), intent(in), optional :: namelistFileParam - character(len=StrKIND), intent(in), optional :: streamsFileParam + character(len=*), intent(in), optional :: namelistFileParam + character(len=*), intent(in), optional :: streamsFileParam integer :: iArg, nArgs @@ -112,11 +112,11 @@ end subroutine xml_stream_get_attributes readNamelistArg = .false. readStreamsArg = .false. - if (present(namelistFileParam)) then + if (present(namelistFileParam) .and. len_trim(namelistFileParam) > 0 ) then readNamelistArg = .true. namelistFile = trim(namelistFileParam) endif - if (present(streamsFileParam)) then + if (present(streamsFileParam) .and. len_trim(streamsFileParam) > 0 ) then readStreamsArg = .true. streamsFile = trim(streamsFileParam) endif From 4387097bbd06e7c37344d2c20e004cfc0ef4dc46 Mon Sep 17 00:00:00 2001 From: svahl991 Date: Thu, 28 Jan 2021 14:58:03 -0700 Subject: [PATCH 3/3] whitespace only --- src/driver/mpas_subdriver.F | 1 - 1 file changed, 1 deletion(-) diff --git a/src/driver/mpas_subdriver.F b/src/driver/mpas_subdriver.F index 2f57fcf221..79a051f347 100644 --- a/src/driver/mpas_subdriver.F +++ b/src/driver/mpas_subdriver.F @@ -56,7 +56,6 @@ subroutine mpas_init(corelist, domain_ptr, mpi_comm, namelistFileParam, streamsF character(len=*), intent(in), optional :: namelistFileParam character(len=*), intent(in), optional :: streamsFileParam - integer :: iArg, nArgs logical :: readNamelistArg, readStreamsArg character(len=StrKIND) :: argument, namelistFile, streamsFile