Skip to content

Commit

Permalink
Pad config file name in interoperability layer
Browse files Browse the repository at this point in the history
By adding spaces to the config file name in the *bmi_initialize*
in the interoperability layer, the file name is read correctly
in GIPL, without junk appended.

Background on this commit is described in https://github.com/csdms/cookiecutter-bmi-wrap/issues/17.
  • Loading branch information
mdpiper committed Aug 1, 2019
1 parent 494d98c commit bbc84fe
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion pymt_gipl/lib/bmi_interoperability.f90
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,18 @@ function bmi_initialize(model_index, config_file, n) &
integer (c_int), intent(in), value :: n
character (len=1, kind=c_char), intent(in) :: config_file(n)
integer (c_int) :: i, status
character (len=n, kind=c_char) :: config_file_
character (len=BMI_MAX_VAR_NAME, kind=c_char) :: config_file_

! Convert `config_file` from rank-1 array to scalar.
do i = 1, n
config_file_(i:i) = config_file(i)
enddo

! Pad with spaces to max size.
do i = n+1, BMI_MAX_VAR_NAME
config_file_(i:i) = ' '
enddo

status = model_array(model_index)%initialize(config_file_)
end function bmi_initialize

Expand Down

0 comments on commit bbc84fe

Please sign in to comment.