OpenFPM_data  0.1.0
Project that contain the implementation and interfaces for basic structure like vectors, grids, graph ... .
 All Data Structures Namespaces Functions Variables Typedefs Friends
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  // This is the type of the object we have to copy
75  typedef typename boost::fusion::result_of::at_c<ov_seq,T::value>::type copy_type;
76 
77  // Remove the reference from the type to copy
78  typedef typename boost::remove_reference<copy_type>::type copy_rtype;
79 
80  meta_copy<copy_rtype> cp(obj.template get<T::value>(),grid_dst.template get<T::value>(key));
81  }
82 };
83 
84 
93 template<typename T>
95 {
96  typedef T& type;
97 };
98 
99 
100 
101 #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
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
This class copy general objects.
Metafunction take T and return a reference.
Definition: grid_common.hpp:94
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:202
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