ValueTypes.h 2.6 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
/** \file ValueTypes.h */

#ifndef VALUE_TYPES_H
#define VALUE_TYPES_H

#include "AMDiS.h"
#include "boost/type_traits.hpp"

using namespace AMDiS;

template<typename T> struct DOFView; 

/// Type-Traits for value_type of Data-Structures
/// ________________________________________________________________________________________________

template<typename T, typename enable=void> struct ValueType { typedef T type; };
template<typename T> struct ValueType<DOFVector<T> > { typedef T type; };
template<typename T> struct ValueType<std::vector<T> > { typedef T type; };
template<typename T> struct ValueType<std::list<T> > { typedef T type; };
template<typename T> struct ValueType<std::set<T> > { typedef T type; };
template<typename T> struct ValueType<mtl::dense_vector<T> > { typedef T type; };
template<typename Derived> struct ValueType<Derived, typename boost::enable_if<boost::is_base_of<DOFView<double>, Derived > >::type> { typedef double type; };
template<typename Derived> struct ValueType<Derived, typename boost::enable_if<boost::is_base_of<DOFView<WorldVector<double> >, Derived > >::type> { typedef WorldVector<double> type; };
template<typename Derived> struct ValueType<Derived, typename boost::enable_if<boost::is_base_of<AbstractFunction<double, WorldVector<double> >, Derived > >::type> { typedef double type; };
template<typename Derived> struct ValueType<Derived, typename boost::enable_if<boost::is_base_of<AbstractFunction<WorldVector<double>, WorldVector<double> >, Derived > >::type> { typedef WorldVector<double> type; };
  

/// random-accessible vectors
/// ________________________________________________________________________________________________

template<typename Vector> struct is_vector : public boost::false_type {};
template<typename T> struct is_vector< std::vector<T> > : public boost::true_type {};
template<typename T> struct is_vector< mtl::dense_vector<T> > : public boost::true_type {};
template<typename T> struct is_vector< WorldVector<T> > : public boost::true_type {};

/// random-accessible matrices
/// ________________________________________________________________________________________________

template<typename Matrix> struct is_matrix : public boost::false_type {};
template<typename T, typename Param> struct is_matrix< mtl::matrix::base_matrix<T, Param> > : public boost::true_type {};
template<typename T> struct is_matrix< mtl::matrix::dense2D<T> > : public boost::true_type {};
template<typename T> struct is_matrix< mtl::matrix::compressed2D<T> > : public boost::true_type {};
template<typename T> struct is_matrix< WorldMatrix<T> > : public boost::true_type {};



#endif // VALUE_TYPES_H