Module s2dw_error_mod

module s2dw_error_mod

        ! Uses
    use s2dw_types_mod, only: STRING_LEN

        ! Variables
    integer, private, parameter :: S2DW_ERROR_NUM = 14
    integer, public, parameter :: S2DW_ERROR_NONE = 0
    integer, public, parameter :: S2DW_ERROR_INIT = 1
    integer, public, parameter :: S2DW_ERROR_NOT_INIT = 2
    integer, public, parameter :: S2DW_ERROR_INIT_FAIL = 3
    integer, public, parameter :: S2DW_ERROR_MEM_ALLOC_FAIL = 4
    integer, public, parameter :: S2DW_ERROR_ARTH = 5
    integer, public, parameter :: S2DW_ERROR_ARTH_WARNING = 6
    integer, public, parameter :: S2DW_ERROR_SIZE_WARNING = 7
    integer, public, parameter :: S2DW_ERROR_SIZE_INVALID = 8
    integer, public, parameter :: S2DW_ERROR_SIZE_NOT_DEF = 9
    integer, public, parameter :: S2DW_ERROR_ARG_INVALID = 10
    integer, public, parameter :: S2DW_ERROR_ARG_WARNING = 11
    integer, public, parameter :: S2DW_ERROR_QUAD_STEP_EXCEED = 12
    integer, public, parameter :: S2DW_ERROR_ADMISS_FAIL = 13
    integer, public, parameter :: S2DW_ERROR_FILEIO = 14
    character (len=STRING_LEN), private, parameter, dimension (S2DW_ERROR_NUM+1) :: error_comment = (/ 'No error                                                                 ', 'Attempt to initialise object that has already been initialised           ', 'Object not initialised                                                   ', 'Object initialisation failed                                             ', 'Memory allocation failed                                                 ', 'Arithmetic exception                                                     ', 'Arithmetic warning                                                       ', 'Warning: Sizes not in recommended range                                  ', 'Invalid sizes                                                            ', 'Sizes not defined                                                        ', 'Arguments invalid                                                        ', 'Argument warning                                                         ', 'Exceeded number of steps limit whem computing quadrature                 ', 'Admissibility test failed (resolution of identity not satisfied)         ', 'File IO error                                                            ' /)
    logical, private, parameter, dimension (S2DW_ERROR_NUM+1) :: halt_default = (/ .false., .true., .true., .true., .true., .true., .false., .false., .true., .true., .true., .false., .true., .true., .true. /)

        ! Subroutines and functions
    public subroutine s2dw_error (error_code, procedure, comment_add, comment_out, halt_in)

end module s2dw_error_mod
Functionality to handle errors that may occur in the s2dw library. Public s2dw error codes are defined, with corresponding private error comments and default halt execution status.

Author: J. D. McEwen (mcewen@mrao.cam.ac.uk)

Version: 0.1 October 2007


Description of Variables

S2DW_ERROR_NUM

integer, private, parameter :: S2DW_ERROR_NUM = 14

S2DW_ERROR_NONE

integer, public, parameter :: S2DW_ERROR_NONE = 0

S2DW_ERROR_INIT

integer, public, parameter :: S2DW_ERROR_INIT = 1

S2DW_ERROR_NOT_INIT

integer, public, parameter :: S2DW_ERROR_NOT_INIT = 2

S2DW_ERROR_INIT_FAIL

integer, public, parameter :: S2DW_ERROR_INIT_FAIL = 3

S2DW_ERROR_MEM_ALLOC_FAIL

integer, public, parameter :: S2DW_ERROR_MEM_ALLOC_FAIL = 4

S2DW_ERROR_ARTH

integer, public, parameter :: S2DW_ERROR_ARTH = 5

S2DW_ERROR_ARTH_WARNING

integer, public, parameter :: S2DW_ERROR_ARTH_WARNING = 6

S2DW_ERROR_SIZE_WARNING

integer, public, parameter :: S2DW_ERROR_SIZE_WARNING = 7

S2DW_ERROR_SIZE_INVALID

integer, public, parameter :: S2DW_ERROR_SIZE_INVALID = 8

S2DW_ERROR_SIZE_NOT_DEF

integer, public, parameter :: S2DW_ERROR_SIZE_NOT_DEF = 9

S2DW_ERROR_ARG_INVALID

integer, public, parameter :: S2DW_ERROR_ARG_INVALID = 10

S2DW_ERROR_ARG_WARNING

integer, public, parameter :: S2DW_ERROR_ARG_WARNING = 11

S2DW_ERROR_QUAD_STEP_EXCEED

integer, public, parameter :: S2DW_ERROR_QUAD_STEP_EXCEED = 12

S2DW_ERROR_ADMISS_FAIL

integer, public, parameter :: S2DW_ERROR_ADMISS_FAIL = 13

S2DW_ERROR_FILEIO

integer, public, parameter :: S2DW_ERROR_FILEIO = 14

error_comment

character (len=STRING_LEN), private, parameter, dimension (S2DW_ERROR_NUM+1) :: error_comment = (/ 'No error                                                                 ', 'Attempt to initialise object that has already been initialised           ', 'Object not initialised                                                   ', 'Object initialisation failed                                             ', 'Memory allocation failed                                                 ', 'Arithmetic exception                                                     ', 'Arithmetic warning                                                       ', 'Warning: Sizes not in recommended range                                  ', 'Invalid sizes                                                            ', 'Sizes not defined                                                        ', 'Arguments invalid                                                        ', 'Argument warning                                                         ', 'Exceeded number of steps limit whem computing quadrature                 ', 'Admissibility test failed (resolution of identity not satisfied)         ', 'File IO error                                                            ' /)
Comment associated with each error type.

halt_default

logical, private, parameter, dimension (S2DW_ERROR_NUM+1) :: halt_default = (/ .false., .true., .true., .true., .true., .true., .false., .false., .true., .true., .true., .false., .true., .true., .true. /)
Default program halt status of each error type.

Description of Subroutines and Functions

s2dw_error

public subroutine s2dw_error (error_code, procedure, comment_add, comment_out, halt_in)
    integer, intent(in) :: error_code
    character (len=*), optional, intent(in) :: procedure
    character (len=*), optional, intent(in) :: comment_add
    character (len=*), optional, intent(inout) :: comment_out
    logical, optional, intent(in) :: halt_in
end subroutine s2dw_error
Displays error message corresponding to error_code and halt program execution if required.

Variables:

Author: J. D. McEwen

Version: 0.1 August 2004