Skip to content
Snippets Groups Projects
Commit 459947d0 authored by Carsten Gräser's avatar Carsten Gräser
Browse files

[cleanup] Unify addCriterion methods.

Now theres only a single addCriterion methods passing all
its arguments to the Criterion constructor (by means of
perfect forwarding).
parent 72d4266b
No related branches found
No related tags found
1 merge request!4Feature/flexible loopsolver monitoring
...@@ -47,25 +47,6 @@ public: ...@@ -47,25 +47,6 @@ public:
*/ */
virtual void check() const; virtual void check() const;
/**
* \brief Add a convergence criterion
*
* All criteria are checked after each loop. The solver loop will
* terminate once any of the supplied criteria evaluates to true.
* If you want to terminate only if several criteria are true
* you can combine criteria using the overloaded bitwise
* logical operations.
*
* Besides checking the criterion the LoopSolver will
* print the diagnostic string returned by the criterion
* in a column with the criterions header string on top.
*/
void addCriterion(const Dune::Solvers::Criterion& criterion)
{
monitors_.push_back(Dune::Solvers::Criterion(criterion));
}
/** /**
* \brief Add a convergence criterion * \brief Add a convergence criterion
* *
...@@ -79,14 +60,14 @@ public: ...@@ -79,14 +60,14 @@ public:
* print the diagnostic string returned by the criterion * print the diagnostic string returned by the criterion
* in a column with the criterions header string on top. * in a column with the criterions header string on top.
* *
* This is a convenience method that just forwards all * This method forward all arguments to the constructor of
* arguments to the constructor of Dune::Solvers::Criterion. * Criterion. So you can pass a Criterion or any argument
* Refer to the documentation of the latter for details. * list supported by the Criterion constructors.
*/ */
template<class... Args> template<class... Args>
void addCriterion(const Args&... args) void addCriterion(Args&&... args)
{ {
monitors_.push_back(Dune::Solvers::Criterion(args...)); monitors_.emplace_back(std::forward<Args>(args)...);
} }
/** /**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment