OPAL (Object Oriented Parallel Accelerator Library) 2022.1
OPAL
Public Member Functions | Private Attributes | Friends | List of all members
interpolation::Mesh::Iterator Class Reference

#include <Mesh.h>

Collaboration diagram for interpolation::Mesh::Iterator:
Collaboration graph
[legend]

Public Member Functions

 Iterator ()
 
 Iterator (const Mesh::Iterator &in)
 
 Iterator (std::vector< int > state, const Mesh *mesh)
 
virtual ~Iterator ()
 
const Mesh::Iteratoroperator= (const Mesh::Iterator &rhs)
 
virtual void getPosition (double *point) const
 
virtual std::vector< double > getPosition () const
 
int toInteger () const
 
std::vector< int > getState () const
 
int & operator[] (int i)
 
const int & operator[] (int i) const
 
const MeshgetMesh () const
 
virtual bool isOutOfBounds () const
 
virtual void addState (const Mesh::Iterator &it)
 

Private Attributes

const Meshmesh_m
 
std::vector< int > state_m
 

Friends

class Mesh
 
class ThreeDGrid
 
class NDGrid
 
Mesh::Iterator operator++ (Mesh::Iterator &lhs, int)
 
Mesh::Iterator operator-- (Mesh::Iterator &lhs, int)
 
Mesh::Iteratoroperator++ (Mesh::Iterator &lhs)
 
Mesh::Iteratoroperator-- (Mesh::Iterator &lhs)
 
Mesh::Iterator operator- (const Mesh::Iterator &lhs, const int &difference)
 
Mesh::Iterator operator+ (const Mesh::Iterator &lhs, const int &difference)
 
Mesh::Iteratoroperator-= (Mesh::Iterator &lhs, const int &difference)
 
Mesh::Iteratoroperator+= (Mesh::Iterator &lhs, const int &difference)
 
Mesh::Iterator operator- (const Mesh::Iterator &lhs, const Mesh::Iterator &rhs)
 
Mesh::Iterator operator+ (const Mesh::Iterator &lhs, const Mesh::Iterator &rhs)
 
Mesh::Iteratoroperator-= (Mesh::Iterator &lhs, const Mesh::Iterator &rhs)
 
Mesh::Iteratoroperator+= (Mesh::Iterator &lhs, const Mesh::Iterator &rhs)
 
bool operator== (const Mesh::Iterator &lhs, const Mesh::Iterator &rhs)
 
bool operator!= (const Mesh::Iterator &lhs, const Mesh::Iterator &rhs)
 
bool operator>= (const Mesh::Iterator &lhs, const Mesh::Iterator &rhs)
 
bool operator<= (const Mesh::Iterator &lhs, const Mesh::Iterator &rhs)
 
bool operator< (const Mesh::Iterator &lhs, const Mesh::Iterator &rhs)
 
bool operator> (const Mesh::Iterator &lhs, const Mesh::Iterator &rhs)
 

Detailed Description

Used to loop over some, or all, points in the mesh, as in stl Enables e.g. generic file I/O operations on a field map without knowing the details of what is in the mesh or what shape it has.

Define standard operators (increment, decrement, booleans, etc) and conversion to integer.

Iterator generalises internal state to a stl vector of integers and a pointer to the mesh over which we iterate. Meaning of integers is mesh- dependent, but prefer convention that left-most index state[0] is most significant index and right-most index state[n] is least significant index i.e. it+1 increments state[n] by 1 first. Convention is chosen to reflect arabic numerals where right-most index is least significant.

Definition at line 169 of file Mesh.h.

Constructor & Destructor Documentation

◆ Iterator() [1/3]

interpolation::Mesh::Iterator::Iterator ( )
inline

Default constructor does nothing

◆ Iterator() [2/3]

interpolation::Mesh::Iterator::Iterator ( const Mesh::Iterator in)
inline

Shallow copy in.mesh_m

◆ Iterator() [3/3]

interpolation::Mesh::Iterator::Iterator ( std::vector< int >  state,
const Mesh mesh 
)
inline

Constructor initialising internal state and mesh

Parameters
stateinteger corresponding to internal state
meshmesh over which the iterator acts - Iterator borrows reference to mesh (is only valid while mesh pointer is valid)

◆ ~Iterator()

virtual interpolation::Mesh::Iterator::~Iterator ( )
inlinevirtual

Destructor

Member Function Documentation

◆ addState()

virtual void interpolation::Mesh::Iterator::addState ( const Mesh::Iterator it)
inlinevirtual

Add the internal state vector of it onto this

◆ getMesh()

const Mesh * interpolation::Mesh::Iterator::getMesh ( ) const
inline

Return the mesh over which the iterator acts

Referenced by interpolation::PPSolveFactory::getDerivs(), and interpolation::PPSolveFactory::outOfBoundsPosition().

◆ getPosition() [1/2]

virtual std::vector< double > interpolation::Mesh::Iterator::getPosition ( ) const
inlinevirtual

Return a vector corresponding to the position referenced by the iterator

vector will be of length corresponding to mesh PointDimension()

◆ getPosition() [2/2]

virtual void interpolation::Mesh::Iterator::getPosition ( double *  point) const
inlinevirtual

Return the position referenced by the iterator;

Point should be initialised to the PositionDimension() of the mesh

Referenced by interpolation::PolynomialPatch::function(), interpolation::VectorMap::function(), interpolation::PPSolveFactory::getDerivs(), interpolation::operator<<(), and interpolation::PPSolveFactory::outOfBoundsPosition().

◆ getState()

std::vector< int > interpolation::Mesh::Iterator::getState ( ) const
inline

◆ isOutOfBounds()

virtual bool interpolation::Mesh::Iterator::isOutOfBounds ( ) const
inlinevirtual

Return true if the iterator is off the edge of the mesh

◆ operator=()

const Mesh::Iterator & interpolation::Mesh::Iterator::operator= ( const Mesh::Iterator rhs)
inline

Shallow copy rhs into this

◆ operator[]() [1/2]

int & interpolation::Mesh::Iterator::operator[] ( int  i)
inline

Return the ith element of the iterator state vector

◆ operator[]() [2/2]

const int & interpolation::Mesh::Iterator::operator[] ( int  i) const
inline

Return the ith element of the iterator state vector

◆ toInteger()

int interpolation::Mesh::Iterator::toInteger ( ) const
inline

Friends And Related Function Documentation

◆ Mesh

friend class Mesh
friend

Definition at line 230 of file Mesh.h.

◆ NDGrid

friend class NDGrid
friend

Definition at line 232 of file Mesh.h.

◆ operator!=

bool operator!= ( const Mesh::Iterator lhs,
const Mesh::Iterator rhs 
)
friend

Return true if lhs does not index the same position as rhs

◆ operator+ [1/2]

Mesh::Iterator operator+ ( const Mesh::Iterator lhs,
const int &  difference 
)
friend

Addition operator - adds rhs to lhs and returns copy of lhs

◆ operator+ [2/2]

Mesh::Iterator operator+ ( const Mesh::Iterator lhs,
const Mesh::Iterator rhs 
)
friend

Addition operator - adds offset of rhs of rhs relative to Begin() to lhs

◆ operator++ [1/2]

Mesh::Iterator & operator++ ( Mesh::Iterator lhs)
friend

Prefix increment operator ++it

◆ operator++ [2/2]

Mesh::Iterator operator++ ( Mesh::Iterator lhs,
int   
)
friend

Postfix increment operator it++ advances iterator by one

◆ operator+= [1/2]

Mesh::Iterator & operator+= ( Mesh::Iterator lhs,
const int &  difference 
)
friend

Addition operator - subtracts rhs from lhs and returns lhs

◆ operator+= [2/2]

Mesh::Iterator & operator+= ( Mesh::Iterator lhs,
const Mesh::Iterator rhs 
)
friend

Addition operator - adds offset of rhs of rhs relative to Begin() to lhs and returns lhs

◆ operator- [1/2]

Mesh::Iterator operator- ( const Mesh::Iterator lhs,
const int &  difference 
)
friend

Subtraction operator - subtracts from lhs and returns copy of lhs

◆ operator- [2/2]

Mesh::Iterator operator- ( const Mesh::Iterator lhs,
const Mesh::Iterator rhs 
)
friend

Subtraction operator - subtracts offset of rhs relative to Begin() from lhs

◆ operator-- [1/2]

Mesh::Iterator & operator-- ( Mesh::Iterator lhs)
friend

Prefix decrement operator –it retreats iterator by one

◆ operator-- [2/2]

Mesh::Iterator operator-- ( Mesh::Iterator lhs,
int   
)
friend

Postfix decrement operator it– retreats iterator by one

◆ operator-= [1/2]

Mesh::Iterator & operator-= ( Mesh::Iterator lhs,
const int &  difference 
)
friend

Subtraction operator - subtracts rhs from lhs and returns lhs

◆ operator-= [2/2]

Mesh::Iterator & operator-= ( Mesh::Iterator lhs,
const Mesh::Iterator rhs 
)
friend

Subtraction operator - subtracts offset of rhs relative to Begin() from lhs and returns lhs

◆ operator<

bool operator< ( const Mesh::Iterator lhs,
const Mesh::Iterator rhs 
)
friend

Return true if lhs indexes a position less than rhs i.e. successive operation of decrement operator would eventually reach lhs

◆ operator<=

bool operator<= ( const Mesh::Iterator lhs,
const Mesh::Iterator rhs 
)
friend

Return true if lhs indexes a position less than or equal to rhs i.e. successive operation of decrement operator would eventually reach lhs

◆ operator==

bool operator== ( const Mesh::Iterator lhs,
const Mesh::Iterator rhs 
)
friend

Return true if lhs indexes the same position as rhs

◆ operator>

bool operator> ( const Mesh::Iterator lhs,
const Mesh::Iterator rhs 
)
friend

Return true if lhs indexes a position greater than rhs i.e. successive operation of increment operator would eventually reach lhs

◆ operator>=

bool operator>= ( const Mesh::Iterator lhs,
const Mesh::Iterator rhs 
)
friend

Return true if lhs indexes a position greater than or equal to rhs i.e. successive operation of increment operator would eventually reach lhs

◆ ThreeDGrid

friend class ThreeDGrid
friend

Definition at line 231 of file Mesh.h.

Member Data Documentation

◆ mesh_m

const Mesh* interpolation::Mesh::Iterator::mesh_m
private

Definition at line 269 of file Mesh.h.

◆ state_m

std::vector<int> interpolation::Mesh::Iterator::state_m
private

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