Reference documentation for deal.II version 9.6.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\}}\)
Loading...
Searching...
No Matches
complex_overloads.h
Go to the documentation of this file.
1// ------------------------------------------------------------------------
2//
3// SPDX-License-Identifier: LGPL-2.1-or-later
4// Copyright (C) 2015 - 2023 by the deal.II authors
5//
6// This file is part of the deal.II library.
7//
8// Part of the source code is dual licensed under Apache-2.0 WITH
9// LLVM-exception OR LGPL-2.1-or-later. Detailed license information
10// governing the source code and code contributions can be found in
11// LICENSE.md and CONTRIBUTING.md at the top level directory of deal.II.
12//
13// ------------------------------------------------------------------------
14
15#ifndef dealii_complex_overloads_h
16#define dealii_complex_overloads_h
17
18#include <deal.II/base/config.h>
19
21
23
24// Forward declarations
25#ifndef DOXYGEN
26template <typename T, typename U>
27struct ProductType;
28#endif
29
30#ifndef DEAL_II_HAVE_COMPLEX_OPERATOR_OVERLOADS
38template <typename T, typename U>
39inline std::enable_if_t<
40 std::is_floating_point_v<T> && std::is_floating_point_v<U>,
41 typename ProductType<std::complex<T>, std::complex<U>>::type>
42operator*(const std::complex<T> &left, const std::complex<U> &right)
43{
44 using result_type =
45 typename ProductType<std::complex<T>, std::complex<U>>::type;
46 return static_cast<result_type>(left) * static_cast<result_type>(right);
47}
48
56template <typename T, typename U>
57inline std::enable_if_t<
58 std::is_floating_point_v<T> && std::is_floating_point_v<U>,
59 typename ProductType<std::complex<T>, std::complex<U>>::type>
60operator/(const std::complex<T> &left, const std::complex<U> &right)
61{
62 using result_type =
63 typename ProductType<std::complex<T>, std::complex<U>>::type;
64 return static_cast<result_type>(left) / static_cast<result_type>(right);
65}
66
74template <typename T, typename U>
75inline std::enable_if_t<std::is_floating_point_v<T> &&
76 std::is_floating_point_v<U>,
77 typename ProductType<std::complex<T>, U>::type>
78operator*(const std::complex<T> &left, const U &right)
79{
80 using result_type = typename ProductType<std::complex<T>, U>::type;
81 return static_cast<result_type>(left) * static_cast<result_type>(right);
82}
83
91template <typename T, typename U>
92inline std::enable_if_t<std::is_floating_point_v<T> &&
93 std::is_floating_point_v<U>,
94 typename ProductType<std::complex<T>, U>::type>
95operator/(const std::complex<T> &left, const U &right)
96{
97 using result_type = typename ProductType<std::complex<T>, U>::type;
98 return static_cast<result_type>(left) / static_cast<result_type>(right);
99}
100
108template <typename T, typename U>
109inline std::enable_if_t<std::is_floating_point_v<T> &&
110 std::is_floating_point_v<U>,
111 typename ProductType<T, std::complex<U>>::type>
112operator*(const T &left, const std::complex<U> &right)
113{
114 using result_type = typename ProductType<T, std::complex<U>>::type;
115 return static_cast<result_type>(left) * static_cast<result_type>(right);
116}
117
125template <typename T, typename U>
126inline std::enable_if_t<std::is_floating_point_v<T> &&
127 std::is_floating_point_v<U>,
128 typename ProductType<T, std::complex<U>>::type>
129operator/(const T &left, const std::complex<U> &right)
130{
131 using result_type = typename ProductType<T, std::complex<U>>::type;
132 return static_cast<result_type>(left) / static_cast<result_type>(right);
133}
134#endif /* DEAL_II_HAVE_COMPLEX_OPERATOR_OVERLOADS */
135
137
138#endif
#define DEAL_II_NAMESPACE_OPEN
Definition config.h:503
#define DEAL_II_NAMESPACE_CLOSE
Definition config.h:504
typename internal::ProductTypeImpl< std::decay_t< T >, std::decay_t< U > >::type type
std::enable_if_t< std::is_floating_point_v< T > &&std::is_floating_point_v< U >, typename ProductType< T, std::complex< U > >::type > operator/(const T &left, const std::complex< U > &right)
std::enable_if_t< std::is_floating_point_v< T > &&std::is_floating_point_v< U >, typename ProductType< std::complex< T >, U >::type > operator/(const std::complex< T > &left, const U &right)
std::enable_if_t< std::is_floating_point_v< T > &&std::is_floating_point_v< U >, 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_v< T > &&std::is_floating_point_v< U >, typename ProductType< T, std::complex< U > >::type > operator*(const T &left, const std::complex< U > &right)
std::enable_if_t< std::is_floating_point_v< T > &&std::is_floating_point_v< U >, 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_v< T > &&std::is_floating_point_v< U >, typename ProductType< std::complex< T >, U >::type > operator*(const std::complex< T > &left, const U &right)