Module s2_error_mod

module s2_error_mod

        ! Uses
    use s2_types_mod, only: S2_STRING_LEN

        ! Variables
    integer, private, parameter :: S2_ERROR_NUM = 37
    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_MEM_OUT_OF_BOUNDS = 5
    integer, public, parameter :: S2_ERROR_ARTH = 6
    integer, public, parameter :: S2_ERROR_SKY_SIZE_WARNING = 7
    integer, public, parameter :: S2_ERROR_SKY_SIZE_INVALID = 8
    integer, public, parameter :: S2_ERROR_SKY_SIZE_NOT_DEF = 9
    integer, public, parameter :: S2_ERROR_SKY_POL_DEF = 10
    integer, public, parameter :: S2_ERROR_SKY_MAP_DEF = 11
    integer, public, parameter :: S2_ERROR_SKY_MAP_NOT_DEF = 12
    integer, public, parameter :: S2_ERROR_SKY_ALM_DEF = 13
    integer, public, parameter :: S2_ERROR_SKY_ALM_NOT_DEF = 14
    integer, public, parameter :: S2_ERROR_SKY_EXT_INVALID = 15
    integer, public, parameter :: S2_ERROR_SKY_PIX_INVALID = 16
    integer, public, parameter :: S2_ERROR_SKY_NON_CONFORM = 17
    integer, public, parameter :: S2_ERROR_SKY_PIX_DIFF = 18
    integer, public, parameter :: S2_ERROR_SKY_FTYPE_INVALID = 19
    integer, public, parameter :: S2_ERROR_SKY_FILE_EXISTS = 20
    integer, public, parameter :: S2_ERROR_SKY_FILE_INVALID = 21
    integer, public, parameter :: S2_ERROR_SKY_FOV_METHOD_INVALID = 22
    integer, public, parameter :: S2_ERROR_SKY_DER_TYPE_INVALID = 23
    integer, public, parameter :: S2_ERROR_SKY_ABGRID_TYPE_INVALID = 24
    integer, public, parameter :: S2_ERROR_DISNT_BND_INVALID = 25
    integer, public, parameter :: S2_ERROR_PL_LMAX_LOW = 26
    integer, public, parameter :: S2_ERROR_PL_SIZE_INVALID = 27
    integer, public, parameter :: S2_ERROR_PL_FILE_EXISTS = 28
    integer, public, parameter :: S2_ERROR_PL_FILE_INVALID = 29
    integer, public, parameter :: S2_ERROR_PL_PLOT_FAIL = 30
    integer, public, parameter :: S2_ERROR_WNOISE_TYPE_INVALID = 31
    integer, public, parameter :: S2_ERROR_VECT_TYPE_INVALID = 32
    integer, public, parameter :: S2_ERROR_VECT_CART_DIM_INVALID = 33
    integer, public, parameter :: S2_ERROR_YLM_ARG_INVALID = 34
    integer, public, parameter :: S2_ERROR_PROJ_METHOD_INVALID = 35
    integer, public, parameter :: S2_ERROR_PROJ_FIELD_INVALID = 36
    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                                                 ', 'Memory out of bounds                                                     ', 'Arithmetic exception                                                     ', 'Warning: Sky sizes not in reccommended range (0halt_default = (/ .false., .true., .true., .true., .true., .true., .true., .false., .true., .true., .false., .false., .true., .false., .true., .true., .true., .true., .false., .true., .true., .true., .true., .true., .true., .false., .false., .true., .true., .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 = 37

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_MEM_OUT_OF_BOUNDS

integer, public, parameter :: S2_ERROR_MEM_OUT_OF_BOUNDS = 5

S2_ERROR_ARTH

integer, public, parameter :: S2_ERROR_ARTH = 6

S2_ERROR_SKY_SIZE_WARNING

integer, public, parameter :: S2_ERROR_SKY_SIZE_WARNING = 7

S2_ERROR_SKY_SIZE_INVALID

integer, public, parameter :: S2_ERROR_SKY_SIZE_INVALID = 8

S2_ERROR_SKY_SIZE_NOT_DEF

integer, public, parameter :: S2_ERROR_SKY_SIZE_NOT_DEF = 9

S2_ERROR_SKY_POL_DEF

integer, public, parameter :: S2_ERROR_SKY_POL_DEF = 10

S2_ERROR_SKY_MAP_DEF

integer, public, parameter :: S2_ERROR_SKY_MAP_DEF = 11

S2_ERROR_SKY_MAP_NOT_DEF

integer, public, parameter :: S2_ERROR_SKY_MAP_NOT_DEF = 12

S2_ERROR_SKY_ALM_DEF

integer, public, parameter :: S2_ERROR_SKY_ALM_DEF = 13

S2_ERROR_SKY_ALM_NOT_DEF

integer, public, parameter :: S2_ERROR_SKY_ALM_NOT_DEF = 14

S2_ERROR_SKY_EXT_INVALID

integer, public, parameter :: S2_ERROR_SKY_EXT_INVALID = 15

S2_ERROR_SKY_PIX_INVALID

integer, public, parameter :: S2_ERROR_SKY_PIX_INVALID = 16

S2_ERROR_SKY_NON_CONFORM

integer, public, parameter :: S2_ERROR_SKY_NON_CONFORM = 17

S2_ERROR_SKY_PIX_DIFF

integer, public, parameter :: S2_ERROR_SKY_PIX_DIFF = 18

S2_ERROR_SKY_FTYPE_INVALID

integer, public, parameter :: S2_ERROR_SKY_FTYPE_INVALID = 19

S2_ERROR_SKY_FILE_EXISTS

integer, public, parameter :: S2_ERROR_SKY_FILE_EXISTS = 20

S2_ERROR_SKY_FILE_INVALID

integer, public, parameter :: S2_ERROR_SKY_FILE_INVALID = 21

S2_ERROR_SKY_FOV_METHOD_INVALID

integer, public, parameter :: S2_ERROR_SKY_FOV_METHOD_INVALID = 22

S2_ERROR_SKY_DER_TYPE_INVALID

integer, public, parameter :: S2_ERROR_SKY_DER_TYPE_INVALID = 23

S2_ERROR_SKY_ABGRID_TYPE_INVALID

integer, public, parameter :: S2_ERROR_SKY_ABGRID_TYPE_INVALID = 24

S2_ERROR_DISNT_BND_INVALID

integer, public, parameter :: S2_ERROR_DISNT_BND_INVALID = 25

S2_ERROR_PL_LMAX_LOW

integer, public, parameter :: S2_ERROR_PL_LMAX_LOW = 26

S2_ERROR_PL_SIZE_INVALID

integer, public, parameter :: S2_ERROR_PL_SIZE_INVALID = 27

S2_ERROR_PL_FILE_EXISTS

integer, public, parameter :: S2_ERROR_PL_FILE_EXISTS = 28

S2_ERROR_PL_FILE_INVALID

integer, public, parameter :: S2_ERROR_PL_FILE_INVALID = 29

S2_ERROR_PL_PLOT_FAIL

integer, public, parameter :: S2_ERROR_PL_PLOT_FAIL = 30

S2_ERROR_WNOISE_TYPE_INVALID

integer, public, parameter :: S2_ERROR_WNOISE_TYPE_INVALID = 31

S2_ERROR_VECT_TYPE_INVALID

integer, public, parameter :: S2_ERROR_VECT_TYPE_INVALID = 32

S2_ERROR_VECT_CART_DIM_INVALID

integer, public, parameter :: S2_ERROR_VECT_CART_DIM_INVALID = 33

S2_ERROR_YLM_ARG_INVALID

integer, public, parameter :: S2_ERROR_YLM_ARG_INVALID = 34

S2_ERROR_PROJ_METHOD_INVALID

integer, public, parameter :: S2_ERROR_PROJ_METHOD_INVALID = 35

S2_ERROR_PROJ_FIELD_INVALID

integer, public, parameter :: S2_ERROR_PROJ_FIELD_INVALID = 36

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                                                 ', 'Memory out of bounds                                                     ', '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., .true., .false., .true., .true., .false., .false., .true., .false., .true., .true., .true., .true., .false., .true., .true., .true., .true., .true., .true., .false., .false., .true., .true., .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