OpenFPM_pdata  1.1.0
Project that contain the implementation of distributed structures
 All Data Structures Namespaces Functions Variables Typedefs Enumerations Friends Pages
SubdomainGraphNodes.hpp
1 #ifndef SUBDOMAIN_NODES_HPP
2 #define SUBDOMAIN_NODES_HPP
3 
4 #include <boost/fusion/container/vector.hpp>
5 #include <boost/fusion/include/at_c.hpp>
6 #include "Grid/Encap.hpp"
7 
8 /* In a decomposition graph each node represent a sub-domain while an edge represent
9  * an interaction between sub-domain (it mean that they have to communicate).
10  *
11  * Here we list the of property that a vertex node can carry with a brief
12  * explanation:
13  *
14  * x = position x of the sub-domain
15  * y = position y of the sub-domain
16  * z = position z of the sub-domain
17  * communication = is the estimated total communication produced by the sub-domain
18  * computation = the total computation produced by the sub-domain
19  * memory = estimated memory required by the sub-domain
20  * id = which processor own this sub-domain
21  * sub-id = sub-decomposition where each group of sub-domain is organized in an
22  * hyper-cube
23  *
24  * Here we list the properties that an edge node can carry with a brief explanation
25  *
26  * communication = is the estimated communication between sub-domains
27  *
28  */
29 
30 /* \brief Sub-domain vertex graph node
31  *
32  */
33 
34 struct nm_v
35 {
37  typedef boost::fusion::vector<float[3], size_t, size_t, size_t, size_t, long int, size_t> type;
38 
40  typedef float s_type;
41 
43  struct attributes
44  {
45  static const std::string name[];
46  };
47 
50 
52  static const unsigned int x = 0;
54  static const unsigned int migration = 1;
56  static const unsigned int computation = 2;
58  static const unsigned int global_id = 3;
60  static const unsigned int id = 4;
62  static const unsigned int sub_id = 5;
64  static const unsigned int proc_id = 6;
65 
67  static const unsigned int max_prop = 7;
68 
70  nm_v()
71  {
72 
73  }
74 
75  inline nm_v(const nm_v & p)
76  {
77  boost::fusion::at_c<0>(data)[0] = boost::fusion::at_c<0>(p.data)[0];
78  boost::fusion::at_c<0>(data)[1] = boost::fusion::at_c<0>(p.data)[1];
79  boost::fusion::at_c<0>(data)[2] = boost::fusion::at_c<0>(p.data)[2];
80  boost::fusion::at_c<1>(data) = boost::fusion::at_c<1>(p.data);
81  boost::fusion::at_c<2>(data) = boost::fusion::at_c<2>(p.data);
82  boost::fusion::at_c<3>(data) = boost::fusion::at_c<3>(p.data);
83  boost::fusion::at_c<4>(data) = boost::fusion::at_c<4>(p.data);
84  boost::fusion::at_c<5>(data) = boost::fusion::at_c<5>(p.data);
85  boost::fusion::at_c<6>(data) = boost::fusion::at_c<6>(p.data);
86  }
87 
88  template<unsigned int dim, typename Mem> inline nm_v(const encapc<dim, nm_v, Mem> & p)
89  {
90  this->operator=(p);
91  }
92 
93  template<unsigned int dim, typename Mem> inline nm_v & operator=(const encapc<dim, nm_v, Mem> & p)
94  {
95  boost::fusion::at_c<0>(data)[0] = p.template get<0>()[0];
96  boost::fusion::at_c<0>(data)[1] = p.template get<0>()[1];
97  boost::fusion::at_c<0>(data)[2] = p.template get<0>()[2];
98  boost::fusion::at_c<1>(data) = p.template get<1>();
99  boost::fusion::at_c<2>(data) = p.template get<2>();
100  boost::fusion::at_c<3>(data) = p.template get<3>();
101  boost::fusion::at_c<4>(data) = p.template get<4>();
102  boost::fusion::at_c<5>(data) = p.template get<5>();
103  boost::fusion::at_c<6>(data) = p.template get<6>();
104 
105  return *this;
106  }
107 
108  template<unsigned int id> inline auto get() -> decltype(boost::fusion::at_c < id > (data))
109  {
110  return boost::fusion::at_c<id>(data);
111  }
112 
113  template<unsigned int id> inline auto get() const -> const decltype(boost::fusion::at_c < id > (data))
114  {
115  return boost::fusion::at_c<id>(data);
116  }
117 
118  static bool noPointers()
119  {
120  return true;
121  }
122 
123 };
124 
129 struct nm_e
130 {
132  typedef boost::fusion::vector<size_t, size_t, size_t> type;
133 
135  struct attributes
136  {
137  static const std::string name[];
138  };
139 
142 
144  static const unsigned int communication = 0;
145  static const unsigned int srcgid = 1;
146  static const unsigned int dstgid = 2;
148  static const unsigned int max_prop = 3;
149 
150  nm_e()
151  {
152 
153  }
154 
155  template<unsigned int dim, typename Mem> inline nm_e(const encapc<dim, nm_e, Mem> & p)
156  {
157  boost::fusion::at_c<0>(data) = p.template get<0>();
158  boost::fusion::at_c<1>(data) = p.template get<1>();
159  boost::fusion::at_c<2>(data) = p.template get<2>();
160 
161  }
162 
163  template<unsigned int id> inline auto get() -> decltype(boost::fusion::at_c < id > (data))
164  {
165  return boost::fusion::at_c<id>(data);
166  }
167 
168  static bool noPointers()
169  {
170  return true;
171  }
172 };
173 
180 struct nm_part_v
181 {
183  typedef boost::fusion::vector<size_t, size_t> type;
184 
185  typedef float s_type;
186 
188  struct attributes
189  {
190  static const std::string name[];
191  };
192 
194 
196 
198  static const unsigned int id = 0;
200  static const unsigned int sub_id = 1;
201 
203  static const unsigned int max_prop = 2;
204 
207  {
208 
209  }
210 
211  template<unsigned int dim, typename Mem> inline nm_part_v(const encapc<dim, nm_part_v, Mem> & p)
212  {
213  boost::fusion::at_c<0>(data) = p.template get<0>();
214  boost::fusion::at_c<1>(data) = p.template get<1>();
215  }
216 
217  static inline bool noPointers()
218  {
219  return true;
220  }
221 
222 };
223 
230 struct nm_part_e
231 {
233  typedef boost::fusion::vector<> type;
234 
236 
238 
240  static const unsigned int max_prop = 0;
241 
243  struct attributes
244  {
245  static const std::string name[];
246  };
247 
248  static inline bool noPointers()
249  {
250  return true;
251  }
252 };
253 
254 
255 
256 #endif
nm_v()
default constructor
Reduced sub-domain vertex graph node.
static const unsigned int communication
computation property id in boost::fusion::vector
type data
The data.
boost::fusion::vector< size_t, size_t > type
The node contain 3 unsigned long integer for comunication computation and memory. ...
static const unsigned int max_prop
total number of properties boost::fusion::vector
type data
The data.
type data
The data.
nm_part_v()
default constructor
static const unsigned int max_prop
total number of properties
static const unsigned int global_id
global_id property id in boost::fusion::vector
type data
The data.
sub-domain edge graph node
static const unsigned int computation
computation property id in boost::fusion::vector
static const unsigned int sub_id
sub_id property id in boost::fusion::vector
float s_type
type of the positional field
boost::fusion::vector type
The node contain 3 unsigned long integer for comunication computation and memory. ...
Reduced edge graph node.
static const unsigned int sub_id
partition id in the boost::fusion::vector
boost::fusion::vector< size_t, size_t, size_t > type
The node contain 3 unsigned long integer for comunication computation and memory. ...
static const unsigned int max_prop
total number of properties
static const unsigned int x
pos property id in boost::fusion::vector
boost::fusion::vector< float[3], size_t, size_t, size_t, size_t, long int, size_t > type
The node contain 3 unsigned long integer for communication computation memory and id...
static const unsigned int migration
migration property id in boost::fusion::vector
static const unsigned int proc_id
proc_id property id in boost::fusion::vector
static const unsigned int max_prop
total number of properties boost::fusion::vector
Attributes name.
Attributes name.