KADATH
|
Class that gives the position inside a multi-dimensional Array
.
More...
#include <index.hpp>
Public Types | |
using | Data_type = Memory_mapped_array< int > |
Type of data. More... | |
Public Member Functions | |
Index (const Dim_array &dim) | |
Standard constructor. More... | |
Index (const Tensor &so) | |
Copy constructor. More... | |
void | swap (Index &so) |
Sylvain's stuff. More... | |
int & | set (int i) |
Read/write of the position in a given dimension. More... | |
int | operator() (int i) const |
Read/write of the position in a given dimension. More... | |
int | get_ndim () const |
Returns the number of dimensions. More... | |
Dim_array const & | get_sizes () const |
Returns all the dimensions. More... | |
void | set_start () |
Sets the position to zero in all dimensions. More... | |
bool | inc (int increm, int var=0) |
Increments the position of the Index . More... | |
bool | inc1 (int var) |
Increment on one dimension. More... | |
bool | inc () |
Increment on the first dimension. More... | |
bool | inc_vanilla (int increm, int var) |
General increment. More... | |
void | operator= (const Index &so) |
Assignment operator. More... | |
bool | operator== (const Index &xx) const |
Comparison operator. More... | |
Protected Attributes | |
Dim_array | sizes |
Sizes of the associated Array . More... | |
Data_type | coord |
Value of each index. More... | |
Friends | |
template<class > | |
class | Array |
ostream & | operator<< (ostream &, const Index &) |
Operator<<. More... | |
Class that gives the position inside a multi-dimensional Array
.
It can also be used to give the indexes of a given component of a Tensor
.
It simply consists of a list of integers.
using Kadath::Index::Data_type = Memory_mapped_array<int> |
|
inlineexplicit |
Standard constructor.
All the positions are set to zero.
dim | [input] Sizes in each dimensions. |
Definition at line 57 of file index.hpp.
References coord, and Kadath::Dim_array::get_ndim().
Kadath::Index::Index | ( | const Tensor & | so | ) |
Copy constructor.
so | source to be copied. Constructor for looping on components of a tensor |
Definition at line 26 of file index.cpp.
References coord, get_ndim(), Kadath::Tensor::get_ndim(), Kadath::Dim_array::set(), and sizes.
|
inline |
Returns the number of dimensions.
Definition at line 81 of file index.hpp.
References Kadath::Dim_array::get_ndim(), and sizes.
|
inline |
|
inline |
|
inline |
Increments the position of the Index
.
If one reaches the last point of a dimension, then the next one is increased.
increm | [input] value of the increment. |
var | [input] dimension to be incremented. |
false
if the result is outside the Array
and true
otherwise. Definition at line 99 of file index.hpp.
References coord, get_ndim(), and sizes.
|
inline |
Increment on one dimension.
Definition at line 114 of file index.hpp.
References coord, get_ndim(), and sizes.
|
inline |
General increment.
Definition at line 134 of file index.hpp.
References coord, get_ndim(), and sizes.
|
inline |
Read/write of the position in a given dimension.
i | [input] dimension. |
Definition at line 77 of file index.hpp.
References coord, and get_ndim().
|
inline |
Assignment operator.
so | source to copy from. |
Definition at line 152 of file index.hpp.
References coord, get_ndim(), and sizes.
|
inline |
|
inline |
Read/write of the position in a given dimension.
i | [input] dimension. |
Definition at line 72 of file index.hpp.
References coord, and get_ndim().
|
inline |
Sets the position to zero in all dimensions.
Definition at line 88 of file index.hpp.
References coord, and get_ndim().
|
inline |
Sylvain's stuff.
Definition at line 66 of file index.hpp.
References coord, sizes, and Kadath::Dim_array::swap().
|
friend |
|
protected |
|
protected |