Amesos2 - Direct Sparse Solver Interfaces  Version of the Day
Amesos2_KLU2_FunctionMap.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 
18 #ifndef AMESOS2_KLU2_FUNCTIONMAP_HPP
19 #define AMESOS2_KLU2_FUNCTIONMAP_HPP
20 
21 // Note since Klu2 is templated we don't use function maps.
22 // Includes are still collected here which mirrors setup in other solvers.
23 
24 #ifdef HAVE_TEUCHOS_COMPLEX
25 #include <complex>
26 #endif
27 
28 #include "Amesos2_FunctionMap.hpp"
29 #include "Amesos2_KLU2_TypeMap.hpp"
30 
31 /* External definitions of the KLU2 functions
32  */
33 namespace KLU2 {
34 #include "klu2_defaults.hpp"
35 #include "klu2_analyze.hpp"
36 #include "klu2_factor.hpp"
37 #include "klu2_solve.hpp"
38 #include "klu2_tsolve.hpp"
39 #include "klu2_free_symbolic.hpp"
40 #include "klu2_free_numeric.hpp"
41 } // end namespace KLU2
42 
43 namespace Amesos2 {
44 
45 #ifdef HAVE_TEUCHOS_COMPLEX
46  template <>
47  struct FunctionMap<KLU2,Kokkos::complex<double>>
48  {
49  static std::complex<double> * convert_scalar(Kokkos::complex<double> * pData) {
50  return reinterpret_cast<std::complex<double> *>(pData);
51  }
52  };
53 
54  // Note that Klu2 does not support complex float so it does not appear here.
55 #endif // HAVE_TEUCHOS_COMPLEX
56 
57  // if not specialized, then assume generic conversion is fine
58  template <typename scalar_t>
59  struct FunctionMap<KLU2,scalar_t>
60  {
61  static scalar_t * convert_scalar(scalar_t * pData) {
62  return pData; // no conversion necessary
63  }
64  };
65 
66 } // end namespace Amesos2
67 
68 #endif // AMESOS2_KLU2_FUNCTIONMAP_HPP
Declaration of Function mapping class for Amesos2.
Provides definition of KLU2 types as well as conversions and type traits.