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

Refactoring preconditioners - the solve method can return just void

parent bc9a2b30
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -59,7 +59,7 @@ public:

   virtual void update( const MatrixPointer& matrixPointer ) override;

   virtual bool solve( ConstVectorViewType b, VectorViewType x ) const override;
   virtual void solve( ConstVectorViewType b, VectorViewType x ) const override;

protected:
   Matrices::CSR< RealType, DeviceType, IndexType > L;
@@ -87,7 +87,7 @@ public:

   virtual void update( const MatrixPointer& matrixPointer ) override;

   virtual bool solve( ConstVectorViewType b, VectorViewType x ) const override;
   virtual void solve( ConstVectorViewType b, VectorViewType x ) const override;

   ~ILU0_impl()
   {
@@ -188,7 +188,7 @@ public:
      throw std::runtime_error("Not Iplemented yet for MIC");
   }

   virtual bool solve( ConstVectorViewType b, VectorViewType x ) const override
   virtual void solve( ConstVectorViewType b, VectorViewType x ) const override
   {
      throw std::runtime_error("Not Iplemented yet for MIC");
   }
+2 −6
Original line number Diff line number Diff line
@@ -103,7 +103,7 @@ update( const MatrixPointer& matrixPointer )
}

template< typename Matrix, typename Real, typename Index >
bool
void
ILU0_impl< Matrix, Real, Devices::Host, Index >::
solve( ConstVectorViewType b, VectorViewType x ) const
{
@@ -147,8 +147,6 @@ solve( ConstVectorViewType b, VectorViewType x ) const

      x[ i ] /= U_ii;
   }

   return true;
}


@@ -262,7 +260,7 @@ update( const MatrixPointer& matrixPointer )
}

template< typename Matrix >
bool
void
ILU0_impl< Matrix, double, Devices::Cuda, int >::
solve( ConstVectorViewType b, VectorViewType x ) const
{
@@ -290,8 +288,6 @@ solve( ConstVectorViewType b, VectorViewType x ) const
                          y.getData(),
                          x.getData(),
                          policy_U, (void*) pBuffer.getData() );

   return true;
#else
   throw std::runtime_error("The program was not compiled with the CUSPARSE library. Pass -DHAVE_CUSPARSE -lcusparse to the compiler.");
#endif
+3 −3
Original line number Diff line number Diff line
@@ -64,7 +64,7 @@ public:

   virtual void update( const MatrixPointer& matrixPointer ) override;

   virtual bool solve( ConstVectorViewType b, VectorViewType x ) const override;
   virtual void solve( ConstVectorViewType b, VectorViewType x ) const override;

protected:
   Index p = 0;
@@ -92,7 +92,7 @@ public:
      throw std::runtime_error("Not Iplemented yet for CUDA");
   }

   virtual bool solve( ConstVectorViewType b, VectorViewType x ) const override
   virtual void solve( ConstVectorViewType b, VectorViewType x ) const override
   {
      throw std::runtime_error("Not Iplemented yet for CUDA");
   }
@@ -115,7 +115,7 @@ public:
      throw std::runtime_error("Not Iplemented yet for MIC");
   }

   virtual bool solve( ConstVectorViewType b, VectorViewType x ) const override
   virtual void solve( ConstVectorViewType b, VectorViewType x ) const override
   {
      throw std::runtime_error("Not Iplemented yet for MIC");
   }
+1 −3
Original line number Diff line number Diff line
@@ -241,7 +241,7 @@ update( const MatrixPointer& matrixPointer )
}

template< typename Matrix, typename Real, typename Index >
bool
void
ILUT_impl< Matrix, Real, Devices::Host, Index >::
solve( ConstVectorViewType b, VectorViewType x ) const
{
@@ -289,8 +289,6 @@ solve( ConstVectorViewType b, VectorViewType x ) const

      x[ i ] /= U_ii;
   }

   return true;
}

} // namespace Preconditioners
+1 −2
Original line number Diff line number Diff line
@@ -46,10 +46,9 @@ public:
   virtual void update( const MatrixPointer& matrixPointer )
   {}

   virtual bool solve( ConstVectorViewType b, VectorViewType x ) const
   virtual void solve( ConstVectorViewType b, VectorViewType x ) const
   {
      TNL_ASSERT_TRUE( false, "The solve() method of a dummy preconditioner should not be called." );
      return true;
   }

   String getType() const