OpenFPM_pdata  4.1.0
Project that contain the implementation of distributed structures
 
Loading...
Searching...
No Matches
grid_key_dx_iterator_sub< dim, stencil, linearizer, warn > Class Template Reference

Declaration grid_key_dx_iterator_sub. More...

Detailed Description

template<unsigned int dim, typename stencil, typename linearizer, typename warn>
class grid_key_dx_iterator_sub< dim, stencil, linearizer, 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 162 of file grid_key_dx_iterator_sub.hpp.

#include <grid_key_dx_iterator_sub.hpp>

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

Public Member Functions

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

Private Member Functions

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

Private Attributes

linearizer 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, linearizer >
grid_key_dx< dim > gk
 Actual key.
 
stencil stl_code
 

Constructor & Destructor Documentation

◆ grid_key_dx_iterator_sub() [1/7]

template<unsigned int dim, typename stencil , typename linearizer , typename warn >
grid_key_dx_iterator_sub< dim, stencil, linearizer, 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.

◆ grid_key_dx_iterator_sub() [2/7]

template<unsigned int dim, typename stencil , typename linearizer , typename warn >
grid_key_dx_iterator_sub< dim, stencil, linearizer, warn >::grid_key_dx_iterator_sub ( const grid_key_dx_iterator_sub< dim, stencil, linearizer > &  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.

◆ grid_key_dx_iterator_sub() [3/7]

template<unsigned int dim, typename stencil , typename linearizer , typename warn >
grid_key_dx_iterator_sub< dim, stencil, linearizer, warn >::grid_key_dx_iterator_sub ( const linearizer &  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.

◆ grid_key_dx_iterator_sub() [4/7]

template<unsigned int dim, typename stencil , typename linearizer , typename warn >
grid_key_dx_iterator_sub< dim, stencil, linearizer, warn >::grid_key_dx_iterator_sub ( const linearizer &  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 358 of file grid_key_dx_iterator_sub.hpp.

◆ grid_key_dx_iterator_sub() [5/7]

template<unsigned int dim, typename stencil , typename linearizer , typename warn >
grid_key_dx_iterator_sub< dim, stencil, linearizer, 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 390 of file grid_key_dx_iterator_sub.hpp.

◆ grid_key_dx_iterator_sub() [6/7]

template<unsigned int dim, typename stencil , typename linearizer , typename warn >
grid_key_dx_iterator_sub< dim, stencil, linearizer, warn >::grid_key_dx_iterator_sub ( const linearizer &  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 407 of file grid_key_dx_iterator_sub.hpp.

◆ grid_key_dx_iterator_sub() [7/7]

template<unsigned int dim, typename stencil , typename linearizer , typename warn >
grid_key_dx_iterator_sub< dim, stencil, linearizer, warn >::grid_key_dx_iterator_sub ( const linearizer &  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,

Parameters
gGrid on which iterate
startstarting point
stopend point

Definition at line 431 of file grid_key_dx_iterator_sub.hpp.

Member Function Documentation

◆ get()

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

Return the actual grid key iterator.

Returns
the actual key

Definition at line 530 of file grid_key_dx_iterator_sub.hpp.

◆ getGridInfo()

template<unsigned int dim, typename stencil , typename linearizer , typename warn >
const linearizer & grid_key_dx_iterator_sub< dim, stencil, linearizer, warn >::getGridInfo ( ) const
inline

Return the grid information related to this grid.

Definition at line 603 of file grid_key_dx_iterator_sub.hpp.

◆ getStart()

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

Starting point.

Returns
starting point

Definition at line 613 of file grid_key_dx_iterator_sub.hpp.

◆ getStop()

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

Stop point.

Returns
stop point

Definition at line 623 of file grid_key_dx_iterator_sub.hpp.

◆ getVolume()

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

Get the volume spanned by this sub-grid iterator.

Returns
the volume

Definition at line 582 of file grid_key_dx_iterator_sub.hpp.

◆ Initialize()

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

Initialize gk.

Initialize gk

Definition at line 180 of file grid_key_dx_iterator_sub.hpp.

◆ invalidate()

template<unsigned int dim, typename stencil , typename linearizer , typename warn >
void grid_key_dx_iterator_sub< dim, stencil, linearizer, warn >::invalidate ( )
inline

Definition at line 652 of file grid_key_dx_iterator_sub.hpp.

◆ isNext()

template<unsigned int dim, typename stencil , typename linearizer , typename warn >
bool grid_key_dx_iterator_sub< dim, stencil, linearizer, 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 507 of file grid_key_dx_iterator_sub.hpp.

◆ operator++()

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

Get the next element.

Get the next element

Returns
the next grid_key

increment the first index

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

Definition at line 459 of file grid_key_dx_iterator_sub.hpp.

◆ operator+=()

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

increment the operator by more than one

Returns
the next grid_key

Definition at line 485 of file grid_key_dx_iterator_sub.hpp.

◆ post_increment()

template<unsigned int dim, typename stencil , typename linearizer , typename warn >
void grid_key_dx_iterator_sub< dim, stencil, linearizer, 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.

◆ private_adjust()

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

Sum a template constant.

Parameters
tot_addAdd an offset to all the pointer

Definition at line 644 of file grid_key_dx_iterator_sub.hpp.

◆ private_sum()

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

Sum a template constant.

Template Parameters
compile-timeoffset

Definition at line 634 of file grid_key_dx_iterator_sub.hpp.

◆ reinitialize()

template<unsigned int dim, typename stencil , typename linearizer , typename warn >
void grid_key_dx_iterator_sub< dim, stencil, linearizer, 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 548 of file grid_key_dx_iterator_sub.hpp.

◆ reset()

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

Reset the iterator (it restart from the beginning)

Initialize to 0 the index

Definition at line 590 of file grid_key_dx_iterator_sub.hpp.

Field Documentation

◆ gk_start

template<unsigned int dim, typename stencil , typename linearizer , typename warn >
grid_key_dx<dim> grid_key_dx_iterator_sub< dim, stencil, linearizer, warn >::gk_start
private

start point

Definition at line 172 of file grid_key_dx_iterator_sub.hpp.

◆ gk_stop

template<unsigned int dim, typename stencil , typename linearizer , typename warn >
grid_key_dx<dim> grid_key_dx_iterator_sub< dim, stencil, linearizer, warn >::gk_stop
private

stop point

Definition at line 175 of file grid_key_dx_iterator_sub.hpp.

◆ grid_base

template<unsigned int dim, typename stencil , typename linearizer , typename warn >
linearizer grid_key_dx_iterator_sub< dim, stencil, linearizer, warn >::grid_base
private

grid base where we are iterating

Definition at line 169 of file grid_key_dx_iterator_sub.hpp.


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