OpenFPM_pdata  1.1.0
Project that contain the implementation of distributed structures
 All Data Structures Namespaces Functions Variables Typedefs Enumerations Friends Pages
grid_common.hpp
1 /*
2  * grid_common.hpp
3  *
4  * Created on: Oct 31, 2015
5  * Author: i-bird
6  */
7 
8 #ifndef OPENFPM_DATA_SRC_GRID_GRID_COMMON_HPP_
9 #define OPENFPM_DATA_SRC_GRID_GRID_COMMON_HPP_
10 
11 // Debugging macro
12 
27 template<unsigned int dim, typename S, typename Memory>
29 {
32 
34  S & grid_dst;
35 
37  typedef typename S::value_type obj_type;
38 
40  typedef typename S::value_type::type ov_seq;
41 
44 
55  :key(key),grid_dst(grid_dst),obj(obj){};
56 
57 
58 #ifdef SE_CLASS1
59 
66  :key(key),grid_dst(grid_dst),obj(obj)
67  {std::cerr << "Error: " <<__FILE__ << ":" << __LINE__ << " Passing a temporal object";};
68 #endif
69 
71  template<typename T>
72  inline void operator()(T& t) const
73  {
74  // Remove the reference from the type to copy
75  typedef typename boost::remove_reference<decltype(grid_dst.template get<T::value>(key))>::type copy_rtype;
76 
77  meta_copy<copy_rtype>::meta_copy_(obj.template get<T::value>(),grid_dst.template get<T::value>(key));
78  }
79 };
80 
81 
90 template<typename T>
92 {
93  typedef T& type;
94 };
95 
96 
97 
98 #endif /* OPENFPM_DATA_SRC_GRID_GRID_COMMON_HPP_ */
grid_key_dx is the key to access any element in the grid
Definition: grid_key.hpp:18
static void meta_copy_(const T &src, T &dst)
copy and object from src to dst
Definition: meta_copy.hpp:37
S::value_type obj_type
type of the object we have to set
Definition: grid_common.hpp:37
const encapc< 1, obj_type, Memory > & obj
object we have to store
Definition: grid_common.hpp:43
void operator()(T &t) const
It call the copy function for each property.
Definition: grid_common.hpp:72
this class is a functor for "for_each" algorithm
Definition: grid_common.hpp:28
Metafunction take T and return a reference.
Definition: grid_common.hpp:91
copy_cpu_encap(grid_key_dx< dim > &key, S &grid_dst, const encapc< 1, obj_type, Memory > &obj)
constructor
Definition: grid_common.hpp:54
This class is a trick to indicate the compiler a specific specialization pattern. ...
Definition: memory_c.hpp:201
grid_key_dx< dim > & key
size to allocate
Definition: grid_common.hpp:31
S & grid_dst
grid where we have to store the data
Definition: grid_common.hpp:34
S::value_type::type ov_seq
type of the object boost::sequence
Definition: grid_common.hpp:40