Commit f7db8a2c authored by Tomáš Oberhuber's avatar Tomáš Oberhuber
Browse files

Adding SOR solver with the new template interface.

parent a6931b0f
Loading
Loading
Loading
Loading
+7 −2
Original line number Diff line number Diff line
INCLUDE_DIRECTORIES( krylov )

ADD_SUBDIRECTORY( implementation )
ADD_SUBDIRECTORY( krylov )
ADD_SUBDIRECTORY( stationary )

SET( headers tnlLinearResidueGetter.h
   )
   
INSTALL( FILES ${headers} DESTINATION include/tnl-${tnlVersion}/solvers/linear )
 No newline at end of file
+4 −0
Original line number Diff line number Diff line
SET( headers tnlLinearResidueGetter_impl.h
   )
   
INSTALL( FILES ${headers} DESTINATION include/tnl-${tnlVersion}/solvers/linear/implementation )
+40 −0
Original line number Diff line number Diff line
/***************************************************************************
                          tnlLinearResidueGetter_impl.h  -  description
                             -------------------
    begin                : Nov 25, 2012
    copyright            : (C) 2012 by Tomas Oberhuber
    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.                                   *
 *                                                                         *
 ***************************************************************************/

#ifndef TNLLINEARRESIDUEGETTER_IMPL_H_
#define TNLLINEARRESIDUEGETTER_IMPL_H_

template< typename Matrix, typename Vector >
typename tnlLinearResidueGetter :: RealType
   tnlResidueGetter< Matrix, Vector > :: getResidue( const Matrix& matrix,
                                                     const Vector& x,
                                                     const Vector& b,
                                                     RealType bNorm )
{
   const IndexType size = matrix. getSize();
   RealType res( 0.0 );
   if( bNorm == 0.0 )
      bNorm = b. lpNorm( 2.0 );
   for( IndexType i = 0; i < size; i ++ )
   {
      RealType err = fabs( matrix. rowProduct( i, x ) - b[ i ] );
      res += err * err;
   }
   return sqrt( res ) / b_norm;
}

#endif /* TNLLINEARRESIDUEGETTER_IMPL_H_ */
+3 −1
Original line number Diff line number Diff line
ADD_SUBDIRECTORY( implementation )

SET( headers tnlGMRESSolver.h
   )
   
INSTALL( FILES ${headers} DESTINATION include/tnl-${tnlVersion}/solver )
INSTALL( FILES ${headers} DESTINATION include/tnl-${tnlVersion}/solvers/linear/krylov )
+4 −0
Original line number Diff line number Diff line
SET( headers tnlGMRESSolver_impl.h
   )
   
INSTALL( FILES ${headers} DESTINATION include/tnl-${tnlVersion}/solvers/linear/krylov/implementation )
Loading