KADATH
Kadath::Array_iterator Class Reference

Version of the Index class optimized for incremental access to Array components. More...

#include <array_iterator.hpp>

Inheritance diagram for Kadath::Array_iterator:

Public Member Functions

 Array_iterator (int ndim, int tndim)
 Constructor. More...
 
 Array_iterator (const Dim_array &dim)
 Standard constructor. More...
 
int get_ndim () const
 Returns the number of dimensions. More...
 
int get_position () const
 Accessor for the value member. More...
 
bool operator== (Array_iterator const &xx) const
 Comparison operator. More...
 
Array_iteratorset_value (int _position)
 Set position. More...
 
Array_iteratorset (Array_iterator const &_so)
 Set the position of the iterator at the same as the one of the source. More...
 
bool check_value ()
 Sylvain's stuff. More...
 
void set_start ()
 Sets the iterator at the start. More...
 
Dim_array const & get_sizes () const
 Returns all the dimensions. More...
 
bool inc (int increm, int var=0)
 Increments the position of the Array_iterator. More...
 
bool inc1 (int var)
 Optimized unit increment with respect to the passed index number. More...
 
bool inc ()
 Optimized unit increment. More...
 

Protected Attributes

Dim_array sizes
 Sizes of the associated Array. More...
 
Memory_mapped_array< int > steps
 The incremental index step with respect to each dimensions. More...
 
int position
 Corresponding value for 1D indexing . More...
 

Friends

template<class >
class Array
 

Detailed Description

Version of the Index class optimized for incremental access to Array components.

Definition at line 18 of file array_iterator.hpp.

Constructor & Destructor Documentation

◆ Array_iterator() [1/2]

Kadath::Array_iterator::Array_iterator ( int  ndim,
int  tndim 
)
inlineexplicit

Constructor.

Definition at line 32 of file array_iterator.hpp.

References Kadath::Dim_array::set(), sizes, and steps.

◆ Array_iterator() [2/2]

Kadath::Array_iterator::Array_iterator ( const Dim_array dim)
inlineexplicit

Standard constructor.

All the positions are set to zero.

Parameters
dim[input] Sizes in each dimensions.

Definition at line 38 of file array_iterator.hpp.

References Kadath::Dim_array::get_ndim(), sizes, and steps.

Member Function Documentation

◆ check_value()

bool Kadath::Array_iterator::check_value ( )
inline

Sylvain's stuff.

Definition at line 90 of file array_iterator.hpp.

References position, and steps.

◆ get_ndim()

int Kadath::Array_iterator::get_ndim ( ) const
inline

Returns the number of dimensions.

Definition at line 46 of file array_iterator.hpp.

References Kadath::Dim_array::get_ndim(), and sizes.

◆ get_position()

int Kadath::Array_iterator::get_position ( ) const
inline

Accessor for the value member.

Definition at line 48 of file array_iterator.hpp.

References position.

◆ get_sizes()

Dim_array const& Kadath::Array_iterator::get_sizes ( ) const
inline

Returns all the dimensions.

Definition at line 67 of file array_iterator.hpp.

References sizes.

◆ inc() [1/2]

bool Kadath::Array_iterator::inc ( )
inline

Optimized unit increment.

Returns
true while the last component index is not passed.

Definition at line 86 of file array_iterator.hpp.

References check_value(), and position.

◆ inc() [2/2]

bool Kadath::Array_iterator::inc ( int  increm,
int  var = 0 
)
inline

Increments the position of the Array_iterator.

If one reaches the last point of a dimension, then the next one is increased.

Parameters
increm[input] value of the increment.
var[input] dimension to be incremented.
Returns
false if the result is outside the Array and true otherwise.

Definition at line 75 of file array_iterator.hpp.

References check_value(), position, and steps.

◆ inc1()

bool Kadath::Array_iterator::inc1 ( int  var)
inline

Optimized unit increment with respect to the passed index number.

Parameters
varindex number
Returns
true while the last component index is not passed.

Definition at line 81 of file array_iterator.hpp.

References check_value(), position, and steps.

◆ operator==()

bool Kadath::Array_iterator::operator== ( Array_iterator const &  xx) const
inline

Comparison operator.

Definition at line 51 of file array_iterator.hpp.

References get_ndim(), and position.

◆ set()

Array_iterator& Kadath::Array_iterator::set ( Array_iterator const &  _so)
inline

Set the position of the iterator at the same as the one of the source.

Parameters
_soiterator to copy the position from.
Returns
a reference toward the current object.

Definition at line 59 of file array_iterator.hpp.

References position.

◆ set_start()

void Kadath::Array_iterator::set_start ( )
inline

Sets the iterator at the start.

Definition at line 63 of file array_iterator.hpp.

References position.

◆ set_value()

Array_iterator& Kadath::Array_iterator::set_value ( int  _position)
inline

Set position.

Definition at line 53 of file array_iterator.hpp.

References position.

Member Data Documentation

◆ position

int Kadath::Array_iterator::position
protected

Corresponding value for 1D indexing .

Definition at line 28 of file array_iterator.hpp.

◆ sizes

Dim_array Kadath::Array_iterator::sizes
protected

Sizes of the associated Array.

When used with a Tensor, it is the dimension, for each tensorial index.

Definition at line 25 of file array_iterator.hpp.

◆ steps

Memory_mapped_array<int> Kadath::Array_iterator::steps
protected

The incremental index step with respect to each dimensions.

Definition at line 27 of file array_iterator.hpp.


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