OpenFPM_pdata  4.1.0
Project that contain the implementation of distributed structures
 
Loading...
Searching...
No Matches
copy_fusion_vector.hpp
1/*
2 * copy_fusion_vector.hpp
3 *
4 * Created on: Nov 1, 2015
5 * Author: i-bird
6 */
7
8#ifndef OPENFPM_DATA_SRC_GRID_COPY_FUSION_VECTOR_HPP_
9#define OPENFPM_DATA_SRC_GRID_COPY_FUSION_VECTOR_HPP_
10
11
17template<typename bfv, typename enc>
19{
21 const bfv & src;
22
24 enc & dst;
25
34 __device__ __host__ inline copy_fusion_vector_encap(const bfv & src, enc & dst)
35 :src(src),dst(dst){};
36
37#ifdef SE_CLASS1
44 inline copy_fusion_vector_encap(const bfv && src, enc && dst)
45 :src(src),dst(dst)
46 {std::cerr << "Error: " <<__FILE__ << ":" << __LINE__ << " Passing a temporal object\n";};
47#endif
48
50 template<typename T>
51 __device__ __host__ inline void operator()(T& t)
52 {
53 typedef typename boost::mpl::at<bfv,boost::mpl::int_<T::value> >::type copy_src;
54 typedef typename std::remove_reference<decltype(dst.template get<T::value>())>::type copy_dst;
55
56 meta_copy_d<copy_src,copy_dst>::meta_copy_d_(boost::fusion::at_c<T::value>(src),dst.template get<T::value>());
57 }
58};
59
60
66template<typename enc, typename bfv>
68{
70 const enc & src;
71
73 bfv & dst;
74
83 __device__ __host__ inline copy_encap_vector_fusion(const enc & src, bfv & dst)
84 :src(src),dst(dst){};
85
86#ifdef SE_CLASS1
93 __device__ __host__ inline copy_encap_vector_fusion(const enc && src, bfv && dst)
94 :src(src),dst(dst)
95 {std::cerr << "Error: " <<__FILE__ << ":" << __LINE__ << " Passing a temporal object\n";};
96#endif
97
99 template<typename T>
100 __device__ __host__ inline void operator()(T& t)
101 {
102 typedef typename boost::mpl::at<bfv,boost::mpl::int_<T::value> >::type copy_dst;
103 typedef typename std::remove_reference<decltype(src.template get<T::value>())>::type copy_src;
104
105 meta_copy_d<copy_src,copy_dst>::meta_copy_d_(src.template get<T::value>(),boost::fusion::at_c<T::value>(dst));
106 }
107};
108
109#endif /* OPENFPM_DATA_SRC_GRID_COPY_FUSION_VECTOR_HPP_ */
this class is a functor for "for_each" algorithm
__device__ __host__ void operator()(T &t)
It call the copy function for each property.
const enc & src
source fusion vector
bfv & dst
destination fusion vector
__device__ __host__ copy_encap_vector_fusion(const enc &src, bfv &dst)
constructor
this class is a functor for "for_each" algorithm
__device__ __host__ copy_fusion_vector_encap(const bfv &src, enc &dst)
constructor
const bfv & src
source fusion vector
__device__ __host__ void operator()(T &t)
It call the copy function for each property.
enc & dst
destination fusion vector
__device__ static __host__ void meta_copy_d_(const Tsrc &src, Tdst &dst)
copy and object from src to dst
Definition meta_copy.hpp:92