![]() |
00001 // Copyright (C) 2004 Johan Hoffman and Anders Logg. 00002 // Licensed under the GNU GPL Version 2. 00003 00004 #ifndef __GAUSS_SEIDEL_H 00005 #define __GAUSS_SEIDEL_H 00006 00007 #include <dolfin/constants.h> 00008 #include <dolfin/Preconditioner.h> 00009 #include <dolfin/LinearSolver.h> 00010 00011 namespace dolfin 00012 { 00013 00014 class Matrix; 00015 class Vector; 00016 00022 00023 class GaussSeidel : public Preconditioner, public LinearSolver 00024 { 00025 public: 00026 00028 GaussSeidel(const Matrix& A, real tol, unsigned int maxiter); 00029 00031 ~GaussSeidel(); 00032 00034 void solve(Vector& x, const Vector& b); 00035 00037 static void solve(const Matrix& A, Vector& x, const Vector& b, 00038 real tol, unsigned int maxiter); 00039 00040 private: 00041 00042 // Perform one Gauss-Seidel iteration 00043 void iteration(const Matrix& A, Vector& x, const Vector& b); 00044 00045 // The matrix 00046 const Matrix& A; 00047 00048 // Tolerance 00049 real tol; 00050 00051 // Maximum number of iterations 00052 unsigned int maxiter; 00053 00054 }; 00055 00056 } 00057 00058 #endif
Documentation automatically generated with Doxygen on 10 Sep 2004.