5 namespace NewtonRaphson
11 template <
typename... TAny>
18 template <
typename TInfo>
26 , mMaxNumLineSearchStep(maxNumLineSearchSteps)
38 template <
typename TProblem,
typename TX>
39 bool operator()(TProblem&& problem, TX* r, TX* x, TX dx)
const 42 int lineSearchStep = 0;
44 const auto previousNorm = problem.Norm(problem.Residual(*x));
45 while (lineSearchStep < mMaxNumLineSearchStep)
48 *r = problem.Residual(*x);
49 const auto trialNorm = problem.Norm(*r);
51 mInfo(lineSearchStep, alpha, trialNorm);
53 if (trialNorm < problem.mTolerance)
59 if (trialNorm < (1. - alpha) * previousNorm)
67 int mMaxNumLineSearchStep;
71 template <
typename TInfo = Vo
idInfo>
82 template <
typename TProblem,
typename TX>
83 bool operator()(TProblem&& problem, TX* r, TX* x, TX dx)
const 86 *r = problem.Residual(*x);
87 return problem.Norm(*r) < problem.mTolerance;
Performs the line search algorithm based on the results of a single newton iteration step...
Definition: LineSearch.h:19
constexpr LineSearchImplementation(TInfo info, int maxNumLineSearchSteps)
ctor
Definition: LineSearch.h:24
just a normal continuation of the newton scheme without using line search while keeping the interface...
Definition: LineSearch.h:79
takes any argument and does nothing...
Definition: LineSearch.h:9
float alpha
Definition: DamageBar.py:18
LineSearchImplementation< TInfo > LineSearch(TInfo info=VoidInfo(), int mMaxNumLineSearchStep=6)
convienient instantiation of the NuTo::LineSearchImplementation with template deduction ...
Definition: LineSearch.h:72
Definition: Exception.h:6
bool operator()(TProblem &&problem, TX *r, TX *x, TX dx) const
actual line search implementation
Definition: LineSearch.h:39
void operator()(TAny &&...) const
Definition: LineSearch.h:12
bool operator()(TProblem &&problem, TX *r, TX *x, TX dx) const
Definition: LineSearch.h:83