OpenFPM_data  0.1.0
Project that contain the implementation and interfaces for basic structure like vectors, grids, graph ... .
 All Data Structures Namespaces Functions Variables Typedefs Friends
grid_key_dx_iterator< dim > Class Template Reference

Detailed Description

template<unsigned int dim>
class grid_key_dx_iterator< dim >

Grid key class iterator, iterate through the grid element

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

Grid iterator declaration and usage

size_t count = 0;
// Subdivisions
size_t div[3] = {16,16,16};
// grid info
grid_sm<3,void> g_info(div);
// Create a grid iterator
// Iterate on all the elements
while (g_it.isNext())
{
grid_key_dx<3> key = g_it.get();
// set the grid key to zero without any reason ( to avoid warning compilations )
key.zero();
count++;
++g_it;
}
BOOST_REQUIRE_EQUAL(count, (size_t)16*16*16);

Definition at line 27 of file grid_key_dx_iterator.hpp.

#include <grid_key_dx_iterator.hpp>

+ Inheritance diagram for grid_key_dx_iterator< dim >:

Public Member Functions

 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)
 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 > & operator++ ()
 Get the next element. More...
 
void set (int d, size_t sz)
 Set the dimension. More...
 
bool isNext ()
 Check if there is the next element. More...
 
const grid_key_dx< dim > & get ()
 Get the actual key. More...
 
void reinitialize (const grid_key_dx_iterator< dim > &key)
 Reinitialize the grid_key_dx_iterator. More...
 
void reset ()
 Reset the iterator (it restart from the beginning) More...
 

Protected Attributes

grid_key_dx< dim > gk
 

Private Member Functions

size_t get_gk (size_t i) const
 return the index i of the gk key More...
 

Private Attributes

grid_sm< dim, void > grid_base
 

Constructor & Destructor Documentation

template<unsigned int dim>
grid_key_dx_iterator< dim >::grid_key_dx_iterator ( )
inline

Default constructor.

Warning
entremly unsafe Before use the iterator you have call reinitialize

Definition at line 62 of file grid_key_dx_iterator.hpp.

template<unsigned int dim>
grid_key_dx_iterator< dim >::grid_key_dx_iterator ( const grid_key_dx_iterator< dim > &  g_it)
inline

Constructor from a grid_key_dx_iterator<dim>

Parameters
g_itgrid_key_dx_iterator<dim>

Initialize to 0 the index

Definition at line 73 of file grid_key_dx_iterator.hpp.

template<unsigned int dim>
template<typename T >
grid_key_dx_iterator< dim >::grid_key_dx_iterator ( const grid_sm< dim, T > &  g)
inline

Constructor require a grid_sm<dim,T>

Parameters
ginfo of the grid on which iterate

Definition at line 92 of file grid_key_dx_iterator.hpp.

Member Function Documentation

template<unsigned int dim>
const grid_key_dx<dim>& grid_key_dx_iterator< dim >::get ( )
inline

Get the actual key.

Get the actual key

Returns
the actual key

Definition at line 197 of file grid_key_dx_iterator.hpp.

template<unsigned int dim>
size_t grid_key_dx_iterator< dim >::get_gk ( size_t  i) const
inlineprivate

return the index i of the gk key

Parameters
iindex to get
Returns
index value

Definition at line 45 of file grid_key_dx_iterator.hpp.

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

we did not reach the end of the grid

we reach the end of the grid

Definition at line 177 of file grid_key_dx_iterator.hpp.

template<unsigned int dim>
grid_key_dx_iterator<dim>& grid_key_dx_iterator< dim >::operator++ ( )
inline

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 124 of file grid_key_dx_iterator.hpp.

template<unsigned int dim>
grid_key_dx_iterator<dim> grid_key_dx_iterator< dim >::operator= ( const grid_key_dx_iterator< dim > &  key_it)
inline

Constructor from another grid_key_dx_iterator.

Parameters
key_itgrid_key_dx_iterator

Initialize the index using key_it

Definition at line 106 of file grid_key_dx_iterator.hpp.

template<unsigned int dim>
void grid_key_dx_iterator< dim >::reinitialize ( const grid_key_dx_iterator< dim > &  key)
inline

Reinitialize the grid_key_dx_iterator.

Parameters
keyform

Definition at line 207 of file grid_key_dx_iterator.hpp.

template<unsigned int dim>
void grid_key_dx_iterator< dim >::reset ( )
inline

Reset the iterator (it restart from the beginning)

Initialize to 0 the index

Definition at line 216 of file grid_key_dx_iterator.hpp.

template<unsigned int dim>
void grid_key_dx_iterator< dim >::set ( int  d,
size_t  sz 
)
inline

Set the dimension.

Set the dimension

Parameters
dis the dimension
szset the counter to sz

Definition at line 162 of file grid_key_dx_iterator.hpp.


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