#include <index2D.h>
Public Member Functions | |
Index2D () | |
The default constructor initializes to (0, 0). | |
Index2D (int row, int column) | |
This constructor explicitly sets the indices. | |
Index2D (const Index2D &other) | |
The copy constructor deep copies its argument. | |
~Index2D () | |
The destructor destroys the Index2D instance. | |
void | setValue (int row, int column) |
This member function explicitly sets the sets the indices. | |
int | getColumn () const |
This member function returns the first component of the Index2D by value. | |
int | getRow () const |
This member function returns the second component of the Index2D by value. | |
int | getU () const |
This member function returns the first component of the Index2D by value. | |
int | getV () const |
This member function returns the second component of the Index2D by value. | |
Index2D & | operator= (const Index2D &other) |
The assignment operator deep copies its argument. | |
int | operator[] (size_t index) const |
WARNING: this operator has confusing semantics, as illustrated by this example, in which all assertions pass:. | |
Index2D & | operator*= (int scalar) |
This operator multiplies each component of the Index2D instance by a scalar. | |
Index2D & | operator/= (int scalar) |
This operator divides each component of the Index2D instance by a scalar. | |
Index2D & | operator+= (const Index2D &other) |
This operator adds a scalar to each component of the Index2D instance. | |
Index2D & | operator-= (const Index2D &other) |
This operator subtracts a scalar from each component of the Index2D instance. | |
Index2D | operator- () |
This operator returns an Index2D equal to *this, but with each element negated. |
An alternate way to think of this class is as a point with integer coordinates in a (U, V) coordinate system, where the origin lies at row = 0, column = 0, the U axis points along the first row, and the V axis points along the first column. Note that by this definition, the value of U is equal to the column index, and the value of V is equal to the row index. This leads to some confusing ordering issues. For example, the value returned by Index2D(1, 2).getU() is 2, and the value returned by Index2D(1, 2).getV() is 1.
WARNING: be particularly careful with Index2D::operator[](size_t), as illustrated by this example, in which all assertions pass:
Index2D exampleIndex(1, 2); assert(exampleIndex[0] == exampleIndex.getU()); assert(exampleIndex[0] == 2); assert(exampleIndex[1] == exampleIndex.getU()); assert(exampleIndex[1] == 1);
Definition at line 50 of file index2D.h.
dlr::numeric::Index2D::Index2D | ( | ) | [inline] |
The default constructor initializes to (0, 0).
Definition at line 56 of file index2D.h.
Referenced by operator-().
dlr::numeric::Index2D::Index2D | ( | int | row, | |
int | column | |||
) | [inline] |
dlr::numeric::Index2D::Index2D | ( | const Index2D & | other | ) | [inline] |
dlr::numeric::Index2D::~Index2D | ( | ) | [inline] |
int dlr::numeric::Index2D::getColumn | ( | ) | const [inline] |
This member function returns the first component of the Index2D by value.
Definition at line 105 of file index2D.h.
Referenced by dlr::numeric::correlate2D(), dlr::numeric::BoxIntegrator2D< Type0, Type1 >::getIntegral(), getU(), dlr::numeric::operator*(), dlr::numeric::operator+(), dlr::numeric::operator-(), dlr::numeric::operator/(), dlr::numeric::operator<<(), dlr::numeric::operator==(), operator[](), dlr::numeric::BoxIntegrator2D< Type0, Type1 >::setArray(), and dlr::numeric::Stencil2D< Type, Size >::setTarget().
int dlr::numeric::Index2D::getRow | ( | ) | const [inline] |
This member function returns the second component of the Index2D by value.
Definition at line 114 of file index2D.h.
Referenced by dlr::numeric::correlate2D(), dlr::numeric::BoxIntegrator2D< Type0, Type1 >::getIntegral(), getV(), dlr::numeric::operator*(), dlr::numeric::operator+(), dlr::numeric::operator-(), dlr::numeric::operator/(), dlr::numeric::operator<<(), dlr::numeric::operator==(), operator[](), dlr::numeric::BoxIntegrator2D< Type0, Type1 >::setArray(), and dlr::numeric::Stencil2D< Type, Size >::setTarget().
int dlr::numeric::Index2D::getU | ( | ) | const [inline] |
This member function returns the first component of the Index2D by value.
It is a synonym for member function getColumn().
Definition at line 123 of file index2D.h.
References getColumn().
int dlr::numeric::Index2D::getV | ( | ) | const [inline] |
Index2D& dlr::numeric::Index2D::operator*= | ( | int | scalar | ) | [inline] |
Index2D dlr::numeric::Index2D::operator- | ( | ) | [inline] |
Index2D& dlr::numeric::Index2D::operator/= | ( | int | scalar | ) | [inline] |
int dlr::numeric::Index2D::operator[] | ( | size_t | index | ) | const [inline] |
WARNING: this operator has confusing semantics, as illustrated by this example, in which all assertions pass:.
Index2D exampleIndex(1, 2); assert(exampleIndex[0] == exampleIndex.getU()); assert(exampleIndex[0] == 2); assert(exampleIndex[1] == exampleIndex.getU()); assert(exampleIndex[1] == 1);
The indexing operator returns a reference to the U or V component of *this as if *this were a two element array. Out of bounds indices will return the V component.
index | This argument is the index into *this. An index of 0 means to return the "U" component, where the U axis is parallel to the first row of the indexed array. In other words, an index of 0 means to return the column value. |
Definition at line 173 of file index2D.h.
References getColumn(), and getRow().
void dlr::numeric::Index2D::setValue | ( | int | row, | |
int | column | |||
) | [inline] |
This member function explicitly sets the sets the indices.
Definition at line 94 of file index2D.h.
Referenced by operator=(), dlr::numeric::operator>>(), and dlr::numeric::BoxIntegrator2D< Type0, Type1 >::setArray().