00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 subroutine psmile_error ( ierror, char_string, ierrp, nerrp, &
00012 file, line )
00013
00014
00015
00016 use PSMILe, dummy_interface => PSMILe_Error
00017 use PRISM_constants
00018
00019 implicit none
00020
00021
00022
00023 integer, Intent (In) :: ierror
00024
00025
00026
00027 character(len=*), Intent(In) :: char_string
00028
00029
00030
00031 integer, Intent (In) :: nerrp
00032
00033
00034
00035 integer, Intent (In) :: ierrp (nerrp)
00036
00037
00038
00039 character(len=*), Intent(In) :: file
00040
00041
00042
00043 integer, Intent (In) :: line
00044
00045
00046
00047
00048
00049 integer :: lenstr
00050 logical :: abort
00051 character(len=16) :: ch_rank
00052 integer :: ipos
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079 Character(len=len_cvs_string), save :: mycvs =
00080 '$Id: psmile_error.F90 2706 2010-11-04 15:33:32Z hanke $'
00081
00082
00083
00084 if ( (PRISM_Error_MPI <= ierror .and. ierror <= 10) .or. &
00085 (ierror == PRISM_Error_Parameter) .or. &
00086 (ierror == PRISM_Error_Alloc) .or. &
00087 (ierror == PRISM_Error_Dealloc) .or. &
00088 (ierror == PRISM_Error_Invalid_Arg) .or. &
00089 (ierror == PRISM_Error_Arg) .or. &
00090 (ierror == PRISM_Error_Arglist) )then
00091 #ifdef DEBUG
00092 print *, 'psmile_error_common : ierror nerrp = ', ierror, nerrp
00093 #endif
00094
00095
00096 call psmile_error_common(ierror, char_string, ierrp, nerrp, file, line)
00097
00098 else
00099
00100
00101
00102
00103 call psmile_flushstd
00104
00105 abort = .true.
00106
00107
00108
00109 ipos = 0
00110 lenstr = len_trim (char_string)
00111 call psmile_int2char ( Appl%rank, ch_rank, ipos)
00112
00113 write (*, 9990) ch_rank(1:ipos), trim(Appl%name), file, line
00114
00115
00116 if (ierror == PRISM_Error_Initialized) then
00117
00118 write (*, 1120) char_string(1:lenstr)
00119
00120 else if (ierror == PRISM_Error_App) then
00121
00122 write (*, 1160) char_string(1:lenstr), ierrp (1), ierrp (2)
00123
00124 abort = .true.
00125
00126 else if (ierror == PRISM_Error_InitApp) then
00127
00128 write (*, 1165) char_string(1:lenstr), ierrp (1), ierrp (2)
00129
00130 abort = .true.
00131
00132 else if (ierror == PRISM_Error_Grid) then
00133
00134 write (*, 1170) trim(Grids(ierrp(1))%grid_name), &
00135 trim(Comps(ierrp(2))%comp_name), &
00136 ierrp (3), &
00137 char_string(1:lenstr)
00138
00139 else if (ierror == PRISM_Error_Gridtype) then
00140
00141 write (*, 1171) trim(Grids(ierrp(1))%grid_name), &
00142 Grids(ierrp(1))%grid_type, &
00143 char_string(1:lenstr)
00144
00145 else if (ierror == PRISM_Error_Mask) then
00146
00147 write (*, 1175) trim(Grids(ierrp(1))%grid_name), &
00148 trim(Comps(ierrp(2))%comp_name), &
00149 ierrp (3), &
00150 char_string(1:lenstr)
00151
00152 else if (ierror == PRISM_Error_Comp_name) then
00153
00154 write (*, 1180) "component", char_string(1:lenstr)
00155
00156 abort = .true.
00157
00158 else if (ierror == PRISM_Error_Appl_name) then
00159
00160 write (*, 1180) "application", char_string(1:lenstr)
00161
00162 abort = .true.
00163
00164 else if (ierror == PRISM_Error_Wrong) then
00165
00166 write (*, 1200) ierrp (2), ierrp (3), ierrp (1)
00167
00168 else if (ierror == PRISM_Error_Date) then
00169
00170 write (*, 1210) char_string(1:lenstr), ierrp (1)
00171
00172 abort = .true.
00173
00174 else if (ierror == PRISM_Error_Size) then
00175
00176 write (*, 1220) char_string(1:lenstr), ierrp (1), ierrp (2), ierrp (3)
00177
00178 abort = .true.
00179
00180 else if (ierror == PRISM_Error_Interp_type) then
00181
00182 write (*, 1230) ierrp (1), char_string(1:lenstr)
00183
00184 abort = .true.
00185
00186
00187
00188 else if (ierror == PRISM_Error_IO_Meta) then
00189
00190 write (*, 4190) char_string(1:lenstr), ierrp (1)
00191
00192 abort = .true.
00193
00194
00195
00196
00197 else if (ierror == PRISM_Error_Internal) then
00198
00199 write (*, 9960) char_string(1:lenstr), nerrp
00200 write (*, 9970) ierrp
00201
00202 else
00203
00204
00205
00206 write (*, 9980) ierror, char_string(1:lenstr), nerrp
00207 write (*, 9970) ierrp
00208 endif
00209
00210 call psmile_flushstd
00211
00212
00213
00214 if (abort) call PSMILe_Abort
00215
00216
00217 endif
00218
00219
00220
00221
00222
00223
00224 1010 format (1x, 'Error in MPI routine ', a, ': Error message :', a)
00225 1020 format (1x, 'Error occured in Send to process', i4, ' using tag', i5)
00226 1030 format (1x, 'Error occured in Receive from process', i4, ' using tag', i5)
00227 1090 format (1x, 'Error parameters:', (1x, 10(i7, :, ',')))
00228
00229
00230
00231 1110 format (1x, 'Value of parameter ', a, ' is insufficient.', &
00232 /1x, 'Current value:', i5, '; should be ', i6)
00233 1120 format (1x, 'Error in routine ', a, '. PRISM is not initialized')
00234 1130 format (1x, 'Cannot allocate ', a, &
00235 '. Number of data items to be allocated was', i9)
00236 1140 format (1x, 'Cannot deallocate ', a, '.')
00237 1150 format (1x, 'Argument ', a, ' is out of range.', &
00238 /1x, 'Current value:', i5)
00239 1160 format (1x, 'Error in specification of applications.', 1x, a, &
00240 1x, i7, 1x, i7)
00241 1165 format (1x, 'Error in initialisation of applications.', 1x, a, &
00242 1x, i7, 1x, i7)
00243 1190 format (1x, 'Error in argument list: ', a, (1x, 10(i7, :, ',')))
00244
00245 1200 format (1x, 'Wrong message from sender', i7, ' received. ', &
00246 'Message tag =', i7, '; Message length =', i7)
00247 1210 format (1x, 'Inconsistent Date Argument: ', a, ' for field_id ', i5)
00248 1220 format (1x, 'Inconsistent sizes specified for field ', a, &
00249 ' with id ', i5, '; lengths are ', i10, i10)
00250 1230 format (1x, 'Invalid interpolation type', i9, ' specified for grid', &
00251 ' of type ', a, '.')
00252
00253
00254
00255
00256
00257 1170 format (1x, 'Error in Grid definition of grid ', a, &
00258 ' of comp ', a, ':' &
00259 /1x, 'Grid type:', i7 &
00260 /1x, a)
00261 1171 format (1x, 'Error in Corner definition of grid ', a, &
00262 /1x, 'Grid type:', i8 , &
00263 /1x, 'requires other corner shapes than ', a )
00264
00265 1175 format (1x, 'Error in Mask definition of grid ', a, &
00266 ' of comp ', a, ':' &
00267 /1x, 'Mask id:', i7 &
00268 /1x, a )
00269
00270 1180 format (1x, 'Unknown ', a, ' name "', a, '" specified')
00271
00272
00273
00274 4190 format (1x, 'Error in PRISM I/O: ', a, i7)
00275
00276
00277
00278 9960 format (1x, 'Internal PSMILe error', '; string "', a, '"; nerrp', i3)
00279
00280 9970 format (1x, 10i7)
00281 9980 format (1x, 'Unknown error code', i4, '; string ', a, '; nerrp', i3)
00282 9990 format (1x, '[', a, '] PSMILe: Error in application ', a, &
00283 '; File ', a, ': line', i6 )
00284 end subroutine PSMILe_Error