Diffpack Documentation


Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Search  

ArrayGenSimplest(Type) Class Reference

general array with variable no. of indices. More...

#include <ArrayGenSimplest_Type.h>

Inheritance diagram for ArrayGenSimplest(Type)::

VecSimplest_Type ArrayGenSimple_Type ArrayGen_Type ArrayGenSel_Type List of all members.

Public Methods

 ArrayGenSimplest(Type) ()
 ArrayGenSimplest(Type) (int n1)
 ArrayGenSimplest(Type) (int n1, int n2)
 ArrayGenSimplest(Type) (int n1, int n2, int n3)
 ArrayGenSimplest(Type) (const Ptv(int) &n)
 ~ArrayGenSimplest(Type) ()
bool redim (int n1)
bool redim (int n1, int n2)
bool redim (int n1, int n2, int n3)
bool redim (const Ptv(int) &n)
bool compatible (const ArrayGenSimplest(Type) &a, bool error_message=true)
void setBase (int b1)
void setBase (int b1, int b2)
void setBase (int b1, int b2, int b3)
void setBase (const Ptv(int) &b)
void getBase (int &b1) const
void getBase (int &b1, int &b2) const
void getBase (int &b1, int &b2, int &b3) const
void getBase (Ptv(int) &b) const
void getMaxI (int &n1) const
void getMaxI (int &n1, int &n2) const
void getMaxI (int &n1, int &n2, int &n3) const
void getMaxI (Ptv(int) &n) const
int getNoIndices () const
void getDim (int &n1) const
void getDim (int &n1, int &n2) const
void getDim (int &n1, int &n2, int &n3) const
void getDim (Ptv(int) &n) const
void indexOk1 (int i, const char *message=NULL) const
void indexOk (int i, const char *message=NULL) const
void indexOk (int i, int j, const char *message=NULL) const
void indexOk (int i, int j, int k, const char *message=NULL) const
void indexOk (const Ptv(int) &index, const char *message=NULL) const
String arraySize () const
Type& singleIndex1 (int i)
const Type& singleIndex1 (int i) const
int multiple2single (int i) const
int multiple2single (int i, int j) const
int multiple2single (int i, int j, int k) const
int multiple2single (const Ptv(int) &index) const
int length1D () const
int length1Dx2D () const
void setLocalIndex (int i) const
void setLocalIndex (int i, int j) const
void setLocalIndex (int i, int j, int k) const
void setLocalIndex (const Ptv(int) &index) const
int getLocalIndex () const
Type& local (int i)
Type& local (int i, int j)
Type& local (int i, int j, int k)
Type& local (const Ptv(int) &index)
const Type& local (int i) const
const Type& local (int i, int j) const
const Type& local (int i, int j, int k) const
const Type& local (const Ptv(int) &index) const
Type& operator() (int i)
Type& operator() (int i, int j)
Type& operator() (int i, int j, int k)
Type& operator() (const Ptv(int) &index)
const Type& operator() (int i) const
const Type& operator() (int i, int j) const
const Type& operator() (int i, int j, int k) const
const Type& operator() (const Ptv(int) &index) const
void startIterator ()
bool nextEntry ()
Type& thisEntry ()
const Type& thisEntry () const
 ArrayGenSimplest(Type) (const ArrayGenSimplest(Type) &v)
void operator= (const ArrayGenSimplest(Type) &v)

Protected Methods

int totalLength (const Ptv(int) &n)
void init (int n1)
void init (int n1, int n2)
void init (int n1, int n2, int n3)
void init (const Ptv(int) &n)
bool redim (Type *a, int n, int base=0)
bool compatible (const VecSimplest(Type) &X) const
int elmNo (const Ptv(int) &index, int base) const

Protected Attributes

int ndim
Ptv(int) nm
Ptv(int) bm
int nm1
int nm1nm2
int bm0
int local_index
int current_iterator_index

Detailed Description

general array with variable no. of indices.

NAME: ArrayGenSimplest(Type) - general array with variable no. of indices

DESCRIPTION:

The class implements a multi-dimensional array in terms of a standard, one-dimensional C array. The multi-dimensional feature is created by offering subscript operators for one, two, three and "Ptv(int)" indices. The bases of the indices can be arbitrary (see the example below). The array is parameterized and can contain any built-in or user defined type, cf. class "VecSimplest(Type)". Further features, such as arithmetic operations, are enabled in the derived class "ArrayGen(Type)".


Constructor & Destructor Documentation

ArrayGenSimplest(Type)::ArrayGenSimplest_Type ( )
 

There are several constructors. All constructors allocate the proper amount of memory and initialize the various internal data structure needed for administrating the multi-dimensional array. The base of each index must be set manually. The default base is 1. The only user required initialization is to assign values to the entries in the array.

There is a default constructor which coincides with the default constructor of the base class "VecSimplest(Type)". The other constructors take the number of entries in each dimension of the array as arguments. If there are more than 3 dimensions, a "Ptv(int)" object is given as argument.

ArrayGenSimplest(Type)::ArrayGenSimplest_Type ( int n1 )
 

See documentation of one of the overloaded constructor.

ArrayGenSimplest(Type)::ArrayGenSimplest_Type ( int n1,
int n2 )
 

See documentation of one of the overloaded constructor.

ArrayGenSimplest(Type)::ArrayGenSimplest_Type ( int n1,
int n2,
int n3 )
 

See documentation of one of the overloaded constructor.

ArrayGenSimplest(Type)::ArrayGenSimplest_Type ( const Ptv(int) & n )
 

See documentation of one of the overloaded constructor.

ArrayGenSimplest(Type)::~ArrayGenSimplest(Type) ( ) [inline]
 

ArrayGenSimplest(Type)::ArrayGenSimplest_Type ( const ArrayGenSimplest(Type) & v )
 

See documentation of one of the overloaded constructor.


Member Function Documentation

String ArrayGenSimplest(Type)::arraySize ( ) const
 

returns a string containing the array size, e.g., for a 2-dimensional array [0:3]x[-1:4] it simply returns the string ""[0:3]x[-1:4]"".

bool ArrayGenSimplest(Type)::compatible ( const ArrayGenSimplest(Type) & a,
bool error_message = true )
 

Reimplemented in ArrayGenSel(Type).

bool ArrayGenSimplest(Type)::compatible ( const VecSimplest(Type) & X ) const [protected]
 

checks if the object has compatible size with the object given as argument.

Reimplemented from VecSimplest(Type).

Reimplemented in ArrayGen(Type).

int ArrayGenSimplest(Type)::elmNo ( const Ptv(int) & index,
int base ) const [protected]
 

void ArrayGenSimplest(Type)::getBase ( Ptv(int) & b ) const
 

See documentation of one of the overloaded functions.

void ArrayGenSimplest(Type)::getBase ( int & b1,
int & b2,
int & b3 ) const
 

See documentation of one of the overloaded functions.

void ArrayGenSimplest(Type)::getBase ( int & b1,
int & b2 ) const
 

See documentation of one of the overloaded functions.

void ArrayGenSimplest(Type)::getBase ( int & b1 ) const
 

returns the base of the index of each dimension.

void ArrayGenSimplest(Type)::getDim ( Ptv(int) & n ) const
 

See documentation of one of the overloaded functions.

void ArrayGenSimplest(Type)::getDim ( int & n1,
int & n2,
int & n3 ) const
 

See documentation of one of the overloaded functions.

void ArrayGenSimplest(Type)::getDim ( int & n1,
int & n2 ) const
 

See documentation of one of the overloaded functions.

void ArrayGenSimplest(Type)::getDim ( int & n1 ) const
 

returns the number of array entries in each dimension. Note that if the base is unity, the number of entries equals the return values of "getMaxI". To redimension another array, "getDim" extracts the correct size. If the bases should also coicide, one must extract the bases ("getBase") and set them in the new array ("setBase") after the declaration.

int ArrayGenSimplest(Type)::getLocalIndex ( ) const [inline]
 

returns the single index of the local index, set by the last call to "setLocalIndex", that is the index corresponding to the element number in "VecSimplest(Type)".

void ArrayGenSimplest(Type)::getMaxI ( Ptv(int) & n ) const
 

See documentation of one of the overloaded functions.

void ArrayGenSimplest(Type)::getMaxI ( int & n1,
int & n2,
int & n3 ) const
 

See documentation of one of the overloaded functions.

void ArrayGenSimplest(Type)::getMaxI ( int & n1,
int & n2 ) const
 

See documentation of one of the overloaded functions.

void ArrayGenSimplest(Type)::getMaxI ( int & n1 ) const
 

returns the upper index value of each dimension. If one wants a loop over the array entries and need to extract the lower and upper loop limits, "getBase" will give the lower limits, while "getMaxI" will give the correct upper limits.

int ArrayGenSimplest(Type)::getNoIndices ( ) const
 

returns the number of dimensions (or indices) of the array.

void ArrayGenSimplest(Type)::indexOk ( const Ptv(int) & index,
const char * message = NULL ) const
 

void ArrayGenSimplest(Type)::indexOk ( int i,
int j,
int k,
const char * message = NULL ) const
 

void ArrayGenSimplest(Type)::indexOk ( int i,
int j,
const char * message = NULL ) const
 

void ArrayGenSimplest(Type)::indexOk ( int i,
const char * message = NULL ) const
 

returns "false" and an error message if the index is illegal, legal indices leads to a "true" return value. There is an optional argument that can be used to give extra information, for example, from which function "indexOk" is called.

Reimplemented from VecSimplest(Type).

void ArrayGenSimplest(Type)::indexOk1 ( int i,
const char * message = NULL ) const
 

void ArrayGenSimplest(Type)::init ( const Ptv(int) & n ) [protected]
 

void ArrayGenSimplest(Type)::init ( int n1,
int n2,
int n3 ) [protected]
 

void ArrayGenSimplest(Type)::init ( int n1,
int n2 ) [protected]
 

void ArrayGenSimplest(Type)::init ( int n1 ) [protected]
 

int ArrayGenSimplest(Type)::length1D ( ) const [inline]
 

int ArrayGenSimplest(Type)::length1Dx2D ( ) const [inline]
 

const Type & ArrayGenSimplest(Type)::local ( const Ptv(int) & index ) const
 

See documentation of one of the overloaded functions.

const Type & ArrayGenSimplest(Type)::local ( int i,
int j,
int k ) const
 

See documentation of one of the overloaded functions.

const Type & ArrayGenSimplest(Type)::local ( int i,
int j ) const
 

See documentation of one of the overloaded functions.

const Type & ArrayGenSimplest(Type)::local ( int i ) const
 

See documentation of one of the overloaded functions.

Type & ArrayGenSimplest(Type)::local ( const Ptv(int) & index )
 

See documentation of one of the overloaded functions.

Type & ArrayGenSimplest(Type)::local ( int i,
int j,
int k )
 

See documentation of one of the overloaded functions.

Type & ArrayGenSimplest(Type)::local ( int i,
int j )
 

See documentation of one of the overloaded functions.

Type & ArrayGenSimplest(Type)::local ( int i )
 

subscripting relative to the index set by "setLocalIndex". For example: "local(0)" refers to the array entry set by the last call to "setLocalIndex", "local(-1)" is the previous entry and so on. When working with 2D finite difference methods, one can call "local(-1,0)", "local(0,1)" and so on (similarly in 3D with triple indices). Alternatively, one can call "setLocalIndex" right before the innermost loop and then run through the fastest varying index (the first index) using "local(i)", where "i" starts at 0. A separate report on the efficiency of various indexing strategies for finite difference methods treats this topic in detail.

int ArrayGenSimplest(Type)::multiple2single ( const Ptv(int) & index ) const
 

int ArrayGenSimplest(Type)::multiple2single ( int i,
int j,
int k ) const
 

int ArrayGenSimplest(Type)::multiple2single ( int i,
int j ) const
 

int ArrayGenSimplest(Type)::multiple2single ( int i ) const
 

bool ArrayGenSimplest(Type)::nextEntry ( )
 

moves a pointer to the next entry in the array. Returns "true" if is there is a next entry, if not, "false" is returned.

const Type & ArrayGenSimplest(Type)::operator() ( const Ptv(int) & index ) const
 

Reimplemented in ArrayGen(Type), and ArrayGenSimple(Type).

const Type & ArrayGenSimplest(Type)::operator() ( int i,
int j,
int k ) const
 

Reimplemented in ArrayGen(Type), and ArrayGenSimple(Type).

const Type & ArrayGenSimplest(Type)::operator() ( int i,
int j ) const
 

Reimplemented in ArrayGen(Type), and ArrayGenSimple(Type).

const Type & ArrayGenSimplest(Type)::operator() ( int i ) const
 

Reimplemented from VecSimplest(Type).

Reimplemented in ArrayGen(Type), and ArrayGenSimple(Type).

Type & ArrayGenSimplest(Type)::operator() ( const Ptv(int) & index )
 

Reimplemented in ArrayGen(Type), and ArrayGenSimple(Type).

Type & ArrayGenSimplest(Type)::operator() ( int i,
int j,
int k )
 

Reimplemented in ArrayGen(Type), and ArrayGenSimple(Type).

Type & ArrayGenSimplest(Type)::operator() ( int i,
int j )
 

Reimplemented in ArrayGen(Type), and ArrayGenSimple(Type).

Type & ArrayGenSimplest(Type)::operator() ( int i )
 

Reimplemented from VecSimplest(Type).

Reimplemented in ArrayGen(Type), and ArrayGenSimple(Type).

void ArrayGenSimplest(Type)::operator= ( const ArrayGenSimplest(Type) & v )
 

Be aware that "ArrayGenSimplest" does not require the "Type" class to have an "operator=". Hence, the copy constructor or the assignment operator has no meaning for "ArrayGenSimplest". Since C++ automatically makes such functions if they are not explicitly declared (and such automatically generated functions lead to serious errors in the present case), the functions are declared, but the content is just an error message.

bool ArrayGenSimplest(Type)::redim ( const Ptv(int) & n )
 

See documentation of one of the overloaded functions.

Reimplemented in ArrayGen(Type), ArrayGenSel(Type), and ArrayGenSimple(Type).

bool ArrayGenSimplest(Type)::redim ( int n1,
int n2,
int n3 )
 

See documentation of one of the overloaded functions.

Reimplemented in ArrayGen(Type), ArrayGenSel(Type), and ArrayGenSimple(Type).

bool ArrayGenSimplest(Type)::redim ( int n1,
int n2 )
 

See documentation of one of the overloaded functions.

Reimplemented in ArrayGen(Type), ArrayGenSel(Type), and ArrayGenSimple(Type).

bool ArrayGenSimplest(Type)::redim ( int n1 )
 

See documentation of one of the overloaded functions.

Reimplemented from VecSimplest(Type).

Reimplemented in ArrayGen(Type), ArrayGenSel(Type), and ArrayGenSimple(Type).

bool ArrayGenSimplest(Type)::redim ( Type * a,
int n,
int base = 0 ) [protected]
 

redimensions the array. With this function one can change the dimension of the array, and the number of entries of each dimension. The base is set to 1.

Reimplemented from VecSimplest(Type).

Reimplemented in ArrayGen(Type), ArrayGenSel(Type), and ArrayGenSimple(Type).

void ArrayGenSimplest(Type)::setBase ( const Ptv(int) & b )
 

See documentation of one of the overloaded functions.

void ArrayGenSimplest(Type)::setBase ( int b1,
int b2,
int b3 )
 

See documentation of one of the overloaded functions.

void ArrayGenSimplest(Type)::setBase ( int b1,
int b2 )
 

See documentation of one of the overloaded functions.

void ArrayGenSimplest(Type)::setBase ( int b1 )
 

enables the programmer to choose an arbitrary base for the index of each dimension.

void ArrayGenSimplest(Type)::setLocalIndex ( const Ptv(int) & index ) const
 

See documentation of one of the overloaded functions.

void ArrayGenSimplest(Type)::setLocalIndex ( int i,
int j,
int k ) const
 

See documentation of one of the overloaded functions.

void ArrayGenSimplest(Type)::setLocalIndex ( int i,
int j ) const
 

See documentation of one of the overloaded functions.

void ArrayGenSimplest(Type)::setLocalIndex ( int i ) const
 

ables subscripting relative to the local index set by this member function. The local index will always have the index `$`(0,0,`\ldots`)`$`. To be used with the function "local". See the documentation of "local" for more information on the use of this function.

const Type & ArrayGenSimplest(Type)::singleIndex1 ( int i ) const
 

See documentation of one of the overloaded functions.

Type & ArrayGenSimplest(Type)::singleIndex1 ( int i )
 

enables the programmer to index the possibly multi-dimensional array by using a single index. This is convenient if the programmer wants to avoid separate loops over each dimension (hence there is no need for "getBase" or "getMaxI" or knowledge of the number of dimensions).

void ArrayGenSimplest(Type)::startIterator ( )
 

starts an iteration over all the array entries.

const Type & ArrayGenSimplest(Type)::thisEntry ( ) const
 

See documentation of one of the overloaded functions.

Type & ArrayGenSimplest(Type)::thisEntry ( )
 

returns the value of the current entry. Actually, a reference is returned so that the function can be used for assigning values to entries (only true for a "const" object).

int ArrayGenSimplest(Type)::totalLength ( const Ptv(int) & n ) [protected]
 


Member Data Documentation

Ptv(int) ArrayGenSimplest(Type)::bm [protected]
 

int ArrayGenSimplest(Type)::bm0 [protected]
 

int ArrayGenSimplest(Type)::current_iterator_index [protected]
 

int ArrayGenSimplest(Type)::local_index [protected]
 

int ArrayGenSimplest(Type)::ndim [protected]
 

Ptv(int) ArrayGenSimplest(Type)::nm [protected]
 

int ArrayGenSimplest(Type)::nm1 [protected]
 

int ArrayGenSimplest(Type)::nm1nm2 [protected]
 


The documentation for this class was generated from the following file:
Copyright © 2003 inuTech GmbH. All rights reserved.