8#ifndef SRC_GRID_GRID_DIST_ID_ITERATOR_DEC_HPP_
9#define SRC_GRID_GRID_DIST_ID_ITERATOR_DEC_HPP_
11#include "grid_dist_id_iterator.hpp"
12#include "Grid/grid_dist_util.hpp"
13#include "grid_dist_id_iterator_util.hpp"
22template<
typename Decomposition,
bool ghost_or_domain = false>
41 typename Decomposition::stype
spacing[Decomposition::dims];
64 size_t sz[Decomposition::dims];
65 for (
size_t i = 0 ; i < Decomposition::dims ; i++)
129 for (
size_t i = 0 ; i < Decomposition::dims ; i++)
133 create_gdb_ext<Decomposition::dims,Decomposition>(
gdb_ext,dec,sz,dec.getDomain(),
spacing);
154 create_gdb_ext<Decomposition::dims,Decomposition>(
gdb_ext,dec,sz,dec.getDomain(),
spacing);
207 for (
int i = 0 ; i < Decomposition::dims ; i++)
277 size_t sub_id = k.getSub();
282 k_glob = k_glob +
gdb_ext.get(sub_id).origin;
295 auto key = this->
get();
297 for (
int i = 0 ; i < Decomposition::dims ; i++)
This class represent an N-dimensional box.
__device__ __host__ T getLow(int i) const
get the i-coordinate of the low bound interval of the box
__device__ __host__ void setHigh(int i, T val)
set the high interval of the box
__device__ __host__ void setLow(int i, T val)
set the low interval of the box
This class define the domain decomposition interface.
This class implement the point shape in an N-dimensional space.
__device__ __host__ const T & get(unsigned int i) const
Get coordinate.
Given the decomposition it create an iterator.
grid_dist_id_iterator_dec< Decomposition > & operator=(const grid_dist_id_iterator_dec< Decomposition > &tmp)
Copy operator=.
Box< Decomposition::dims, typename Decomposition::stype > domain
Domain.
grid_dist_key_dx< Decomposition::dims > get_int()
Get the actual key.
grid_key_dx< Decomposition::dims > start
start key
size_t getGridId()
Return the index of the grid in which we are iterating.
openfpm::vector< GBoxes< Decomposition::dims > > gdb_ext
Extension of each grid: domain and ghost + domain.
void selectValidGrid()
from g_c increment g_c until you find a valid grid
grid_dist_id_iterator_dec(Decomposition &dec, const size_t(&sz)[Decomposition::dims], grid_key_dx< Decomposition::dims > start, grid_key_dx< Decomposition::dims > stop)
Constructor of the distributed grid iterator.
grid_key_dx< Decomposition::dims > getStart()
Get the starting point of the sub-grid we are iterating.
grid_key_dx< Decomposition::dims > get()
Get the actual global key of the grid.
grid_key_dx< Decomposition::dims > getStop()
Get the starting point of the sub-grid we are iterating.
Box< Decomposition::dims, size_t > getGridBox()
Return the actual pointed grid.
Point< Decomposition::dims, typename Decomposition::stype > getPoint()
Return the point coordinates.
bool isNextGrid()
Return true if we point to a valid grid.
grid_key_dx_iterator_sub< Decomposition::dims > a_it
Actual iterator.
Decomposition::stype spacing[Decomposition::dims]
Spacing.
grid_dist_id_iterator_dec(Decomposition &dec, const size_t(&sz)[Decomposition::dims])
Constructor of the distributed grid iterator.
Decomposition::stype getSpacing(size_t i)
Get the spacing of the grid.
grid_key_dx< Decomposition::dims > stop
stop key
grid_dist_id_iterator_dec< Decomposition, ghost_or_domain > & operator++()
Get the next element.
grid_dist_id_iterator_dec(const grid_dist_id_iterator_dec< Decomposition > &tmp)
Copy constructor.
bool isNext()
Check if there is the next element.
size_t g_c
grid list counter
grid_dist_key_dx< Decomposition::dims > get_dist()
Get the actual grid key for a distributed grid.
Grid key for a distributed grid.
Declaration grid_key_dx_iterator_sub.
grid_key_dx< dim > get() const
Return the actual grid key iterator.
bool isNext()
Check if there is the next element.
void reinitialize(const grid_key_dx_iterator_sub< dim > &g_s_it)
Reinitialize the iterator.
const grid_key_dx< dim > & getStart() const
Starting point.
const grid_key_dx< dim > & getStop() const
Stop point.
grid_key_dx is the key to access any element in the grid
void zero()
Set to zero the key.
__device__ __host__ void set_d(index_type i, index_type id)
Set the i index.
__device__ __host__ index_type get(index_type i) const
Get the i index.
Implementation of 1-D std::vector like structure.