Go to the documentation of this file.
3 #ifndef DUNE_PDELAB_SOLVER_NEWTONTERMINATE_HH
4 #define DUNE_PDELAB_SOLVER_NEWTONTERMINATE_HH
20 template <
typename Newton>
24 using Real =
typename Newton::Real;
30 if (_force_iteration && _newton.result().iterations == 0)
32 auto converged = _newton.result().defect < _newton.getAbsoluteLimit() || _newton.result().defect < _newton.result().first_defect * _newton.getReduction();
33 if (_newton.result().iterations >= _maxIterations && not _newton.result().converged)
34 DUNE_THROW(NewtonNotConverged,
35 "NewtonTerminate::terminate(): Maximum iteration count reached");
41 _maxIterations = parameterTree.get<
unsigned int>(
"max_iterations", _maxIterations);
42 _force_iteration = parameterTree.get<
bool>(
"force_iteration", _force_iteration);
47 unsigned int _maxIterations = 40;
48 bool _force_iteration =
false;
Definition: adaptivity.hh:29
virtual void setParameters(const ParameterTree ¶meterTree) override
Definition: newtonterminate.hh:39
virtual bool terminate() override
Definition: newtonterminate.hh:28
typename Newton::Real Real
Definition: newtonterminate.hh:24
virtual void setParameters(const ParameterTree &)=0
virtual ~TerminateInterface()
Every abstract base class should have a virtual destructor.
Definition: newtonterminate.hh:12
Definition: newtonterminate.hh:8
virtual bool terminate()=0
Definition: newtonterminate.hh:21
DefaultTerminate(Newton &newton)
Definition: newtonterminate.hh:26