Module s2_error_mod

module s2_error_mod

        ! Uses
    use s2_types_mod, only: S2_STRING_LEN

        ! Variables
    integer, private, parameter :: S2_ERROR_NUM = 31
    integer, public, parameter :: S2_ERROR_NONE = 0
    integer, public, parameter :: S2_ERROR_INIT = 1
    integer, public, parameter :: S2_ERROR_NOT_INIT = 2
    integer, public, parameter :: S2_ERROR_INIT_FAIL = 3
    integer, public, parameter :: S2_ERROR_MEM_ALLOC_FAIL = 4
    integer, public, parameter :: S2_ERROR_ARTH = 5
    integer, public, parameter :: S2_ERROR_SKY_SIZE_WARNING = 6
    integer, public, parameter :: S2_ERROR_SKY_SIZE_INVALID = 7
    integer, public, parameter :: S2_ERROR_SKY_SIZE_NOT_DEF = 8
    integer, public, parameter :: S2_ERROR_SKY_POL_DEF = 9
    integer, public, parameter :: S2_ERROR_SKY_MAP_DEF = 10
    integer, public, parameter :: S2_ERROR_SKY_MAP_NOT_DEF = 11
    integer, public, parameter :: S2_ERROR_SKY_ALM_DEF = 12
    integer, public, parameter :: S2_ERROR_SKY_ALM_NOT_DEF = 13
    integer, public, parameter :: S2_ERROR_SKY_EXT_INVALID = 14
    integer, public, parameter :: S2_ERROR_SKY_PIX_INVALID = 15
    integer, public, parameter :: S2_ERROR_SKY_NON_CONFORM = 16
    integer, public, parameter :: S2_ERROR_SKY_PIX_DIFF = 17
    integer, public, parameter :: S2_ERROR_SKY_FTYPE_INVALID = 18
    integer, public, parameter :: S2_ERROR_SKY_FILE_EXISTS = 19
    integer, public, parameter :: S2_ERROR_SKY_FILE_INVALID = 20
    integer, public, parameter :: S2_ERROR_DISNT_BND_INVALID = 21
    integer, public, parameter :: S2_ERROR_PL_LMAX_LOW = 22
    integer, public, parameter :: S2_ERROR_PL_SIZE_INVALID = 23
    integer, public, parameter :: S2_ERROR_PL_FILE_EXISTS = 24
    integer, public, parameter :: S2_ERROR_PL_FILE_INVALID = 25
    integer, public, parameter :: S2_ERROR_PL_PLOT_FAIL = 26
    integer, public, parameter :: S2_ERROR_WNOISE_TYPE_INVALID = 27
    integer, public, parameter :: S2_ERROR_VECT_TYPE_INVALID = 28
    integer, public, parameter :: S2_ERROR_VECT_CART_DIM_INVALID = 29
    integer, public, parameter :: S2_ERROR_YLM_ARG_INVALID = 30
    character (len=S2_STRING_LEN), private, parameter, dimension (S2_ERROR_NUM) :: error_comment = (/ 'No error                                                                 ', 'Attempt to initialise object that has already been initialised           ', 'Object not initialised                                                   ', 'Object initialisation failed                                             ', 'Memory allocation failed                                                 ', 'Arithmetic exception                                                     ', 'Warning: Sky sizes not in reccommended range (0halt_default = (/ .false., .true., .true., .true., .true., .true., .false., .true., .true., .false., .false., .true., .false., .true., .true., .true., .true., .false., .true., .true., .true., .false., .false., .true., .true., .true., .true., .true., .true., .true., .true. /)

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

end module s2_error_mod
Functionality to handle errors that may occur in the s2 library. Public s2 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 August 2004


Description of Variables

S2_ERROR_NUM

integer, private, parameter :: S2_ERROR_NUM = 31

S2_ERROR_NONE

integer, public, parameter :: S2_ERROR_NONE = 0

S2_ERROR_INIT

integer, public, parameter :: S2_ERROR_INIT = 1

S2_ERROR_NOT_INIT

integer, public, parameter :: S2_ERROR_NOT_INIT = 2

S2_ERROR_INIT_FAIL

integer, public, parameter :: S2_ERROR_INIT_FAIL = 3

S2_ERROR_MEM_ALLOC_FAIL

integer, public, parameter :: S2_ERROR_MEM_ALLOC_FAIL = 4

S2_ERROR_ARTH

integer, public, parameter :: S2_ERROR_ARTH = 5

S2_ERROR_SKY_SIZE_WARNING

integer, public, parameter :: S2_ERROR_SKY_SIZE_WARNING = 6

S2_ERROR_SKY_SIZE_INVALID

integer, public, parameter :: S2_ERROR_SKY_SIZE_INVALID = 7

S2_ERROR_SKY_SIZE_NOT_DEF

integer, public, parameter :: S2_ERROR_SKY_SIZE_NOT_DEF = 8

S2_ERROR_SKY_POL_DEF

integer, public, parameter :: S2_ERROR_SKY_POL_DEF = 9

S2_ERROR_SKY_MAP_DEF

integer, public, parameter :: S2_ERROR_SKY_MAP_DEF = 10

S2_ERROR_SKY_MAP_NOT_DEF

integer, public, parameter :: S2_ERROR_SKY_MAP_NOT_DEF = 11

S2_ERROR_SKY_ALM_DEF

integer, public, parameter :: S2_ERROR_SKY_ALM_DEF = 12

S2_ERROR_SKY_ALM_NOT_DEF

integer, public, parameter :: S2_ERROR_SKY_ALM_NOT_DEF = 13

S2_ERROR_SKY_EXT_INVALID

integer, public, parameter :: S2_ERROR_SKY_EXT_INVALID = 14

S2_ERROR_SKY_PIX_INVALID

integer, public, parameter :: S2_ERROR_SKY_PIX_INVALID = 15

S2_ERROR_SKY_NON_CONFORM

integer, public, parameter :: S2_ERROR_SKY_NON_CONFORM = 16

S2_ERROR_SKY_PIX_DIFF

integer, public, parameter :: S2_ERROR_SKY_PIX_DIFF = 17

S2_ERROR_SKY_FTYPE_INVALID

integer, public, parameter :: S2_ERROR_SKY_FTYPE_INVALID = 18

S2_ERROR_SKY_FILE_EXISTS

integer, public, parameter :: S2_ERROR_SKY_FILE_EXISTS = 19

S2_ERROR_SKY_FILE_INVALID

integer, public, parameter :: S2_ERROR_SKY_FILE_INVALID = 20

S2_ERROR_DISNT_BND_INVALID

integer, public, parameter :: S2_ERROR_DISNT_BND_INVALID = 21

S2_ERROR_PL_LMAX_LOW

integer, public, parameter :: S2_ERROR_PL_LMAX_LOW = 22

S2_ERROR_PL_SIZE_INVALID

integer, public, parameter :: S2_ERROR_PL_SIZE_INVALID = 23

S2_ERROR_PL_FILE_EXISTS

integer, public, parameter :: S2_ERROR_PL_FILE_EXISTS = 24

S2_ERROR_PL_FILE_INVALID

integer, public, parameter :: S2_ERROR_PL_FILE_INVALID = 25

S2_ERROR_PL_PLOT_FAIL

integer, public, parameter :: S2_ERROR_PL_PLOT_FAIL = 26

S2_ERROR_WNOISE_TYPE_INVALID

integer, public, parameter :: S2_ERROR_WNOISE_TYPE_INVALID = 27

S2_ERROR_VECT_TYPE_INVALID

integer, public, parameter :: S2_ERROR_VECT_TYPE_INVALID = 28

S2_ERROR_VECT_CART_DIM_INVALID

integer, public, parameter :: S2_ERROR_VECT_CART_DIM_INVALID = 29

S2_ERROR_YLM_ARG_INVALID

integer, public, parameter :: S2_ERROR_YLM_ARG_INVALID = 30

error_comment

character (len=S2_STRING_LEN), private, parameter, dimension (S2_ERROR_NUM) :: error_comment = (/ 'No error                                                                 ', 'Attempt to initialise object that has already been initialised           ', 'Object not initialised                                                   ', 'Object initialisation failed                                             ', 'Memory allocation failed                                                 ', 'Arithmetic exception                                                     ', 'Warning: Sky sizes not in reccommended range (0
 Comment associated with each error type.

halt_default

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

Description of Subroutines and Functions

s2_error

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

Variables:

Author: J. D. McEwen

Version: 0.1 August 2004