From a9ddaac7d7e55891493837feef949ce9ecfb9a25 Mon Sep 17 00:00:00 2001
From: Elias Pipping <elias.pipping@fu-berlin.de>
Date: Sun, 14 Jul 2013 21:18:28 +0200
Subject: [PATCH] [Cleanup] Use subtractProduct()

---
 dune/tectonic/myblockproblem.hh   | 2 +-
 src/timestepping/eulerpair.cc     | 2 +-
 src/timestepping/impliciteuler.cc | 2 +-
 src/timestepping/newmark.cc       | 8 ++++----
 4 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/dune/tectonic/myblockproblem.hh b/dune/tectonic/myblockproblem.hh
index a6aceca4..d9b01fb0 100644
--- a/dune/tectonic/myblockproblem.hh
+++ b/dune/tectonic/myblockproblem.hh
@@ -271,7 +271,7 @@ class MyBlockProblem<MyConvexProblemTypeTEMPLATE>::IterateObject {
         if (j == m)
           localA = &(*it); // localA = A[m][m]
         else
-          Arithmetic::addProduct(localb, -1.0, *it, u[j]);
+          Arithmetic::subtractProduct(localb, *it, u[j]);
       }
       assert(localA != nullptr);
 
diff --git a/src/timestepping/eulerpair.cc b/src/timestepping/eulerpair.cc
index 85cee621..480f8605 100644
--- a/src/timestepping/eulerpair.cc
+++ b/src/timestepping/eulerpair.cc
@@ -28,7 +28,7 @@ void EulerPair<VectorType, MatrixType, FunctionType, dim>::setup(
 
   problem_rhs = ell;
   Arithmetic::addProduct(problem_rhs, 1.0 / tau, B, v_old);
-  Arithmetic::addProduct(problem_rhs, -1.0, A, u_old);
+  Arithmetic::subtractProduct(problem_rhs, A, u_old);
 
   // For fixed tau, we'd only really have to do this once
   Dune::MatrixIndexSet indices(A.N(), A.M());
diff --git a/src/timestepping/impliciteuler.cc b/src/timestepping/impliciteuler.cc
index f2dd8be8..753689da 100644
--- a/src/timestepping/impliciteuler.cc
+++ b/src/timestepping/impliciteuler.cc
@@ -25,7 +25,7 @@ void ImplicitEuler<VectorType, MatrixType, FunctionType, dim>::setup(
   tau = _tau;
 
   problem_rhs = ell;
-  Arithmetic::addProduct(problem_rhs, -1.0, A, u_old);
+  Arithmetic::subtractProduct(problem_rhs, A, u_old);
 
   // For fixed tau, we'd only really have to do this once
   problem_AB = A;
diff --git a/src/timestepping/newmark.cc b/src/timestepping/newmark.cc
index a479b08f..30ad548a 100644
--- a/src/timestepping/newmark.cc
+++ b/src/timestepping/newmark.cc
@@ -30,8 +30,8 @@ void Newmark<VectorType, MatrixType, FunctionType, dim>::setup(
   problem_rhs = ell;
   Arithmetic::addProduct(problem_rhs, 2.0 / tau, B, v_old);
   Arithmetic::addProduct(problem_rhs, B, a_old);
-  Arithmetic::addProduct(problem_rhs, -1.0, A, u_old);
-  Arithmetic::addProduct(problem_rhs, -tau / 2.0, A, v_old);
+  Arithmetic::subtractProduct(problem_rhs, A, u_old);
+  Arithmetic::subtractProduct(problem_rhs, tau / 2.0, A, v_old);
 
   // For fixed tau, we'd only really have to do this once
   Dune::MatrixIndexSet indices(A.N(), A.M());
@@ -81,8 +81,8 @@ void Newmark<VectorType, MatrixType, FunctionType, dim>::postProcess(
 
   a = 0;
   Arithmetic::addProduct(a, 2.0 / tau, v);
-  Arithmetic::addProduct(a, -2.0 / tau, v_old);
-  Arithmetic::addProduct(a, -1.0, a_old);
+  Arithmetic::subtractProduct(a, 2.0 / tau, v_old);
+  Arithmetic::subtractProduct(a, 1.0, a_old);
 }
 
 template <class VectorType, class MatrixType, class FunctionType, int dim>
-- 
GitLab