Discontinuous Galerkin Library
#include "dg/algorithm.h"
tensor_traits_cusp.h
Go to the documentation of this file.
1#pragma once
2
3#include <cassert>
4#include <cusp/array1d.h>
5#include <cusp/coo_matrix.h>
6#include <cusp/csr_matrix.h>
7#include <cusp/dia_matrix.h>
8#include <cusp/ell_matrix.h>
9#include <cusp/hyb_matrix.h>
10
11#include "vector_categories.h"
12#include "matrix_categories.h"
13#include "tensor_traits.h"
14
15namespace dg
16{
17//makes such a long name in class list
19template<class T>
20struct TensorTraits<cusp::array1d<T,cusp::host_memory>,
21 std::enable_if_t< std::is_arithmetic<T>::value>>
22{
23 using value_type = T;
24 using tensor_category = CuspVectorTag;
25 using execution_policy = SerialTag;
26};
27// if cpp cusp::device_memory is the same as cusp::host_memory
28#if THRUST_DEVICE_SYSTEM!=THRUST_DEVICE_SYSTEM_CPP
29template<class T>
30struct TensorTraits<cusp::array1d<T,cusp::device_memory>,
31 std::enable_if_t< std::is_arithmetic<T>::value>>
32{
33 using value_type = T;
34 using tensor_category = CuspVectorTag;
35#if THRUST_DEVICE_SYSTEM==THRUST_DEVICE_SYSTEM_CUDA
36 using execution_policy = CudaTag ;
37#elif THRUST_DEVICE_SYSTEM==THRUST_DEVICE_SYSTEM_OMP
38 using execution_policy = OmpTag ;
39#endif
40};
41#endif
45
46template< class I, class V, class M>
47struct TensorTraits< cusp::coo_matrix<I,V,M> >
48{
49 using value_type = V;
51};
52template< class I, class V, class M>
53struct TensorTraits< cusp::csr_matrix<I,V,M> >
54{
55 using value_type = V;
57};
58template< class I, class V, class M>
59struct TensorTraits< cusp::dia_matrix<I,V,M> >
60{
61 using value_type = V;
63};
64template< class I, class V, class M>
65struct TensorTraits< cusp::ell_matrix<I,V,M> >
66{
67 using value_type = V;
69};
70template< class I, class V, class M>
71struct TensorTraits< cusp::hyb_matrix<I,V,M> >
72{
73 using value_type = V;
75};
76
78
79} //namespace dg
This is the namespace for all functions and classes defined and used by the discontinuous Galerkin li...
One of cusp's matrices, for these only the blas2 transfer and the symv( m,x,y) are implemented.
Definition: matrix_categories.h:29
V value_type
Definition: tensor_traits_cusp.h:49
V value_type
Definition: tensor_traits_cusp.h:55
V value_type
Definition: tensor_traits_cusp.h:61
V value_type
Definition: tensor_traits_cusp.h:67
V value_type
Definition: tensor_traits_cusp.h:73
The vector traits.
Definition: tensor_traits.h:31
NoPolicyTag execution_policy
Definition: tensor_traits.h:34
NotATensorTag tensor_category
Definition: tensor_traits.h:33
void value_type
Definition: tensor_traits.h:32