LinSolver< T > Class Template Reference

The linear solver base class template. More...

#include <LinSolver.hpp>

Inheritance diagram for LinSolver< T >:

Inheritance graph
[legend]
Collaboration diagram for LinSolver< T >:

Collaboration graph
[legend]
List of all members.

Public Member Functions

virtual void PrintParam ()=0
 Prints the name of the solver and (optionally) the parameters.
virtual void PreProcess (SysMatrix< T > &A)=0
 Prepares the solver for a given system matrix.
virtual bool Run (GridVec< T > &f, GridVec< T > &x)=0
 Solves the linear system with a right-hand side $ f $ and writes the solution to $ x $. Note that in some cases $ f $ and $ x $ must be physically different vectors, but they should have equal sizes. This function should throw exceptions on errors. The function returns nonzero if the prescribed precision has not been achieved.
virtual void PostProcess ()=0
 Releases the memory allocated in PreProcess, ...
bool Solve (SysMatrix< T > &A, GridVec< T > &f, GridVec< T > &x)
 A shorter method to call the solver: this function merely calls the preprocess, then 'Run' and the postprocess.
virtual ~LinSolver ()
 Virtual destructor.

Detailed Description

template<typename T>
class LinSolver< T >

The linear solver base class template.

This is the virtual class template for generic linear solvers for large sparse linear systems. All such the solvers (line the damped linear iteration, the CG-method or the BiCGStab method) should be derived from this class. This class is further used as the interface for the linear solver in for ex. the Newton method.

Note:

  1. Note that only PreProcess gets the matrix as an argument. This function prepares the solver to solve any system with the fine level matrix. Nevertheless the other virtual functions (Run and PostProcess) may need this matrix, too. Thus, the matrices must be kept unchanged until you call PostProcess and you may save a reference to it in the derived class.
  2. SGDisplay is a virtual base class and its constructor should be called in the derived class.


Constructor & Destructor Documentation

template<typename T>
virtual LinSolver< T >::~LinSolver (  )  [inline, virtual]

Virtual destructor.


Member Function Documentation

template<typename T>
virtual void LinSolver< T >::PrintParam (  )  [pure virtual]

Prints the name of the solver and (optionally) the parameters.

Implemented in BiCGStab< T >, CGIter< T >, and LinIter< T >.

template<typename T>
virtual void LinSolver< T >::PreProcess ( SysMatrix< T > &  A  )  [pure virtual]

Prepares the solver for a given system matrix.

This function must be called only once for a given system matrix. Then the solver can be applied to any right-hand side. This function does not return any value but may throw exceptions:

Parameters:
[in] A The system matrix hierarchy

Implemented in BiCGStab< T >, CGIter< T >, and LinIter< T >.

template<typename T>
virtual bool LinSolver< T >::Run ( GridVec< T > &  f,
GridVec< T > &  x 
) [pure virtual]

Solves the linear system with a right-hand side $ f $ and writes the solution to $ x $. Note that in some cases $ f $ and $ x $ must be physically different vectors, but they should have equal sizes. This function should throw exceptions on errors. The function returns nonzero if the prescribed precision has not been achieved.

Parameters:
[in] f The right-hand side
[in] x The solution (and the initial guess)

Implemented in BiCGStab< T >, CGIter< T >, and LinIter< T >.

template<typename T>
virtual void LinSolver< T >::PostProcess (  )  [pure virtual]

Releases the memory allocated in PreProcess, ...

After you called this function the solver cannot work before you call PreProcess again. This function does not return any value but may throw exceptions.

Implemented in BiCGStab< T >, CGIter< T >, and LinIter< T >.

template<typename T>
bool LinSolver< T >::Solve ( SysMatrix< T > &  A,
GridVec< T > &  f,
GridVec< T > &  x 
) [inline]

A shorter method to call the solver: this function merely calls the preprocess, then 'Run' and the postprocess.

Parameters:
[in] A The system matrix hierarchy
[in] f The right-hand side
[in] x The solution
Returns:
The same value as 'Run'


The documentation for this class was generated from the following file:
Generated on Fri Sep 21 12:34:18 2007 for SG2 by  doxygen 1.5.2