OpenFPM_pdata  4.1.0
Project that contain the implementation of distributed structures
grid_dist_iterator_sub< dim, device_grid > Class Template Reference

Distributed grid iterator. More...

Detailed Description

template<unsigned int dim, typename device_grid>
class grid_dist_iterator_sub< dim, device_grid >

Distributed grid iterator.

Iterator across the local elements of the distributed grid

Template Parameters
dimdimensionality of the grid
device_gridtype of basic grid
implimplementation

Definition at line 22 of file grid_dist_id_iterator_sub.hpp.

#include <grid_dist_id_iterator_sub.hpp>

Data Structures

struct  sub_set
 

Public Member Functions

grid_dist_iterator_sub< dim, device_grid > & operator= (const grid_dist_iterator_sub< dim, device_grid > &tmp)
 Copy operator=. More...
 
 grid_dist_iterator_sub (const grid_dist_iterator_sub< dim, device_grid > &tmp, bool reinitialize=true)
 Copy constructor. More...
 
 grid_dist_iterator_sub (const grid_key_dx< dim > &start, const grid_key_dx< dim > &stop, const openfpm::vector< device_grid > &gk, const openfpm::vector< GBoxes< device_grid::dims >> &gdb_ext)
 Constructor of the distributed grid iterator. More...
 
grid_dist_iterator_sub< dim, device_grid > & operator++ ()
 Get the next element. More...
 
bool isNext ()
 Check if there is the next element. More...
 
grid_dist_key_dx< dim, typename device_grid::base_key > get ()
 Get the actual key. More...
 
grid_key_dx< dim > getGKey (const grid_dist_key_dx< dim > &k)
 Convert a g_dist_key_dx into a global key. More...
 
grid_key_dx< dim > getStart () const
 
grid_key_dx< dim > getStop () const
 
size_t N_loc_grid ()
 Return the number of local grids. More...
 
size_t loc_grid_info_start (size_t i, size_t j)
 Return the component j of the starting point (P1) of the domain part for the local grid i. More...
 
size_t loc_grid_info_size (size_t i, size_t j)
 Return the component j of the stop point (P2) of the domain part for the local grid i. More...
 

Private Member Functions

bool compute_subset (size_t gc, grid_key_dx< dim > &start_c, grid_key_dx< dim > &stop_c)
 compute the subset where it has to iterate More...
 
void selectValidGrid ()
 from g_c increment g_c until you find a valid grid More...
 

Private Attributes

size_t g_c
 grid list counter
 
const openfpm::vector< device_grid > & gList
 List of the grids we are going to iterate.
 
const openfpm::vector< GBoxes< device_grid::dims > > & gdb_ext
 Extension of each grid: domain and ghost + domain.
 
decltype(device_grid::type_of_subiterator()) a_it
 Actual iterator.
 
grid_key_dx< dim > start
 start key
 
grid_key_dx< dim > stop
 stop key
 

Constructor & Destructor Documentation

◆ grid_dist_iterator_sub() [1/2]

template<unsigned int dim, typename device_grid>
grid_dist_iterator_sub< dim, device_grid >::grid_dist_iterator_sub ( const grid_dist_iterator_sub< dim, device_grid > &  tmp,
bool  reinitialize = true 
)
inline

Copy constructor.

Parameters
tmpiterator to copy

Definition at line 136 of file grid_dist_id_iterator_sub.hpp.

◆ grid_dist_iterator_sub() [2/2]

template<unsigned int dim, typename device_grid>
grid_dist_iterator_sub< dim, device_grid >::grid_dist_iterator_sub ( const grid_key_dx< dim > &  start,
const grid_key_dx< dim > &  stop,
const openfpm::vector< device_grid > &  gk,
const openfpm::vector< GBoxes< device_grid::dims >> &  gdb_ext 
)
inline

Constructor of the distributed grid iterator.

Parameters
startposition
stopposition
gkstd::vector of the local grid
gdb_extinformation about the local grids

Definition at line 157 of file grid_dist_id_iterator_sub.hpp.

Member Function Documentation

◆ compute_subset()

template<unsigned int dim, typename device_grid>
bool grid_dist_iterator_sub< dim, device_grid >::compute_subset ( size_t  gc,
grid_key_dx< dim > &  start_c,
grid_key_dx< dim > &  stop_c 
)
inlineprivate

compute the subset where it has to iterate

Parameters
gcActual grid
start_cadjusted start point for the grid g_c
stop_cadjusted stop point for the grid g_c
Returns
false if the sub-set does not contain points

Definition at line 60 of file grid_dist_id_iterator_sub.hpp.

◆ get()

template<unsigned int dim, typename device_grid>
grid_dist_key_dx<dim,typename device_grid::base_key> grid_dist_iterator_sub< dim, device_grid >::get ( )
inline

Get the actual key.

Returns
the actual key

Definition at line 215 of file grid_dist_id_iterator_sub.hpp.

◆ getGKey()

template<unsigned int dim, typename device_grid>
grid_key_dx<dim> grid_dist_iterator_sub< dim, device_grid >::getGKey ( const grid_dist_key_dx< dim > &  k)
inline

Convert a g_dist_key_dx into a global key.

See also
grid_dist_key_dx
grid_dist_iterator
Returns
the global position in the grid

Definition at line 228 of file grid_dist_id_iterator_sub.hpp.

◆ isNext()

template<unsigned int dim, typename device_grid>
bool grid_dist_iterator_sub< dim, device_grid >::isNext ( )
inline

Check if there is the next element.

Returns
true if there is the next, false otherwise

Definition at line 200 of file grid_dist_id_iterator_sub.hpp.

◆ loc_grid_info_size()

template<unsigned int dim, typename device_grid>
size_t grid_dist_iterator_sub< dim, device_grid >::loc_grid_info_size ( size_t  i,
size_t  j 
)
inline

Return the component j of the stop point (P2) of the domain part for the local grid i.

Parameters
ilocal grid
jdimension

Definition at line 291 of file grid_dist_id_iterator_sub.hpp.

◆ loc_grid_info_start()

template<unsigned int dim, typename device_grid>
size_t grid_dist_iterator_sub< dim, device_grid >::loc_grid_info_start ( size_t  i,
size_t  j 
)
inline

Return the component j of the starting point (P1) of the domain part for the local grid i.

Parameters
ilocal grid
jdimension

Definition at line 278 of file grid_dist_id_iterator_sub.hpp.

◆ N_loc_grid()

template<unsigned int dim, typename device_grid>
size_t grid_dist_iterator_sub< dim, device_grid >::N_loc_grid ( )
inline

Return the number of local grids.

Definition at line 265 of file grid_dist_id_iterator_sub.hpp.

◆ operator++()

template<unsigned int dim, typename device_grid>
grid_dist_iterator_sub<dim,device_grid>& grid_dist_iterator_sub< dim, device_grid >::operator++ ( )
inline

Get the next element.

Returns
the next grid_key

Definition at line 176 of file grid_dist_id_iterator_sub.hpp.

◆ operator=()

template<unsigned int dim, typename device_grid>
grid_dist_iterator_sub<dim,device_grid>& grid_dist_iterator_sub< dim, device_grid >::operator= ( const grid_dist_iterator_sub< dim, device_grid > &  tmp)
inline

Copy operator=.

Parameters
tmpiterator to copy

Definition at line 119 of file grid_dist_id_iterator_sub.hpp.

◆ selectValidGrid()

template<unsigned int dim, typename device_grid>
void grid_dist_iterator_sub< dim, device_grid >::selectValidGrid ( )
inlineprivate

from g_c increment g_c until you find a valid grid

Definition at line 89 of file grid_dist_id_iterator_sub.hpp.


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