MODFLOW 6  version 6.7.0.dev0
USGS Modular Hydrologic Model
mf6bmierror Module Reference

Detailed error information for the BMI. More...

Functions/Subroutines

subroutine report_bmi_error (err_msg)
 Sets the last BMI error message and copies it to an exported C-string. More...
 
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. More...
 

Variables

integer, parameter bmi_failure = 1
 BMI status code for failure (taken from bmi.f90, CSDMS) More...
 
integer, parameter bmi_success = 0
 BMI status code for success (taken from bmi.f90, CSDMS) More...
 
integer(i4b), parameter lenerrmessage = 1024
 max length for the error message More...
 
integer(c_int), bind(C, name="BMI_LENERRMESSAGE") bmi_lenerrmessage = LENERRMESSAGE + 1
 max. length for the (exported) C-style error message More...
 
character(len=lenerrmessagebmi_last_error = 'No BMI error reported'
 module variable containing the last error as a Fortran string More...
 
character(len= *), parameter fmt_general_err = "('BMI Error, ', a)"
 
character(len= *), parameter fmt_unknown_var = "('BMI Error, unknown variable: ', a, ' at ', a)"
 
character(len= *), parameter fmt_invalid_var = "('BMI Error, invalid address string: ', a)"
 
character(len= *), parameter fmt_unsupported_rank = "('BMI Error, unsupported rank for variable: ', a)"
 
character(len= *), parameter fmt_unsupported_type = "('BMI Error, unsupported type for variable: ', a)"
 
character(len= *), parameter fmt_invalid_mem_access = "('Fatal BMI Error, invalid access of memory for variable: ', a)"
 
character(len= *), parameter fmt_fail_cvg_sol = "('BMI Error, Numerical Solution ', i3, ' failed to converge')"
 

Detailed Description

This module contains error codes and detailed error messages (as format strings) for the BMI/XMI.

Function/Subroutine Documentation

◆ get_last_bmi_error()

integer(kind=c_int) function mf6bmierror::get_last_bmi_error ( character(kind=c_char, len=1), dimension(bmi_lenerrmessage), intent(out)  c_error)
Parameters
[out]c_errorC style char array with error
Returns
BMI status code

Definition at line 56 of file mf6bmiError.f90.

58  !DIR$ ATTRIBUTES DLLEXPORT :: get_last_bmi_error
59  ! -- dummy variables
60  character(kind=c_char, len=1), intent(out) :: c_error(BMI_LENERRMESSAGE) !< C style char array with error
61  integer(kind=c_int) :: bmi_status !< BMI status code
62  ! -- local variables
63  integer(I4B) :: i, length
64 
65  length = len(trim(bmi_last_error))
66  do i = 1, length
67  c_error(i) = bmi_last_error(i:i)
68  end do
69  c_error(length + 1) = c_null_char
70 
71  bmi_status = bmi_success

◆ report_bmi_error()

subroutine mf6bmierror::report_bmi_error ( character(len=*), intent(in)  err_msg)
Parameters
[in]err_msgthe error message

Definition at line 46 of file mf6bmiError.f90.

47  ! -- dummy variables
48  character(len=*), intent(in) :: err_msg !< the error message
49  bmi_last_error = err_msg
50  write (istdout, *) trim(err_msg)
Here is the caller graph for this function:

Variable Documentation

◆ bmi_failure

integer, parameter mf6bmierror::bmi_failure = 1

Definition at line 12 of file mf6bmiError.f90.

12  integer, parameter :: BMI_FAILURE = 1 !< BMI status code for failure (taken from bmi.f90, CSDMS)

◆ bmi_last_error

character(len=lenerrmessage) mf6bmierror::bmi_last_error = 'No BMI error reported'

Definition at line 20 of file mf6bmiError.f90.

20  character(len=LENERRMESSAGE) :: bmi_last_error = 'No BMI error reported' !< module variable containing the last error as a Fortran string

◆ bmi_lenerrmessage

integer(c_int), bind(C, name="BMI_LENERRMESSAGE") mf6bmierror::bmi_lenerrmessage = LENERRMESSAGE + 1

Definition at line 16 of file mf6bmiError.f90.

16  integer(c_int), bind(C, name="BMI_LENERRMESSAGE") :: BMI_LENERRMESSAGE = &
17  lenerrmessage + 1 !< max. length for the (exported) C-style error message

◆ bmi_success

integer, parameter mf6bmierror::bmi_success = 0

Definition at line 13 of file mf6bmiError.f90.

13  integer, parameter :: BMI_SUCCESS = 0 !< BMI status code for success (taken from bmi.f90, CSDMS)

◆ fmt_fail_cvg_sol

character(len=*), parameter mf6bmierror::fmt_fail_cvg_sol = "('BMI Error, Numerical Solution ', i3, ' failed to converge')"

Definition at line 37 of file mf6bmiError.f90.

37  character(len=*), parameter :: fmt_fail_cvg_sol = & !< Solution failed to converge, args: detail
38  "('BMI Error, Numerical Solution ', i3, &
39  &' failed to converge')"

◆ fmt_general_err

character(len=*), parameter mf6bmierror::fmt_general_err = "('BMI Error, ', a)"

Definition at line 22 of file mf6bmiError.f90.

22  character(len=*), parameter :: fmt_general_err = & !< General bmi error, args: context/detail
23  "('BMI Error, ', a)"

◆ fmt_invalid_mem_access

character(len=*), parameter mf6bmierror::fmt_invalid_mem_access = "('Fatal BMI Error, invalid access of memory for variable: ', a)"

Definition at line 34 of file mf6bmiError.f90.

34  character(len=*), parameter :: fmt_invalid_mem_access = & !< Invalid memory access, args: variable name
35  "('Fatal BMI Error, invalid access of memory &
36  &for variable: ', a)"

◆ fmt_invalid_var

character(len=*), parameter mf6bmierror::fmt_invalid_var = "('BMI Error, invalid address string: ', a)"

Definition at line 26 of file mf6bmiError.f90.

26  character(len=*), parameter :: fmt_invalid_var = & !< Invalid variable address, args: variable address
27  "('BMI Error, invalid address string: ', a)"

◆ fmt_unknown_var

character(len=*), parameter mf6bmierror::fmt_unknown_var = "('BMI Error, unknown variable: ', a, ' at ', a)"

Definition at line 24 of file mf6bmiError.f90.

24  character(len=*), parameter :: fmt_unknown_var = & !< Variable unknown, args: variable name, memory path
25  "('BMI Error, unknown variable: ', a, ' at ', a)"

◆ fmt_unsupported_rank

character(len=*), parameter mf6bmierror::fmt_unsupported_rank = "('BMI Error, unsupported rank for variable: ', a)"

Definition at line 28 of file mf6bmiError.f90.

28  character(len=*), parameter :: fmt_unsupported_rank = & !< Unsupported rank, args: variable name
29  "('BMI Error, unsupported rank for variable: &
30  &', a)"

◆ fmt_unsupported_type

character(len=*), parameter mf6bmierror::fmt_unsupported_type = "('BMI Error, unsupported type for variable: ', a)"

Definition at line 31 of file mf6bmiError.f90.

31  character(len=*), parameter :: fmt_unsupported_type = & !< Unsupported type, args: variable name
32  "('BMI Error, unsupported type for variable: &
33  &', a)"

◆ lenerrmessage

integer(i4b), parameter mf6bmierror::lenerrmessage = 1024

Definition at line 15 of file mf6bmiError.f90.

15  integer(I4B), parameter :: LENERRMESSAGE = 1024 !< max length for the error message