Skip to content
Snippets Groups Projects
Commit 1a1fb9ae authored by Elias Pipping's avatar Elias Pipping Committed by Elias Pipping
Browse files

Ignore the nonlinearity in CircularConvexFunctions

parent 65f4e7bd
No related branches found
No related tags found
No related merge requests found
......@@ -5,17 +5,12 @@
#include <dune/fufem/interval.hh>
namespace Dune {
template <class NonlinearityType> class CircularConvexFunction {
typedef typename NonlinearityType::VectorType VectorType;
typedef typename NonlinearityType::MatrixType MatrixType;
template <class MatrixType, class VectorType> class CircularConvexFunction {
public:
CircularConvexFunction(MatrixType const &A, VectorType const &b,
NonlinearityType const &phi, VectorType const &x,
VectorType const &dir)
VectorType const &x, VectorType const &dir)
: A(A),
b(b),
phi(phi),
x(x),
dir(dir),
xnorm(x.two_norm()),
......@@ -31,14 +26,11 @@ template <class NonlinearityType> class CircularConvexFunction {
VectorType t;
tangent(m, t);
phi.directionalSubDiff(x, t, D);
VectorType tmp;
A.mv(x, tmp); // Ax
tmp -= b; // Ax - b
double const dotp = tmp * t; // <Ax - b,t>
D[0] += dotp;
D[1] += dotp;
D[0] = D[1] = dotp;
}
void domain(Interval<double> &domain) const {
......@@ -55,7 +47,6 @@ template <class NonlinearityType> class CircularConvexFunction {
private:
MatrixType const &A;
VectorType const &b;
NonlinearityType const &phi;
VectorType const &x;
VectorType const &dir;
......
......@@ -196,11 +196,13 @@ void tangentialMinimisation(Functional const &J,
typename Functional::SmallVector &x,
typename Functional::SmallVector const &descDir,
Bisection const &bisection) {
typedef typename Functional::NonlinearityType LocalNonlinearityType;
typedef typename Functional::SmallMatrix SmallMatrix;
typedef typename Functional::SmallVector SmallVector;
CircularConvexFunction<LocalNonlinearityType> const JRest(J.A, J.b, *J.phi, x,
descDir);
// We completely ignore the nonlinearity here -- when restricted
// to a circle, it just enters as a constant!
CircularConvexFunction<SmallMatrix, SmallVector> const JRest(J.A, J.b, x,
descDir);
int count;
double const stepsize = bisection.minimize(JRest, 0.0, 1.0, count);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment