8#ifndef SRC_GRID_STAGGERED_DIST_GRID_COPY_HPP_
9#define SRC_GRID_STAGGERED_DIST_GRID_COPY_HPP_
19template<
typename copy_type,
typename Tsrc,
typename Tdst,
typename Gr
id_src,
typename Gr
id_dst,
int sa>
24 typedef typename boost::mpl::at<Tdst,Tsrc>::type Tdst_ele;
26 copy_type division = 0.0;
28 for (
size_t i = 0 ; i < interp_pos.get(0).size() ; i++)
30 auto key_m = key_src.
move(interp_pos.get(0)[i]);
32 grid_dst.template get<Tdst_ele::value>(key_dst) += x.template get<Tsrc::value>(key_m);
36 grid_dst.template get<Tdst_ele::value>(key_dst) /= division;
49template<
typename copy_type,
typename Tsrc,
typename Tdst,
typename Gr
id_src,
typename Gr
id_dst>
52 inline static void interp(Grid_dst & grid_dst,
58 typename std::remove_all_extents<copy_type>::type division;
59 typedef typename boost::mpl::at<Tdst,Tsrc>::type Tdst_ele;
61 for (
size_t j = 0 ; j < std::extent<copy_type>::value ; j++)
64 for (
size_t i = 0 ; i < interp_pos.get(j).size() ; i++)
66 auto key_m = key_src.
move(interp_pos.get(j)[i]);
68 grid_dst.template get<Tdst_ele::value>(key_dst)[j] += x.template get<Tsrc::value>(key_m)[j];
72 grid_dst.template get<Tsrc::value>(key_dst)[j] /= division;
88template<
typename Tdst,
typename Gr
id_dst,
typename Gr
id_src,
unsigned int nst_pos>
134 {std::cerr <<
"Error: " <<__FILE__ <<
":" << __LINE__ <<
" Passing a temporal object";};
142 template<
typename Tsrc>
146 typedef typename boost::mpl::at_c<typename Grid_dst::value_type::type,Tsrc::value>::type copy_type;
Grid key for a distributed grid.
grid_dist_key_dx< dim, base_key > move(size_t i, int s) const
Create a new key moving the old one.
Implementation of 1-D std::vector like structure.
Position of the element of dimension d in the hyper-cube of dimension dim.
this class is a functor for "for_each" algorithm
Grid_dst & grid_dst
destination grid
const grid_dist_key_dx< Grid_dst::dims > key_dst
destination point
void operator()(Tsrc &t)
Interpolate each point in the destination grid for each property.
interp_ele(const grid_dist_key_dx< Grid_dst::dims > &key_dst, Grid_dst &grid_dst, const Grid_src &x, const grid_dist_key_dx< Grid_src::dims > &key_src, openfpm::vector< std::vector< comb< Grid_src::dims > > >(&interp_pos)[nst_pos])
constructor
const Grid_src & x
source grid
grid_dist_key_dx< Grid_dst::dims > key_src
source point