OpenFPM_pdata  4.1.0
Project that contain the implementation of distributed structures
 
Loading...
Searching...
No Matches
grid_key_dx_iterator_sp< dim > Class Template Reference

Detailed Description

template<unsigned int dim>
class grid_key_dx_iterator_sp< dim >

Grid key class iterator, iterate through a starting linearized grid element to a stop linearized grid element in particular if linearize is the function that linearize all the grid_key_dx, it create an iterator that pass through Linearize^(-1)(start) Linearize^(-1)(start+1) ....... Linearize^(-1)(stop)

Parameters
dimdimensionality of the grid

Usage: In general you never create object directly, but you get it from a grid_cpu or grid_gpu with getIteratorLinStartStop()

Definition at line 28 of file grid_key_dx_iterator_sp.hpp.

#include <grid_key_dx_iterator_sp.hpp>

+ Inheritance diagram for grid_key_dx_iterator_sp< dim >:

Public Member Functions

template<typename T >
 grid_key_dx_iterator_sp (grid_sm< dim, T > &g, mem_id from, mem_id to)
 Constructor require a grid grid<dim,T>
 
bool isNext ()
 Check if there is the next element.
 
- 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>
 
template<typename grid_lin >
 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.
 
template<unsigned int id>
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 Attributes

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_sp()

template<unsigned int dim>
template<typename T >
grid_key_dx_iterator_sp< dim >::grid_key_dx_iterator_sp ( grid_sm< dim, T > &  g,
mem_id  from,
mem_id  to 
)
inline

Constructor require a grid grid<dim,T>

It construct an iterator from one index to another, in particular if linearize is the function that linearize all the grid_key, it create an iterator that pass through Linearize^(-1)(start) Linearize^(-1)(start+1) ....... Linearize^(-1)(stop)

For example for start (1,1) and stop (3,3) the point indicated with # are explored by the iterator

*
                 +-----+-----+-----+-----+-----+-----+ (6,5)
                 |     |     |     |     |     |     |
                 |     |     |     |     |     |     |
                 |     |     |     |     |     |     |
                 +-----+-----+-----+-----+-----+-----+
                 |     |     |     |     |     |     |
                 |     |     |     |     |     |     |
                 |     |     |     |     |     |     |
                 #-----#-----#-----#-----+-----+-----+
                 |     |     |     |     |     |     |
                 |     |     |     |     |     |     |
                 |     |     |     |     |     |     |
                 #-----#-----#-----#-----#-----#-----#
                 |     |     |     |     |     |     |
                 |     |     |     |     |     |     |
                 +-----#-----#-----#-----#-----#-----#
                 |     |     |     |     |     |     |
                 |     |     |     |     |     |     |
                 |     |     |     |     |     |     |
                 +-----+-----+-----+-----+-----+-----+
               (0,0)
*
*
* 
Template Parameters
Ttype of object that the grid store
Parameters
gGrid on which iterate
fromstarting point
toend point

Convert to a grid_key

Convert to a grid_key

Definition at line 80 of file grid_key_dx_iterator_sp.hpp.

Member Function Documentation

◆ isNext()

template<unsigned int dim>
bool grid_key_dx_iterator_sp< dim >::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

for all dimensions

check if we still have points

(Final point) we we still have one point

Definition at line 98 of file grid_key_dx_iterator_sp.hpp.

Field Documentation

◆ gk_stop

template<unsigned int dim>
grid_key_dx<dim> grid_key_dx_iterator_sp< dim >::gk_stop
private

stop point

Definition at line 31 of file grid_key_dx_iterator_sp.hpp.


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