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

this class draw particles on subset of grid-like position More...

Detailed Description

template<unsigned int dim, typename T, typename Decomposition>
class PointIterator< dim, T, Decomposition >

this class draw particles on subset of grid-like position

                  Point B
                    |                 (0.6,0.6)
  +   +   +   +   + |  +   +   +   +
    +---------------+
  + | +   +   +   + | +   +   +   +
    |               |
  + | +   +   +   + | +   +   +   +
    |               |
  + | +   +   +   + | +   +   +   +
    |               |
  + | +   +   +   + | +   +   +   +
    |               |
  + | +   +   +   + | +   +   +   +
    |               |
  + | +   +   +   + | +   +   +   +
    |               |
  + | +   +   +   + | +   +   +   +
    +---------------+
  +   +   +   +   + ^ +   +   +   +
(-1.0,-1.0)         |
                    |
                   (Point A)

Suppose we have a grid 9x9 from (-1.0,-1.0 to 0.6,0.6)

Defined a Box (-0.9,-0.9 to -0.1,0.5)

This class will return the points

(-0.8 -0.8) (-0.6 -0.8) (-0.4 -0.8) ... (-0.1,-0.8) Point A ... (-0.1,0.5) Point B

Definition at line 58 of file PointIterator.hpp.

#include <PointIterator.hpp>

+ Inheritance diagram for PointIterator< dim, T, Decomposition >:

Public Member Functions

 PointIterator (Decomposition &dec, size_t(&sz)[dim], const Box< dim, T > &domain, Box< dim, T > &sub_domain)
 Draw Particles.
 
Point< dim, T > & get ()
 
PointIteratoroperator++ ()
 Next point.
 
bool isNext ()
 
Box< dim, T > getBoxMargins ()
 Return the real Margin of the box.
 

Private Member Functions

void calculateAp ()
 

Static Private Member Functions

static grid_key_dx< dim > getStart (size_t(&gs)[dim], const Box< dim, T > &dom, Box< dim, T > &sub_dom, T(&sp)[dim])
 
static grid_key_dx< dim > getStop (size_t(&gs)[dim], const Box< dim, T > &dom, Box< dim, T > &sub_dom, T(&sp)[dim])
 

Private Attributes

Point< dim, T > ap
 Actual point.
 
Box< dim, T > sub_domain
 sub_domain
 
Box< dim, T > domain
 domain
 
sp [dim]
 Spacing.
 

Additional Inherited Members

- Protected Member Functions inherited from grid_dist_id_iterator_dec< Decomposition, ghost_or_domain >
grid_dist_id_iterator_dec< Decomposition > & operator= (const grid_dist_id_iterator_dec< Decomposition > &tmp)
 Copy operator=.
 
 grid_dist_id_iterator_dec (const grid_dist_id_iterator_dec< Decomposition > &tmp)
 Copy constructor.
 
 grid_dist_id_iterator_dec (Decomposition &dec, const size_t(&sz)[Decomposition::dims])
 Constructor of the distributed grid iterator.
 
 grid_dist_id_iterator_dec (Decomposition &dec, const size_t(&sz)[Decomposition::dims], grid_key_dx< Decomposition::dims > start, grid_key_dx< Decomposition::dims > stop)
 Constructor of the distributed grid iterator.
 
bool isNextGrid ()
 Return true if we point to a valid grid.
 
size_t getGridId ()
 Return the index of the grid in which we are iterating.
 
void nextGrid ()
 next grid
 
Box< Decomposition::dims, size_t > getGridBox ()
 Return the actual pointed grid.
 
grid_dist_id_iterator_dec< Decomposition, ghost_or_domain > & operator++ ()
 Get the next element.
 
bool isNext ()
 Check if there is the next element.
 
Decomposition::stype getSpacing (size_t i)
 Get the spacing of the grid.
 
grid_key_dx< Decomposition::dims > get ()
 Get the actual global key of the grid.
 
Point< Decomposition::dims, typename Decomposition::stype > getPoint ()
 Return the point coordinates.
 
grid_dist_key_dx< Decomposition::dims > get_dist ()
 Get the actual grid key for a distributed grid.
 
grid_key_dx< Decomposition::dims > getStart ()
 Get the starting point of the sub-grid we are iterating.
 
grid_key_dx< Decomposition::dims > getStop ()
 Get the starting point of the sub-grid we are iterating.
 

Constructor & Destructor Documentation

◆ PointIterator()

template<unsigned int dim, typename T , typename Decomposition >
PointIterator< dim, T, Decomposition >::PointIterator ( Decomposition dec,
size_t(&)  sz[dim],
const Box< dim, T > &  domain,
Box< dim, T > &  sub_domain 
)
inline

Draw Particles.

Parameters
spgrid spacing

Definition at line 116 of file PointIterator.hpp.

Member Function Documentation

◆ calculateAp()

template<unsigned int dim, typename T , typename Decomposition >
void PointIterator< dim, T, Decomposition >::calculateAp ( )
inlineprivate

Definition at line 98 of file PointIterator.hpp.

◆ get()

template<unsigned int dim, typename T , typename Decomposition >
Point< dim, T > & PointIterator< dim, T, Decomposition >::get ( )
inline

\Return the actual point

Definition at line 126 of file PointIterator.hpp.

◆ getBoxMargins()

template<unsigned int dim, typename T , typename Decomposition >
Box< dim, T > PointIterator< dim, T, Decomposition >::getBoxMargins ( )
inline

Return the real Margin of the box.

For example consider to have a domain (0.0,0.0) to (1.0,1.0) 11 points in each direction (spacing 0.1). if we have a sub-domain (0.15,0.15) to (0.55,0.55) getBoxMargins return the box (0.2,0.2) to (0.5,0.5). the smallest box that enclose the points that the point iterator is going to give

Definition at line 159 of file PointIterator.hpp.

◆ getStart()

template<unsigned int dim, typename T , typename Decomposition >
static grid_key_dx< dim > PointIterator< dim, T, Decomposition >::getStart ( size_t(&)  gs[dim],
const Box< dim, T > &  dom,
Box< dim, T > &  sub_dom,
T(&)  sp[dim] 
)
inlinestaticprivate

Definition at line 72 of file PointIterator.hpp.

◆ getStop()

template<unsigned int dim, typename T , typename Decomposition >
static grid_key_dx< dim > PointIterator< dim, T, Decomposition >::getStop ( size_t(&)  gs[dim],
const Box< dim, T > &  dom,
Box< dim, T > &  sub_dom,
T(&)  sp[dim] 
)
inlinestaticprivate

Definition at line 85 of file PointIterator.hpp.

◆ isNext()

template<unsigned int dim, typename T , typename Decomposition >
bool PointIterator< dim, T, Decomposition >::isNext ( )
inline

Definition at line 145 of file PointIterator.hpp.

◆ operator++()

template<unsigned int dim, typename T , typename Decomposition >
PointIterator & PointIterator< dim, T, Decomposition >::operator++ ( )
inline

Next point.

Returns
itself

Definition at line 136 of file PointIterator.hpp.

Field Documentation

◆ ap

template<unsigned int dim, typename T , typename Decomposition >
Point<dim,T> PointIterator< dim, T, Decomposition >::ap
private

Actual point.

Definition at line 61 of file PointIterator.hpp.

◆ domain

template<unsigned int dim, typename T , typename Decomposition >
Box<dim,T> PointIterator< dim, T, Decomposition >::domain
private

domain

Definition at line 67 of file PointIterator.hpp.

◆ sp

template<unsigned int dim, typename T , typename Decomposition >
T PointIterator< dim, T, Decomposition >::sp[dim]
private

Spacing.

Definition at line 70 of file PointIterator.hpp.

◆ sub_domain

template<unsigned int dim, typename T , typename Decomposition >
Box<dim,T> PointIterator< dim, T, Decomposition >::sub_domain
private

sub_domain

Definition at line 64 of file PointIterator.hpp.


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