Commit a3af0864 authored by Jorn Bruggeman's avatar Jorn Bruggeman
Browse files

cleaned up c interface

parent b9af1d46
......@@ -27,20 +27,36 @@ else:
# Load FABM library.
fabm = ctypes.CDLL(dllpath)
# Specify arguments and return types for FABM interfaces.
# Initialization
fabm.initialize.argtypes = [ctypes.c_char_p]
fabm.get_variable_counts.argtypes = [ctypes.POINTER(ctypes.c_int),ctypes.POINTER(ctypes.c_int),ctypes.POINTER(ctypes.c_int),ctypes.POINTER(ctypes.c_int),ctypes.POINTER(ctypes.c_int),ctypes.POINTER(ctypes.c_int),ctypes.POINTER(ctypes.c_int),ctypes.POINTER(ctypes.c_int),ctypes.POINTER(ctypes.c_int)]
# Access to model objects (variables, parameters, dependencies, couplings, model instances)
fabm.get_counts.argtypes = [ctypes.POINTER(ctypes.c_int),ctypes.POINTER(ctypes.c_int),ctypes.POINTER(ctypes.c_int),ctypes.POINTER(ctypes.c_int),ctypes.POINTER(ctypes.c_int),ctypes.POINTER(ctypes.c_int),ctypes.POINTER(ctypes.c_int),ctypes.POINTER(ctypes.c_int),ctypes.POINTER(ctypes.c_int)]
fabm.get_counts.restype = None
fabm.get_variable_metadata.argtypes = [ctypes.c_int,ctypes.c_int,ctypes.c_int,ctypes.c_char_p,ctypes.c_char_p,ctypes.c_char_p,ctypes.c_char_p]
fabm.get_variable_ptr.argtypes = [ctypes.c_int,ctypes.c_int]
fabm.get_variable_ptr.restype = ctypes.c_void_p
fabm.get_variable_metadata_ptr.argtypes = [ctypes.c_void_p,ctypes.c_int,ctypes.c_char_p,ctypes.c_char_p,ctypes.c_char_p]
fabm.get_variable_background_value.argtypes = [ctypes.c_void_p]
fabm.get_variable_background_value.restype = ctypes.c_double
fabm.get_variable_long_path.argtypes = [ctypes.c_void_p,ctypes.c_int,ctypes.c_char_p]
fabm.get_variable_metadata.restype = None
fabm.get_variable.argtypes = [ctypes.c_int,ctypes.c_int]
fabm.get_variable.restype = ctypes.c_void_p
fabm.get_parameter_metadata.argtypes = [ctypes.c_int,ctypes.c_int,ctypes.c_char_p,ctypes.c_char_p,ctypes.c_char_p,ctypes.POINTER(ctypes.c_int),ctypes.POINTER(ctypes.c_int)]
fabm.get_parameter_metadata.restype = None
fabm.get_dependency_metadata.argtypes = [ctypes.c_int,ctypes.c_int,ctypes.c_char_p,ctypes.c_char_p]
fabm.get_dependency_metadata.restype = None
fabm.get_model_metadata.argtypes = [ctypes.c_char_p,ctypes.c_int,ctypes.c_char_p,ctypes.POINTER(ctypes.c_int)]
fabm.get_model_metadata.restype = None
fabm.get_coupling.argtypes = [ctypes.c_int,ctypes.POINTER(ctypes.c_void_p),ctypes.POINTER(ctypes.c_void_p)]
fabm.get_coupling.restype = None
# Read access to variable attributes
fabm.variable_get_metadata.argtypes = [ctypes.c_void_p,ctypes.c_int,ctypes.c_char_p,ctypes.c_char_p,ctypes.c_char_p]
fabm.variable_get_metadata.restype = None
fabm.variable_get_background_value.argtypes = [ctypes.c_void_p]
fabm.variable_get_background_value.restype = ctypes.c_double
fabm.variable_get_long_path.argtypes = [ctypes.c_void_p,ctypes.c_int,ctypes.c_char_p]
fabm.variable_get_long_path.restype = None
fabm.variable_get_suitable_masters.argtypes = [ctypes.c_void_p]
fabm.variable_get_suitable_masters.restype = ctypes.c_void_p
# Read/write/reset access to parameters.
fabm.get_real_parameter.argtypes = [ctypes.c_int,ctypes.c_int]
fabm.get_real_parameter.restype = ctypes.c_double
fabm.get_integer_parameter.argtypes = [ctypes.c_int,ctypes.c_int]
......@@ -48,25 +64,45 @@ fabm.get_integer_parameter.restype = ctypes.c_int
fabm.get_logical_parameter.argtypes = [ctypes.c_int,ctypes.c_int]
fabm.get_logical_parameter.restype = ctypes.c_int
fabm.get_string_parameter.argtypes = [ctypes.c_int,ctypes.c_int,ctypes.c_int,ctypes.c_char_p]
fabm.get_string_parameter.restype = None
fabm.reset_parameter.argtypes = [ctypes.c_int]
fabm.reset_parameter.restype = None
fabm.set_real_parameter.argtypes = [ctypes.c_char_p,ctypes.c_double]
fabm.set_real_parameter.restype = None
fabm.set_integer_parameter.argtypes = [ctypes.c_char_p,ctypes.c_int]
fabm.set_integer_parameter.restype = None
fabm.set_logical_parameter.argtypes = [ctypes.c_char_p,ctypes.c_int]
fabm.set_logical_parameter.restype = None
fabm.set_string_parameter.argtypes = [ctypes.c_char_p,ctypes.c_char_p]
fabm.set_string_parameter.restype = None
# Read access to lists of variables (e.g., suitable coupling targets).
fabm.link_list_count.argtypes = [ctypes.c_void_p]
fabm.link_list_count.restype = ctypes.c_int
fabm.link_list_index.argtypes = [ctypes.c_void_p,ctypes.c_int]
fabm.link_list_index.restype = ctypes.c_void_p
fabm.link_list_finalize.argtypes = [ctypes.c_void_p]
fabm.link_list_finalize.restype = None
# Routines for sending pointers to state and dependency data.
fabm.link_bulk_state_data.argtypes = [ctypes.c_int,ctypes.POINTER(ctypes.c_double)]
fabm.link_bulk_state_data.restype = None
fabm.link_surface_state_data.argtypes = [ctypes.c_int,ctypes.POINTER(ctypes.c_double)]
fabm.link_surface_state_data.restype = None
fabm.link_bottom_state_data.argtypes = [ctypes.c_int,ctypes.POINTER(ctypes.c_double)]
fabm.link_bottom_state_data.restype = None
fabm.link_dependency_data.argtypes = [ctypes.c_int,ctypes.POINTER(ctypes.c_double)]
fabm.link_dependency_data.restype = None
# Read access to diagnostic data.
fabm.get_bulk_diagnostic_data.argtypes = [ctypes.c_int,ctypes.POINTER(ctypes.POINTER(ctypes.c_double))]
fabm.get_bulk_diagnostic_data.restype = None
fabm.get_horizontal_diagnostic_data.argtypes = [ctypes.c_int,ctypes.POINTER(ctypes.POINTER(ctypes.c_double))]
fabm.get_horizontal_diagnostic_data.restype = None
# Routine for retrieving source-sink terms for the interior domain.
fabm.get_rates.argtypes = [numpy.ctypeslib.ndpointer(dtype=ctypes.c_double, ndim=1, flags='CONTIGUOUS')]
fabm.get_suitable_masters_for_ptr.argtypes = [ctypes.c_void_p]
fabm.get_suitable_masters_for_ptr.restype = ctypes.c_void_p
fabm.link_list_count.argtypes = [ctypes.c_void_p]
fabm.link_list_count.restype = ctypes.c_int
fabm.link_list_index.argtypes = [ctypes.c_void_p,ctypes.c_int]
fabm.link_list_index.restype = ctypes.c_void_p
fabm.link_list_finalize.argtypes = [ctypes.c_void_p]
fabm.get_rates.restype = None
BULK_STATE_VARIABLE = 1
SURFACE_STATE_VARIABLE = 2
......@@ -170,7 +206,7 @@ class StateVariable(Variable):
@property
def background_value(self):
return fabm.get_variable_background_value(self.variable_pointer)
return fabm.variable_get_background_value(self.variable_pointer)
class DiagnosticVariable(Variable):
def __init__(self,name,index,horizontal,units=None,long_name=None,path=None):
......@@ -245,12 +281,12 @@ class Coupling(Variable):
strunits = ctypes.create_string_buffer(ATTRIBUTE_LENGTH)
strlong_name = ctypes.create_string_buffer(ATTRIBUTE_LENGTH)
fabm.get_variable_metadata_ptr(self.slave,ATTRIBUTE_LENGTH,strname,strunits,strlong_name)
fabm.variable_get_metadata(self.slave,ATTRIBUTE_LENGTH,strname,strunits,strlong_name)
Variable.__init__(self,strname.value,strunits.value,strlong_name.value)
def getValue(self):
strlong_name = ctypes.create_string_buffer(ATTRIBUTE_LENGTH)
fabm.get_variable_long_path(self.master,ATTRIBUTE_LENGTH,strlong_name)
fabm.variable_get_long_path(self.master,ATTRIBUTE_LENGTH,strlong_name)
return strlong_name.value
def setValue(self,value):
......@@ -259,11 +295,11 @@ class Coupling(Variable):
def getOptions(self):
options = []
list = fabm.get_suitable_masters_for_ptr(self.slave)
list = fabm.variable_get_suitable_masters(self.slave)
strlong_name = ctypes.create_string_buffer(ATTRIBUTE_LENGTH)
for i in range(fabm.link_list_count(list)):
variable = fabm.link_list_index(list,i+1)
fabm.get_variable_long_path(variable,ATTRIBUTE_LENGTH,strlong_name)
fabm.variable_get_long_path(variable,ATTRIBUTE_LENGTH,strlong_name)
options.append(strlong_name.value)
fabm.link_list_finalize(list)
return options
......@@ -271,7 +307,7 @@ class Coupling(Variable):
@property
def long_path(self):
strlong_name = ctypes.create_string_buffer(ATTRIBUTE_LENGTH)
fabm.get_variable_long_path(self.slave,ATTRIBUTE_LENGTH,strlong_name)
fabm.variable_get_long_path(self.slave,ATTRIBUTE_LENGTH,strlong_name)
return strlong_name.value
value = property(getValue, setValue)
......@@ -316,7 +352,7 @@ class Model(object):
ndependencies = ctypes.c_int()
nparameters = ctypes.c_int()
ncouplings = ctypes.c_int()
fabm.get_variable_counts(ctypes.byref(nstate_bulk),ctypes.byref(nstate_surface),ctypes.byref(nstate_bottom),
fabm.get_counts(ctypes.byref(nstate_bulk),ctypes.byref(nstate_surface),ctypes.byref(nstate_bottom),
ctypes.byref(ndiag_bulk),ctypes.byref(ndiag_horizontal),
ctypes.byref(nconserved),ctypes.byref(ndependencies),ctypes.byref(nparameters),ctypes.byref(ncouplings))
......@@ -345,15 +381,15 @@ class Model(object):
self.parameters = []
self.dependencies = []
for i in range(nstate_bulk.value):
ptr = fabm.get_variable_ptr(BULK_STATE_VARIABLE,i+1)
ptr = fabm.get_variable(BULK_STATE_VARIABLE,i+1)
fabm.get_variable_metadata(BULK_STATE_VARIABLE,i+1,ATTRIBUTE_LENGTH,strname,strunits,strlong_name,strpath)
self.bulk_state_variables.append(StateVariable(ptr,self.state,strname.value,i,strunits.value,strlong_name.value,strpath.value))
for i in range(nstate_surface.value):
ptr = fabm.get_variable_ptr(SURFACE_STATE_VARIABLE,i+1)
ptr = fabm.get_variable(SURFACE_STATE_VARIABLE,i+1)
fabm.get_variable_metadata(SURFACE_STATE_VARIABLE,i+1,ATTRIBUTE_LENGTH,strname,strunits,strlong_name,strpath)
self.surface_state_variables.append(StateVariable(ptr,self.state,strname.value,nstate_bulk.value+i,strunits.value,strlong_name.value,strpath.value))
for i in range(nstate_bottom.value):
ptr = fabm.get_variable_ptr(BOTTOM_STATE_VARIABLE,i+1)
ptr = fabm.get_variable(BOTTOM_STATE_VARIABLE,i+1)
fabm.get_variable_metadata(BOTTOM_STATE_VARIABLE,i+1,ATTRIBUTE_LENGTH,strname,strunits,strlong_name,strpath)
self.bottom_state_variables.append(StateVariable(ptr,self.state,strname.value,nstate_bulk.value+nstate_surface.value+i,strunits.value,strlong_name.value,strpath.value))
for i in range(ndiag_bulk.value):
......
......@@ -158,12 +158,12 @@
call get_environment_metadata(model,environment_names,environment_units)
call get_couplings(model,coupling_link_list)
end subroutine
end subroutine reinitialize
subroutine check_ready()
!DIR$ ATTRIBUTES DLLEXPORT :: check_ready
call fabm_check_ready(model)
end subroutine
end subroutine check_ready
integer(c_int) function model_count() bind(c)
!DIR$ ATTRIBUTES DLLEXPORT :: model_count
......@@ -176,11 +176,11 @@
model_count = model_count + 1
node => node%next
end do
end function
end function model_count
subroutine get_variable_counts(nstate_bulk,nstate_surface,nstate_bottom,ndiagnostic_bulk,ndiagnostic_horizontal,nconserved, &
subroutine get_counts(nstate_bulk,nstate_surface,nstate_bottom,ndiagnostic_bulk,ndiagnostic_horizontal,nconserved, &
ndependencies,nparameters,ncouplings) bind(c)
!DIR$ ATTRIBUTES DLLEXPORT :: get_variable_counts
!DIR$ ATTRIBUTES DLLEXPORT :: get_counts
integer(c_int),intent(out) :: nstate_bulk,nstate_surface,nstate_bottom
integer(c_int),intent(out) :: ndiagnostic_bulk,ndiagnostic_horizontal
integer(c_int),intent(out) :: nconserved,ndependencies,nparameters,ncouplings
......@@ -193,7 +193,7 @@
ndependencies = size(environment_names)
nparameters = model%root%parameters%size()
ncouplings = coupling_link_list%count()
end subroutine
end subroutine get_counts
subroutine get_variable_metadata(category,index,length,name,units,long_name,path) bind(c)
!DIR$ ATTRIBUTES DLLEXPORT :: get_variable_metadata
......@@ -221,12 +221,12 @@
call copy_to_c_string(variable%units, units)
call copy_to_c_string(variable%local_long_name,long_name)
call copy_to_c_string(variable%path, path)
end subroutine
end subroutine get_variable_metadata
function get_variable_ptr(category,index) bind(c) result(pvariable)
!DIR$ ATTRIBUTES DLLEXPORT :: get_variable_ptr
integer(c_int), intent(in), value :: category,index
type (c_ptr) :: pvariable
function get_variable(category,index) bind(c) result(pvariable)
!DIR$ ATTRIBUTES DLLEXPORT :: get_variable
integer(c_int),intent(in), value :: category,index
type (c_ptr) :: pvariable
type (type_internal_variable),pointer :: variable
......@@ -246,7 +246,7 @@
variable => model%conserved_quantities(index)%target
end select
pvariable = c_loc(variable)
end function get_variable_ptr
end function get_variable
subroutine get_parameter_metadata(index,length,name,units,long_name,typecode,has_default) bind(c)
!DIR$ ATTRIBUTES DLLEXPORT :: get_parameter_metadata
......@@ -270,16 +270,16 @@
call copy_to_c_string(property%long_name,long_name)
typecode = property%typecode()
has_default = logical2int(property%has_default)
end subroutine
end subroutine get_parameter_metadata
subroutine get_dependency_metadata(index,length,name,units) bind(c)
!DIR$ ATTRIBUTES DLLEXPORT :: get_dependency_metadata
integer(c_int),intent(in), value :: index,length
integer(c_int), intent(in), value :: index,length
character(kind=c_char),intent(out),dimension(length) :: name,units
call copy_to_c_string(environment_names(index),name)
call copy_to_c_string(environment_units(index),units)
end subroutine
end subroutine get_dependency_metadata
subroutine get_coupling(index,slave,master) bind(c)
!DIR$ ATTRIBUTES DLLEXPORT :: get_coupling
......@@ -295,10 +295,10 @@
end do
slave = c_loc(link_slave%original)
master = c_loc(link_slave%target)
end subroutine
end subroutine get_coupling
function get_suitable_masters_for_ptr(pvariable) result(plist) bind(c)
!DIR$ ATTRIBUTES DLLEXPORT :: get_suitable_masters_for_ptr
function variable_get_suitable_masters(pvariable) result(plist) bind(c)
!DIR$ ATTRIBUTES DLLEXPORT :: variable_get_suitable_masters
type (c_ptr), intent(in), value :: pvariable
type (c_ptr) :: plist
......@@ -308,7 +308,7 @@
call c_f_pointer(pvariable, variable)
list => get_suitable_masters(model,variable)
plist = c_loc(list)
end function
end function variable_get_suitable_masters
function link_list_count(plist) bind(c) result(value)
!DIR$ ATTRIBUTES DLLEXPORT :: link_list_count
......@@ -319,7 +319,7 @@
call c_f_pointer(plist, list)
value = list%count()
end function
end function link_list_count
function link_list_index(plist,index) bind(c) result(pvariable)
!DIR$ ATTRIBUTES DLLEXPORT :: link_list_index
......@@ -337,7 +337,7 @@
link => link%next
end do
pvariable = c_loc(link%target)
end function
end function link_list_index
subroutine link_list_finalize(plist) bind(c)
!DIR$ ATTRIBUTES DLLEXPORT :: link_list_finalize
......@@ -348,10 +348,10 @@
call c_f_pointer(plist, list)
call list%finalize()
deallocate(list)
end subroutine
end subroutine link_list_finalize
subroutine get_variable_long_path(pvariable,length,long_name) bind(c)
!DIR$ ATTRIBUTES DLLEXPORT :: get_variable_long_path
subroutine variable_get_long_path(pvariable,length,long_name) bind(c)
!DIR$ ATTRIBUTES DLLEXPORT :: variable_get_long_path
type (c_ptr), intent(in), value :: pvariable
integer(c_int), intent(in), value :: length
character(kind=c_char),intent(out),dimension(length) ::long_name
......@@ -368,10 +368,10 @@
owner => owner%parent
end do
call copy_to_c_string(long_name_,long_name)
end subroutine get_variable_long_path
end subroutine variable_get_long_path
function get_variable_background_value(pvariable) bind(c) result(value)
!DIR$ ATTRIBUTES DLLEXPORT :: get_variable_background_value
function variable_get_background_value(pvariable) bind(c) result(value)
!DIR$ ATTRIBUTES DLLEXPORT :: variable_get_background_value
type (c_ptr), value, intent(in) :: pvariable
real(kind=c_double) :: value
......@@ -380,10 +380,10 @@
call c_f_pointer(pvariable, variable)
value = 0.0_rk
if (size(variable%background_values%pointers)>0) value = variable%background_values%pointers(1)%p
end function get_variable_background_value
end function variable_get_background_value
subroutine get_variable_metadata_ptr(pvariable,length,name,units,long_name) bind(c)
!DIR$ ATTRIBUTES DLLEXPORT :: get_variable_metadata_ptr
subroutine variable_get_metadata(pvariable,length,name,units,long_name) bind(c)
!DIR$ ATTRIBUTES DLLEXPORT :: variable_get_metadata
type (c_ptr), intent(in), value :: pvariable
integer(c_int), intent(in), value :: length
character(kind=c_char),intent(out),dimension(length) :: name,units,long_name
......@@ -394,7 +394,7 @@
call copy_to_c_string(variable%name, name)
call copy_to_c_string(variable%units, units)
call copy_to_c_string(variable%long_name,long_name)
end subroutine get_variable_metadata_ptr
end subroutine variable_get_metadata
subroutine get_model_metadata(name,length,long_name,user_created) bind(c)
!DIR$ ATTRIBUTES DLLEXPORT :: get_model_metadata
......@@ -412,7 +412,7 @@
'model "'//pname(:index(pname,C_NULL_CHAR)-1)//'" not found.')
call copy_to_c_string(found_model%long_name,long_name)
user_created = logical2int(found_model%user_created)
end subroutine
end subroutine get_model_metadata
subroutine link_dependency_data(index,value) bind(c)
!DIR$ ATTRIBUTES DLLEXPORT :: link_dependency_data
......@@ -422,7 +422,7 @@
call fabm_link_bulk_data(model,environment_names(index),value)
call fabm_link_horizontal_data(model,environment_names(index),value)
call fabm_link_scalar_data(model,environment_names(index),value)
end subroutine
end subroutine link_dependency_data
subroutine link_bulk_state_data(index,value) bind(c)
!DIR$ ATTRIBUTES DLLEXPORT :: link_bulk_state_data
......@@ -431,7 +431,7 @@
value = model%state_variables(index)%initial_value
call fabm_link_bulk_state_data(model,index,value)
end subroutine
end subroutine link_bulk_state_data
subroutine link_surface_state_data(index,value) bind(c)
!DIR$ ATTRIBUTES DLLEXPORT :: link_surface_state_data
......@@ -440,7 +440,7 @@
value = model%surface_state_variables(index)%initial_value
call fabm_link_surface_state_data(model,index,value)
end subroutine
end subroutine link_surface_state_data
subroutine link_bottom_state_data(index,value) bind(c)
!DIR$ ATTRIBUTES DLLEXPORT :: link_bottom_state_data
......@@ -449,7 +449,7 @@
value = model%bottom_state_variables(index)%initial_value
call fabm_link_bottom_state_data(model,index,value)
end subroutine
end subroutine link_bottom_state_data
subroutine get_rates(pelagic_rates_) bind(c)
!DIR$ ATTRIBUTES DLLEXPORT :: get_rates
......@@ -471,27 +471,27 @@
! Normalize rate of change in conserved quantities to sum of absolute rates of change.
!call fabm_state_to_conserved_quantities(model,abs(pelagic_rates),abs_conserved_rates)
!where (abs_conserved_rates>0.0_rk) conserved_rates = conserved_rates/abs_conserved_rates
end subroutine
end subroutine get_rates
subroutine get_bulk_diagnostic_data(index,ptr) bind(c)
!DIR$ ATTRIBUTES DLLEXPORT :: get_bulk_diagnostic_data
integer(c_int),intent(in),value :: index
type(c_ptr), intent(out) :: ptr
ptr = c_loc(fabm_get_bulk_diagnostic_data(model,index))
end subroutine
end subroutine get_bulk_diagnostic_data
subroutine get_horizontal_diagnostic_data(index,ptr) bind(c)
!DIR$ ATTRIBUTES DLLEXPORT :: get_horizontal_diagnostic_data
integer(c_int),intent(in),value :: index
type(c_ptr), intent(out) :: ptr
ptr = c_loc(fabm_get_horizontal_diagnostic_data(model,index))
end subroutine
end subroutine get_horizontal_diagnostic_data
subroutine finalize() bind(c)
call fabm_finalize(model)
if (allocated(environment_names)) deallocate(environment_names)
if (allocated(environment_units)) deallocate(environment_units)
end subroutine
end subroutine finalize
subroutine reset_parameter(index) bind(c)
!DIR$ ATTRIBUTES DLLEXPORT :: reset_parameter
......@@ -504,7 +504,7 @@
! Re-initialize the model using updated parameter values
call reinitialize()
end subroutine
end subroutine reset_parameter
subroutine set_real_parameter(name,value) bind(c)
!DIR$ ATTRIBUTES DLLEXPORT :: set_real_parameter
......@@ -518,7 +518,7 @@
! Re-initialize the model using updated parameter values
call reinitialize()
end subroutine
end subroutine set_real_parameter
function get_real_parameter(index,default) bind(c) result(value)
!DIR$ ATTRIBUTES DLLEXPORT :: get_real_parameter
......@@ -537,7 +537,7 @@
class default
call driver%fatal_error('get_real_parameter','not a real variable')
end select
end function
end function get_real_parameter
subroutine set_integer_parameter(name,value) bind(c)
!DIR$ ATTRIBUTES DLLEXPORT :: set_integer_parameter
......@@ -551,7 +551,7 @@
! Re-initialize the model using updated parameter values
call reinitialize()
end subroutine
end subroutine set_integer_parameter
function get_integer_parameter(index,default) bind(c) result(value)
!DIR$ ATTRIBUTES DLLEXPORT :: get_integer_parameter
......@@ -570,7 +570,7 @@
class default
call driver%fatal_error('get_integer_parameter','not an integer variable')
end select
end function
end function get_integer_parameter
subroutine set_logical_parameter(name,value) bind(c)
!DIR$ ATTRIBUTES DLLEXPORT :: set_logical_parameter
......@@ -584,7 +584,7 @@
! Re-initialize the model using updated parameter values
call reinitialize()
end subroutine
end subroutine set_logical_parameter
function get_logical_parameter(index,default) bind(c) result(value)
!DIR$ ATTRIBUTES DLLEXPORT :: get_logical_parameter
......@@ -603,7 +603,7 @@
class default
call driver%fatal_error('get_logical_parameter','not a logical variable')
end select
end function
end function get_logical_parameter
subroutine set_string_parameter(name,value) bind(c)
!DIR$ ATTRIBUTES DLLEXPORT :: set_string_parameter
......@@ -617,7 +617,7 @@
! Re-initialize the model using updated parameter values
call reinitialize()
end subroutine
end subroutine set_string_parameter
subroutine get_string_parameter(index,default,length,value) bind(c)
!DIR$ ATTRIBUTES DLLEXPORT :: get_string_parameter
......@@ -637,7 +637,7 @@
class default
call driver%fatal_error('get_string_parameter','not a string variable')
end select
end subroutine
end subroutine get_string_parameter
subroutine python_driver_fatal_error(self,location,message)
class (type_python_driver),intent(inout) :: self
......@@ -645,14 +645,14 @@
write (*,*) trim(location)//': '//trim(message)
stop 1
end subroutine
end subroutine python_driver_fatal_error
subroutine python_driver_log_message(self,message)
class (type_python_driver),intent(inout) :: self
character(len=*), intent(in) :: message
!write (*,*) trim(message)
end subroutine
end subroutine python_driver_log_message
subroutine copy_to_c_string(string,cstring)
character(len=*), intent(in) :: string
......
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