Reference documentation for deal.II version GIT a3f17f8a20 2023-06-02 10:50:02+00:00
\(\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
39 template <typename T, typename U>
40 inline std::enable_if_t<
41  std::is_floating_point<T>::value && std::is_floating_point<U>::value,
42  typename ProductType<std::complex<T>, std::complex<U>>::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 std::enable_if_t<
59  std::is_floating_point<T>::value && std::is_floating_point<U>::value,
60  typename ProductType<std::complex<T>, std::complex<U>>::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 std::enable_if_t<std::is_floating_point<T>::value &&
77  std::is_floating_point<U>::value,
79 operator*(const std::complex<T> &left, const U &right)
80 {
81  using result_type = typename ProductType<std::complex<T>, U>::type;
82  return static_cast<result_type>(left) * static_cast<result_type>(right);
83 }
84 
92 template <typename T, typename U>
93 inline std::enable_if_t<std::is_floating_point<T>::value &&
94  std::is_floating_point<U>::value,
96 operator/(const std::complex<T> &left, const U &right)
97 {
98  using result_type = typename ProductType<std::complex<T>, U>::type;
99  return static_cast<result_type>(left) / static_cast<result_type>(right);
100 }
101 
109 template <typename T, typename U>
110 inline std::enable_if_t<std::is_floating_point<T>::value &&
111  std::is_floating_point<U>::value,
113 operator*(const T &left, const std::complex<U> &right)
114 {
115  using result_type = typename ProductType<T, std::complex<U>>::type;
116  return static_cast<result_type>(left) * static_cast<result_type>(right);
117 }
118 
126 template <typename T, typename U>
127 inline std::enable_if_t<std::is_floating_point<T>::value &&
128  std::is_floating_point<U>::value,
130 operator/(const T &left, const std::complex<U> &right)
131 {
132  using result_type = typename ProductType<T, std::complex<U>>::type;
133  return static_cast<result_type>(left) / static_cast<result_type>(right);
134 }
135 #endif /* DEAL_II_HAVE_COMPLEX_OPERATOR_OVERLOADS */
136 
138 
139 #endif
#define DEAL_II_NAMESPACE_OPEN
Definition: config.h:474
#define DEAL_II_NAMESPACE_CLOSE
Definition: config.h:475
static const char U
static const char T
std::enable_if_t< std::is_floating_point< T >::value &&std::is_floating_point< U >::value, typename ProductType< std::complex< T >, std::complex< U > >::type > operator/(const std::complex< T > &left, const std::complex< U > &right)
std::enable_if_t< std::is_floating_point< T >::value &&std::is_floating_point< U >::value, typename ProductType< std::complex< T >, std::complex< U > >::type > operator*(const std::complex< T > &left, const std::complex< U > &right)
std::enable_if_t< std::is_floating_point< T >::value &&std::is_floating_point< U >::value, typename ProductType< T, std::complex< U > >::type > operator*(const T &left, const std::complex< U > &right)
std::enable_if_t< std::is_floating_point< T >::value &&std::is_floating_point< U >::value, typename ProductType< std::complex< T >, U >::type > operator*(const std::complex< T > &left, const U &right)
typename internal::ProductTypeImpl< typename std::decay< T >::type, typename std::decay< U >::type >::type type
std::enable_if_t< std::is_floating_point< T >::value &&std::is_floating_point< U >::value, typename ProductType< std::complex< T >, U >::type > operator/(const std::complex< T > &left, const U &right)
std::enable_if_t< std::is_floating_point< T >::value &&std::is_floating_point< U >::value, typename ProductType< T, std::complex< U > >::type > operator/(const T &left, const std::complex< U > &right)