8#ifndef OPENFPM_DATA_SRC_GRID_GRID_COMMON_HPP_
9#define OPENFPM_DATA_SRC_GRID_GRID_COMMON_HPP_
12#include "util/tokernel_transformation.hpp"
21template<
typename aggrT_src,
typename local_gr
ids_type>
26 local_grids_type & loc_grid;
29 :bck(bck),loc_grid(loc_grid)
36 for (
size_t i = 0 ; i < loc_grid.size() ; i++)
38 loc_grid.get(i).template setBackgroundValue<T::value>(bck.template get<T::value>());
46template<
typename T,
typename T_ker,
typename type_prp,
template<
typename>
class layout_base ,
int is_vector>
49 template<
typename mem_type,
typename obj_type>
static void destruct(mem_type * mem, obj_type & obj)
51 size_t sz = mem->size() /
sizeof(type_prp);
57 tmp.allocate(mem->size());
59 mem->deviceToHost(tmp);
60 T_ker * ptr =
static_cast<T_ker *
>(tmp.getPointer());
62 for(
size_t i = 0 ; i < sz ; i++)
70template<
typename T,
typename T_ker,
typename type_prp ,
template<
typename>
class layout_base>
73 template<
typename mem_type,
typename obj_type>
static void destruct(mem_type * mem, obj_type & obj)
77template<
typename T,
typename T_ker,
typename type_prp ,
template<
typename>
class layout_base>
80 template<
typename mem_type,
typename obj_type>
static void destruct(mem_type * mem, obj_type & obj)
84template<
typename T,
typename T_ker,
typename type_prp ,
template<
typename>
class layout_base>
87 template<
typename mem_type,
typename obj_type>
static void destruct(mem_type * mem, obj_type & obj)
107template<
unsigned int dim,
typename S,
typename Memory>
120 typedef typename S::value_type::type
ov_seq;
147 {std::cerr <<
"Error: " <<__FILE__ <<
":" << __LINE__ <<
" Passing a temporal object";};
155 typedef typename boost::remove_reference<
decltype(
grid_dst.template get<T::value>(
key))>::type copy_rtype;
grid_key_dx is the key to access any element in the grid
this class is a functor for "for_each" algorithm
grid_key_dx< dim > & key
size to allocate
S::value_type obj_type
type of the object we have to set
void operator()(T &t) const
It call the copy function for each property.
S & grid_dst
grid where we have to store the data
S::value_type::type ov_seq
type of the object boost::sequence
copy_cpu_encap(grid_key_dx< dim > &key, S &grid_dst, const encapc< 1, obj_type, Memory > &obj)
constructor
const encapc< 1, obj_type, Memory > & obj
object we have to store
Metafunction take T and return a reference.
this class is a functor for "for_each" algorithm
void operator()(T &t)
It call the copy function for each property.