From e74dab2b7187d4ba079f04fdf74192610e256fd4 Mon Sep 17 00:00:00 2001 From: Elias Pipping <elias.pipping@fu-berlin.de> Date: Fri, 9 Sep 2011 14:53:38 +0200 Subject: [PATCH] Use Small(Vector|Matrix) for (Vector|Matrix)Type --- src/bisection-example-new.cc | 5 +---- src/mynonlinearity.cc | 22 +++++++++++----------- 2 files changed, 12 insertions(+), 15 deletions(-) diff --git a/src/bisection-example-new.cc b/src/bisection-example-new.cc index f5bc2f02..f075e31a 100644 --- a/src/bisection-example-new.cc +++ b/src/bisection-example-new.cc @@ -71,14 +71,11 @@ class SampleFunctional { A_.mv(x, tmp3); double const rest_b = (b_ - tmp3) * descDir; - Dune::BlockVector<SmallVector> xx; // FIXME: we actually want x here - Dune::BlockVector<SmallVector> dd; // FIXME: we actually want descDir here - typedef MyNonlinearity<dimension, SampleFunction> MyNonlinearityType; MyNonlinearityType phi; typedef DirectionalConvexFunction<MyNonlinearityType> MyDirectionalConvexFunctionType; - MyDirectionalConvexFunctionType rest(rest_A, rest_b, phi, xx, dd); + MyDirectionalConvexFunctionType rest(rest_A, rest_b, phi, x, descDir); // Experiment a bit Interval<double> D; diff --git a/src/mynonlinearity.cc b/src/mynonlinearity.cc index db756cbb..4efdd603 100644 --- a/src/mynonlinearity.cc +++ b/src/mynonlinearity.cc @@ -21,19 +21,19 @@ class MyNonlinearity { typedef Dune::FieldVector<double, dimension> SmallVector; typedef Dune::FieldMatrix<double, dimension, dimension> SmallMatrix; - typedef Dune::BlockVector<SmallVector> VectorType; - typedef Dune::BlockVector<SmallMatrix> MatrixType; + typedef SmallVector VectorType; + typedef SmallMatrix MatrixType; void directionalSubDiff(VectorType u, VectorType v, Interval<double>& D) { - // if (u == SmallVector(0.0)) { - // D[0] = D[1] = func_.rightDifferential(0); - // } else if (u * v > 0) { - // D[1] = (v * u) * func_.rightDifferential(u.two_norm())/u.two_norm(); - // D[0] = (v * u) * func_.leftDifferential(u.two_norm())/u.two_norm(); - // } else { - // D[1] = (v * u) * func_.leftDifferential(u.two_norm())/u.two_norm(); - // D[0] = (v * u) * func_.rightDifferential(u.two_norm())/u.two_norm(); - // } + if (u == SmallVector(0.0)) { + D[0] = D[1] = func_.rightDifferential(0); + } else if (u * v > 0) { + D[1] = (v * u) * func_.rightDifferential(u.two_norm()) / u.two_norm(); + D[0] = (v * u) * func_.leftDifferential(u.two_norm()) / u.two_norm(); + } else { + D[1] = (v * u) * func_.leftDifferential(u.two_norm()) / u.two_norm(); + D[0] = (v * u) * func_.rightDifferential(u.two_norm()) / u.two_norm(); + } } void directionalDomain(const VectorType&, const VectorType&, -- GitLab