OPAL (Object Oriented Parallel Accelerator Library)  2024.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

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

Default constructor does nothing

Definition at line 40 of file Mesh-inl.icc.

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

Shallow copy in.mesh_m

Definition at line 43 of file Mesh-inl.icc.

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)

Definition at line 47 of file Mesh-inl.icc.

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

Destructor

Definition at line 51 of file Mesh-inl.icc.

Member Function Documentation

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

Add the internal state vector of it onto this

Definition at line 198 of file Mesh-inl.icc.

References state_m.

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

Return the mesh over which the iterator acts

Definition at line 70 of file Mesh-inl.icc.

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

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

Definition at line 80 of file Mesh-inl.icc.

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

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()

Definition at line 84 of file Mesh-inl.icc.

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

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

Definition at line 184 of file Mesh-inl.icc.

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

Shallow copy rhs into this

Definition at line 74 of file Mesh-inl.icc.

References mesh_m, and state_m.

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

Return the ith element of the iterator state vector

Definition at line 62 of file Mesh-inl.icc.

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

Return the ith element of the iterator state vector

Definition at line 66 of file Mesh-inl.icc.

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

Friends And Related Function Documentation

friend class Mesh
friend

Definition at line 230 of file Mesh.h.

friend class NDGrid
friend

Definition at line 232 of file Mesh.h.

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

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

Definition at line 178 of file Mesh-inl.icc.

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

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

Definition at line 130 of file Mesh-inl.icc.

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

Definition at line 124 of file Mesh-inl.icc.

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

Postfix increment operator it++ advances iterator by one

Definition at line 98 of file Mesh-inl.icc.

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

Prefix increment operator ++it

Definition at line 90 of file Mesh-inl.icc.

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

Addition operator - subtracts rhs from lhs and returns lhs

Definition at line 145 of file Mesh-inl.icc.

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

Definition at line 137 of file Mesh-inl.icc.

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

Subtraction operator - subtracts from lhs and returns copy of lhs

Definition at line 117 of file Mesh-inl.icc.

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

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

Definition at line 111 of file Mesh-inl.icc.

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

Postfix decrement operator it– retreats iterator by one

Definition at line 104 of file Mesh-inl.icc.

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

Prefix decrement operator –it retreats iterator by one

Definition at line 94 of file Mesh-inl.icc.

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

Subtraction operator - subtracts rhs from lhs and returns lhs

Definition at line 149 of file Mesh-inl.icc.

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

Definition at line 141 of file Mesh-inl.icc.

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

Definition at line 168 of file Mesh-inl.icc.

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

Definition at line 159 of file Mesh-inl.icc.

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

Return true if lhs indexes the same position as rhs

Definition at line 172 of file Mesh-inl.icc.

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

Definition at line 164 of file Mesh-inl.icc.

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

Definition at line 154 of file Mesh-inl.icc.

friend class ThreeDGrid
friend

Definition at line 231 of file Mesh.h.

Member Data Documentation

const Mesh* interpolation::Mesh::Iterator::mesh_m
private
std::vector<int> interpolation::Mesh::Iterator::state_m
private

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