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

Use addProduct(A, <scalar> B, C, D)

parent 6b4670d6
No related branches found
No related tags found
No related merge requests found
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
#include <dune/common/stdstreams.hh> #include <dune/common/stdstreams.hh>
#include <dune/fufem/interval.hh> #include <dune/fufem/interval.hh>
#include <dune/fufem/arithmetic.hh>
#include "localnonlinearity.hh" #include "localnonlinearity.hh"
...@@ -25,7 +26,7 @@ template <int dim> class EllipticEnergy { ...@@ -25,7 +26,7 @@ template <int dim> class EllipticEnergy {
double operator()(SmallVector const &v) const { double operator()(SmallVector const &v) const {
SmallVector y(0); SmallVector y(0);
A.usmv(0.5, v, y); // 1/2 Av Arithmetic::addProduct(y, 0.5, A, v);
y -= b; // 1/2 Av - b y -= b; // 1/2 Av - b
return y * v + (*phi)(v); // <1/2 Av - b,v> + H(|v|) return y * v + (*phi)(v); // <1/2 Av - b,v> + H(|v|)
} }
......
...@@ -129,10 +129,10 @@ void Newmark<VectorType, MatrixType, FunctionType, dim>::setup( ...@@ -129,10 +129,10 @@ void Newmark<VectorType, MatrixType, FunctionType, dim>::setup(
tau = _tau; tau = _tau;
problem_rhs = ell; problem_rhs = ell;
B.usmv(2.0 / tau, ud_old, problem_rhs); Arithmetic::addProduct(problem_rhs, 2.0 / tau, B, ud_old);
B.usmv(1.0, udd_old, problem_rhs); Arithmetic::addProduct(problem_rhs, B, udd_old);
A.usmv(-1.0, u_old, problem_rhs); Arithmetic::addProduct(problem_rhs, -1.0, A, u_old);
A.usmv(-tau / 2.0, ud_old, problem_rhs); Arithmetic::addProduct(problem_rhs, -tau / 2.0, A, ud_old);
// For fixed tau, we'd only really have to do this once // For fixed tau, we'd only really have to do this once
Dune::MatrixIndexSet indices(A.N(), A.M()); Dune::MatrixIndexSet indices(A.N(), A.M());
...@@ -237,8 +237,8 @@ void EulerPair<VectorType, MatrixType, FunctionType, dim>::setup( ...@@ -237,8 +237,8 @@ void EulerPair<VectorType, MatrixType, FunctionType, dim>::setup(
tau = _tau; tau = _tau;
problem_rhs = ell; problem_rhs = ell;
B.usmv(1.0 / tau, ud_old, problem_rhs); Arithmetic::addProduct(problem_rhs, 1.0 / tau, B, ud_old);
A.usmv(-1.0, u_old, problem_rhs); Arithmetic::addProduct(problem_rhs, -1.0, A, u_old);
// For fixed tau, we'd only really have to do this once // For fixed tau, we'd only really have to do this once
Dune::MatrixIndexSet indices(A.N(), A.M()); Dune::MatrixIndexSet indices(A.N(), A.M());
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment