ODIN
Public Member Functions | Friends | List of all members

#include <tjarray.h>

Inherits STD_vector< unsigned long >.

Public Member Functions

 ndim (unsigned long d=0)
 
 ndim (const ndim &mm)
 
 ndim (const STD_string &s)
 
unsigned long dim () const
 
 operator STD_string () const
 
ndimoperator-- ()
 
ndimoperator-- (int)
 
ndimadd_dim (unsigned long e, bool first=false)
 
unsigned long total () const
 
unsigned long extent2index (const ndim &mm) const
 
ndim index2extent (unsigned long index) const
 
bool operator== (const ndim &nn) const
 
bool operator!= (const ndim &nn) const
 
ndimreduce (unsigned long dim)
 
ndimautosize ()
 

Friends

STD_ostream & operator<< (STD_ostream &s, const ndim &nn)
 

Detailed Description

This class is an extent vector for arrays, i.e. it is used to hold dimension information of multidimensional arrays. It is a vector of integer numbers which describe the extent of the array in each direction/dimension. It can also be used to index a certain element in the multidimensional array.

Definition at line 41 of file tjarray.h.

Constructor & Destructor Documentation

◆ ndim() [1/3]

ndim::ndim ( unsigned long  d = 0)

Constructs an extent vector of size 'd'.

◆ ndim() [2/3]

ndim::ndim ( const ndim mm)
inline

Copy constructor.

Definition at line 55 of file tjarray.h.

◆ ndim() [3/3]

ndim::ndim ( const STD_string &  s)

Constructs an extent vector by parsing the string 's'. The string must have the syntax (i,j,...) e.g. (3,2,5) to describe a 3-dimensional array.

Member Function Documentation

◆ add_dim()

ndim& ndim::add_dim ( unsigned long  e,
bool  first = false 
)

Add new dimension with extent 'e' either as last or first dim, depending on 'first'

◆ autosize()

ndim& ndim::autosize ( )

Resize to essential dims, e.g. ( 1, 3, 1, 7).autosize() -> ( 3, 7 )

◆ dim()

unsigned long ndim::dim ( ) const
inline

The number of dimensions, i.e. the length of the extent vector.

Definition at line 68 of file tjarray.h.

◆ extent2index()

unsigned long ndim::extent2index ( const ndim mm) const

Converts an index vector to the linear index in the array.

◆ index2extent()

ndim ndim::index2extent ( unsigned long  index) const

Converts the linear index in the array to an index vector.

◆ operator STD_string()

ndim::operator STD_string ( ) const

Returns the extent vector as a formatted string, e.g. (3,2,5).

◆ operator!=()

bool ndim::operator!= ( const ndim nn) const

Returns true if nn and this are unequal, otherwise false.

◆ operator--() [1/2]

ndim& ndim::operator-- ( )

Prefix – operator: Strips of the first dimension/index.

◆ operator--() [2/2]

ndim& ndim::operator-- ( int  )

Postfix – operator: Strips of the last dimension/index.

◆ operator==()

bool ndim::operator== ( const ndim nn) const

Returns true if nn and this are equal, otherwise false.

◆ reduce()

ndim& ndim::reduce ( unsigned long  dim)

Reduce to dimension dim, e.g. ( 3, 4, 7).reduce(2) -> ( 12, 7 )

◆ total()

unsigned long ndim::total ( ) const

Returns the total product of the vector.

Friends And Related Function Documentation

◆ operator<<

STD_ostream& operator<< ( STD_ostream &  s,
const ndim nn 
)
friend

Stream operator

Definition at line 79 of file tjarray.h.


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