11#include "util/for_each_ref.hpp"
12#include "util/copy_compare/meta_copy.hpp"
13#include "boost/mpl/range_c.hpp"
14#include <boost/fusion/container/vector.hpp>
15#include "util/se_util.hpp"
16#include "util/copy_compare/copy_fusion_vector.hpp"
17#include "util/copy_compare/compare_fusion_vector.hpp"
18#include "memory_ly/memory_conf.hpp"
31template<
typename e_src,
typename e_dst,
unsigned int ... prp>
50#if defined(SE_CLASS1) && !defined(__NVCC__)
53 if (e_src::T_type::max_prop != e_dst::T_type::max_prop)
54 std::cerr <<
"Error " << __FILE__ <<
":" << __LINE__ <<
" the number of properties between src and dst must match";
68 {std::cerr <<
"Error: " <<__FILE__ <<
":" << __LINE__ <<
" Passing a temporal object";};
75 typedef typename boost::mpl::at<vprp,T>::type prp_cp;
78 typedef typename boost::remove_reference<
decltype(
dst.template get<prp_cp::value>())>::type copy_rtype;
95template<
typename e_src,
typename e_dst>
113#if defined(SE_CLASS1) && !defined(__NVCC__)
116 if (e_src::T_type::max_prop != e_dst::T_type::max_prop)
117 std::cerr <<
"Error " << __FILE__ <<
":" << __LINE__ <<
" the number of properties between src and dst must match";
131 {std::cerr <<
"Error: " <<__FILE__ <<
":" << __LINE__ <<
" Passing a temporal object";};
139 typedef typename boost::remove_reference<
decltype(
dst.template get<T::value>())>::type copy_rtype;
156template<
typename e_src,
typename e_dst>
174#if defined(SE_CLASS1) && !defined(__NVCC__)
177 if (e_src::T_type::max_prop != e_dst::T_type::max_prop)
178 std::cerr <<
"Error " << __FILE__ <<
":" << __LINE__ <<
" the number of properties between src and dst must match";
192 {std::cerr <<
"Error: " <<__FILE__ <<
":" << __LINE__ <<
" Passing a temporal object";};
200 typedef typename boost::remove_reference<
decltype(
dst.template get<T::value>())>::type copy_dtype;
203 typedef typename boost::remove_reference<
decltype(
src.template get<T::value>())>::type copy_stype;
220template<
typename e_src>
238#if defined(SE_CLASS1) && !defined(__NVCC__)
241 if (e_src::T_type::max_prop != e_src::T_type::max_prop)
242 std::cerr <<
"Error " << __FILE__ <<
":" << __LINE__ <<
" the number of properties between src and dst must match";
256 {std::cerr <<
"Error: " <<__FILE__ <<
":" << __LINE__ <<
" Passing a temporal object";};
264 typedef typename boost::remove_reference<
decltype(
dst.template get<T::value>())>::type copy_rtype;
274template<
template<
typename,
typename>
class op,
typename e_src,
typename e_dst,
int ... prp>
296 if (e_src::T_type::max_prop != e_dst::T_type::max_prop)
297 std::cerr <<
"Error " << __FILE__ <<
":" << __LINE__ <<
" the number of properties between src and dst must match";
311 {std::cerr <<
"Error: " <<__FILE__ <<
":" << __LINE__ <<
" Passing a temporal object";};
319 typedef typename boost::mpl::vector_c<
unsigned int,prp...> prpv;
322 typedef typename boost::mpl::at<prpv,T>::type ele_cop;
325 typedef typename boost::remove_reference<
decltype(
src.template get< ele_cop::value >())>::type copy_rtype;
346template<
typename e_src,
typename e_dst>
368 if (e_src::max_prop != e_dst::max_prop)
369 std::cerr <<
"Error " << __FILE__ <<
":" << __LINE__ <<
" the number of properties between src and dst must match";
387 {std::cerr <<
"Error: " <<__FILE__ <<
":" << __LINE__ <<
" Passing a temporal object";};
399 typedef typename boost::fusion::result_of::at_c<typename e_src::type,T::value>::type copy_type;
402 typedef typename boost::remove_reference<copy_type>::type copy_rtype;
415template<
unsigned int dim,
typename T,
typename layout>
437template<
unsigned int dim,
typename T>
461 __device__ __host__
void check_init()
const
466 std::cout << __FILE__ <<
":" << __LINE__ <<
" Error using unallocated pointer" << std::endl;
468 assert(init ==
true);
488 static const int max_prop = T::max_prop;
518 template <unsigned int p, typename r_type=decltype(boost::fusion::at_c<p>(data_c))>
519 __device__ __host__
inline r_type
get()
524 return boost::fusion::at_c<p>(data_c);
532 template <unsigned int p, typename r_type=decltype(boost::fusion::at_c<p>(data_c))>
533 __device__ __host__
inline const r_type
get()
const
538 return boost::fusion::at_c<p>(data_c);
548 template <
unsigned int p>
inline
549 __device__ __host__
void set(
decltype(boost::fusion::at_c<p>(data_c)) &
ele)
554 return boost::fusion::at_c<p>(data_c) =
ele;
567 template<
unsigned int dim2>
575 boost::mpl::for_each_ref< boost::mpl::range_c<int,0,T::max_prop> >(cp);
594 boost::mpl::for_each_ref< boost::mpl::range_c<int,0,T::max_prop> >(cp);
613 boost::mpl::for_each_ref< boost::mpl::range_c<int,0,T::max_prop> >(cp);
632 boost::mpl::for_each_ref< boost::mpl::range_c<int,0,T::max_prop> >(cp);
651 boost::mpl::for_each_ref< boost::mpl::range_c<int,0,T::max_prop> >(cp);
668 return ! this->operator==(ec);
679template<
unsigned int dim,
typename Mem>
689 template <
unsigned int p>
void get()
693 template <
unsigned int p,
typename S>
void set(S &
ele)
711template<
unsigned int dim,
typename T>
731 __device__ __host__
void check_init()
const
736 std::cout << __FILE__ <<
":" << __LINE__ <<
" Error using unallocated pointer" << std::endl;
738 assert(init ==
true);
756 static const int max_prop = T::max_prop;
779 template <
unsigned int p>
780 __device__ __host__
auto get() ->
decltype(boost::fusion::at_c<p>(data).mem_r.operator[](k))
785 return boost::fusion::at_c<p>(data).mem_r.operator[](k);
795 template <
unsigned int p> __device__ __host__
auto get() const -> decltype(boost::fusion::at_c<p>(data).mem_r.operator[](k))
800 return boost::fusion::at_c<p>(data).mem_r.operator[](k);
826 boost::mpl::for_each_ref< boost::mpl::range_c<int,0,T::max_prop> >(cp);
845 boost::mpl::for_each_ref< boost::mpl::range_c<int,0,T::max_prop> >(cp);
864 boost::mpl::for_each_ref< boost::mpl::range_c<int,0,T::max_prop> >(cp);
869 __device__ __host__
inline void private_set_data_k(Mem & data_c,
size_t k)
878 __device__ __host__
inline Mem & private_get_data()
886 __device__ __host__
inline size_t private_get_k()
894 __device__ __host__
inline size_t private_set_k(
unsigned int k)
903#include "util/common.hpp"
905template<
typename T,
typename Sfinae =
void>
919struct is_encap<T, typename
Void< typename T::yes_i_am_encap>::type> : std::true_type
924template<unsigned int dim , typename T, typename layout, typename data_type, typename g1_type, typename key_type, unsigned int sel = 2*is_layout_mlin<layout>::value +
is_layout_inte<layout>::value >
939template<
unsigned int dim,
typename T,
typename layout,
typename data_type,
typename g1_type,
typename key_type>
940struct mem_geto<dim,T,layout,data_type,g1_type,key_type,1>
Mem & data
reference to the encapsulated object
__device__ __host__ encapc< dim, T, Mem > & operator=(const T &obj)
Assignment.
T T_type
original object type
__device__ __host__ encapc(typename memory_traits_inte< T >::type &data, size_t k)
constructor require a key and a memory data
__device__ __host__ encapc< dim, T, Mem > & operator=(const encapc< dim, T, Mem > &ec)
Assignment.
memory_traits_inte< T >::type Mem
type of layout
T::type type
Original list if types.
int yes_i_am_encap
indicate it is an encapsulated object
__device__ __host__ encapc< dim, T, Mem > & operator=(const encapc< dim, T, Mem2 > &ec)
Assignment.
__device__ __host__ auto get() -> decltype(boost::fusion::at_c< p >(data).mem_r.operator[](k))
Access the data.
memory_traits_lin< T >::type Mem2
layout of the encapsulated object
__device__ __host__ auto get() const -> decltype(boost::fusion::at_c< p >(data).mem_r.operator[](k))
Access the data.
__device__ __host__ encapc< dim, T, Mem > & operator=(const encapc< dim, T, Mem > &ec)
Assignment.
__device__ __host__ void set(decltype(boost::fusion::at_c< p >(data_c)) &ele)
Set one property of the encapsulated object.
__device__ __host__ encapc(type &data_c)
constructor from a reference object
memory_traits_lin< T >::type Mem
layout of the encapsulated object
type * operator&()
Return the address of the base.
memory_traits_inte< T >::type Mem2
layout of the encapsulated object
bool operator==(const encapc< dim, T, Mem > &ec) const
Compare.
type & data_c
reference to the encapsulated object
bool operator!=(const encapc< dim, T, Mem > &ec) const
Compare.
__device__ __host__ const r_type get() const
access the data but return a constant reference
__device__ __host__ r_type get()
access the data
__device__ __host__ encapc< dim, T, Mem > & operator=(const encapc< dim, T, Mem2 > &ec)
Assignment.
int yes_i_am_encap
indicate the it is an encapsulated object
T::type type
object type the encap object encapsulate
__device__ __host__ encapc< dim, T, Mem > & operator=(const T &obj)
Assignment.
__device__ __host__ encapc< dim, T, Mem > & set(const encapc< dim2, T, Mem > &ec)
Set one property of the encapsulated object.
void set(S &ele)
set the data
void get()
access the data
this class is a functor for "for_each" algorithm
const e_src & src
object 1 we have to compare
const e_dst & dst
object 2 we have to compare
compare_cpu_encap_encap(const e_src &src, const e_dst &dst)
constructor
void operator()(T &t) const
It call the copy function for each property.
this class is a functor for "for_each" algorithm
this class is a functor for "for_each" algorithm
e_dst & dst
encapsulated destination object
__device__ __host__ void operator()(T &t) const
It call the copy function for each property.
__device__ __host__ copy_cpu_encap_encap_general(const e_src &src, e_dst &dst)
constructor
const e_src & src
encapsulated source object
It copy two encap object.
e_dst & dst
encapsulated object destination
const e_src & src
encapsulated object source
void operator()(T &t) const
It call the copy function for each property.
copy_cpu_encap_encap_op_prp(const e_src &src, e_dst &dst)
constructor
this class is a functor for "for_each" algorithm
e_dst & dst
encapsulated destination object
__device__ __host__ copy_cpu_encap_encap_prp(e_src &src, e_dst &dst)
constructor
__device__ __host__ void operator()(T &t) const
It call the copy function for each property.
e_src & src
encapsulated source object
this class is a functor for "for_each" algorithm
__device__ __host__ copy_cpu_encap_encap(const e_src &src, e_dst &dst)
constructor
e_dst & dst
encapsulated destination object
const e_src & src
encapsulated source object
__device__ __host__ void operator()(T &t) const
It call the copy function for each property.
this class is a functor for "for_each" algorithm
e_src & dst
encapsulated destination object
__device__ __host__ copy_cpu_encap_single(const e_src &src, e_src &dst)
constructor
__device__ __host__ void operator()(T &t) const
It call the copy function for each property.
const e_src & src
encapsulated source object
this class is a functor for "for_each" algorithm
this class is a functor for "for_each" algorithm
Transform the boost::fusion::vector into memory specification (memory_traits)
inter_memc< typenameT::type >::type type
for each element in the vector interleave memory_c
Transform the boost::fusion::vector into memory specification (memory_traits)