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

Passing of preconditioners via SharedPointer

parent ab534045
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -40,7 +40,7 @@ class BICGStab : public Object,
   typedef Matrix MatrixType;
   typedef Preconditioner PreconditionerType;
   typedef SharedPointer< const MatrixType, DeviceType, true > MatrixPointer;

   typedef SharedPointer< const PreconditionerType, DeviceType, true > PreconditionerPointer;

   BICGStab();

@@ -54,7 +54,7 @@ class BICGStab : public Object,

   void setMatrix( MatrixPointer matrix );

   void setPreconditioner( const PreconditionerType& preconditioner );
   void setPreconditioner( PreconditionerPointer preconditioner );

   template< typename Vector,
             typename ResidueGetter = LinearResidueGetter< Matrix, Vector >  >
@@ -69,7 +69,7 @@ class BICGStab : public Object,
   Containers::Vector< RealType, DeviceType, IndexType >  r, r_ast, r_new, p, s, Ap, As, M_tmp;

   MatrixPointer matrix;
   const PreconditionerType* preconditioner;
   PreconditionerPointer preconditioner;
};

} // namespace Linear
+3 −4
Original line number Diff line number Diff line
@@ -25,7 +25,6 @@ RealType computeBICGStabNewP( Vector& p,
template< typename Matrix,
          typename Preconditioner >
BICGStab< Matrix, Preconditioner > :: BICGStab()
: preconditioner( 0 )
{
}

@@ -67,9 +66,9 @@ void BICGStab< Matrix, Preconditioner >::setMatrix( MatrixPointer matrix )

template< typename Matrix,
          typename Preconditioner >
void BICGStab< Matrix, Preconditioner > :: setPreconditioner( const PreconditionerType& preconditioner )
void BICGStab< Matrix, Preconditioner > :: setPreconditioner( PreconditionerPointer preconditioner )
{
   this->preconditioner = &preconditioner;
   this->preconditioner = preconditioner;
}

template< typename Matrix,
+2 −2
Original line number Diff line number Diff line
@@ -54,7 +54,7 @@ class CG : public Object,

   void setMatrix( MatrixPointer matrix );

   void setPreconditioner( const PreconditionerType& preconditioner );
   void setPreconditioner( PreconditionerPointer preconditioner );

   template< typename Vector,
             typename ResidueGetter = LinearResidueGetter< Matrix, Vector >  >
@@ -69,7 +69,7 @@ class CG : public Object,
   Containers::Vector< RealType, DeviceType, IndexType >  r, new_r, p, Ap;

   MatrixPointer matrix;
   const PreconditionerType* preconditioner;
   PreconditionerPointer preconditioner;
};

} // namespace Linear
+2 −3
Original line number Diff line number Diff line
@@ -17,7 +17,6 @@ namespace Linear {
template< typename Matrix,
          typename Preconditioner >
CG< Matrix, Preconditioner > :: CG()
: preconditioner( 0 )
{
}

@@ -59,9 +58,9 @@ void CG< Matrix, Preconditioner >::setMatrix( MatrixPointer matrix )

template< typename Matrix,
          typename Preconditioner >
void CG< Matrix, Preconditioner > :: setPreconditioner( const Preconditioner& preconditioner )
void CG< Matrix, Preconditioner > :: setPreconditioner( PreconditionerPointer preconditioner )
{
   this->preconditioner = &preconditioner;
   this->preconditioner = preconditioner;
}

template< typename Matrix,
+3 −2
Original line number Diff line number Diff line
@@ -39,6 +39,7 @@ class GMRES : public Object,
   typedef Matrix MatrixType;
   typedef Preconditioner PreconditionerType;
   typedef SharedPointer< const MatrixType, DeviceType, true > MatrixPointer;
   typedef SharedPointer< const PreconditionerType, DeviceType, true > PreconditionerPointer;

   GMRES();

@@ -54,7 +55,7 @@ class GMRES : public Object,

   void setMatrix( MatrixPointer matrix );

   void setPreconditioner( const PreconditionerType& preconditioner );
   void setPreconditioner( PreconditionerPointer preconditioner );

   template< typename Vector,
             typename ResidueGetter = LinearResidueGetter< Matrix, Vector >  >
@@ -91,7 +92,7 @@ class GMRES : public Object,
   IndexType size, restarting;

   MatrixPointer matrix;
   const PreconditionerType* preconditioner;
   PreconditionerPointer preconditioner;
};

} // namespace Linear
Loading