Diffpack Documentation


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

LinEqVector Class Reference

vector in a system of linear equations. More...

#include <LinEqVector.h>

Inheritance diagram for LinEqVector::

HandleId List of all members.

Public Methods

 LinEqVector ()
 LinEqVector (int nblocks)
 LinEqVector (const LinEqVector &u)
 LinEqVector (Vector(NUMT) &vec)
 ~LinEqVector ()
int size () const
int getNoEntries () const
bool redim (int nblocks=1)
bool redim (const LinEqVector_prm &vecprm)
bool redim (const LinEqVector &u)
int getWork (const VectorWork work_tp=NORM_WORK) const
real getStorage () const
bool ok () const
bool single () const
Vector(NUMT)& vec (int i=1)
const Vector(NUMT)& vec (int i=1) const
void attach (const Vector(NUMT) &vec, int i=1)
LinEqVector& operator= (const LinEqVector &v)
LinEqVector& operator= (NUMT a)
void assemble (const Vec(NUMT) &ev, const VecSimple(int) &idx_trans, int elm_no, int i=1)
bool blockCompatible (const LinEqVector &y) const
void add (const LinEqVector &y, const LinEqVector &z)
void add (const LinEqVector &y, char s, const LinEqVector &z)
void add (const LinEqVector &y, NUMT b, const LinEqVector &z)
void add (NUMT a, const LinEqVector &y, NUMT b, const LinEqVector &z)
void mult (NUMT value)
NUMT inner (const LinEqVector &y) const
real norm (Norm_type lp=l2)
real normDiff (const LinEqVector &y, Norm_type lp=l2)
void randomize (real low=-1.0, real high=1.0)
const Vec(NUMT)& getVec (int i=1) const
Vec(NUMT)& getVec (int i=1)
const ArrayGen(NUMT)& getArrayGen (int i=1) const
ArrayGen(NUMT)& getArrayGen (int i=1)
const ArrayGenSel(NUMT)& getArrayGenSel (int i=1) const
ArrayGenSel(NUMT)& getArrayGenSel (int i=1)
void debugPrint (Os os, const char *header) const

Friends

Osoperator<< (Os &os, const LinEqVector &v)

Detailed Description

vector in a system of linear equations.

NAME: LinEqVector - vector in a system of linear equations

DESCRIPTION:

The class implements a block vector and constitutes the basic vector class to be used by (iterative) equation solvers in the "LinEqSolver" hierarchy. Most operations are simplified if there is only one block present.

The class allocates a vector of "Handle(Vector(NUMT)" instances, where each vector represents a block.

The class has features for keeping track of the storage requirements of "LinEqVectors", see the documentation page of class "LinEqMatrix" for more details.


Constructor & Destructor Documentation

LinEqVector::LinEqVector ( ) [inline]
 

There are four constructors. One is empty and allocates no internal data structure. Further initialization is then required: either a call to the "redim" function with an int (the number of blocks) as argument and then calls to "attach", or a call to "redim(LinEqVector_prm)". In the latter case, the "redim" function allocates memory for all the matrices according to the sizes given in the parameter object of class "LinEqVector_prm". Another alternative is to call "redim(LinEqVector)", where the allocation is based on an already existing "LinEqVector" structure. Note that the "redim" function that takes an int as argument allocates an internal vector of handles. These handles are empty and must be rebound to objects of type "Vector(NUMT)" by calling the "attach" function. The other "redim" functions allocate both the vector of handles and "Vector(NUMT)" objects that are rebound to the handles.

In addition to the default constructor, there are other constructors accepting the number of blocks, a preallocated "LinEqVector" object or a "Vector(NUMT)" object. In the first of these cases, attachment or some redimensioning of each block is required. The third option implies that the "LinEqVector" object consists of a single block.

Deallocation of everything that is allocated in "LinEqVector" objects will automatically take place when the "LinEqVector" object goes out of scope since then all handles will be deleted and the handles will delete the "Vector(NUMT)" objects if there are no other handle referring to these objects. Further initialization of the class is not necessary, except that the matrices must be filled by proper "NUMT" values.

LinEqVector::LinEqVector ( int nblocks )
 

LinEqVector::LinEqVector ( const LinEqVector & u )
 

See documentation of one of the overloaded constructor.

LinEqVector::LinEqVector ( Vector(NUMT) & vec )
 

See documentation of one of the overloaded constructor.

LinEqVector::~LinEqVector ( )
 


Member Function Documentation

void LinEqVector::add ( NUMT a,
const LinEqVector & y,
NUMT b,
const LinEqVector & z )
 

See documentation of one of the overloaded functions.

void LinEqVector::add ( const LinEqVector & y,
NUMT b,
const LinEqVector & z )
 

See documentation of one of the overloaded functions.

void LinEqVector::add ( const LinEqVector & y,
char s,
const LinEqVector & z )
 

See documentation of one of the overloaded functions.

void LinEqVector::add ( const LinEqVector & y,
const LinEqVector & z )
 

computes a sum of (block) vectors. Some of the vectors can be multiplied by a scalar. There are several overloaded instances.

void LinEqVector::assemble ( const Vec(NUMT) & ev,
const VecSimple(int) & idx_trans,
int elm_no,
int i = 1 )
 

adds a small vector to a large, global vector. The elements are assembled according to an index transformation vector. The routine is useful when programming finite element methods.

void LinEqVector::attach ( const Vector(NUMT) & vec,
int i = 1 )
 

attach a "Vector(NUMT)" handle as a block.

bool LinEqVector::blockCompatible ( const LinEqVector & y ) const
 

compares the block size of the "LinEqVector" y and the current object.

void LinEqVector::debugPrint ( Os os,
const char * header ) const
 

prints the contents of a "LinEqVector" object block for block. Alternatively, printing can be done by calls like "vec(i).print(os)".

ArrayGen(NUMT) & LinEqVector::getArrayGen ( int i = 1 )
 

See documentation of one of the overloaded functions.

const ArrayGen(NUMT) & LinEqVector::getArrayGen ( int i = 1 ) const
 

as "getVec", but the subclass instance of "Vector(NUMT)" must be of "ArrayGen(NUMT)" type.

ArrayGenSel(NUMT) & LinEqVector::getArrayGenSel ( int i = 1 )
 

See documentation of one of the overloaded functions.

const ArrayGenSel(NUMT) & LinEqVector::getArrayGenSel ( int i = 1 ) const
 

as "getVec", but the subclass instance of "Vector(NUMT)" must be of "ArrayGenSel(NUMT)" type.

int LinEqVector::getNoEntries ( ) const
 

returns the total number of entries (added up over all blocks).

real LinEqVector::getStorage ( ) const
 

returns the total storage cost (added up over all blocks).

Vec(NUMT) & LinEqVector::getVec ( int i = 1 )
 

See documentation of one of the overloaded functions.

const Vec(NUMT) & LinEqVector::getVec ( int i = 1 ) const
 

performs a cast from the general vector representation ("Vector(NUMT)" pointer) to a specific subclass reference. Do not use this routine to index a vector, declare your own reference and use this routine to initialize that reference.

int LinEqVector::getWork ( const VectorWork work_tp = NORM_WORK ) const
 

returns the total cost if the last issued vector operation (added up over all blocks).

NUMT LinEqVector::inner ( const LinEqVector & y ) const
 

computes the inner product of two vectors with identical block structure. If both vectors contain complex values, the complex conjugate is used.

void LinEqVector::mult ( NUMT value )
 

real LinEqVector::norm ( Norm_type lp = l2 )
 

computes the norm of the (block) vector. There are several norms available (see "enum" "Norm_type"): "l1" is the discrete `$`L`_`1`$` norm, "L1" is the corresponding continuous norm, "l2" is the discrete `$`L`_`2`$` norm (Euclidean norm), while "L2" is the corresponding continuous norm. Finally, "Linf" is the `$`L`_{\`infty`}$` norm.

real LinEqVector::normDiff ( const LinEqVector & y,
Norm_type lp = l2 )
 

similar to "norm", but computes the norm of the vector difference between the current object and the argument vector.

bool LinEqVector::ok ( ) const
 

returns "true" if the object is in an ok state. the value "false" is returned only if there are empty handles.

LinEqVector & LinEqVector::operator= ( NUMT a )
 

See documentation of one of the overloaded functions.

LinEqVector & LinEqVector::operator= ( const LinEqVector & v )
 

redimensions and initializes this "LinEqVector" object based on another existing "LinEqVector".

void LinEqVector::randomize ( real low = -1.0,
real high = 1.0 )
 

fills the vector with random values in the closed interval from "low" to "high". Two sequences of same length will be identical if they are based on the same "seed" value.

bool LinEqVector::redim ( const LinEqVector & u )
 

See documentation of one of the overloaded functions.

bool LinEqVector::redim ( const LinEqVector_prm & vecprm )
 

See documentation of one of the overloaded functions.

bool LinEqVector::redim ( int nblocks = 1 )
 

redimension the block vector. If given a "LinEqVector_prm" or "LinEqVector" object, each block is also redimensioned according to indicated block sizes and formats.

bool LinEqVector::single ( ) const
 

returns "true" if there is only a single block.

int LinEqVector::size ( ) const [inline]
 

returns the number of blocks.

const Vector(NUMT) & LinEqVector::vec ( int i = 1 ) const [inline]
 

See documentation of one of the overloaded functions.

Vector(NUMT) & LinEqVector::vec ( int i = 1 ) [inline]
 

subscripting, returns a "Vector(NUMT)" reference to a block.


Friends And Related Function Documentation

Os & operator<< ( Os & os,
const LinEqVector & v ) [friend]
 

see "debugPrint".


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