Commit 0317e237 authored by Lasse Hinrichsen's avatar Lasse Hinrichsen
Browse files

Bisection localsolver PoC

parent d29ed54f
Pipeline #34613 failed with stage
in 6 minutes and 13 seconds
// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
// // vi: set et ts=4 sw=2 sts=2:
#ifndef DUNE_TNNMG_LOCALSOLVERS_SCALARBISECTIONSOLVER_HH
#define DUNE_TNNMG_LOCALSOLVERS_SCALARBISECTIONSOLVER_HH
#include <dune/tnnmg/localsolvers/functionproperties.hh>
#include <dune/tnnmg/problem-classes/bisection.hh>
/*
TODO: This is just some proof of concept to integrate the bisection solver in
the new TNNMG interface. It's not pretty, yet.
*/
namespace Dune {
namespace TNNMG {
/**
* \brief A local solver for scalar quadratic obstacle problems
*
* \todo Add concept check for the function interface
*/
class ScalarBisectionSolver
{
public:
ScalarBisectionSolver(double start, double acceptFactor)
: start_(start)
, acceptFactor_(acceptFactor)
{}
template<class Vector, class Functional, class BitVector>
void operator()(Vector& x, const Functional& f, const BitVector& ignore) const
{
if (not ignore) {
int count = 0;
Bisection bisection(0.0, acceptFactor_);
x = bisection.minimize(f, start_, 0, count);
}
}
private:
// TODO: These starting values are completely arbitrary.
double start_ = 0.;
double acceptFactor_ = 0.9;
};
} // end namespace TNNMG
} // end namespace Dune
#endif // DUNE_TNNMG_LOCALSOLVERS_SCALARBISECTIONSOLVER_HH
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment