Commit a9a10f23 authored by Jakub Klinkovský's avatar Jakub Klinkovský
Browse files

Refactored Jacobi solver

parent cb9918bb
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -10,6 +10,7 @@ SET( headers BICGStab.h
             CWYGMRES_impl.h
             GMRES.h
             GMRES_impl.h
             Jacobi.h
             LinearResidueGetter.h
             LinearResidueGetter_impl.h
             SOR.h
+115 −0
Original line number Diff line number Diff line
@@ -6,21 +6,11 @@
    email                : tomas.oberhuber@fjfi.cvut.cz
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 ***************************************************************************/

#pragma once

#include <math.h>
#include <TNL/Object.h>
#include <TNL/Solvers/Preconditioners/Dummy.h>
#include <TNL/Solvers/IterativeSolver.h>
#include <TNL/Solvers/Linear/Preconditioners/Dummy.h>
#include <TNL/Solvers/Linear/LinearResidueGetter.h>

namespace TNL {
@@ -28,7 +18,7 @@ namespace TNL {
namespace Linear {

template< typename Matrix,
          typename Preconditioner = DummyPreconditioner< typename Matrix :: RealType,
          typename Preconditioner = Preconditioners::Dummy< typename Matrix::RealType,
                                                            typename Matrix::DeviceType,
                                                            typename Matrix::IndexType> >
class Jacobi : public Object,
@@ -51,7 +41,7 @@ class Jacobi : public Object,
      return String( "Jacobi< " ) + this->matrix->getType() + ", " +   this->preconditioner->getType() + " >";
   }

   static void configSetup( tnlConfigDescription& config,
   static void configSetup( Config::ConfigDescription& config,
                            const String& prefix = "" )
   {
      config.addEntry< double >( prefix + "jacobi-omega", "Relaxation parameter of the weighted/damped Jacobi method.", 1.0 );
@@ -64,7 +54,7 @@ class Jacobi : public Object,
      this->setOmega( parameters.getParameter< double >( prefix + "jacobi-omega" ) );
      if( this->omega <= 0.0 || this->omega > 2.0 )
      {
			cerr << "Warning: The Jacobi method parameter omega is out of interval (0,2). The value is " << this->omega << " the method will not converge." << endl;
         std::cerr << "Warning: The Jacobi method parameter omega is out of interval (0,2). The value is " << this->omega << " the method will not converge." << std::endl;
      }
      return true;
   }
@@ -118,7 +108,6 @@ class Jacobi : public Object,
      RealType omega;
      const MatrixType* matrix;
      const PreconditionerType* preconditioner;

};

} // namespace Linear