Amesos2 - Direct Sparse Solver Interfaces  Version of the Day
Amesos2_SolverTraits.hpp
Go to the documentation of this file.
1 // @HEADER
2 // *****************************************************************************
3 // Amesos2: Templated Direct Sparse Solver Package
4 //
5 // Copyright 2011 NTESS and the Amesos2 contributors.
6 // SPDX-License-Identifier: BSD-3-Clause
7 // *****************************************************************************
8 // @HEADER
9 
10 
21 #ifndef AMESOS2_SOLVERTRAITS_HPP
22 #define AMESOS2_SOLVERTRAITS_HPP
23 
24 #include "Amesos2_Meta.hpp"
25 #include "Amesos2_MatrixAdapter.hpp"
26 
27 namespace Amesos2 {
28 
36  template <template <class,class> class ConcreteSolver>
37  struct solver_traits {
38  typedef Meta::nil_t supported_scalars;
39  };
40 
41 
43  // Related meta-functions //
45 
58  /* SR: We will not use external initialization for the static const types.
59  * Combined with template meta programming this fails in Intel compilers
60  * 11-13. Moving all the initializations inside the declarations.
61  */
62  template <template <class,class> class ConcreteSolver,
63  typename Scalar>
65  static const bool value =
66  std::conditional_t<std::is_same_v<typename solver_traits<ConcreteSolver>::supported_scalars, Meta::nil_t>,
67  std::true_type,
68  Meta::type_list_contains<
69  typename solver_traits<ConcreteSolver>::supported_scalars,
70  Scalar> >::value;
71  };
72 
73  template <template <class,class> class ConcreteSolver,
74  typename Matrix>
75  struct solver_supports_matrix {
76  static const bool value = true;
77  };
78 
79  // for kokkos adapter we only allow this for the specific solvers which
80  // are using it. This is to avoid having ETI setup for all solvers. The
81  // kokkos adapter is for testing UVM off and would become relic when Tpetra
82  // switches to UVM off. To support this, solvers like Tacho override this
83  // method and return true.
84  template <template <class,class> class ConcreteSolver,
85  typename Scalar, typename LocalOrdinal, typename ExecutionSpace>
86  struct solver_supports_matrix<ConcreteSolver,
87  KokkosSparse::CrsMatrix<Scalar, LocalOrdinal, ExecutionSpace>> {
88  static const bool value = false;
89  };
90 
91 } // end namespace Amesos2
92 
93 #endif // AMESOS2_SOLVERTRAITS_HPP
Provides some simple meta-programming utilities for Amesos2.
Provides traits about solvers.
Definition: Amesos2_SolverTraits.hpp:37
Check whether a solver supports a scalar type.
Definition: Amesos2_SolverTraits.hpp:64