LAMA
|
00001 00034 #ifndef LAMA_RESIDUALSTAGNATION_HPP_ 00035 #define LAMA_RESIDUALSTAGNATION_HPP_ 00036 00037 // for dll_import 00038 #include <lama/config.hpp> 00039 00040 // base classes 00041 #include <lama/solver/criteria/Criterion.hpp> 00042 00043 // others 00044 #include <lama/LAMATypes.hpp> 00045 00046 #include <lama/norm/Norm.hpp> 00047 00048 namespace lama 00049 { 00050 00051 class IterativeSolver; 00052 00059 class LAMA_DLL_IMPORTEXPORT ResidualStagnation : public Criterion 00060 { 00061 00062 public: 00063 00071 ResidualStagnation( NormPtr norm ); 00072 00082 ResidualStagnation( 00083 NormPtr norm, 00084 IndexType lookback, 00085 Scalar precision ); 00086 00087 ResidualStagnation( const ResidualStagnation &other ); 00088 00089 virtual ~ResidualStagnation(); 00090 00091 virtual Criterion* copy() const; 00092 00107 virtual bool isSatisfied( const IterativeSolver& solver ); 00108 00114 IndexType getLookback() const; 00115 00121 const NormPtr getNorm() const; 00122 00128 const Scalar getPrecision() const; 00129 00134 void setLookback( const IndexType lookback ); 00135 00141 void setPrecision( const Scalar precision ); 00142 00143 virtual void writeAt(std::ostream& stream) const; 00144 private: 00145 00149 const NormPtr mNorm; 00150 00154 IndexType mLookback; 00155 00159 std::vector<Scalar> mLastResidualNorms; 00160 00164 IndexType mNextEntry; 00165 00170 bool mEntriesReady; 00171 00175 Scalar mPrecision; 00176 }; 00177 00178 }// namespace lama 00179 00180 #endif // LAMA_RESIDUALSTAGNATION_HPP_ 00181