From 4a3d5ce8f8d72386f98f075a9bdaf2de6d8557af Mon Sep 17 00:00:00 2001 From: Elias Pipping <elias.pipping@fu-berlin.de> Date: Wed, 4 Jan 2012 16:38:17 +0100 Subject: [PATCH] Add another assertion --- dune/tectonic/myblockproblem.hh | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/dune/tectonic/myblockproblem.hh b/dune/tectonic/myblockproblem.hh index 2d702879..de1d5130 100644 --- a/dune/tectonic/myblockproblem.hh +++ b/dune/tectonic/myblockproblem.hh @@ -187,6 +187,25 @@ template <class MyConvexProblemTypeTEMPLATE> class MyBlockProblem { // -grad is needed for Newton step linearization.b *= -1.0; + // b should be a descent direction + { + VectorType const direction = linearization.b; + VectorType tmp = linearization.b; // b + linearization.A.mmv(u, tmp); // b-Au + double const localA = tmp * direction; // <b-Au,v> + + linearization.A.mv(direction, tmp); // Av + double const localb = tmp * direction; // <Av,v> + + MyDirectionalConvexFunction<Dune::GlobalNonlinearity<block_size>> const + psi(localA, localb, problem.phi, u, direction); + + Interval<double> D; + psi.subDiff(0, D); + if (!isnan(D[1])) + assert(D[1] <= 0); + } + // apply truncation to system for (size_t row = 0; row < linearization.A.N(); ++row) { auto const end = linearization.A[row].end(); -- GitLab