#include <ArrayGenSimplest_Type.h>
Inheritance diagram for ArrayGenSimplest(Type)::

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 |
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)".
|
|
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. |
|
|
See documentation of one of the overloaded constructor. |
|
|
See documentation of one of the overloaded constructor. |
|
|
See documentation of one of the overloaded constructor. |
|
|
See documentation of one of the overloaded constructor. |
|
|
|
|
|
See documentation of one of the overloaded constructor. |
|
|
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]"". |
|
|
Reimplemented in ArrayGenSel(Type). |
|
|
checks if the object has compatible size with the object given as argument. Reimplemented from VecSimplest(Type). Reimplemented in ArrayGen(Type). |
|
|
|
|
|
See documentation of one of the overloaded functions. |
|
|
See documentation of one of the overloaded functions. |
|
|
See documentation of one of the overloaded functions. |
|
|
returns the base of the index of each dimension. |
|
|
See documentation of one of the overloaded functions. |
|
|
See documentation of one of the overloaded functions. |
|
|
See documentation of one of the overloaded functions. |
|
|
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. |
|
|
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)". |
|
|
See documentation of one of the overloaded functions. |
|
|
See documentation of one of the overloaded functions. |
|
|
See documentation of one of the overloaded functions. |
|
|
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. |
|
|
returns the number of dimensions (or indices) of the array. |
|
|
|
|
|
|
|
|
|
|
|
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). |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
See documentation of one of the overloaded functions. |
|
|
See documentation of one of the overloaded functions. |
|
|
See documentation of one of the overloaded functions. |
|
|
See documentation of one of the overloaded functions. |
|
|
See documentation of one of the overloaded functions. |
|
|
See documentation of one of the overloaded functions. |
|
|
See documentation of one of the overloaded functions. |
|
|
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. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
moves a pointer to the next entry in the array. Returns "true" if is there is a next entry, if not, "false" is returned. |
|
|
Reimplemented in ArrayGen(Type), and ArrayGenSimple(Type). |
|
|
Reimplemented in ArrayGen(Type), and ArrayGenSimple(Type). |
|
|
Reimplemented in ArrayGen(Type), and ArrayGenSimple(Type). |
|
|
Reimplemented from VecSimplest(Type). Reimplemented in ArrayGen(Type), and ArrayGenSimple(Type). |
|
|
Reimplemented in ArrayGen(Type), and ArrayGenSimple(Type). |
|
|
Reimplemented in ArrayGen(Type), and ArrayGenSimple(Type). |
|
|
Reimplemented in ArrayGen(Type), and ArrayGenSimple(Type). |
|
|
Reimplemented from VecSimplest(Type). Reimplemented in ArrayGen(Type), and ArrayGenSimple(Type). |
|
|
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. |
|
|
See documentation of one of the overloaded functions. Reimplemented in ArrayGen(Type), ArrayGenSel(Type), and ArrayGenSimple(Type). |
|
|
See documentation of one of the overloaded functions. Reimplemented in ArrayGen(Type), ArrayGenSel(Type), and ArrayGenSimple(Type). |
|
|
See documentation of one of the overloaded functions. Reimplemented in ArrayGen(Type), ArrayGenSel(Type), and ArrayGenSimple(Type). |
|
|
See documentation of one of the overloaded functions. Reimplemented from VecSimplest(Type). Reimplemented in ArrayGen(Type), ArrayGenSel(Type), and ArrayGenSimple(Type). |
|
|
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). |
|
|
See documentation of one of the overloaded functions. |
|
|
See documentation of one of the overloaded functions. |
|
|
See documentation of one of the overloaded functions. |
|
|
enables the programmer to choose an arbitrary base for the index of each dimension. |
|
|
See documentation of one of the overloaded functions. |
|
|
See documentation of one of the overloaded functions. |
|
|
See documentation of one of the overloaded functions. |
|
|
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. |
|
|
See documentation of one of the overloaded functions. |
|
|
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). |
|
|
starts an iteration over all the array entries. |
|
|
See documentation of one of the overloaded functions. |
|
|
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). |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|