template <typename T>
struct NumberType
{
- static DEAL_II_CUDA_HOST_DEV T value (const T &t)
+ static DEAL_II_CUDA_HOST_DEV const T &value (const T &t)
{
return t;
}
template <typename T>
struct NumberType<std::complex<T> >
{
+ static const std::complex<T> &value (const std::complex<T> &t)
+ {
+ return t;
+ }
+
static std::complex<T> value (const T &t)
{
return std::complex<T>(t);
}
+
+ // Facilitate cast from complex<double> to complex<float>
+ template <typename U>
+ static std::complex<T> value (const std::complex<U> &t)
+ {
+ return std::complex<T>(
+ NumberType<T>::value(t.real()),
+ NumberType<T>::value(t.imag()));
+ }
};
}
template <int rank, int dim, typename T>
struct NumberType<Tensor<rank,dim,T> >
{
+ static const Tensor<rank,dim,T> &value (const Tensor<rank,dim,T> &t)
+ {
+ return t;
+ }
+
static Tensor<rank,dim,T> value (const T &t)
{
Tensor<rank,dim,T> tmp;
template <int rank, int dim, typename T>
struct NumberType<Tensor<rank,dim,VectorizedArray<T> > >
{
+ static const Tensor<rank,dim,VectorizedArray<T> > &value (const Tensor<rank,dim,VectorizedArray<T> > &t)
+ {
+ return t;
+ }
+
static Tensor<rank,dim,VectorizedArray<T> > value (const T &t)
{
Tensor<rank,dim,VectorizedArray<T> > tmp;