|
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\}}\)
Go to the documentation of this file.
16 #ifndef dealii_numbers_h
17 #define dealii_numbers_h
24 #ifdef DEAL_II_COMPILER_CUDA_AWARE
25 # include <cuComplex.h>
31 #include <type_traits>
33 #ifdef DEAL_II_COMPILER_CUDA_AWARE
34 # define DEAL_II_CUDA_HOST_DEV __host__ __device__
36 # define DEAL_II_CUDA_HOST_DEV
61 template <
typename Number>
85 #if DEAL_II_VECTORIZATION_WIDTH_IN_BITS >= 512
87 #elif DEAL_II_VECTORIZATION_WIDTH_IN_BITS >= 256
89 #elif DEAL_II_VECTORIZATION_WIDTH_IN_BITS >= 128
111 #if DEAL_II_VECTORIZATION_WIDTH_IN_BITS >= 128 && defined(__ALTIVEC__)
113 #elif DEAL_II_VECTORIZATION_WIDTH_IN_BITS >= 512 && defined(__AVX512F__)
115 #elif DEAL_II_VECTORIZATION_WIDTH_IN_BITS >= 256 && defined(__AVX__)
117 #elif DEAL_II_VECTORIZATION_WIDTH_IN_BITS >= 128 && defined(__SSE2__)
129 template <
typename Number,
133 template <
typename T>
141 #ifdef DEAL_II_WITH_ADOLC
144 # include <adolc/adouble.h>
150 #ifdef DEAL_II_TRILINOS_WITH_SACADO
151 # include <Sacado.hpp>
156 template <
typename Number, std::
size_t w
idth>
157 DEAL_II_ALWAYS_INLINE ::VectorizedArray<Number, width>
158 sqrt(const ::VectorizedArray<Number, width> &);
159 template <
typename Number, std::
size_t w
idth>
160 DEAL_II_ALWAYS_INLINE ::VectorizedArray<Number, width>
161 abs(const ::VectorizedArray<Number, width> &);
162 template <
typename Number, std::
size_t w
idth>
163 DEAL_II_ALWAYS_INLINE ::VectorizedArray<Number, width>
164 max(const ::VectorizedArray<Number, width> &,
165 const ::VectorizedArray<Number, width> &);
166 template <
typename Number, std::
size_t w
idth>
167 DEAL_II_ALWAYS_INLINE ::VectorizedArray<Number, width>
168 min(const ::VectorizedArray<Number, width> &,
169 const ::VectorizedArray<Number, width> &);
170 template <
typename Number,
size_t w
idth>
172 pow(const ::VectorizedArray<Number, width> &,
const Number p);
173 template <
typename Number,
size_t w
idth>
175 sin(const ::VectorizedArray<Number, width> &);
176 template <
typename Number,
size_t w
idth>
178 cos(const ::VectorizedArray<Number, width> &);
179 template <
typename Number,
size_t w
idth>
181 tan(const ::VectorizedArray<Number, width> &);
182 template <
typename Number,
size_t w
idth>
184 exp(const ::VectorizedArray<Number, width> &);
185 template <
typename Number,
size_t w
idth>
187 log(const ::VectorizedArray<Number, width> &);
212 static constexpr
double E = 2.7182818284590452354;
217 static constexpr
double LOG2E = 1.4426950408889634074;
222 static constexpr
double LOG10E = 0.43429448190325182765;
227 static constexpr
double LN2 = 0.69314718055994530942;
232 static constexpr
double LN10 = 2.30258509299404568402;
237 static constexpr
double PI = 3.14159265358979323846;
242 static constexpr
double PI_2 = 1.57079632679489661923;
247 static constexpr
double PI_4 = 0.78539816339744830962;
252 static constexpr
double SQRT2 = 1.41421356237309504880;
257 static constexpr
double SQRT1_2 = 0.70710678118654752440;
264 template <
typename Number,
typename =
void>
271 template <
typename Number>
292 is_finite(
const std::complex<double> &x);
310 is_finite(
const std::complex<long double> &x);
322 template <
typename Number1,
typename Number2>
336 template <
typename Number1,
typename Number2>
347 template <
typename Number>
361 template <
typename Number1,
typename Number2>
375 template <
typename Number1,
typename Number2>
378 const Number2 &value_2);
392 template <
typename Number1,
typename Number2>
406 template <
typename Number1,
typename Number2>
409 const Number2 &value_2);
421 template <
typename number>
457 template <
typename Dummy = number>
464 template <
typename Dummy = number>
475 abs(
const number &x);
485 template <
typename number>
506 static constexpr std::complex<number>
507 conjugate(
const std::complex<number> &x);
523 abs(
const std::complex<number> &x);
531 return std::isnan(x);
539 return std::isfinite(x);
572 template <
typename number>
581 template <
typename number>
582 template <
typename Dummy>
594 template <
typename number>
595 template <
typename Dummy>
607 template <
typename number>
616 template <
typename number>
617 constexpr std::complex<number>
625 template <
typename number>
634 template <
typename number>
652 template <
typename T>
657 template <
typename NumberType>
669 template <
typename From,
typename To>
674 template <
typename T>
677 template <
typename F,
typename T>
678 static constexpr
auto
679 test(
int) -> decltype(
f(
static_cast<T>(std::declval<F>())),
true)
684 template <
typename F,
typename T>
685 static constexpr
auto
692 static bool const value = test<From, To>(0);
699 template <
typename T>
716 template <
typename F>
719 typename std::enable_if<
720 !std::is_same<
typename std::decay<T>::type,
721 typename std::decay<F>::type>::
value &&
728 template <
typename F>
731 typename std::enable_if<
732 !std::is_same<
typename std::decay<T>::type,
733 typename std::decay<F>::type>::
value &&
737 return static_cast<T>(f);
744 template <
typename F>
747 typename std::enable_if<
748 !std::is_same<
typename std::decay<T>::type,
749 typename std::decay<F>::type>::
value &&
758 template <
typename T>
761 static constexpr
const std::complex<T> &
767 static constexpr std::complex<T>
770 return std::complex<T>(t);
774 template <
typename U>
775 static constexpr std::complex<T>
783 #ifdef DEAL_II_COMPILER_CUDA_AWARE
790 return make_cuComplex(t, 0.f);
797 static cuDoubleComplex
800 return make_cuDoubleComplex(t, 0.);
808 #ifdef DEAL_II_ADOLC_WITH_ADVANCED_BRANCHING
835 template <
typename Number>
855 template <
typename Number>
890 template <
typename Number>
911 template <
typename Number>
923 template <
typename Number1,
typename Number2>
931 template <
typename Number1,
typename Number2>
939 template <
typename Number>
947 template <
typename Number1,
typename Number2>
955 template <
typename Number1,
typename Number2>
964 template <
typename Number1,
typename Number2>
972 template <
typename Number1,
typename Number2>
975 const Number2 &value_2)
static constexpr auto test(...) -> bool
Tensor< 2, dim, Number > F(const Tensor< 2, dim, Number > &Grad_u)
static constexpr double LOG10E
static constexpr std::complex< T > value(const T &t)
static constexpr bool is_complex
static constexpr auto test(int) -> decltype(f(static_cast< T >(std::declval< F >())), true)
static constexpr std::complex< T > value(const std::complex< U > &t)
static constexpr const T & value(const T &t)
static constexpr T value(const F &f, typename std::enable_if< !std::is_same< typename std::decay< T >::type, typename std::decay< F >::type >::value &&!std::is_constructible< T, F >::value &&is_explicitly_convertible< const F, T >::value >::type *=nullptr)
static constexpr std::enable_if< std::is_same< Dummy, number >::value &&is_cuda_compatible< Dummy >::value, real_type >::type abs_square(const number &x)
#define DEAL_II_ALWAYS_INLINE
constexpr bool values_are_equal(const Number1 &value_1, const Number2 &value_2)
static constexpr double PI_2
bool values_are_not_equal(const Number1 &value_1, const Number2 &value_2)
bool is_nan(const double x)
bool is_finite(const double x)
static constexpr double SQRT1_2
double norm(const FEValuesBase< dim > &fe, const ArrayView< const std::vector< Tensor< 1, dim >>> &Du)
#define DEAL_II_NAMESPACE_OPEN
static cuComplex value(const float t)
static constexpr double E
Vector< double > ::value_type real_type
static constexpr const std::complex< T > & value(const std::complex< T > &t)
static constexpr const number & conjugate(const number &x)
static constexpr double SQRT2
static real_type abs(const number &x)
bool value_is_greater_than_or_equal_to(const Number1 &value_1, const Number2 &value_2)
bool value_is_greater_than(const Number1 &value_1, const Number2 &value_2)
bool value_is_less_than_or_equal_to(const Number1 &value_1, const Number2 &value_2)
#define DEAL_II_CUDA_HOST_DEV
static constexpr double LOG2E
static constexpr T value(const F &f, typename std::enable_if< !std::is_same< typename std::decay< T >::type, typename std::decay< F >::type >::value &&std::is_constructible< T, F >::value >::type *=nullptr)
#define DEAL_II_NAMESPACE_CLOSE
static constexpr double PI
static constexpr double LN2
static T value(const F &f, typename std::enable_if< !std::is_same< typename std::decay< T >::type, typename std::decay< F >::type >::value &&!std::is_constructible< T, F >::value &&!is_explicitly_convertible< const F, T >::value &&Differentiation::AD::is_ad_number< F >::value >::type *=nullptr)
static constexpr double LN10
static cuDoubleComplex value(const double t)
constexpr bool value_is_zero(const Number &value)
constexpr static unsigned int max_width
bool value_is_less_than(const Number1 &value_1, const Number2 &value_2)
static constexpr double PI_4