Skip to content

Commit

Permalink
feat(api): add get_version routine to modflow api (xmi) (MODFLOW-USGS…
Browse files Browse the repository at this point in the history
…#936)

* add get_version routine to modflow api (xmi)
* update xmi get_version
  • Loading branch information
mjr-deltares authored and Hofer-Julian committed Jul 14, 2022
1 parent 121957d commit 7f945d4
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/Utilities/version.f90
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,10 @@ module VersionModule
implicit none
public
! -- modflow 6 version
integer(I4B), parameter :: IDEVELOPMODE = 1
character(len=40), parameter :: VERSION = '6.4.0 release candidate 03/04/2022'
integer(I4B), parameter :: IDEVELOPMODE = 1
character(len=*), parameter :: VERSIONNUMBER = '6.4.0'
character(len=*), parameter :: VERSIONTAG = ' release candidate 03/04/2022'
character(len=40), parameter :: VERSION = VERSIONNUMBER//VERSIONTAG
character(len=10), parameter :: MFVNAM = ' 6'
character(len=*), parameter :: MFTITLE = &
'U.S. GEOLOGICAL SURVEY MODULAR HYDROLOGIC MODEL'
Expand Down
3 changes: 3 additions & 0 deletions srcbmi/mf6bmiUtil.f90
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ module mf6bmiUtil
integer(c_int), bind(C, name="BMI_LENCOMPONENTNAME") :: BMI_LENCOMPONENTNAME = 256 !< component name length, i.e. 'MODFLOW 6'
!DIR$ ATTRIBUTES DLLEXPORT :: BMI_LENCOMPONENTNAME

integer(c_int), bind(C, name="BMI_LENVERSION") :: BMI_LENVERSION = 256 !< length of version string, e.g. '6.3.1' or '6.4.1-dev'
!DIR$ ATTRIBUTES DLLEXPORT :: BMI_LENVERSION

contains

!> @brief Split the variable address string
Expand Down
24 changes: 24 additions & 0 deletions srcbmi/mf6xmi.f90
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,30 @@ function xmi_finalize_solve(subcomponent_idx) result(bmi_status) bind(C, name="f

end function xmi_finalize_solve


!> @brief Get the version string for this component
!<
function xmi_get_version(mf_version) result(bmi_status) bind(C, name="get_version")
!DIR$ ATTRIBUTES DLLEXPORT :: xmi_get_version
! -- modules
use VersionModule, only: VERSIONNUMBER, IDEVELOPMODE
! -- dummy variables
character(kind=c_char), intent(out) :: mf_version(BMI_LENVERSION)
integer(kind=c_int) :: bmi_status !< BMI status code
! -- local variables
character(len=BMI_LENVERSION) :: vstr

if (IDEVELOPMODE == 1) then
vstr = VERSIONNUMBER//'-dev'
else
vstr = VERSIONNUMBER
end if
mf_version = string_to_char_array(vstr, len_trim(vstr))
bmi_status = BMI_SUCCESS

end function xmi_get_version


!> @brief Get the full address string for a variable
!!
!! This routine constructs the full address string of a variable using the
Expand Down

0 comments on commit 7f945d4

Please sign in to comment.