00001
00002
00003
00004
00005
00006
00007
00008 #ifndef SRC_AMG_MKB_LAD_PETSC_RESIDUALBASEDERROREVALUATOR_HPP_
00009 #define SRC_AMG_MKB_LAD_PETSC_RESIDUALBASEDERROREVALUATOR_HPP_
00010
00011 #include <petscmat.h>
00012 #include <petscvec.h>
00013 #include "ErrorEvaluator.hpp"
00014
00015 class ResidualBasedErrorEvaluator : public ErrorEvaluator{
00016 public:
00017 ResidualBasedErrorEvaluator(Mat mat, Vec rhs, double difference_threshold, double exact_solution_threshold, int size, int max_iterations);
00018 virtual ~ResidualBasedErrorEvaluator();
00019 virtual bool Stop(Vec x, int iteration_nr);
00020 private:
00021 Vec residual;
00022 Mat mat;
00023 Vec rhs;
00024 double difference_threshold;
00025 double previous_residual;
00026 double exact_solution_threshold;
00027 bool first_iteration;
00028 int max_iterations;
00029 };
00030
00031 #endif