Module bianchi_error_mod

module bianchi_error_mod

        ! Uses
    use s2_types_mod, only: S2_STRING_LEN

        ! Variables
    integer, private, parameter :: BIANCHI_ERROR_NUM = 12
    integer, public, parameter :: BIANCHI_ERROR_NONE = 0
    integer, public, parameter :: BIANCHI_ERROR_INIT = 1
    integer, public, parameter :: BIANCHI_ERROR_NOT_INIT = 2
    integer, public, parameter :: BIANCHI_ERROR_INIT_FAIL = 3
    integer, public, parameter :: BIANCHI_ERROR_MEM_ALLOC_FAIL = 4
    integer, public, parameter :: BIANCHI_ERROR_SKY_QUAD_INVALID = 5
    integer, public, parameter :: BIANCHI_ERROR_SKY_QUAD_STEP_EXCEED = 6
    integer, public, parameter :: BIANCHI_ERROR_SKY_N_MISSING = 7
    integer, public, parameter :: BIANCHI_ERROR_SIM_PARAM_INVALID = 8
    integer, public, parameter :: BIANCHI_ERROR_SIM_NARG = 9
    integer, public, parameter :: BIANCHI_ERROR_PLM1TABLE_THETA_INVALID = 10
    integer, public, parameter :: BIANCHI_ERROR_PLM1TABLE_L_INVALID = 11
    character (len=S2_STRING_LEN), private, parameter, dimension (BIANCHI_ERROR_NUM) :: error_comment = (/ 'No error                                                                 ', 'Attempt to initialise object that has already been initialised           ', 'Object not initialised                                                   ', 'Object initialisation failed                                             ', 'Memory allocation failed                                                 ', 'Quadrature type invalid                                                  ', 'Exceeded number of steps limit whem computing quadrature                 ', 'Must specify N if using direct quadrature                                ', 'Invalid simulation parameter                                             ', 'Invalid number of command line parameters                                ', 'Invalid theta for Plm1 lookup table (not on regular grid)                ', 'Invalid l for Plm1 lookup table (out of range)                           ' /)
    logical, private, parameter, dimension (BIANCHI_ERROR_NUM) :: halt_default = (/ .false., .true., .true., .true., .true., .true., .true., .true., .true., .true., .true., .true. /)

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

end module bianchi_error_mod
Functionality to handle errors that may occur in the bianchi library. Public bianchi 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 June 2005


Description of Variables

BIANCHI_ERROR_NUM

integer, private, parameter :: BIANCHI_ERROR_NUM = 12

BIANCHI_ERROR_NONE

integer, public, parameter :: BIANCHI_ERROR_NONE = 0

BIANCHI_ERROR_INIT

integer, public, parameter :: BIANCHI_ERROR_INIT = 1

BIANCHI_ERROR_NOT_INIT

integer, public, parameter :: BIANCHI_ERROR_NOT_INIT = 2

BIANCHI_ERROR_INIT_FAIL

integer, public, parameter :: BIANCHI_ERROR_INIT_FAIL = 3

BIANCHI_ERROR_MEM_ALLOC_FAIL

integer, public, parameter :: BIANCHI_ERROR_MEM_ALLOC_FAIL = 4

BIANCHI_ERROR_SKY_QUAD_INVALID

integer, public, parameter :: BIANCHI_ERROR_SKY_QUAD_INVALID = 5

BIANCHI_ERROR_SKY_QUAD_STEP_EXCEED

integer, public, parameter :: BIANCHI_ERROR_SKY_QUAD_STEP_EXCEED = 6

BIANCHI_ERROR_SKY_N_MISSING

integer, public, parameter :: BIANCHI_ERROR_SKY_N_MISSING = 7

BIANCHI_ERROR_SIM_PARAM_INVALID

integer, public, parameter :: BIANCHI_ERROR_SIM_PARAM_INVALID = 8

BIANCHI_ERROR_SIM_NARG

integer, public, parameter :: BIANCHI_ERROR_SIM_NARG = 9

BIANCHI_ERROR_PLM1TABLE_THETA_INVALID

integer, public, parameter :: BIANCHI_ERROR_PLM1TABLE_THETA_INVALID = 10

BIANCHI_ERROR_PLM1TABLE_L_INVALID

integer, public, parameter :: BIANCHI_ERROR_PLM1TABLE_L_INVALID = 11

error_comment

character (len=S2_STRING_LEN), private, parameter, dimension (BIANCHI_ERROR_NUM) :: error_comment = (/ 'No error                                                                 ', 'Attempt to initialise object that has already been initialised           ', 'Object not initialised                                                   ', 'Object initialisation failed                                             ', 'Memory allocation failed                                                 ', 'Quadrature type invalid                                                  ', 'Exceeded number of steps limit whem computing quadrature                 ', 'Must specify N if using direct quadrature                                ', 'Invalid simulation parameter                                             ', 'Invalid number of command line parameters                                ', 'Invalid theta for Plm1 lookup table (not on regular grid)                ', 'Invalid l for Plm1 lookup table (out of range)                           ' /)
Comment associated with each error type.

halt_default

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

Description of Subroutines and Functions

bianchi_error

public subroutine bianchi_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 bianchi_error
Display error message corresponding to error_code and halt program execution if required.

Variables:

Author: J. D. McEwen

Version: 0.1 August 2004