13 use s2_types_mod
, only: s2_string_len
31 integer,
parameter :: BIANCHI2_ERROR_NUM = 11
33 integer,
public,
parameter :: &
34 BIANCHI2_ERROR_NONE = 0, &
35 BIANCHI2_ERROR_INIT = 1, &
36 BIANCHI2_ERROR_NOT_INIT = 2, &
37 BIANCHI2_ERROR_INIT_FAIL = 3, &
38 BIANCHI2_ERROR_MEM_ALLOC_FAIL = 4, &
39 BIANCHI2_ERROR_SIM_PARAM_INVALID = 5, &
40 BIANCHI2_ERROR_SIM_NARG = 6, &
41 BIANCHI2_ERROR_SKY_NUM_FAIL = 7, &
42 BIANCHI2_ERROR_TMPLFIT_FAIL = 8, &
43 BIANCHI2_ERROR_PLM1TABLE_THETA_INVALID = 9, &
44 BIANCHI2_ERROR_PLM1TABLE_L_INVALID = 10
50 character(len=S2_STRING_LEN),
parameter :: &
51 error_comment(BIANCHI2_ERROR_NUM) = &
54 'Attempt to initialise object that has already been initialised ', &
55 'Object not initialised ', &
56 'Object initialisation failed ', &
57 'Memory allocation failed ', &
58 'Invalid simulation parameter ', &
59 'Invalid number of command line parameters ', &
60 'Numerical routine failed ', &
61 'Template fitting failed ', &
62 'Invalid theta for Plm1 lookup table (not on regular grid) ', &
63 'Invalid l for Plm1 lookup table (out of range) ' &
67 logical,
parameter :: &
68 halt_default(BIANCHI2_ERROR_NUM) = &
107 comment_out, halt_in)
109 integer,
intent(in) :: error_code
110 character(len=*),
intent(in),
optional :: procedure, comment_add
111 character(len=*),
intent(inout),
optional :: comment_out
112 logical,
intent(in),
optional :: halt_in
115 character(len=*),
parameter :: comment_prefix =
'BIANCHI2_ERROR: '
121 if(present(procedure))
then
123 if(present(comment_add))
then
124 write(*,
'(a,a,a,a,a,a,a,a)') comment_prefix,
'Error ''', &
125 trim(error_comment(error_code+1)), &
126 ''' occured in procedure ''', &
129 ' - ', trim(comment_add)
131 write(*,
'(a,a,a,a,a,a)') comment_prefix,
'Error ''', &
132 trim(error_comment(error_code+1)), &
133 ''' occured in procedure ''', &
140 if(present(comment_add))
then
141 write(*,
'(a,a,a,a)') comment_prefix, &
142 trim(error_comment(error_code+1)), &
143 ' - ', trim(comment_add)
145 write(*,
'(a,a)') comment_prefix, trim(error_comment(error_code+1))
151 if(present(comment_out)) comment_out = error_comment(error_code+1)
157 if( present(halt_in) )
then
160 halt = halt_default(error_code+1)
164 write(*,
'(a,a,a,a,a)') comment_prefix, &
165 ' Halting program execution ', &
166 'due to error ''', trim(error_comment(error_code+1)),
''''