Commit 5a1c176a authored by Jakub Klinkovský's avatar Jakub Klinkovský
Browse files

Fixed bug in setting preconditioners

parent d1678765
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -24,7 +24,7 @@
#include <cstring>


#define TNL_DEBUG_SHARED_POINTERS
//#define TNL_DEBUG_SHARED_POINTERS

#ifdef TNL_DEBUG_SHARED_POINTERS
   #include <typeinfo>
+11 −3
Original line number Diff line number Diff line
@@ -11,6 +11,7 @@
#pragma once

#include <TNL/Object.h>
#include <TNL/SharedPointer.h>

namespace TNL {
namespace Solvers {
@@ -26,7 +27,12 @@ class Dummy
   void update( const Matrix& matrix ) {}

   template< typename Vector1, typename Vector2 >
   bool solve( const Vector1& b, Vector2& x ) const { return true; }
   bool solve( const Vector1& b, Vector2& x ) const
   {
      Assert( false,
              std::cerr << "The solve() method of a dummy preconditioner should not be called." << std::endl; );
      return true;
   }

   String getType() const
   {
@@ -39,7 +45,8 @@ class SolverStarterSolverPreconditionerSetter
{
   public:
       
      static void run( LinearSolver& solver, Preconditioner& preconditioner )
      static void run( LinearSolver& solver,
                       SharedPointer< Preconditioner, typename LinearSolver::DeviceType >& preconditioner )
      {
         solver.setPreconditioner( preconditioner );
      }
@@ -53,7 +60,8 @@ class SolverStarterSolverPreconditionerSetter< LinearSolver, Dummy< Real, Device
      typedef Device DeviceType;
      typedef Dummy< Real, DeviceType, Index > PreconditionerType;
   
      static void run( LinearSolver& solver, PreconditionerType& preconditioner )
      static void run( LinearSolver& solver,
                       SharedPointer< PreconditionerType, typename LinearSolver::DeviceType >& preconditioner )
      {
         // do nothing
      }
+1 −1
Original line number Diff line number Diff line
@@ -158,7 +158,7 @@ solve( const RealType& time,
   RealType t = time;
   this->linearSystemSolver->setMatrix( this->matrix );
   PreconditionerPointer preconditioner;
   Linear::Preconditioners::SolverStarterSolverPreconditionerSetter< LinearSystemSolverType, PreconditionerPointer >
   Linear::Preconditioners::SolverStarterSolverPreconditionerSetter< LinearSystemSolverType, PreconditionerType >
       ::run( *(this->linearSystemSolver), preconditioner );

   while( t < stopTime )