Skip to content

Commit

Permalink
we need the function after all
Browse files Browse the repository at this point in the history
  • Loading branch information
wpbonelli committed Aug 9, 2024
1 parent 1153883 commit 458510f
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions srcbmi/mf6bmi.f90
Original file line number Diff line number Diff line change
Expand Up @@ -611,7 +611,7 @@ function get_value_string(c_var_address, c_arr_ptr) result(bmi_status) &
call mem_setptr(srcstr, var_name, mem_path)
call get_mem_elem_size(var_name, mem_path, ilen)
call c_f_pointer(c_arr_ptr, tgtstr, shape=[ilen + 1])
tgtstr(1:len(srcstr) + 1) = trim(srcstr)//c_null_char
tgtstr(1:len(srcstr) + 1) = string_to_char_array(trim(srcstr))

else if (rank == 1) then
! an array of strings
Expand All @@ -633,7 +633,7 @@ function get_value_string(c_var_address, c_arr_ptr) result(bmi_status) &
allocate (character(ilen) :: tempstr)
do i = 1, isize
tempstr = srccharstr1d(i)
tgtstr1d(1:ilen + 1, i) = trim(tempstr)//c_null_char
tgtstr1d(1:ilen + 1, i) = string_to_char_array(trim(tempstr))
end do
deallocate (tempstr)
else
Expand Down Expand Up @@ -1171,7 +1171,7 @@ function get_var_type(c_var_address, c_var_type) result(bmi_status) &

call get_mem_type(var_name, mem_path, mem_type)
c_var_type(1:len(trim(mem_type)) + 1) = &
trim(mem_type)//c_null_char
string_to_char_array(trim(mem_type))

if (mem_type == 'UNKNOWN') then
write (bmi_last_error, fmt_general_err) 'unknown memory type'
Expand Down
4 changes: 2 additions & 2 deletions srcbmi/mf6bmiGrid.f90
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
module mf6bmiGrid
use mf6bmiUtil
use mf6bmiError
use iso_c_binding, only: c_double, c_ptr, c_loc, c_null_char
use iso_c_binding, only: c_double, c_ptr, c_loc
use ConstantsModule, only: LENMODELNAME, LENMEMPATH
use KindModule, only: DP, I4B
use MemoryManagerModule, only: mem_setptr
Expand Down Expand Up @@ -81,7 +81,7 @@ function get_grid_type(grid_id, grid_type) result(bmi_status) &
else
return
end if
grid_type = trim(grid_type_f)//c_null_char
grid_type = string_to_char_array(trim(grid_type_f))
bmi_status = BMI_SUCCESS
end function get_grid_type

Expand Down
6 changes: 3 additions & 3 deletions srcbmi/mf6xmi.F90
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ module mf6xmi
use mf6bmiError
use Mf6CoreModule
use KindModule
use iso_c_binding, only: c_int, c_char, c_double, c_null_char
use iso_c_binding, only: c_int, c_char, c_double
implicit none

integer(I4B), pointer :: iterationCounter => null() !< the counter for the outer iteration loop, initialized in xmi_prepare_iteration()
Expand Down Expand Up @@ -357,7 +357,7 @@ function xmi_get_version(mf_version) result(bmi_status) &
else
vstr = VERSIONNUMBER
end if
mf_version = trim(vstr)//c_null_char
mf_version = string_to_char_array(trim(vstr))
bmi_status = BMI_SUCCESS

end function xmi_get_version
Expand Down Expand Up @@ -412,7 +412,7 @@ function get_var_address(c_component_name, c_subcomponent_name, &

! convert to c string:
c_var_address(1:len(trim(mem_address)) + 1) = &
trim(mem_address)//c_null_char
string_to_char_array(trim(mem_address))

bmi_status = BMI_SUCCESS

Expand Down

0 comments on commit 458510f

Please sign in to comment.