16 #include <deal.II/base/logstream.h> 17 #include <deal.II/base/parameter_handler.h> 18 #include <deal.II/base/signaling_nan.h> 19 #include <deal.II/lac/solver_control.h> 24 DEAL_II_NAMESPACE_OPEN
30 const double tolerance,
31 const bool m_log_history,
32 const bool m_log_result)
37 initial_val(
numbers::signaling_nan<double>()),
38 lvalue(
numbers::signaling_nan<double>()),
39 lstep(
numbers::invalid_unsigned_int),
41 relative_failure_residual(0),
43 m_log_history(m_log_history),
45 m_log_result(m_log_result),
46 history_data_enabled(false)
53 const double check_value)
64 deallog <<
"Check " << step <<
"\t" << check_value << std::endl;
75 deallog <<
"Starting value " << check_value << std::endl;
81 if (check_value <=
tol)
84 deallog <<
"Convergence step " << step
85 <<
" value " << check_value << std::endl;
91 std::isnan(check_value) ||
96 deallog <<
"Failure step " << step
97 <<
" value " << check_value << std::endl;
159 ExcMessage(
"The SolverControl object was asked for the solver history " 160 "data, but there is no data. Possibly you requested the data before the " 229 const bool m_log_history,
230 const bool m_log_result)
234 reduced_tol(
numbers::signaling_nan<double>())
241 reduce(
numbers::signaling_nan<double>()),
242 reduced_tol(
numbers::signaling_nan<double>())
260 const double check_value)
278 deallog <<
"Convergence step " << step
279 <<
" value " << check_value << std::endl;
315 const double tolerance,
316 const bool m_log_history,
317 const bool m_log_result)
326 const double check_value)
333 deallog <<
"Convergence step " << step
334 <<
" value " << check_value << std::endl;
349 const double tolerance,
350 const unsigned int n_consecutive_iterations,
351 const bool m_log_history,
352 const bool m_log_result)
355 n_consecutive_iterations(n_consecutive_iterations),
356 n_converged_iterations(0)
359 ExcMessage(
"n_consecutive_iterations should be positive"));
367 n_consecutive_iterations(1),
368 n_converged_iterations(0)
386 const double check_value)
397 ExcMessage(
"steps should be ascending integers."));
422 DEAL_II_NAMESPACE_CLOSE
double initial_value() const
Stop iteration, goal not reached.
long int get_integer(const std::string &entry_string) const
virtual State check(const unsigned int step, const double check_value)
bool history_data_enabled
Subscriptor & operator=(const Subscriptor &)
const std::vector< double > & get_history_data() const
static void declare_parameters(ParameterHandler ¶m)
unsigned int n_consecutive_iterations
double step_reduction(unsigned int step) const
double final_reduction() const
void parse_parameters(ParameterHandler ¶m)
ConsecutiveControl(const unsigned int maxiter=100, const double tolerance=1.e-10, const unsigned int n_consecutive_iterations=2, const bool log_history=false, const bool log_result=false)
#define AssertThrow(cond, exc)
static ::ExceptionBase & ExcIndexRange(int arg1, int arg2, int arg3)
ConsecutiveControl & operator=(const SolverControl &c)
static ::ExceptionBase & ExcMessage(std::string arg1)
double get_double(const std::string &entry_name) const
static void declare_parameters(ParameterHandler ¶m)
unsigned int log_frequency(unsigned int)
Stop iteration, goal reached.
#define Assert(cond, exc)
unsigned int m_log_frequency
double set_reduction(const double)
static ::ExceptionBase & ExcHistoryDataRequired()
virtual State check(const unsigned int step, const double check_value)
bool get_bool(const std::string &entry_name) const
double relative_failure_residual
double last_value() const
double average_reduction() const
unsigned int last_step() const
IterationNumberControl(const unsigned int maxiter=100, const double tolerance=1e-12, const bool log_history=false, const bool log_result=true)
unsigned int n_converged_iterations
void declare_entry(const std::string &entry, const std::string &default_value, const Patterns::PatternBase &pattern=Patterns::Anything(), const std::string &documentation=std::string())
void enable_history_data()
double set_tolerance(const double)
ReductionControl(const unsigned int maxiter=100, const double tolerance=1.e-10, const double reduce=1.e-2, const bool log_history=false, const bool log_result=true)
virtual State check(const unsigned int step, const double check_value)
void parse_parameters(ParameterHandler ¶m)
std::vector< double > history_data
SolverControl(const unsigned int n=100, const double tol=1.e-10, const bool log_history=false, const bool log_result=true)
unsigned int set_max_steps(const unsigned int)
virtual State check(const unsigned int step, const double check_value)
ReductionControl & operator=(const SolverControl &c)
static ::ExceptionBase & ExcInternalError()