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"
18 template<
unsigned int dim,
typename stencil=no_stencil,
typename warn=pr
int_warning_on_adjustment<dim>>
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++)
122 for (
size_t i = 0 ; i < dim ; i++)
123 {this->
bc[i] =
bc[i];}
127 typedef typename generate_array<size_t,dim, Fill_zero>::result NNzero;
128 typedef typename generate_array<size_t,dim, Fill_two>::result NNtwo;
129 typedef typename generate_array<size_t,dim, Fill_three>::result NNthree;
138 for (
size_t i = 0 ; i < dim ; i++)
140 if (this->
bc[i] == NON_PERIODIC && g.
size(i) == 1)
141 {start_p[i] = 1; end_p[i] = 1;}
143 {start_p[i] = 0; end_p[i] = 2;}
171 for (
size_t i = 0 ; i < dim ; i++)
177 intersect = base_b.
Intersect(b_int,b_out);
180 for (
size_t i = 0 ; i < dim ; i++)
182 if (
bc[i] == PERIODIC)
190 if (intersect ==
true)
191 boxes.push_back(b_out);
197 if (
boxes.size() > 0)
void Initialize(const grid_sm< dim, T > &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< dim, stencil, warn > & operator++()
Get the next element.
std::vector< Box< dim, size_t > > boxes
Here we have all the boxes that this iterator produce.
grid_key_dx_iterator_sub_bc(const grid_sm< dim, T > &g, const grid_key_dx< dim > &start, const grid_key_dx< dim > &stop, const size_t(&bc)[dim])
Constructor.
T getLow(int i) const
get the i-coordinate of the low bound interval of the box
grid_key_dx is the key to access any element in the grid
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.
size_t size() const
Return the size of the grid.
T getHigh(int i) const
get the high interval of the box
void setHigh(int i, T val)
set the high interval of the box
bool isNext()
Check if there is the next element.
const grid_sm< dim, void > & getGridInfo() const
Return the grid information related to this grid.
mem_id get(size_t i) const
Get the i index.
void Initialize()
Initialize gk.
bool Intersect(const Box< dim, T > &b, Box< dim, T > &b_out) const
Intersect.
The same as grid_key_dx_iterator_sub_p but with periodic boundary.
void reset()
Reset the iterator (it restart from the beginning)
const size_t(& getSize() const)[N]
Return the size of the grid as an array.
grid_key_dx_iterator_sub_bc()
Constructor.
void setLow(int i, T val)
set the low interval of the box
grid_key_dx< dim > get() const
Return the actual grid key iterator.
This class is a trick to indicate the compiler a specific specialization pattern. ...
Declaration grid_key_dx_iterator_sub.
size_t bc[dim]
Boundary conditions.
size_t act
actual iterator box
bool isNext()
Check if there is the next element.
void reinitialize(const grid_key_dx_iterator_sub< dim > &g_s_it)
Reinitialize the iterator.
grid_key_dx_iterator_sub_bc< dim, stencil, warn > & operator++()
Get the next element.