OpenFPM_pdata  4.1.0
Project that contain the implementation of distributed structures
 
Loading...
Searching...
No Matches
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
14template<typename T, typename Sfinae = void>
15struct is_vector: std::false_type {};
16
26template<typename T>
27struct is_vector<T, typename Void< typename T::yes_i_am_vector>::type > : std::true_type
28{};
29
31
32template<typename T, typename Sfinae = void>
33struct is_vector_native: std::false_type {};
34
35
45template<typename T>
46struct is_vector_native<T, typename Void< typename std::remove_reference<T>::type::yes_i_am_vector_native>::type > : std::true_type
47{};
48
50
51template<typename T, typename Sfinae = void>
52struct is_vector_dist: std::false_type {};
53
54
64template<typename T>
65struct is_vector_dist<T, typename Void< typename T::yes_i_am_vector_dist>::type > : std::true_type
66{};
67
69
73template<typename T, typename Sfinae = void>
74struct is_gpu_celllist: std::false_type {};
75
76
77template<typename T>
78struct is_gpu_celllist<T, typename Void<typename T::yes_is_gpu_celllist>::type> : std::true_type
79{};
80
82
86template<typename T, typename Sfinae = void>
87struct is_gpu_ker_celllist: std::false_type {};
88
89
90template<typename T>
91struct 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
102template<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_ */
Void structure.
Definition common.hpp:74
this class is a functor for "for_each" algorithm
Definition util.hpp:104
void * ptr
pointer to check
Definition util.hpp:106
void operator()(T &t)
It call the copy function for each property.
Definition util.hpp:127
check_device_ptr(void *ptr, data_type &data)
constructor
Definition util.hpp:121
data_type & data
Data to check.
Definition util.hpp:109
Check this is a gpu or cpu type cell-list.
Definition util.hpp:74
Check this is a gpu or cpu type cell-list.
Definition util.hpp:87