8#ifndef OPENFPM_DATA_SRC_GRID_ITERATORS_GRID_KEY_DX_ITERATOR_SUB_BC_HPP_
9#define OPENFPM_DATA_SRC_GRID_ITERATORS_GRID_KEY_DX_ITERATOR_SUB_BC_HPP_
11#include "grid_key_dx_iterator_sub.hpp"
18template<
unsigned int dim,
typename stencil=no_stencil,
typename linearizer = gr
id_sm<dim,
void>,
typename warn=pr
int_warning_on_adjustment<dim,linearizer>>
28 std::vector<Box<dim,size_t>>
boxes;
37 for (
size_t i = 0 ; i < dim ; i++)
39 if (
bc[i] == NON_PERIODIC && key.
get(i) != 1)
65 for (
size_t i = 0 ; i < dim ; i++)
76 for (
size_t i = 0 ; i < dim ; i++)
80 boxes.swap(tmp.boxes);
107 const size_t (&
bc)[dim])
124 const size_t (&
bc)[dim])
128 for (
size_t i = 0 ; i < dim ; i++)
129 {this->bc[i] =
bc[i];}
133 typedef typename generate_array<size_t,dim, Fill_three>::result NNthree;
142 for (
size_t i = 0 ; i < dim ; i++)
144 if (this->bc[i] == NON_PERIODIC && g.size(i) == 1)
145 {start_p[i] = 1; end_p[i] = 1;}
147 {start_p[i] = 0; end_p[i] = 2;}
175 for (
size_t i = 0 ; i < dim ; i++)
177 b_int.
setLow(i,(key.
get(i)-1)*g.getSize()[i]);
181 intersect = base_b.
Intersect(b_int,b_out);
184 for (
size_t i = 0 ; i < dim ; i++)
186 if (
bc[i] == PERIODIC)
188 b_out.
setLow(i,openfpm::math::positive_modulo(b_out.
getLow(i),g.size(i)));
189 b_out.
setHigh(i,openfpm::math::positive_modulo(b_out.
getHigh(i),g.size(i)));
194 if (intersect ==
true)
195 {
boxes.push_back(b_out);}
201 if (
boxes.size() > 0)
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__ bool Intersect(const Box< dim, T > &b, Box< dim, T > &b_out) const
Intersect.
__device__ __host__ T getHigh(int i) const
get the high 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
The same as grid_key_dx_iterator_sub_p but with periodic boundary.
void Initialize(const linearizer &g, const grid_key_dx< dim > &start, const grid_key_dx< dim > &stop, const size_t(&bc)[dim])
Initialize the iterator.
grid_key_dx_iterator_sub_bc()
Constructor.
grid_key_dx_iterator_sub_bc(const linearizer &g, const grid_key_dx< dim > &start, const grid_key_dx< dim > &stop, const size_t(&bc)[dim])
Constructor.
size_t bc[dim]
Boundary conditions.
const grid_key_dx< dim > get() const
Return the actual grid key iterator.
void reset()
Reset the iterator (it restart from the beginning)
size_t act
actual iterator box
std::vector< Box< dim, size_t > > boxes
Here we have all the boxes that this iterator produce.
bool isNext()
Check if there is the next element.
bool check_invalid(const grid_key_dx< dim > &key, const size_t(&bc)[dim])
Check if the position is valid with the actual boundary conditions.
grid_key_dx_iterator_sub_bc< dim, stencil, linearizer, warn > & operator++()
Get the next element.
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.
void Initialize()
Initialize gk.
const linearizer & getGridInfo() const
Return the grid information related to this grid.
grid_key_dx_iterator_sub< dim, stencil, linearizer, warn > & operator++()
Get the next element.
grid_key_dx is the key to access any element in the grid
__device__ __host__ index_type get(index_type i) const
Get the i index.