Commit a4417db1 authored by Karsten Bolding's avatar Karsten Bolding
Browse files

git version information through pyfabm.get_version()

parent 51ca1499
...@@ -109,6 +109,10 @@ fabm.check_ready.restype = None ...@@ -109,6 +109,10 @@ fabm.check_ready.restype = None
fabm.get_rates.argtypes = [numpy.ctypeslib.ndpointer(dtype=ctypes.c_double, ndim=1, flags='CONTIGUOUS')] fabm.get_rates.argtypes = [numpy.ctypeslib.ndpointer(dtype=ctypes.c_double, ndim=1, flags='CONTIGUOUS')]
fabm.get_rates.restype = None fabm.get_rates.restype = None
# Routine for getting git repository version information.
fabm.get_version.argtypes = (ctypes.c_int,ctypes.c_char_p)
fabm.get_version.restype = None
BULK_STATE_VARIABLE = 1 BULK_STATE_VARIABLE = 1
SURFACE_STATE_VARIABLE = 2 SURFACE_STATE_VARIABLE = 2
BOTTOM_STATE_VARIABLE = 3 BOTTOM_STATE_VARIABLE = 3
...@@ -536,3 +540,10 @@ class Model(object): ...@@ -536,3 +540,10 @@ class Model(object):
printArray('external variables',self.dependencies) printArray('external variables',self.dependencies)
print ' %i parameters:' % len(self.parameters) print ' %i parameters:' % len(self.parameters)
printTree(self.getParameterTree(),lambda x:'%s %s' % (x.value,x.units),' ') printTree(self.getParameterTree(),lambda x:'%s %s' % (x.value,x.units),' ')
def get_version():
version_length = 256
strversion = ctypes.create_string_buffer(version_length)
fabm.get_version(version_length,strversion)
return strversion.value
...@@ -53,6 +53,18 @@ ...@@ -53,6 +53,18 @@
contains contains
subroutine get_version(length,version_string) bind(c)
!DIR$ ATTRIBUTES DLLEXPORT :: get_version
use fabm_version, only: fabm_commit_id=>git_commit_id, &
fabm_branch_name=>git_branch_name
integer(c_int),value,intent(in) :: length
character(kind=c_char) :: version_string(length)
call copy_to_c_string(fabm_commit_id//' ('//fabm_branch_name//' branch)', version_string)
end subroutine get_version
!----------------------------------------------------------------------- !-----------------------------------------------------------------------
!BOP !BOP
! !
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment