7 use iso_c_binding,
only: c_char, c_int, c_null_char
22 character(len=*),
parameter ::
fmt_general_err = & !< General bmi error, args: context/detail
24 character(len=*),
parameter ::
fmt_unknown_var = & !< Variable unknown, args: variable name, memory path
25 "('BMI Error, unknown variable: ', a, ' at ', a)"
26 character(len=*),
parameter ::
fmt_invalid_var = & !< Invalid variable address, args: variable address
27 "('BMI Error, invalid address string: ', a)"
29 "('BMI Error, unsupported rank for variable: &
32 "('BMI Error, unsupported type for variable: &
35 "('Fatal BMI Error, invalid access of memory &
37 character(len=*),
parameter ::
fmt_fail_cvg_sol = & !< Solution failed to converge, args: detail
38 "('BMI Error, Numerical Solution ', i3, &
39 &' failed to converge')"
48 character(len=*),
intent(in) :: err_msg
50 write (
istdout, *) trim(err_msg)
57 bind(C, name="get_last_bmi_error")
61 integer(kind=c_int) :: bmi_status
63 integer(I4B) :: i, length
69 c_error(length + 1) = c_null_char
This module contains simulation constants.
integer(i4b), parameter maxcharlen
maximum length of char string
This module defines variable data types.
Detailed error information for the BMI.
character(len= *), parameter fmt_invalid_var
character(len= *), parameter fmt_unknown_var
character(len= *), parameter fmt_general_err
integer(i4b), parameter lenerrmessage
max length for the error message
integer, parameter bmi_failure
BMI status code for failure (taken from bmi.f90, CSDMS)
integer(kind=c_int) function get_last_bmi_error(c_error)
Get the last error in the BMI as a character array with size BMI_LENERRMESSAGE.
character(len= *), parameter fmt_unsupported_type
character(len=lenerrmessage) bmi_last_error
module variable containing the last error as a Fortran string
subroutine report_bmi_error(err_msg)
Sets the last BMI error message and copies it to an exported C-string.
character(len= *), parameter fmt_invalid_mem_access
character(len= *), parameter fmt_fail_cvg_sol
integer(c_int), bind(C, name="BMI_LENERRMESSAGE") bmi_lenerrmessage
max. length for the (exported) C-style error message
character(len= *), parameter fmt_unsupported_rank
integer, parameter bmi_success
BMI status code for success (taken from bmi.f90, CSDMS)
This module contains simulation variables.
integer(i4b) istdout
unit number for stdout