Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members

SISolver.h

Go to the documentation of this file.
00001 // Copyright (C) 2002 Johan Hoffman and Anders Logg.
00002 // Licensed under the GNU GPL Version 2.
00003 
00004 #ifndef __SI_SOLVER_H
00005 #define __SI_SOLVER_H
00006 
00007 #include <dolfin/constants.h>
00008 
00009 namespace dolfin {
00010   
00011   class Vector;
00012   class Matrix;
00013   
00014   class SISolver{
00015   public:
00016     
00017     enum Method { RICHARDSON, JACOBI, GAUSS_SEIDEL, SOR };
00018     
00019     SISolver();
00020     ~SISolver(){}
00021     
00022     void solve(const Matrix& A, Vector& x, const Vector& b);
00023 
00024     void setMethod(Method method);
00025     void setNoSweeps(int max_no_iterations);
00026     
00027   private:
00028     
00029     void iterateRichardson  (const Matrix& A, Vector& x, const Vector& b);
00030     void iterateJacobi      (const Matrix& A, Vector& x, const Vector& b);
00031     void iterateGaussSeidel (const Matrix& A, Vector& x, const Vector& b);
00032     void iterateSOR         (const Matrix& A, Vector& x, const Vector& b);
00033     
00034     real residual(const Matrix& A, Vector& x, const Vector& b);
00035     
00036     Method method;
00037     
00038     real tol;
00039     
00040     int max_no_iterations;
00041   };
00042   
00043   typedef SISolver SimpleSolver;
00044 }
00045 
00046 #endif


Documentation automatically generated with Doxygen on 10 Sep 2004.