#include <ArrayGen_Type.h>
Inheritance diagram for ArrayGen(Type)::

Public Methods | |
| ArrayGen(Type) () | |
| ArrayGen(Type) (int n1) | |
| ArrayGen(Type) (int n1, int n2) | |
| ArrayGen(Type) (int n1, int n2, int n3) | |
| ArrayGen(Type) (const Ptv(int) &n) | |
| ArrayGen(Type) (const ArrayGen(Type) &X) | |
| ArrayGen(Type) (const Vector(prm_Type) &pm) | |
| virtual | ~ArrayGen(Type) () |
| bool | compatible (const Vec(Type) &a) |
| bool | compatible (const ArrayGen(Type) &a) |
| virtual bool | makeItSimilar (Handle(Vector(Type)) &v) const |
| virtual bool | redim (const Vector(prm_Type) &pm) |
| bool | redim (int n1) |
| bool | redim (int n1, int n2) |
| bool | redim (int n1, int n2, int n3) |
| bool | redim (const Ptv(int) &n) |
| virtual void | fill (const Vector(Type) &X) |
| virtual void | fill (const Type &a) |
| ArrayGen(Type)& | operator= (const ArrayGen(Type) &X) |
| ArrayGen(Type)& | operator= (const Type &a) |
| ArrayGen(Type)& | operator= (const ArrayGenSel(Type) &X) |
| void | fill (Type start, Type stop) |
| 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 |
| virtual void | print (Os os, const char *header=NULL, int nentries_per_line=3) const |
| virtual void | printAscii (Os os, const char *header=NULL) const |
| virtual void | scan (Is is) |
| CLASS_INFO | VIRTUAL_CAST (ArrayGen(Type)) private |
| bool | compatible (const VecSimplest(Type) &X) const |
| void | printAscii (Os os, const char *, int) const |
| bool | redim (Type *a, int n, int base=0) |
Friends | |
| class | ArrayGenSel(Type) |
| Os& | operator<< (Os &os, const ArrayGen(Type) &x) |
| Is& | operator>> (Is &is, ArrayGen(Type) &x) |
NAME: ArrayGen(Type) - generalized, multi-dimensional array with arithmetic operations (arbitrary base)
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 for class "ArrayGenSimplest(Type)". It is assumed that the entries in the array can be used in arithmetic operations like "+", "-", "*" and "/".
Please note that "ArrayGen(Type)" is simply a standard vector with the possibility of multi-dimensional indexing.
The present class has class "VecSimplest(Type)" as a virtual base class.
|
|
With respect to the constructors taking multiple integers or "Ptv(int)" arguments, see the documentation for class "ArrayGenSimplest(Type)". In addition, there is a copy constructor and a version based on the parameter class "Vector_prm(Type)", see class "Vec(Type)" for further details. |
|
|
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. |
|
|
See documentation of one of the overloaded constructor. |
|
|
|
|
|
Reimplemented in ArrayGenSel(Type). |
|
|
See documentation of one of the overloaded functions. Reimplemented from ArrayGenSimplest(Type). |
|
|
See documentation of one of the overloaded functions. Reimplemented in ArrayGenSel(Type). |
|
|
checks compatibility between the input vector and the current object with respect to the total length. Reimplemented in ArrayGenSel(Type). |
|
|
See documentation of one of the overloaded functions. Reimplemented from Vec(Type). Reimplemented in ArrayGenSel(Type). |
|
|
Reimplemented from ArrayGenSimple(Type). Reimplemented in ArrayGenSel(Type). |
|
|
the version with one argument (inherited from class "VecSimple") fills all array entries with the argument value. The version with two arguments, "start" and "stop", fills the vector with values that are uniformly distributed in the closed interval from "start" to "stop" (in ascending order). Reimplemented from Vec(Type). Reimplemented in ArrayGenSel(Type). |
|
|
the "Vector(Type)" object given as input is initialized to be an imprint of the current object. This implies that the input handle "v" should be empty or refer to a vector of type "Vec(Type)". In cases where the input handle is empty, a new "Vec(Type): object is allocated and rebound to "v". Please note that this function does not copy the actual vector entries. Reimplemented from Vec(Type). Reimplemented in ArrayGenSel(Type). |
|
|
Reimplemented from ArrayGenSimple(Type). |
|
|
Reimplemented from ArrayGenSimple(Type). |
|
|
Reimplemented from ArrayGenSimple(Type). |
|
|
Reimplemented from ArrayGenSimple(Type). |
|
|
Reimplemented from ArrayGenSimple(Type). |
|
|
Reimplemented from ArrayGenSimple(Type). |
|
|
Reimplemented from ArrayGenSimple(Type). |
|
|
Reimplemented from ArrayGenSimple(Type). |
|
|
Reimplemented in ArrayGenSel(Type). |
|
|
the version that takes another "VecSimple(Type)" as argument makes the object a copy of the vector argument, that is, the object is redimensioned according to the dimensions of "X" and thereafter each entry is set equal to the corresponding entry in "X". The version that takes a "Type" value as argument sets all the entries in the vector to have this value. Reimplemented from Vec(Type). Reimplemented in ArrayGenSel(Type). |
|
|
Reimplemented in ArrayGenSel(Type). |
|
|
prints the contents of the vector. See documentation of the function "scan". Reimplemented from ArrayGenSimple(Type). Reimplemented in ArrayGenSel(Type). |
|
|
sets the format to ASCII and calls "print". Reimplemented from ArrayGenSimple(Type). |
|
|
Reimplemented from Vec(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 ArrayGenSimple(Type). Reimplemented in ArrayGenSel(Type). |
|
|
See documentation of one of the overloaded functions. Reimplemented from ArrayGenSimple(Type). Reimplemented in ArrayGenSel(Type). |
|
|
See documentation of one of the overloaded functions. Reimplemented from ArrayGenSimple(Type). Reimplemented in ArrayGenSel(Type). |
|
|
See documentation of one of the overloaded functions. Reimplemented from ArrayGenSimple(Type). Reimplemented in ArrayGenSel(Type). |
|
|
See documentation of one of the overloaded functions. Reimplemented from ArrayGenSimple(Type). Reimplemented in ArrayGenSel(Type). |
|
|
one "redim" function is inherited from class "VecSimplest" and redimensions the internal array. The other "redim" function takes a "Vector_prm(Type)" argument and is used in conjuction with a baseclass pointer to "Vector". The function enables redimensioning of any object in the "Vector" hierarchy and is typically used by equation solvers and equation system objects to redimension a vector of unknown class type. A similar function in the "Matrix" hierarchy is easier to understand. Reimplemented from Vec(Type). Reimplemented in ArrayGenSel(Type). |
|
|
reads the vector from an "Is" object. The entries of an array can be written and read in two main formats, the binary format or the ascii format. When "print" is invoked, the format is determined by the state of the "Os" object (the result of the "getFormat" function). Each of the ascii/binary formats can have a header or not. The header is present if "print" is called with a non-"NULL" "header" string. In "scan" one detects the header if the first non-space character is "[". If the header is present, its syntax is like this:
[size]X text $
After the header a character "@" follows if the format is binary, if not, a space appears. Hence one can detect whether the format is binary or ascii even when the header does not appear. After the "@", the binary format has two binary numbers: The number of array entries and the size of each entry. If the header is present and the format is ascii, there will be "nentires_per_line" array entries on each output line. There array index will also be written. In all other cases, the array entries are written with no index, but in the ascii format there will be an extra space. With a header the "scan" functions can read the dimensions of the array and call "redim" before reading the entries. Without a header the dimensions of the array must be correct BEFORE "scan" is called. In other words, a file containing the array entries only can only be read when the number of entries is known. The function "scanFromFile" can, however, read an unknown number of entries from file into a vector with wrong dimensions (see documentation below). If the format is binary, the "scan" function detects the array length and redimensions the array, but a warning is issued. The reason is that, without a header, the main rule is that the programmer must have redimensioned the array on beforehand. After the header the data appears. If they are written in binary mode, the first non-white character (after the header) is "@". Then, in binary format, the number of items must appear and after that the size of each item. Then the data appear in binary format. If the "@" character is not present, the data appear in ascii format. Let us present some examples on valid data files. First the most comprehensive form:
[3] Example of a data file with much additional information such as
indices for each vector entry. This file is in ascii format.
(1)=1.2
(2)=3.4
(3)=1.8
Here is an ascii format file with as little information as possible (a NULL header was given when calling "print":
1.2 3.4 1.8
1.2 3.4
1.8
Finally we show a binary file without header. To indicate a binary number (f.ex. 8.1) we use the notation [B8.1].
@[B3][B4][B1.2][B3.4][B1.8]
Reimplemented from ArrayGenSimple(Type). Reimplemented in ArrayGenSel(Type). |
|
|
|
|
|
|
|
|
|