Reference documentation for deal.II version 9.2.0
\(\newcommand{\dealvcentcolon}{\mathrel{\mathop{:}}}\) \(\newcommand{\dealcoloneq}{\dealvcentcolon\mathrel{\mkern-1.2mu}=}\) \(\newcommand{\jump}[1]{\left[\!\left[ #1 \right]\!\right]}\) \(\newcommand{\average}[1]{\left\{\!\left\{ #1 \right\}\!\right\}}\)
complex_overloads.h
Go to the documentation of this file.
1 // ---------------------------------------------------------------------
2 //
3 // Copyright (C) 1998 - 2019 by the deal.II authors
4 //
5 // This file is part of the deal.II library.
6 //
7 // The deal.II library is free software; you can use it, redistribute
8 // it, and/or modify it under the terms of the GNU Lesser General
9 // Public License as published by the Free Software Foundation; either
10 // version 2.1 of the License, or (at your option) any later version.
11 // The full text of the license can be found in the file LICENSE.md at
12 // the top level directory of deal.II.
13 //
14 // ---------------------------------------------------------------------
15 
16 #ifndef dealii_complex_overloads_h
17 #define dealii_complex_overloads_h
18 
19 #include <deal.II/base/config.h>
20 
22 
24 
25 // Forward declarations
26 #ifndef DOXYGEN
27 template <typename T, typename U>
28 struct ProductType;
29 #endif
30 
31 #ifndef DEAL_II_HAVE_COMPLEX_OPERATOR_OVERLOADS
32 
39 template <typename T, typename U>
40 inline typename std::enable_if<
42  typename ProductType<std::complex<T>, std::complex<U>>::type>::type
43 operator*(const std::complex<T> &left, const std::complex<U> &right)
44 {
45  using result_type =
46  typename ProductType<std::complex<T>, std::complex<U>>::type;
47  return static_cast<result_type>(left) * static_cast<result_type>(right);
48 }
49 
57 template <typename T, typename U>
58 inline typename std::enable_if<
60  typename ProductType<std::complex<T>, std::complex<U>>::type>::type
61 operator/(const std::complex<T> &left, const std::complex<U> &right)
62 {
63  using result_type =
64  typename ProductType<std::complex<T>, std::complex<U>>::type;
65  return static_cast<result_type>(left) / static_cast<result_type>(right);
66 }
67 
75 template <typename T, typename U>
76 inline
80  operator*(const std::complex<T> &left, const U &right)
81 {
82  using result_type = typename ProductType<std::complex<T>, U>::type;
83  return static_cast<result_type>(left) * static_cast<result_type>(right);
84 }
85 
93 template <typename T, typename U>
94 inline
98  operator/(const std::complex<T> &left, const U &right)
99 {
100  using result_type = typename ProductType<std::complex<T>, U>::type;
101  return static_cast<result_type>(left) / static_cast<result_type>(right);
102 }
103 
111 template <typename T, typename U>
112 inline typename
113 
117  operator*(const T &left, const std::complex<U> &right)
118 {
119  using result_type = typename ProductType<T, std::complex<U>>::type;
120  return static_cast<result_type>(left) * static_cast<result_type>(right);
121 }
122 
130 template <typename T, typename U>
131 inline
135  operator/(const T &left, const std::complex<U> &right)
136 {
137  using result_type = typename ProductType<T, std::complex<U>>::type;
138  return static_cast<result_type>(left) / static_cast<result_type>(right);
139 }
140 #endif /* DEAL_II_HAVE_COMPLEX_OPERATOR_OVERLOADS */
141 
143 
144 #endif
LAPACKSupport::U
static const char U
Definition: lapack_support.h:167
ProductType::type
typename internal::ProductTypeImpl< typename std::decay< T >::type, typename std::decay< U >::type >::type type
Definition: template_constraints.h:426
ProductType
Definition: template_constraints.h:422
LAPACKSupport::T
static const char T
Definition: lapack_support.h:163
Point::operator*
Point< dim, typename ProductType< Number, typename EnableIfScalar< OtherNumber >::type >::type > operator*(const OtherNumber) const
DEAL_II_NAMESPACE_OPEN
#define DEAL_II_NAMESPACE_OPEN
Definition: config.h:358
value
static const bool value
Definition: dof_tools_constraints.cc:433
ProductType::operator/
std::enable_if< std::is_floating_point< T >::value &&std::is_floating_point< U >::value, typename ProductType< std::complex< T >, std::complex< U > >::type >::type operator/(const std::complex< T > &left, const std::complex< U > &right)
Definition: complex_overloads.h:61
template_constraints.h
config.h
DEAL_II_NAMESPACE_CLOSE
#define DEAL_II_NAMESPACE_CLOSE
Definition: config.h:359