Amesos2 - Direct Sparse Solver Interfaces Version of the Day
Amesos2_CssMKL_TypeMap.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
22#ifndef AMESOS2_CLUSTERSPARSEMKL_TYPEMAP_HPP
23#define AMESOS2_CLUSTERSPARSEMKL_TYPEMAP_HPP
24
25#ifdef HAVE_TEUCHOS_COMPLEX
26#include <complex>
27#endif
28
29#include <mkl_types.h>
30#include <mkl_dss.h>
31
32#include <Teuchos_as.hpp>
33#ifdef HAVE_TEUCHOS_COMPLEX
34#include <Teuchos_SerializationTraits.hpp>
35#endif
36
37#include "Amesos2_TypeMap.hpp"
39
40namespace Amesos2 {
41
42 // forward declaration due to circular reference
43 template <class, class> class CssMKL;
44
45 /* Specialize the Amesos::TypeMap struct for CssMKL types.
46 *
47 * Additional nested types may be added without harm. For an example, look at
48 * Amesos2_Superlu_TypeMap.hpp
49 */
50
51 template <>
52 struct TypeMap<CssMKL,float>
53 {
54 typedef PMKL::_REAL_t type;
55 typedef PMKL::_REAL_t magnitude_type;
56 };
57
58
59 template <>
60 struct TypeMap<CssMKL,double>
61 {
62 typedef PMKL::_DOUBLE_PRECISION_t type;
63 typedef PMKL::_DOUBLE_PRECISION_t magnitude_type;
64 };
65
66#ifdef HAVE_TEUCHOS_COMPLEX
67
68 /*
69 * We map the std complex types to the appropriate CssMKL complex
70 * types.
71 */
72
73 template <>
74 struct TypeMap<CssMKL,std::complex<float> >
75 {
76 typedef PMKL::_MKL_Complex8 type;
77 typedef PMKL::_REAL_t magnitude_type;
78 };
79
80
81 template <>
82 struct TypeMap<CssMKL,std::complex<double> >
83 {
84 typedef PMKL::_DOUBLE_COMPLEX_t type;
85 typedef PMKL::_DOUBLE_PRECISION_t magnitude_type;
86 };
87
88
89 template <>
90 struct TypeMap<CssMKL,PMKL::_MKL_Complex8>
91 {
92 typedef PMKL::_MKL_Complex8 type;
93 typedef PMKL::_REAL_t magnitude_type;
94 };
95
96
97 template <>
98 struct TypeMap<CssMKL,PMKL::_DOUBLE_COMPLEX_t>
99 {
100 typedef PMKL::_DOUBLE_COMPLEX_t type;
101 typedef PMKL::_DOUBLE_PRECISION_t magnitude_type;
102 };
103#endif // HAVE_TEUCHOS_COMPLEX
104
105 template <>
106 struct TypeMap<CssMKL,int>
107 {
108 typedef PMKL::_INTEGER_t type;
109 //typedef int type;
110 };
111
112 template <>
113 struct TypeMap<CssMKL,long long int>
114 {
115 typedef long long int type;
116 };
117
118 /*
119 * We check whether the size of long int is bigger than an int. If
120 * it is, then long int should be the same size as a long long int,
121 * so we can safely promote. Otherwise, long int will probably be
122 * the same size as int, and we can safely treat it as such.
123 */
124 template <>
125 struct TypeMap<CssMKL,long int>
126 {
127 typedef std::conditional_t<
128 sizeof(int) < sizeof(long int),
129 TypeMap<CssMKL,long long int>::type,
130 TypeMap<CssMKL,int>::type > type;
131 };
132
133} // end namespace Amesos
134
135#endif // AMESOS2_CLUSTERSPARSEMKL_TYPEMAP_HPP
Provides definition of PardisoMKL types as well as conversions and type traits. For the purpose of de...