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