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

directionalSubDiff works on BlockVectors!

parent 109bc227
No related branches found
No related tags found
No related merge requests found
...@@ -62,22 +62,28 @@ class SampleFunctional { ...@@ -62,22 +62,28 @@ class SampleFunctional {
since A is symmetric. since A is symmetric.
*/ */
SmallVector tmp2; {
A_.mv(descDir, tmp2); SmallVector tmp2;
double const rest_A = tmp2 * descDir; A_.mv(descDir, tmp2);
double const rest_A = tmp2 * descDir;
SmallVector tmp3;
A_.mv(x, tmp3); SmallVector tmp3;
double const rest_b = (b_ - tmp3) * descDir; 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 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 MyNonlinearity<dimension, SampleFunction> MyNonlinearityType;
typedef DirectionalConvexFunction<MyNonlinearityType> MyNonlinearityType phi;
MyDirectionalConvexFunctionType; typedef DirectionalConvexFunction<MyNonlinearityType>
MyDirectionalConvexFunctionType rest(rest_A, rest_b, phi, xx, dd); MyDirectionalConvexFunctionType;
MyDirectionalConvexFunctionType rest(rest_A, rest_b, phi, xx, dd);
// Experiment a bit
Interval<double> D;
rest.subDiff(0, D);
}
if (descDir == SmallVector(0.0)) if (descDir == SmallVector(0.0))
return SmallVector(0.0); return SmallVector(0.0);
......
...@@ -24,16 +24,16 @@ class MyNonlinearity { ...@@ -24,16 +24,16 @@ class MyNonlinearity {
typedef Dune::BlockVector<SmallVector> VectorType; typedef Dune::BlockVector<SmallVector> VectorType;
typedef Dune::BlockVector<SmallMatrix> MatrixType; typedef Dune::BlockVector<SmallMatrix> MatrixType;
void directionalSubDiff(SmallVector u, SmallVector v, Interval<double>& D) { void directionalSubDiff(VectorType u, VectorType v, Interval<double>& D) {
if (u == SmallVector(0.0)) { // if (u == SmallVector(0.0)) {
D[0] = D[1] = func_.rightDifferential(0); // D[0] = D[1] = func_.rightDifferential(0);
} else if (u * v > 0) { // } else if (u * v > 0) {
D[1] = (v * u) * func_.rightDifferential(u.two_norm()) / u.two_norm(); // D[1] = (v * u) * func_.rightDifferential(u.two_norm())/u.two_norm();
D[0] = (v * u) * func_.leftDifferential(u.two_norm()) / u.two_norm(); // D[0] = (v * u) * func_.leftDifferential(u.two_norm())/u.two_norm();
} else { // } else {
D[1] = (v * u) * func_.leftDifferential(u.two_norm()) / u.two_norm(); // D[1] = (v * u) * func_.leftDifferential(u.two_norm())/u.two_norm();
D[0] = (v * u) * func_.rightDifferential(u.two_norm()) / u.two_norm(); // D[0] = (v * u) * func_.rightDifferential(u.two_norm())/u.two_norm();
} // }
} }
void directionalDomain(const VectorType&, const VectorType&, void directionalDomain(const VectorType&, const VectorType&,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment