Commit 7c9c0e27 authored by Tomáš Oberhuber's avatar Tomáš Oberhuber Committed by Tomáš Oberhuber
Browse files

Small fixes in the Jacobi linear solver.

parent b274befe
Loading
Loading
Loading
Loading
+15 −1
Original line number Diff line number Diff line
@@ -62,7 +62,7 @@ class Jacobi
       * defines the following:
       *
       * \e jacobi-omega - relaxation parameter of the weighted/damped Jacobi method - 1.0 by default.
       * \e residue-period - says after how many iterations the reside is recomputed - 4 by default.
       * \e residue-period - number of iterations between subsequent recomputations of the residue - 4 by default.
       *
       * \param config contains description of configuration parameters.
       * \param prefix is a prefix of particular configuration entries.
@@ -91,6 +91,20 @@ class Jacobi
       */
      RealType getOmega() const;

      /**
       * \brief Set the period for a recomputation of the residue.
       *
       * \param period number of iterations between subsequent recomputations of the residue.
       */
      void setResiduePeriod( IndexType period );

      /**
       * \brief Get the period for a recomputation of the residue.
       *
       * \return number of iterations between subsequent recomputations of the residue.
       */
      IndexType getResiduePerid() const;

      /**
       * \brief Method for solving of a linear system.
       *
+19 −1
Original line number Diff line number Diff line
@@ -24,7 +24,7 @@ configSetup( Config::ConfigDescription& config, const String& prefix )
{
   LinearSolver< Matrix >::configSetup( config, prefix );
   config.addEntry< double >( prefix + "jacobi-omega", "Relaxation parameter of the weighted/damped Jacobi method.", 1.0 );
   config.addEntry< int >( prefix + "residue-period", "Says after how many iterations the reside is recomputed.", 4 );
   config.addEntry< int >( prefix + "residue-period", "Number of iterations between subsequent recomputations of the residue.", 4 );
}

template< typename Matrix >
@@ -38,6 +38,8 @@ setup( const Config::ParameterContainer& parameters, const String& prefix )
   {
      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;
   }
   if( parameters.checkParameter( prefix + "residue-period" ) )
      this->setResiduePeriod( parameters.getParameter< int >( prefix + "residue-period" ) );
   return LinearSolver< Matrix >::setup( parameters, prefix );
}

@@ -57,6 +59,22 @@ getOmega() const -> RealType
   return omega;
}

template< typename Matrix >
void
Jacobi< Matrix >::
setResiduePeriod( IndexType period )
{
   this->residuePeriod = period;
}

template< typename Matrix >
auto
Jacobi< Matrix >::
getResiduePerid() const -> IndexType
{
   return this->residuePeriod;
}

template< typename Matrix >
bool
Jacobi< Matrix >::