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