Reference documentation for deal.II version 9.4.1
\(\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\}}\)
Loading...
Searching...
No Matches
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
27template <typename T, typename U>
28struct ProductType;
29#endif
30
31#ifndef DEAL_II_HAVE_COMPLEX_OPERATOR_OVERLOADS
39template <typename T, typename U>
40inline typename std::enable_if<
41 std::is_floating_point<T>::value && std::is_floating_point<U>::value,
42 typename ProductType<std::complex<T>, std::complex<U>>::type>::type
43operator*(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
57template <typename T, typename U>
58inline typename std::enable_if<
59 std::is_floating_point<T>::value && std::is_floating_point<U>::value,
60 typename ProductType<std::complex<T>, std::complex<U>>::type>::type
61operator/(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
75template <typename T, typename U>
76inline
77 typename std::enable_if<std::is_floating_point<T>::value &&
78 std::is_floating_point<U>::value,
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
93template <typename T, typename U>
94inline
95 typename std::enable_if<std::is_floating_point<T>::value &&
96 std::is_floating_point<U>::value,
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
111template <typename T, typename U>
112inline typename
113
114 std::enable_if<std::is_floating_point<T>::value &&
115 std::is_floating_point<U>::value,
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
130template <typename T, typename U>
131inline
132 typename std::enable_if<std::is_floating_point<T>::value &&
133 std::is_floating_point<U>::value,
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
#define DEAL_II_NAMESPACE_OPEN
Definition: config.h:442
#define DEAL_II_NAMESPACE_CLOSE
Definition: config.h:443
std::enable_if< std::is_floating_point< T >::value &&std::is_floating_point< U >::value, typenameProductType< std::complex< T >, U >::type >::type operator/(const std::complex< T > &left, const U &right)
std::enable_if< std::is_floating_point< T >::value &&std::is_floating_point< U >::value, typenameProductType< T, std::complex< U > >::type >::type operator/(const T &left, const std::complex< U > &right)
std::enable_if< std::is_floating_point< T >::value &&std::is_floating_point< U >::value, typenameProductType< std::complex< T >, std::complex< U > >::type >::type operator*(const std::complex< T > &left, const std::complex< U > &right)
std::enable_if< std::is_floating_point< T >::value &&std::is_floating_point< U >::value, typenameProductType< std::complex< T >, U >::type >::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< std::is_floating_point< T >::value &&std::is_floating_point< U >::value, typenameProductType< T, std::complex< U > >::type >::type operator*(const T &left, const std::complex< U > &right)
std::enable_if< std::is_floating_point< T >::value &&std::is_floating_point< U >::value, typenameProductType< std::complex< T >, std::complex< U > >::type >::type operator/(const std::complex< T > &left, const std::complex< U > &right)