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_sub< dim, warn > Class Template Reference

Detailed Description

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

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

// Subdivisions
size_t div[3] = {16,16,16};
// grid info
grid_sm<3,void> g_info(div);
grid_key_dx<3> start(1,1,1);
grid_key_dx<3> stop(14,14,14);
// Create a grid iterator (start and stop included)
grid_key_dx_iterator_sub<3> g_it(g_info,start,stop);
// 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)14*14*14);

Definition at line 71 of file grid_sm.hpp.

#include <grid_key_dx_iterator_sub.hpp>

+ Inheritance diagram for grid_key_dx_iterator_sub< dim, warn >:

Public Member Functions

 grid_key_dx_iterator_sub ()
 Default constructor. More...
 
 grid_key_dx_iterator_sub (const grid_key_dx_iterator_sub< dim > &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 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< dim > & operator++ ()
 Get the next element. More...
 
bool isNext ()
 Check if there is the next element. More...
 
grid_key_dx< dim > get ()
 Return the actual grid key iterator. More...
 
void reinitialize (const grid_key_dx_iterator_sub< dim, warn > &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 ()
 Return the grid information related to this grid. More...
 
- Public Member Functions inherited from grid_key_dx_iterator< dim >
 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...
 

Private Member Functions

void Initialize ()
 Initialize gk. 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 >
grid_key_dx< dim > gk
 

Constructor & Destructor Documentation

template<unsigned int dim, typename warn = print_warning_on_adjustment<dim>>
grid_key_dx_iterator_sub< dim, 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 146 of file grid_key_dx_iterator_sub.hpp.

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

Constructor from another grid_key_dx_iterator_sub.

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
Parameters
g_s_itgrid_key_dx_iterator_sub

Definition at line 158 of file grid_key_dx_iterator_sub.hpp.

template<unsigned int dim, typename warn = print_warning_on_adjustment<dim>>
template<typename T >
grid_key_dx_iterator_sub< dim, 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 176 of file grid_key_dx_iterator_sub.hpp.

template<unsigned int dim, typename warn = print_warning_on_adjustment<dim>>
template<typename T >
grid_key_dx_iterator_sub< dim, 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 208 of file grid_key_dx_iterator_sub.hpp.

template<unsigned int dim, typename warn = print_warning_on_adjustment<dim>>
template<typename T >
grid_key_dx_iterator_sub< dim, 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 233 of file grid_key_dx_iterator_sub.hpp.

Member Function Documentation

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

Return the actual grid key iterator.

Definition at line 324 of file grid_key_dx_iterator_sub.hpp.

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

Return the grid information related to this grid.

Definition at line 397 of file grid_key_dx_iterator_sub.hpp.

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

Get the volume spanned by this sub-grid iterator.

Returns
the volume

Definition at line 376 of file grid_key_dx_iterator_sub.hpp.

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

Initialize gk.

Initialize gk

Definition at line 79 of file grid_key_dx_iterator_sub.hpp.

template<unsigned int dim, typename warn = print_warning_on_adjustment<dim>>
bool grid_key_dx_iterator_sub< dim, 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 303 of file grid_key_dx_iterator_sub.hpp.

template<unsigned int dim, typename warn = print_warning_on_adjustment<dim>>
grid_key_dx_iterator<dim>& grid_key_dx_iterator_sub< dim, 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 260 of file grid_key_dx_iterator_sub.hpp.

template<unsigned int dim, typename warn = print_warning_on_adjustment<dim>>
void grid_key_dx_iterator_sub< dim, warn >::reinitialize ( const grid_key_dx_iterator_sub< dim, warn > &  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 343 of file grid_key_dx_iterator_sub.hpp.

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

Reset the iterator (it restart from the beginning)

Initialize to 0 the index

Definition at line 384 of file grid_key_dx_iterator_sub.hpp.


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