8 #ifndef GRID_DIST_ID_ITERATOR_HPP_
9 #define GRID_DIST_ID_ITERATOR_HPP_
14 #include "Grid/grid_dist_key.hpp"
15 #include "VCluster/VCluster.hpp"
16 #include "util/GBoxes.hpp"
28 template<
unsigned int dim,
typename device_gr
id,
int impl,
typename stencil = no_stencil >
44 template<
unsigned int dim,
typename device_gr
id,
typename stencil>
68 while (g_c < gList.size() && (gList.get(g_c).size() == 0 || gdb_ext.get(g_c).Dbox.isValid() == false ) )
72 if (g_c < gList.size())
74 a_it.reinitialize(gList.get(g_c).getIterator(gdb_ext.get(g_c).Dbox.getKP1(),gdb_ext.get(g_c).Dbox.getKP2()));
88 :g_c(0),gList(gk),gdb_ext(gdb_ext),stop(stop)
108 :g_c(0),gList(gk),gdb_ext(gdb_ext),a_it(stencil_pnt),stop(stop)
132 if (a_it.isNext() ==
true)
154 if (g_c >= gList.size())
223 size_t sub_id = k.
getSub();
228 k_glob = k_glob + gdb_ext.
get(sub_id).origin;
256 template<
unsigned int dim,
typename device_gr
id,
typename stencil>
277 while (g_c < gList.size() && (gList.get(g_c).size() == 0 || gdb_ext.get(g_c).Dbox.isValid() == false ) ) g_c++;
280 if (g_c < gList.size())
282 a_it.reinitialize(gList.get(g_c).getIterator(gdb_ext.get(g_c).Dbox.getKP1(),gdb_ext.get(g_c).Dbox.getKP2()));
299 gdb_ext = tmp.gdb_ext;
300 a_it.reinitialize(tmp.a_it);
312 :g_c(0),gList(gk),gdb_ext(gdb_ext)
336 if (a_it.isNext() ==
true)
357 if (g_c >= gList.size())
398 size_t sub_id = k.
getSub();
403 k_glob = k_glob + gdb_ext.
get(sub_id).origin;
const openfpm::vector< GBoxes< device_grid::dims > > & gdb_ext
Extension of each grid: domain and ghost + domain.
grid_key_dx_iterator< dim, stencil > a_it
Actual iterator.
grid_key_dx is the key to access any element in the grid
grid_dist_lin_dx getStencil()
Return the stencil point offset.
grid_dist_lin_dx getStencil()
Return the stencil point offset.
grid_dist_iterator< dim, device_grid, FIXED > & operator++()
Get the next element.
grid_key_dx< dim > getGKey(const grid_dist_key_dx< dim > &k)
Convert a g_dist_key_dx into a global key.
grid_key_dx< dim > getStop() const
it return the stop point of the iterator
Grid key for a distributed grid.
grid_key_dx< dim > stop
stop point (is the grid size)
size_t g_c
grid list counter
mem_id get(size_t i) const
Get the i index.
grid_dist_iterator(openfpm::vector< device_grid > &gk, const openfpm::vector< GBoxes< device_grid::dims >> &gdb_ext, const grid_key_dx< dim > &stop)
Constructor of the distributed grid iterator.
This structure store the Box that define the domain inside the Ghost + domain box.
const openfpm::vector< GBoxes< device_grid::dims > > & getGBoxes()
Get the boxes.
const openfpm::vector< device_grid > & gList
List of the grids we are going to iterate.
size_t g_c
grid list counter
bool isNext()
Check if there is the next element.
void selectValidGrid()
from g_c increment g_c until you find a valid grid
void zero()
Set to zero the key.
grid_key_dx_iterator_sub< dim, stencil > a_it
Actual iterator.
grid_key_dx< dim > getStart() const
it return the start point of the iterator
Distributed grid iterator.
grid_dist_iterator(openfpm::vector< device_grid > &gk, const openfpm::vector< GBoxes< device_grid::dims >> &gdb_ext, const grid_key_dx< dim > &stop, const grid_key_dx< dim >(&stencil_pnt)[stencil::nsp])
Constructor of the distributed grid iterator with stencil support.
void selectValidGrid()
from g_c increment g_c until you find a valid grid
openfpm::vector< device_grid > & gList
List of the grids we are going to iterate.
grid_key_dx< dim > getGKey(const grid_dist_key_dx< dim > &k)
Convert a g_dist_key_dx into a global key.
const openfpm::vector< GBoxes< device_grid::dims > > & gdb_ext
Extension of each grid: domain and ghost + domain.
grid_dist_iterator(const openfpm::vector< device_grid > &gk, const openfpm::vector< GBoxes< device_grid::dims >> &gdb_ext)
Constructor of the distributed grid iterator.
bool isNext()
Check if there is the next element.
Distributed grid iterator.
grid_dist_iterator< dim, device_grid, FIXED > & operator=(const grid_dist_iterator< dim, device_grid, FIXED > &tmp)
Copy operator=.
size_t getSub() const
Get the local grid.
const openfpm::vector< GBoxes< device_grid::dims > > & getGBoxes()
Get the boxes.
grid_dist_iterator< dim, device_grid, FREE, stencil > & operator++()
Get the next element.
grid_key_dx< dim > getKey() const
Get the key.
Distributed linearized key.