OpenFPM_pdata  1.1.0
Project that contain the implementation of distributed structures
 All Data Structures Namespaces Functions Variables Typedefs Enumerations Friends Pages
grid_key_dx_iterator_sub< dim, stencil, warn > Class Template Reference

Declaration grid_key_dx_iterator_sub. More...

Detailed Description

template<unsigned int dim, typename stencil = no_stencil, typename warn = print_warning_on_adjustment<dim>>
class grid_key_dx_iterator_sub< dim, stencil, warn >

Declaration grid_key_dx_iterator_sub.

Grid key class iterator, iterate through a sub-grid defined by an hyper-cube

Parameters
dimdimensionality of the grid
Note
if you have a grid you can get this object from getIteratorSub()

Sub grid iterator declaration and usage

Definition at line 77 of file grid_sm.hpp.

#include <grid_sm.hpp>

+ Inheritance diagram for grid_key_dx_iterator_sub< dim, stencil, warn >:

Public Member Functions

 grid_key_dx_iterator_sub ()
 Default constructor. More...
 
 grid_key_dx_iterator_sub (const grid_key_dx_iterator_sub< dim, stencil > &g_s_it)
 Constructor from another grid_key_dx_iterator_sub. More...
 
template<typename T >
 grid_key_dx_iterator_sub (const grid_sm< dim, T > &g, const grid_key_dx< dim > &start, const grid_key_dx< dim > &stop)
 Constructor require a grid grid<dim,T> More...
 
template<typename T >
 grid_key_dx_iterator_sub (const grid_sm< dim, T > &g, const grid_key_dx< dim > &start, const grid_key_dx< dim > &stop, const grid_key_dx< dim >(&stencil_pnt)[stencil::nsp])
 Constructor require a grid grid<dim,T> More...
 
 grid_key_dx_iterator_sub (const grid_key_dx< dim >(&stencil_pnt)[stencil::nsp])
 Constructor. More...
 
template<typename T >
 grid_key_dx_iterator_sub (const grid_sm< dim, T > &g, const size_t m)
 Constructor require a grid grid<dim,T> More...
 
template<typename T >
 grid_key_dx_iterator_sub (const grid_sm< dim, T > &g, const size_t(&start)[dim], const size_t(&stop)[dim])
 Constructor require a grid grid<dim,T> More...
 
grid_key_dx_iterator_sub< dim,
stencil, warn > & 
operator++ ()
 Get the next element. More...
 
grid_key_dx_iterator_sub< dim,
stencil, warn > & 
operator+= (int nsteps)
 increment the operator by more than one More...
 
bool isNext ()
 Check if there is the next element. More...
 
grid_key_dx< dim > get () const
 Return the actual grid key iterator. More...
 
void reinitialize (const grid_key_dx_iterator_sub< dim > &g_s_it)
 Reinitialize the iterator. More...
 
size_t getVolume ()
 Get the volume spanned by this sub-grid iterator. More...
 
void reset ()
 Reset the iterator (it restart from the beginning) More...
 
const grid_sm< dim, void > & getGridInfo () const
 Return the grid information related to this grid. More...
 
const grid_key_dx< dim > & getStart () const
 Starting point. More...
 
const grid_key_dx< dim > & getStop () const
 Stop point. More...
 
template<unsigned int tot_add>
void private_sum ()
 Sum a template constant. More...
 
void private_adjust (size_t tot_add)
 Sum a template constant. More...
 
- Public Member Functions inherited from grid_key_dx_iterator< dim, stencil >
 grid_key_dx_iterator ()
 Default constructor. More...
 
 grid_key_dx_iterator (const grid_key_dx_iterator< dim > &g_it)
 Constructor from a grid_key_dx_iterator<dim> More...
 
template<typename T >
 grid_key_dx_iterator (const grid_sm< dim, T > &g, const grid_key_dx< dim >(&stencil_pnt)[stencil::nsp])
 Constructor require a grid_sm<dim,T> More...
 
 grid_key_dx_iterator (const grid_key_dx< dim >(&stencil_pnt)[stencil::nsp])
 Constructor. More...
 
template<typename T >
 grid_key_dx_iterator (const grid_sm< dim, T > &g)
 Constructor require a grid_sm<dim,T> More...
 
grid_key_dx_iterator< dim > operator= (const grid_key_dx_iterator< dim > &key_it)
 Constructor from another grid_key_dx_iterator. More...
 
grid_key_dx_iterator< dim,
stencil > & 
operator++ ()
 Get the next element. More...
 
void set (int d, size_t sz)
 Set the dimension. More...
 
template<unsigned int id>
size_t getStencil () const
 Get the actual position. More...
 
bool isNext ()
 Check if there is the next element. More...
 
const grid_key_dx< dim > & get () const
 Get the actual key. More...
 
void reinitialize (const grid_key_dx_iterator< dim > &key)
 Reinitialize the grid_key_dx_iterator. More...
 
const grid_sm< dim, void > & getGridInfo () const
 Get the information about the grid. More...
 
void reset ()
 Reset the iterator (it restart from the beginning) More...
 
void calc_stencil_offset (const grid_key_dx< dim > &start_p)
 Calculate the stencil offset. More...
 
grid_key_dx< dim > getStart ()
 Return the starting point of the iteration. More...
 
grid_key_dx< dim > getStop ()
 Return the stop point of the iteration. More...
 
size_t getVolume ()
 Get the volume spanned by this sub-grid iterator. More...
 

Private Member Functions

void Initialize ()
 Initialize gk. More...
 
void post_increment ()
 After incremented we have to check we did not overflo any dimension and in case adjust the dimensions. More...
 

Private Attributes

grid_sm< dim, void > grid_base
 grid base where we are iterating
 
grid_key_dx< dim > gk_start
 start point
 
grid_key_dx< dim > gk_stop
 stop point
 

Additional Inherited Members

- Protected Attributes inherited from grid_key_dx_iterator< dim, stencil >
grid_key_dx< dim > gk
 Actual key.
 
stencil stl_code
 

Constructor & Destructor Documentation

template<unsigned int dim, typename stencil = no_stencil, typename warn = print_warning_on_adjustment<dim>>
grid_key_dx_iterator_sub< dim, stencil, warn >::grid_key_dx_iterator_sub ( )
inline

Default constructor.

Warning
extremely unsafe If you use this constructor before use the iterator you should call reinitialize first

Definition at line 280 of file grid_key_dx_iterator_sub.hpp.

template<unsigned int dim, typename stencil = no_stencil, typename warn = print_warning_on_adjustment<dim>>
grid_key_dx_iterator_sub< dim, stencil, warn >::grid_key_dx_iterator_sub ( const grid_key_dx_iterator_sub< dim, stencil > &  g_s_it)
inline

Constructor from another grid_key_dx_iterator_sub.

Parameters
g_s_itgrid_key_dx_iterator_sub

Definition at line 289 of file grid_key_dx_iterator_sub.hpp.

template<unsigned int dim, typename stencil = no_stencil, typename warn = print_warning_on_adjustment<dim>>
template<typename T >
grid_key_dx_iterator_sub< dim, stencil, warn >::grid_key_dx_iterator_sub ( const grid_sm< dim, T > &  g,
const grid_key_dx< dim > &  start,
const grid_key_dx< dim > &  stop 
)
inline

Constructor require a grid grid<dim,T>

It construct an iterator over an hyper-cube defined by start and stop,

Warning
if start and stop are outside the domain defined by g the intersection will be considered
Template Parameters
Ttype of object that the grid store
Parameters
gGrid on which iterate
startstarting point
stopend point

Definition at line 322 of file grid_key_dx_iterator_sub.hpp.

template<unsigned int dim, typename stencil = no_stencil, typename warn = print_warning_on_adjustment<dim>>
template<typename T >
grid_key_dx_iterator_sub< dim, stencil, warn >::grid_key_dx_iterator_sub ( const grid_sm< dim, T > &  g,
const grid_key_dx< dim > &  start,
const grid_key_dx< dim > &  stop,
const grid_key_dx< dim >(&)  stencil_pnt[stencil::nsp] 
)
inline

Constructor require a grid grid<dim,T>

It construct an iterator over an hyper-cube defined by start and stop,

Warning
if start and stop are outside the domain defined by g the intersection will be considered
Template Parameters
Ttype of object that the grid store
Parameters
gGrid on which iterate
startstarting point
stopend point
stencil_pntstencil points

Definition at line 357 of file grid_key_dx_iterator_sub.hpp.

template<unsigned int dim, typename stencil = no_stencil, typename warn = print_warning_on_adjustment<dim>>
grid_key_dx_iterator_sub< dim, stencil, warn >::grid_key_dx_iterator_sub ( const grid_key_dx< dim >(&)  stencil_pnt[stencil::nsp])
inline

Constructor.

It construct an iterator setting only the stencil point. Require reinitialize to make it work

Parameters
stencil_pntstencil points

Definition at line 389 of file grid_key_dx_iterator_sub.hpp.

template<unsigned int dim, typename stencil = no_stencil, typename warn = print_warning_on_adjustment<dim>>
template<typename T >
grid_key_dx_iterator_sub< dim, stencil, warn >::grid_key_dx_iterator_sub ( const grid_sm< dim, T > &  g,
const size_t  m 
)
inline

Constructor require a grid grid<dim,T>

It construct an iterator over an hyper-cube defined by start and stop,

Warning
if start and stop are outside the domain defined by g the intersection will be considered
Template Parameters
Ttype of object that the grid store
Parameters
ginfo of the grid where we are iterating
mMargin of the domain

Definition at line 406 of file grid_key_dx_iterator_sub.hpp.

template<unsigned int dim, typename stencil = no_stencil, typename warn = print_warning_on_adjustment<dim>>
template<typename T >
grid_key_dx_iterator_sub< dim, stencil, warn >::grid_key_dx_iterator_sub ( const grid_sm< dim, T > &  g,
const size_t(&)  start[dim],
const size_t(&)  stop[dim] 
)
inline

Constructor require a grid grid<dim,T>

It construct an iterator over an hyper-cube defined by start and stop,

Template Parameters
Ttype of object that the grid store
Parameters
gGrid on which iterate
startstarting point
stopend point

Definition at line 431 of file grid_key_dx_iterator_sub.hpp.

Member Function Documentation

template<unsigned int dim, typename stencil = no_stencil, typename warn = print_warning_on_adjustment<dim>>
grid_key_dx<dim> grid_key_dx_iterator_sub< dim, stencil, warn >::get ( ) const
inline

Return the actual grid key iterator.

Returns
the actual key

Definition at line 526 of file grid_key_dx_iterator_sub.hpp.

template<unsigned int dim, typename stencil = no_stencil, typename warn = print_warning_on_adjustment<dim>>
const grid_sm<dim,void>& grid_key_dx_iterator_sub< dim, stencil, warn >::getGridInfo ( ) const
inline

Return the grid information related to this grid.

Definition at line 600 of file grid_key_dx_iterator_sub.hpp.

template<unsigned int dim, typename stencil = no_stencil, typename warn = print_warning_on_adjustment<dim>>
const grid_key_dx<dim>& grid_key_dx_iterator_sub< dim, stencil, warn >::getStart ( ) const
inline

Starting point.

Returns
starting point

Definition at line 610 of file grid_key_dx_iterator_sub.hpp.

template<unsigned int dim, typename stencil = no_stencil, typename warn = print_warning_on_adjustment<dim>>
const grid_key_dx<dim>& grid_key_dx_iterator_sub< dim, stencil, warn >::getStop ( ) const
inline

Stop point.

Returns
stop point

Definition at line 620 of file grid_key_dx_iterator_sub.hpp.

template<unsigned int dim, typename stencil = no_stencil, typename warn = print_warning_on_adjustment<dim>>
size_t grid_key_dx_iterator_sub< dim, stencil, warn >::getVolume ( )
inline

Get the volume spanned by this sub-grid iterator.

Returns
the volume

Definition at line 579 of file grid_key_dx_iterator_sub.hpp.

template<unsigned int dim, typename stencil = no_stencil, typename warn = print_warning_on_adjustment<dim>>
void grid_key_dx_iterator_sub< dim, stencil, warn >::Initialize ( )
inlineprivate

Initialize gk.

Initialize gk

Definition at line 180 of file grid_key_dx_iterator_sub.hpp.

template<unsigned int dim, typename stencil = no_stencil, typename warn = print_warning_on_adjustment<dim>>
bool grid_key_dx_iterator_sub< dim, stencil, warn >::isNext ( )
inline

Check if there is the next element.

Check if there is the next element

Returns
true if there is the next, false otherwise

we did not reach the end of the grid

we reach the end of the grid

Definition at line 503 of file grid_key_dx_iterator_sub.hpp.

template<unsigned int dim, typename stencil = no_stencil, typename warn = print_warning_on_adjustment<dim>>
grid_key_dx_iterator_sub<dim,stencil,warn>& grid_key_dx_iterator_sub< dim, stencil, warn >::operator++ ( )
inline

Get the next element.

Get the next element

Returns
the next grid_key

increment the first index

Definition at line 457 of file grid_key_dx_iterator_sub.hpp.

template<unsigned int dim, typename stencil = no_stencil, typename warn = print_warning_on_adjustment<dim>>
grid_key_dx_iterator_sub<dim,stencil,warn>& grid_key_dx_iterator_sub< dim, stencil, warn >::operator+= ( int  nsteps)
inline

increment the operator by more than one

Returns
the next grid_key

Definition at line 481 of file grid_key_dx_iterator_sub.hpp.

template<unsigned int dim, typename stencil = no_stencil, typename warn = print_warning_on_adjustment<dim>>
void grid_key_dx_iterator_sub< dim, stencil, warn >::post_increment ( )
inlineprivate

After incremented we have to check we did not overflo any dimension and in case adjust the dimensions.

check the overflow of all the index with exception of the last dimensionality

Definition at line 243 of file grid_key_dx_iterator_sub.hpp.

template<unsigned int dim, typename stencil = no_stencil, typename warn = print_warning_on_adjustment<dim>>
void grid_key_dx_iterator_sub< dim, stencil, warn >::private_adjust ( size_t  tot_add)
inline

Sum a template constant.

Parameters
tot_addAdd an offset to all the pointer

Definition at line 641 of file grid_key_dx_iterator_sub.hpp.

template<unsigned int dim, typename stencil = no_stencil, typename warn = print_warning_on_adjustment<dim>>
template<unsigned int tot_add>
void grid_key_dx_iterator_sub< dim, stencil, warn >::private_sum ( )
inline

Sum a template constant.

Template Parameters
compile-timeoffset

Definition at line 631 of file grid_key_dx_iterator_sub.hpp.

template<unsigned int dim, typename stencil = no_stencil, typename warn = print_warning_on_adjustment<dim>>
void grid_key_dx_iterator_sub< dim, stencil, warn >::reinitialize ( const grid_key_dx_iterator_sub< dim > &  g_s_it)
inline

Reinitialize the iterator.

it re-initialize the iterator with the passed grid_key_dx_iterator_sub the actual position of the grid_key_dx_iterator_sub is ignored

Parameters
g_s_itgrid_key_dx_iterator_sub

Definition at line 545 of file grid_key_dx_iterator_sub.hpp.

template<unsigned int dim, typename stencil = no_stencil, typename warn = print_warning_on_adjustment<dim>>
void grid_key_dx_iterator_sub< dim, stencil, warn >::reset ( )
inline

Reset the iterator (it restart from the beginning)

Initialize to 0 the index

Definition at line 587 of file grid_key_dx_iterator_sub.hpp.


The documentation for this class was generated from the following files: