OpenFPM_pdata  4.1.0
Project that contain the implementation of distributed structures
util.hpp
1 /*
2  * util.hpp
3  *
4  * Created on: Jul 16, 2015
5  * Author: i-bird
6  */
7 
8 #ifndef SRC_VECTOR_UTIL_HPP_
9 #define SRC_VECTOR_UTIL_HPP_
10 
11 #include "util/common.hpp"
12 
13 
14 template<typename T, typename Sfinae = void>
15 struct is_vector: std::false_type {};
16 
26 template<typename T>
27 struct is_vector<T, typename Void< typename T::yes_i_am_vector>::type > : std::true_type
28 {};
29 
31 
32 template<typename T, typename Sfinae = void>
33 struct is_vector_native: std::false_type {};
34 
35 
45 template<typename T>
46 struct is_vector_native<T, typename Void< typename std::remove_reference<T>::type::yes_i_am_vector_native>::type > : std::true_type
47 {};
48 
50 
51 template<typename T, typename Sfinae = void>
52 struct is_vector_dist: std::false_type {};
53 
54 
64 template<typename T>
65 struct is_vector_dist<T, typename Void< typename T::yes_i_am_vector_dist>::type > : std::true_type
66 {};
67 
69 
73 template<typename T, typename Sfinae = void>
74 struct is_gpu_celllist: std::false_type {};
75 
76 
77 template<typename T>
78 struct is_gpu_celllist<T, typename Void<typename T::yes_is_gpu_celllist>::type> : std::true_type
79 {};
80 
82 
86 template<typename T, typename Sfinae = void>
87 struct is_gpu_ker_celllist: std::false_type {};
88 
89 
90 template<typename T>
91 struct is_gpu_ker_celllist<T, typename Void<typename T::yes_is_gpu_ker_celllist>::type> : std::true_type
92 {};
93 
94 // structure to check the device pointer
95 
102 template<typename data_type>
104 {
106  void * ptr;
107 
109  data_type & data;
110 
111  mutable int prp;
112 
113  mutable bool result;
114 
121  inline check_device_ptr(void * ptr, data_type & data)
122  :ptr(ptr),data(data),result(false)
123  {};
124 
126  template<typename T>
127  inline void operator()(T& t)
128  {
129  if (data.template getPointer<T::value>() == ptr)
130  {
131  prp = T::value;
132  result = true;
133  }
134  }
135 };
136 
137 #endif /* SRC_VECTOR_UTIL_HPP_ */
data_type & data
Data to check.
Definition: util.hpp:109
void operator()(T &t)
It call the copy function for each property.
Definition: util.hpp:127
void * ptr
pointer to check
Definition: util.hpp:106
check_device_ptr(void *ptr, data_type &data)
constructor
Definition: util.hpp:121
Void structure.
Definition: common.hpp:73
Check this is a gpu or cpu type cell-list.
Definition: util.hpp:74
this class is a functor for "for_each" algorithm
Definition: util.hpp:103
Check this is a gpu or cpu type cell-list.
Definition: util.hpp:87