src/gray_errors.f90: use macros for error message padding

This commit is contained in:
Lorenzo Figini 2024-11-20 11:12:06 +00:00
parent 6693fdf9b9
commit 4a5c858ae7

View File

@ -25,62 +25,55 @@ module gray_errors
! macros used for defining errors ! macros used for defining errors
#define after(x) x%offset + x%subcases #define after(x) x%offset + x%subcases
#define str character(64) #define str character(64)
#define pad1 '', '', '', '', '', '', '', '', ''
#define pad2 '', '', '', '', '', '', '', ''
#define pad3 '', '', '', '', '', '', ''
! All GRAY errors ! All GRAY errors
type(error_spec), parameter :: unstable_beam = & type(error_spec), parameter :: unstable_beam = &
error_spec(offset=0, subcases=2, & error_spec(offset=0, subcases=1, &
mod='gray_core', proc='gray_main', & mod='gray_core', proc='gray_main', &
msg=[str :: & msg=[str :: 'beamtracing may be unstable', pad1])
'beamtracing may be unstable', &
'', '', '', '', '', '', '', '', ''])
type(error_spec), parameter :: dielectric_tensor = & type(error_spec), parameter :: dielectric_tensor = &
error_spec(offset=after(unstable_beam), subcases=2, & error_spec(offset=after(unstable_beam), subcases=2, &
mod='gray_core', proc='gray_main', & mod='gray_core', proc='gray_main', &
msg=[str :: & msg=[str :: 'ε tensor, overflow in `fsup`', &
'ε tensor, overflow in `fsup`', & 'ε tensor, integration error in `hermitian_2`', &
'ε tensor, integration error in `hermitian_2`', & pad2])
'', '', '', '', '', '', '', ''])
type(error_spec), parameter :: warmdisp_convergence = & type(error_spec), parameter :: warmdisp_convergence = &
error_spec(offset=after(dielectric_tensor), subcases=2, & error_spec(offset=after(dielectric_tensor), subcases=2, &
mod='dispersion', proc='warmdisp', & mod='dispersion', proc='warmdisp', &
msg=[str :: & msg=[str :: 'failed to converge, returned fallback value', &
'failed to converge, returned fallback value', & 'failed to converge, returned last value', &
'failed to converge, returned last value', & pad2])
'', '', '', '', '', '', '', ''])
type(error_spec), parameter :: warmdisp_result = & type(error_spec), parameter :: warmdisp_result = &
error_spec(offset=after(warmdisp_convergence), subcases=2, & error_spec(offset=after(warmdisp_convergence), subcases=2, &
mod='dispersion', proc='warmdisp', & mod='dispersion', proc='warmdisp', &
msg=[str :: & msg=[str :: 'final N⊥² is NaN or ±Infinity', &
'final N⊥² is NaN or ±Infinity', & 'final N⊥² in 3rd quadrant', &
'final N⊥² in 3rd quadrant', & pad2])
'', '', '', '', '', '', '', ''])
type(error_spec), parameter :: negative_absorption = & type(error_spec), parameter :: negative_absorption = &
error_spec(offset=after(warmdisp_result), subcases=1, & error_spec(offset=after(warmdisp_result), subcases=1, &
mod='gray_core', proc='alpha_effj', & mod='gray_core', proc='alpha_effj', &
msg=[str :: & msg=[str :: 'negative absorption coeff.', pad1])
'negative absorption coeff.', &
'', '', '', '', '', '', '', '', ''])
type(error_spec), parameter :: fpp_integration = & type(error_spec), parameter :: fpp_integration = &
error_spec(offset=after(negative_absorption), subcases=1, & error_spec(offset=after(negative_absorption), subcases=1, &
mod='eccd', proc='eccdeff', & mod='eccd', proc='eccdeff', &
msg=[str :: & msg=[str :: 'fpp integration error', pad1])
'fpp integration error', &
'', '', '', '', '', '', '', '', ''])
type(error_spec), parameter :: fcur_integration = & type(error_spec), parameter :: fcur_integration = &
error_spec(offset=after(fpp_integration), subcases=3, & error_spec(offset=after(fpp_integration), subcases=3, &
mod='eccd', proc='eccdeff', & mod='eccd', proc='eccdeff', &
msg=[str :: & msg=[str :: 'fcur integration error (no trapping)', &
'fcur integration error (no trapping)', & 'fcur integration error (1st trapping region)', &
'fcur integration error (1st trapping region)', & 'fcur integration error (2st trapping region)', &
'fcur integration error (2st trapping region)', & pad3])
'', '', '', '', '', '', ''])
! Errors occuring during raytracing ! Errors occuring during raytracing
type(error_spec), parameter :: raytracing_errors(*) = [unstable_beam] type(error_spec), parameter :: raytracing_errors(*) = [unstable_beam]