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 (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., .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
Author: J. D. McEwen (mcewen@mrao.cam.ac.uk)
Version: 0.1 August 2004
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 (0Comment 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_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