ndim Class Reference
[Classes for basic data types and vectors/arrays (tjutils library)]

#include <tjarray.h>

List of all members.

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::ndim ( unsigned long  d = 0  ) 

Constructs an extent vector of size 'd'.

ndim::ndim ( const ndim mm  )  [inline]

Copy constructor.

Definition at line 55 of file tjarray.h.

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

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.

ndim::operator STD_string (  )  const

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

ndim& ndim::operator-- (  ) 

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

ndim& ndim::operator-- ( int   ) 

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

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'

unsigned long ndim::total (  )  const

Returns the total product of the vector.

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

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

ndim ndim::index2extent ( unsigned long  index  )  const

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

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

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

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

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

ndim& ndim::reduce ( unsigned long  dim  ) 

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

ndim& ndim::autosize (  ) 

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


Friends And Related Function Documentation

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:
Generated on Sat Jun 14 12:31:46 2008 by  doxygen 1.5.1