1#include "Grid/grid_dist_id.hpp"
2#include "data_type/aggregate.hpp"
46 auto it = g_dist.getDomainGhostIterator();
86 auto key_g = g_dist.getGKey(key);
106 if (key_g.get(0) < 0 || key_g.get(0) == sz[0] ||
107 key_g.get(1) < 0 || key_g.get(1) == sz[1])
110 g_dist.template get<0>(key) = 0.0;
115 g_dist.template get<0>(key) = 0.0;
134int main(
int argc,
char* argv[])
151 openfpm_init(&argc,&argv);
172 size_t sz[2] = {64,64};
205 double spacing[2] = {g_dist.spacing(0),g_dist.spacing(1)};
241 g_dist.template ghost_get<0>();
259 bool red_black =
true;
262 for (
size_t i = 0 ; i < 10000 ; i++)
279 auto dom = g_dist.getDomainIterator();
286 auto key = dom.get();
290 auto key_g = g_dist.getGKey(key);
297 if (red_black ==
false && (key_g.get(0) + key_g.get(1)) % 2 == 0)
299 else if (red_black ==
true && (key_g.get(0) + key_g.get(1)) % 2 == 1)
308 g_dist.get<0>(key) = (g_dist.get<0>(key.move(x,1)) + g_dist.template get<0>(key.move(x,-1)) +
309 g_dist.get<0>(key.move(y,1)) + g_dist.template get<0>(key.move(y,-1)) +
335 g_dist.template ghost_get<0>();
338 red_black = !red_black;
371 auto dom = g_dist.getDomainIterator();
377 auto key = dom.get();
381 double error_tmp = abs((g_dist.get<0>(key.move(x,1)) + g_dist.get<0>(key.move(x,-1)) +
382 g_dist.get<0>(key.move(y,1)) + g_dist.get<0>(key.move(y,-1)) +
383 - 4.0*g_dist.get<0>(key)) - 1.0);
387 if (error_tmp > error)
403 std::cout <<
"Error norm infinity: " << error << std::endl;
424 g_dist.write(
"output");
This class represent an N-dimensional box.
void execute()
Execute all the requests.
size_t getProcessUnitID()
Get the process unit id.
void max(T &num)
Get the maximum number across all processors (or reduction with infinity norm)
Implementation of VCluster class.
This is a distributed grid.
OutputIteratorT OffsetT ReductionOpT OuputT init
< [in] The initial value of the reduction
aggregate of properties, from a list of object if create a struct that follow the OPENFPM native stru...