#include <ArrayGenSel_Type.h>
Inheritance diagram for ArrayGenSel(Type)::

Public Methods | |
| ArrayGenSel(Type) () | |
| ArrayGenSel(Type) (int n1) | |
| ArrayGenSel(Type) (int n1, int n2) | |
| ArrayGenSel(Type) (int n1, int n2, int n3) | |
| ArrayGenSel(Type) (const Ptv(int) &n) | |
| ArrayGenSel(Type) (const IndexSet &I, int offset) | |
| ArrayGenSel(Type) (const IndexSet &I, const Ptv(int) &offset) | |
| ArrayGenSel(Type) (const ArrayGenSel(Type) &X) | |
| ArrayGenSel(Type) (const Vector(prm_Type) &pm) | |
| ~ArrayGenSel(Type) () | |
| virtual int | getNoEntries () const |
| bool | hasIndexSet () const |
| IndexSet& | getIndexSet () const |
| bool | compatible (const IndexSet &I) const |
| bool | compatible (const Vec(Type) &a) |
| bool | compatible (const ArrayGen(Type) &a) |
| bool | compatible (const ArrayGenSel(Type) &a) |
| void | attach (ArrayGen(Type) &values) |
| void | pureCopy (const ArrayGen(Type) &values) |
| void | activate () |
| void | activate (const IndexSet &I) |
| 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 | redim (const IndexSet &I, int offset=0) |
| bool | redim (const IndexSet &I, const Ptv(int) &offset) |
| virtual bool | redim (const Vector(prm_Type) &pm) |
| virtual bool | makeItSimilar (Handle(Vector(Type)) &v) const |
| virtual void | fill (const Vector(Type) &X) |
| virtual void | fill (const Type &a) |
| void | fill (Type start, Type stop) |
| ArrayGenSel(Type)& | operator= (const ArrayGenSel(Type) &X) |
| ArrayGenSel(Type)& | operator= (const ArrayGen(Type) &X) |
| ArrayGenSel(Type)& | operator= (const Type &a) |
| void | fillSel (const IndexSet &I, Type a) |
| virtual void | add (const Vector(Type) &yb, const Vector(Type) &zb) |
| virtual void | add (const Vector(Type) &yb, char s, const Vector(Type) &zb) |
| virtual void | add (const Vector(Type) &yb, Type b, const Vector(Type) &zb) |
| virtual void | add (Type a, const Vector(Type) &yb, Type b, const Vector(Type) &zb) |
| virtual void | add (const Vector(Type) &y, int power, Type front_factor) |
| virtual void | add (Type value) |
| virtual void | apply (Func(Type) f) |
| virtual void | mult (Type value) |
| virtual Type | inner (const Vector(Type) &yb) const |
| virtual real | norm (Norm_type lp=l2) const |
| virtual real | normDiff (const Vector(Type) &y, Norm_type lp=l2) const |
| virtual void | printSel (Os os, const char *header=NULL, int nentries_per_line=3) const |
| virtual void | printSelAscii (Os os, const char *header=NULL) const |
| void | print (Os os, const char *header=NULL, int nentries_per_line=3) const |
| virtual void | scan (Is is) |
| CLASS_INFO | VIRTUAL_CAST (ArrayGenSel(Type)) private |
| bool | compatible (const ArrayGenSimplest(Type) &a, bool error_message=true) |
| bool | redim (Type *a, int n, int base=0) |
Protected Methods | |
| void | reset () |
Friends | |
| Os& | operator<< (Os &os, const Vec(Type) &x) |
| Is& | operator>> (Is &is, Vec(Type) &x) |
NAME: ArrayGenSel(Type) - subset of general array with arithmetic operations
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 through inheritance from class "ArrayGen(Type)". The bases of the indices can be arbitrary. It is assumed that the entries in the array can be used in arithmetic operations like +, -, * and /. In contrast to "ArrayGen(Type)", the current class can mark a subset of the total collection of vector entries as active.
In terms of finite difference stencils, this option allows us to disable nodes close to the grid borders. That is, these points will not contribute to arithmetic operations such as vector additions and inner products. The information needed for disabling nodes is extracted from a set of indicies, the index set must be represented by a class derived from the abstract base class "IndexSet". The index set will mark corresponding entries as active. Please notice that the subset mechanism does not influence vector assignments in terms of operators of member functions.
|
|
There are several constructors, besides the specialized constructor with an index set as argument, the documentation of the constructors are found within the documentation of class "ArrayGen(Type)" and class "ArrayGenSimplest(Type)". The constructor with the argument of an index set "I" and an integer "offset" allocates an array, using the size of "I". The offset size is appended to each end of the spatial dimension and the indices given by "I" are marked as active. |
|
|
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. |
|
|
See documentation of one of the overloaded constructor. |
|
|
See documentation of one of the overloaded constructor. |
|
|
|
|
|
Reimplemented from ArrayGen(Type). |
|
|
See documentation of one of the overloaded functions. |
|
|
make it possible to mark selected array entries as active (others are then non-active in computations). If no argument is present all the array entries are marked, otherwise the index set given as argument is used to mark active entries. |
|
|
See documentation of one of the overloaded functions. Reimplemented from Vec(Type). |
|
|
See documentation of one of the overloaded functions. Reimplemented from Vec(Type). |
|
|
See documentation of one of the overloaded functions. Reimplemented from Vec(Type). |
|
|
See documentation of one of the overloaded functions. Reimplemented from Vec(Type). |
|
|
See documentation of one of the overloaded functions. Reimplemented from Vec(Type). |
|
|
vector additions use only entries that are marked as active. This is also true for other arithmetic operations like "apply", "mult", "inner", "norm" and "normDiff". Reimplemented from Vec(Type). |
|
|
given a function pointer "f", this transformation is applied to every entry of the vector object. Reimplemented from Vec(Type). |
|
|
borrow the values of a "ArrayGen" object. This function is not completely safe since the borrowed object might be deleted. Use the function with care! |
|
|
See documentation of one of the overloaded functions. Reimplemented from ArrayGenSimplest(Type). |
|
|
See documentation of one of the overloaded functions. |
|
|
See documentation of one of the overloaded functions. Reimplemented from ArrayGen(Type). |
|
|
See documentation of one of the overloaded functions. Reimplemented from ArrayGen(Type). |
|
|
the version with an index set argument checks if the indices are well defined corresponding to the size of the array. If so "true" is returned, otherwise "false" is returned. The other versions checks compability with different vector types and compatibility requires that the memomory segments have equal length (the case where an "ArrayGenSel" object, neglecting the ghost boundary, is mathematically compatible with an "ArrayGen" object is not treated). |
|
|
See documentation of one of the overloaded functions. Reimplemented from ArrayGen(Type). |
|
|
See documentation of one of the overloaded functions. Reimplemented from ArrayGen(Type). |
|
|
assigns the specified value to all the elements of the array. Reimplemented from ArrayGen(Type). |
|
|
the elements corresponding to the index set in the argument is assigned to a given value. |
|
|
return the index set (class "IndexSet") contained by the class. |
|
|
return the number of 'active' vector entries. Reimplemented from Vec(Type). |
|
|
|
|
|
computes the inner product of two vectors. If both vectors contain complex values, the complex conjugate of the first vector is used. Reimplemented from Vec(Type). |
|
|
as in the other classes derived from "Vector(Type)", this function reinitializes an existing "ArrayGenSel(Type)" object or allocates a new one. In both cases, the handle "v" refers to an object with the same attributes as the current one. In particular, the referenced object will inherit the present marking of active entries. Please note that this function does not copy the actual vector entries. Reimplemented from ArrayGen(Type). |
|
|
all vector entries are multiplied with a given constant "value". Reimplemented from Vec(Type). |
|
|
computes the norm of the vector. There are several norms available (see "enum" "Norm_type"): "l1" is the discrete
`$`L`_`1`$ norm (`$\`sum`_{`i=1`}^`n ``v`_`i`|$`), "L1" is the
(`$`(1/n)`\`sum`_{`i=1`}^`n``v`_`i`|$`), "l2" is the discrete
``v`_`i`|$`).
Reimplemented from Vec(Type). |
|
|
similar to "norm", but computes the norm of the vector difference between the current object and the argument vector. Reimplemented from Vec(Type). |
|
|
See documentation of one of the overloaded functions. Reimplemented from ArrayGen(Type). |
|
|
See documentation of one of the overloaded functions. Reimplemented from ArrayGen(Type). |
|
|
performs a "fill" operation. Reimplemented from ArrayGen(Type). |
|
|
prints the contents of the vector. See documentation of the function "scan". Reimplemented from ArrayGen(Type). |
|
|
|
|
|
|
|
|
make a pure copy of an "ArrayGen" object, that is, allocated the vector and copy the values. |
|
|
See documentation of one of the overloaded functions. Reimplemented from ArrayGen(Type). |
|
|
See documentation of one of the overloaded functions. Reimplemented from 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. Reimplemented from ArrayGen(Type). |
|
|
See documentation of one of the overloaded functions. Reimplemented from ArrayGen(Type). |
|
|
See documentation of one of the overloaded functions. Reimplemented from ArrayGen(Type). |
|
|
reallocates the array, c.f. the construcors. Reimplemented from ArrayGen(Type). |
|
|
Reimplemented from Vector(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 ArrayGen(Type). |
|
|
calls the function "print". Reimplemented from Vec(Type). |
|
|
calls the function "scan". Reimplemented from Vec(Type). |