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);
105 if (key_g.get(0) == 0 || key_g.get(0) == sz[0] ||
106 key_g.get(1) == 0 || key_g.get(1) == sz[1])
109 g_dist.template get<0>(
key) = 0.0;
114 g_dist.template get<0>(
key) = 0.0;
133 int main(
int argc,
char* argv[])
150 openfpm_init(&argc,&argv);
171 size_t sz[2] = {64,64};
204 double spacing[2] = {g_dist.spacing(0),g_dist.spacing(1)};
240 g_dist.template ghost_get<0>();
258 bool red_black =
true;
261 for (
size_t i = 0 ; i < 10000 ; i++)
278 auto dom = g_dist.getDomainIterator();
285 auto key = dom.get();
289 auto key_g = g_dist.getGKey(
key);
296 if (red_black ==
false && (key_g.get(0) + key_g.get(1)) % 2 == 0)
298 else if (red_black ==
true && (key_g.get(0) + key_g.get(1)) % 2 == 1)
307 g_dist.get<0>(
key) = (g_dist.get<0>(
key.move(x,1)) + g_dist.template get<0>(
key.move(x,-1)) +
308 g_dist.get<0>(
key.move(y,1)) + g_dist.template get<0>(
key.move(y,-1)) +
334 g_dist.template ghost_get<0>();
337 red_black = !red_black;
370 auto dom = g_dist.getDomainIterator();
376 auto key = dom.get();
380 double error_tmp = abs((g_dist.get<0>(
key.move(x,1)) + g_dist.get<0>(
key.move(x,-1)) +
381 g_dist.get<0>(
key.move(y,1)) + g_dist.get<0>(
key.move(y,-1)) +
382 - 4.0*g_dist.get<0>(
key)) - 1.0);
386 if (error_tmp > error)
396 Vcluster & v_cl = create_vcluster();
402 std::cout <<
"Error norm infinity: " << error << std::endl;
423 g_dist.write(
"output");
size_t getProcessUnitID()
Get the process unit id.
void execute()
Execute all the requests.
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.
This class represent an N-dimensional box.
This class is a trick to indicate the compiler a specific specialization pattern. ...
aggregate of properties, from a list of object if create a struct that follow the OPENFPM native stru...