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 (0Functionality 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.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. /) ! Subroutines and functions public subroutine s2_error (error_code, procedure, comment_add, comment_out, halt_in) end module s2_error_mod
Author: J. D. McEwen (mcewen@mrao.cam.ac.uk)
Version: 0.1 August 2004
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 (0Comment 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_errorDisplay error message corresponding to error_code and halt program execution if required.Variables:
- error_code: Integer error code.
- [procedure]: Procedure name where s2_error called from. Displayed when error message printed to screen.
- [comment_add]: If present, additional comment to append to default error comment.
- [comment_out]: If present the error comment is copied to comment_out on output.
- [halt_in]: If present overrides default halt value.
Author: J. D. McEwen
Version: 0.1 August 2004