1 #include "Grid/grid_dist_id.hpp" 
    2 #include "data_type/aggregate.hpp" 
   57     auto it = Old.getDomainIterator();
 
   65         Old.template get<U>(
key) = 1.0;
 
   66         Old.template get<V>(
key) = 0.0;
 
   69         New.template get<U>(
key) = 0.0;
 
   70         New.template get<V>(
key) = 0.0;
 
   75     long int x_start = Old.size(0)*1.55f/domain.
getHigh(0);
 
   76     long int y_start = Old.size(1)*1.55f/domain.
getHigh(1);
 
   77     long int z_start = Old.size(1)*1.55f/domain.
getHigh(2);
 
   79     long int x_stop = Old.size(0)*1.85f/domain.
getHigh(0);
 
   80     long int y_stop = Old.size(1)*1.85f/domain.
getHigh(1);
 
   81     long int z_stop = Old.size(1)*1.85f/domain.
getHigh(2);
 
   85     auto it_init = Old.getSubDomainIterator(start,stop);
 
   87     while (it_init.isNext())
 
   91                 Old.template get<U>(
key) = 0.5 + (((
double)std::rand())/RAND_MAX -0.5)/10.0;
 
   92                 Old.template get<V>(
key) = 0.25 + (((
double)std::rand())/RAND_MAX -0.5)/20.0;
 
   99 int main(
int argc, 
char* argv[])
 
  101     openfpm_init(&argc,&argv);
 
  107         size_t sz[3] = {128,128,128};
 
  125         size_t timeSteps = 5000;
 
  138     double spacing[3] = {Old.
spacing(0),Old.spacing(1),Old.spacing(2)};
 
  140     init(Old,New,domain);
 
  144     Old.template ghost_get<U,V>();
 
  148     double uFactor = deltaT * du/(spacing[x]*spacing[x]);
 
  149     double vFactor = deltaT * dv/(spacing[x]*spacing[x]);
 
  166     for (
size_t i = 0; i < timeSteps; ++i)
 
  169         {std::cout << 
"STEP: " << i << std::endl;}
 
  173         auto it = Old.getDomainIteratorStencil(star_stencil_3D);
 
  178             auto Cp = it.getStencil<0>();
 
  181             auto mx = it.getStencil<1>();
 
  182             auto px = it.getStencil<2>();
 
  183             auto my = it.getStencil<3>();
 
  184             auto py = it.getStencil<4>();
 
  185             auto mz = it.getStencil<5>();
 
  186             auto pz = it.getStencil<6>();
 
  189             New.
get<U>(Cp) = Old.get<U>(Cp) + uFactor * (
 
  196                                         6.0*Old.get<U>(Cp)) +
 
  197                                         - deltaT * Old.get<U>(Cp) * Old.get<V>(Cp) * Old.get<V>(Cp) +
 
  198                                         - deltaT * F * (Old.get<U>(Cp) - 1.0);
 
  202             New.get<V>(Cp) = Old.get<V>(Cp) + vFactor * (
 
  210                                         deltaT * Old.get<U>(Cp) * Old.get<V>(Cp) * Old.get<V>(Cp) +
 
  211                                         - deltaT * (F+K) * Old.get<V>(Cp);
 
  227         Old.ghost_get<U,V>();
 
  233             Old.save(
"output_" + std::to_string(count));
 
  239     std::cout << 
"Total simulation: " << tot_sim.
getwct() << std::endl;
 
grid_key_dx is the key to access any element in the grid 
 
T getHigh(int i) const 
get the high interval of the box 
 
double getwct()
Return the elapsed real time. 
 
mem_id get(size_t i) const 
Get the i index. 
 
This is a distributed grid. 
 
void start()
Start the timer. 
 
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...
 
Class for cpu time benchmarking. 
 
St spacing(size_t i) const 
Get the spacing of the grid in direction i. 
 
void stop()
Stop the timer. 
 
[v_transform metafunction]