concepts::MultiArray< dim, T > Class Template Reference

Container typename for multidimensional Array which is based on std::map. More...

#include <multiArray.hh>

Classes

class  Scanner
 Class for scanning (iterating) over the array in all dimensions. More...
 

Public Member Functions

void clear ()
 Clears the array. More...
 
void commute (uint i[dim]) const
 if commutable_ then order the smallest index to front More...
 
void erase (const uint i[dim])
 Erase entry i. More...
 
void erase (uint i[dim])
 
void erase_last ()
 Erase last entry. More...
 
bool isElm (const uint i[dim]) const
 Checks if the element exists. More...
 
bool isElm (uint i[dim]) const
 
 MultiArray (bool commutable=false)
 Constructor If commutable then the order of the indices is not important, e.g. More...
 
T & operator[] (const uint i[dim])
 Index operator for the container. More...
 
const T & operator[] (const uint i[dim]) const
 Index operator for the container. More...
 
T & operator[] (uint i[dim])
 
const T & operator[] (uint i[dim]) const
 
Scannerscan () const
 
uint size () const
 Size. More...
 
 ~MultiArray ()
 

Protected Member Functions

virtual std::ostream & info (std::ostream &os) const
 

Private Attributes

const bool commutable_
 flag for commutability More...
 
std::map< uint, MultiArray< dim-1, T > > data_
 array of arrays of the dimension dim-1 More...
 

Detailed Description

template<uint dim, typename T>
class concepts::MultiArray< dim, T >

Container typename for multidimensional Array which is based on std::map.

Is recursivly defined.

Author
Kersten Schmidt, 2004

Definition at line 33 of file multiArray.hh.

Constructor & Destructor Documentation

◆ MultiArray()

template<uint dim, typename T >
concepts::MultiArray< dim, T >::MultiArray ( bool  commutable = false)
inline

Constructor If commutable then the order of the indices is not important, e.g.

(i,j) and (j,i) have the same entrance.

Definition at line 234 of file multiArray.hh.

◆ ~MultiArray()

template<uint dim, typename T >
concepts::MultiArray< dim, T >::~MultiArray ( )
inline

Definition at line 235 of file multiArray.hh.

Member Function Documentation

◆ clear()

template<uint dim, typename T >
void concepts::MultiArray< dim, T >::clear

Clears the array.

Definition at line 403 of file multiArray.hh.

◆ commute()

template<uint dim, typename T >
void concepts::MultiArray< dim, T >::commute ( uint  i[dim]) const

if commutable_ then order the smallest index to front

Definition at line 354 of file multiArray.hh.

◆ erase() [1/2]

template<uint dim, typename T >
void concepts::MultiArray< dim, T >::erase ( const uint  i[dim])

Erase entry i.

Definition at line 364 of file multiArray.hh.

◆ erase() [2/2]

template<uint dim, typename T >
void concepts::MultiArray< dim, T >::erase ( uint  i[dim])

◆ erase_last()

template<uint dim, typename T >
void concepts::MultiArray< dim, T >::erase_last

Erase last entry.

Definition at line 386 of file multiArray.hh.

◆ info()

template<uint dim, typename T >
std::ostream & concepts::MultiArray< dim, T >::info ( std::ostream &  os) const
protectedvirtual

Definition at line 411 of file multiArray.hh.

◆ isElm() [1/2]

template<uint dim, typename T >
bool concepts::MultiArray< dim, T >::isElm ( const uint  i[dim]) const

Checks if the element exists.

Definition at line 337 of file multiArray.hh.

◆ isElm() [2/2]

template<uint dim, typename T >
bool concepts::MultiArray< dim, T >::isElm ( uint  i[dim]) const

◆ operator[]() [1/4]

template<uint dim, typename T >
T & concepts::MultiArray< dim, T >::operator[] ( const uint  i[dim])

Index operator for the container.

If an item is not existing, it is created, inserted into the array and then returned.

Returns
The (i,j)th element of the array.

Definition at line 280 of file multiArray.hh.

◆ operator[]() [2/4]

template<uint dim, typename T >
const T & concepts::MultiArray< dim, T >::operator[] ( const uint  i[dim]) const

Index operator for the container.

Returns
The (i,j)th element of the array.

Definition at line 311 of file multiArray.hh.

◆ operator[]() [3/4]

template<uint dim, typename T >
T& concepts::MultiArray< dim, T >::operator[] ( uint  i[dim])

◆ operator[]() [4/4]

template<uint dim, typename T >
const T& concepts::MultiArray< dim, T >::operator[] ( uint  i[dim]) const

◆ scan()

template<uint dim, typename T >
Scanner* concepts::MultiArray< dim, T >::scan ( ) const
inline

Definition at line 252 of file multiArray.hh.

◆ size()

template<uint dim, typename T >
uint concepts::MultiArray< dim, T >::size

Size.

Definition at line 393 of file multiArray.hh.

Member Data Documentation

◆ commutable_

template<uint dim, typename T >
const bool concepts::MultiArray< dim, T >::commutable_
private

flag for commutability

Definition at line 276 of file multiArray.hh.

◆ data_

template<uint dim, typename T >
std::map<uint, MultiArray<dim-1, T> > concepts::MultiArray< dim, T >::data_
private

array of arrays of the dimension dim-1

Definition at line 274 of file multiArray.hh.


The documentation for this class was generated from the following file:
Page URL: http://wiki.math.ethz.ch/bin/view/Concepts/WebHome
21 August 2020
© 2020 Eidgenössische Technische Hochschule Zürich