Debian Codegraph @

dune/istl/solvercategory.hh

raw
1 // SPDX-FileCopyrightText: Copyright © DUNE Project contributors, see file LICENSE.md in module root
2 // SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception
3 // -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
4 // vi: set et ts=4 sw=2 sts=2:
5 #ifndef DUNE_ISTL_SOLVERCATEGORY_HH
6 #define DUNE_ISTL_SOLVERCATEGORY_HH
7
8 #include <dune/common/exceptions.hh>
9
10
11 namespace Dune {
12
13 /**
14 @addtogroup ISTL_Solvers
15 @{
16 */
17
18 /**
19 * @brief Categories for the solvers.
20 */
21 struct SolverCategory
22 {
23 enum Category {
24 //! \brief Category for sequential solvers
25 sequential,
26 //! \brief Category for non-overlapping solvers
27 nonoverlapping,
28 //! \brief Category for overlapping solvers
29 overlapping
30 };
31
32 /** \brief Helperfunction to extract the solver category either from an enum, or from the newly introduced virtual member function */
33 template<typename OP>
34 static Category category(const OP& op, decltype(op.category())* = nullptr)
35 {
36 return op.category();
37 }
38
39 #ifndef DOXYGEN
40 // template<typename OP>
41 // static Category category(const OP& op, decltype(op.getSolverCategory())* = nullptr)
42 // {
43 // return op.getSolverCategory();
44 // }
45
46 template<typename OP>
47 static Category category(const OP& op, decltype(op.category)* = nullptr)
48 {
49 return OP::category;
50 }
51 #endif
52 };
53
54 class InvalidSolverCategory : public InvalidStateException{};
55
56 /** @} end documentation */
57
58 } // end namespace
59
60 #endif