qrupdate-ng
1.2.0
Toggle main menu visibility
Loading...
Searching...
No Matches
qrupdate_error.f90
Go to the documentation of this file.
1
! Copyright (C) 2026 Martin Köhler <koehlerm(AT)mpi-magdeburg.mpg.de>
2
!
3
! This file is part of qrupdate-ng.
4
!
5
! qrupdate is free software; you can redistribute it and/or modify
6
! it under the terms of the GNU General Public License as published by
7
! the Free Software Foundation; either version 3 of the License, or
8
! (at your option) any later version.
9
!
10
! This program is distributed in the hope that it will be useful,
11
! but WITHOUT ANY WARRANTY; without even the implied warranty of
12
! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
! GNU General Public License for more details.
14
!
15
! You should have received a copy of the GNU General Public License
16
! along with this software; see the file COPYING. If not, see
17
! <http://www.gnu.org/licenses/>.
18
!
19
!> \brief Module for custom error handling.
20
!>
21
!> This module provides a mechanism to override the default BLAS/LAPACK
22
!> error handler (xerbla). Users can specify a custom subroutine to
23
!> handle errors, along with optional auxiliary data.
24
module
qrupdate_error
25
use
qrupdate_blas
26
implicit none
27
28
!> \brief Abstract interface for custom error handlers.
29
!> \ingroup error
30
abstract
interface
31
subroutine
error_handler_if
(srname, info, aux)
32
character(len=*)
,
intent(in)
:: srname
33
integer
,
intent(in)
:: info
34
class
(*),
optional
,
intent(in)
:: aux
35
end subroutine
error_handler_if
36
end interface
37
38
procedure
(
error_handler_if
),
pointer
:: global_error_handler => null()
39
class
(*),
pointer
:: global_error_aux => null()
40
41
private
:: global_error_handler, global_error_aux
42
contains
43
44
!> \brief Sets the custom error handler.
45
!>
46
!> \param[in] p_handler
47
!> \verbatim
48
!> p_handler is a procedure pointer conforming to the
49
!> error_handler_if interface.
50
!> \endverbatim
51
!> \ingroup error
52
subroutine
qrupdate_set_error
(p_handler)
53
procedure
(
error_handler_if
),
pointer
,
intent(in)
:: p_handler
54
global_error_handler => p_handler
55
end subroutine
qrupdate_set_error
56
57
!> \brief Sets auxiliary data for the error handler.
58
!>
59
!> \param[in] p_aux
60
!> \verbatim
61
!> p_aux is a pointer to a polymorphic object (class(*))
62
!> that will be passed to the error handler.
63
!> \endverbatim
64
!> \ingroup error
65
subroutine
qrupdate_set_error_data
(p_aux)
66
class
(*),
pointer
:: p_aux
67
global_error_aux => p_aux
68
end subroutine
qrupdate_set_error_data
69
70
!> \brief Dispatches error reporting to the handler.
71
!>
72
!> This subroutine checks if a custom error handler has been set via
73
!> qrupdate_set_error. If so, it calls that handler with the provided
74
!> routine name, error code, and any set auxiliary data. Otherwise, it
75
!> falls back to the standard LAPACK xerbla routine.
76
!>
77
!> \param[in] srname
78
!> \verbatim
79
!> srname is CHARACTER(LEN=*)
80
!> The name of the routine that encountered the error.
81
!> \endverbatim
82
!> \param[in] info
83
!> \verbatim
84
!> info is INTEGER
85
!> The error code.
86
!> \endverbatim
87
!> \ingroup error
88
subroutine
qrupdate_xerror
(srname, info)
89
character(len=*)
,
intent(in)
:: srname
90
integer
,
intent(in)
:: info
91
if
(
associated
(global_error_handler))
then
92
call
global_error_handler(srname, info, global_error_aux)
93
else
94
call
xerbla
(srname, info)
95
end if
96
end subroutine
qrupdate_xerror
97
98
end module
qrupdate_error
qrupdate_error::qrupdate_xerror
subroutine qrupdate_xerror(srname, info)
Dispatches error reporting to the handler.
Definition
qrupdate_error.f90:89
qrupdate_error::qrupdate_set_error
subroutine qrupdate_set_error(p_handler)
Sets the custom error handler.
Definition
qrupdate_error.f90:53
qrupdate_error::qrupdate_set_error_data
subroutine qrupdate_set_error_data(p_aux)
Sets auxiliary data for the error handler.
Definition
qrupdate_error.f90:66
qrupdate_blas::xerbla
Definition
qrupdate_blas.f90:66
qrupdate_error::error_handler_if
Abstract interface for custom error handlers.
Definition
qrupdate_error.f90:31
qrupdate_blas
Definition
qrupdate_blas.f90:25
qrupdate_error
Module for custom error handling.
Definition
qrupdate_error.f90:24
src
qrupdate_error.f90
Generated by
1.17.0