From f411ed4b67376c3e9b4631bfa7593320003d85b7 Mon Sep 17 00:00:00 2001
From: Elias Pipping <elias.pipping@fu-berlin.de>
Date: Sat, 14 Dec 2013 15:32:17 +0100
Subject: [PATCH] [Extend]  Implement extractOldVelocity()

---
 src/timestepping.hh                | 1 +
 src/timestepping/backward_euler.cc | 6 ++++++
 src/timestepping/backward_euler.hh | 1 +
 src/timestepping/newmark.cc        | 6 ++++++
 src/timestepping/newmark.hh        | 1 +
 5 files changed, 15 insertions(+)

diff --git a/src/timestepping.hh b/src/timestepping.hh
index fe88bcc0..f2ee1f83 100644
--- a/src/timestepping.hh
+++ b/src/timestepping.hh
@@ -14,6 +14,7 @@ class TimeSteppingScheme {
   void virtual postProcess(Vector const &iterate) = 0;
   void virtual extractDisplacement(Vector &displacement) const = 0;
   void virtual extractVelocity(Vector &velocity) const = 0;
+  void virtual extractOldVelocity(Vector &velocity) const = 0;
 };
 
 #include "timestepping/newmark.hh"
diff --git a/src/timestepping/backward_euler.cc b/src/timestepping/backward_euler.cc
index 981483c5..6e14784a 100644
--- a/src/timestepping/backward_euler.cc
+++ b/src/timestepping/backward_euler.cc
@@ -108,3 +108,9 @@ void BackwardEuler<Vector, Matrix, Function, dim>::extractVelocity(
 
   velocity = v;
 }
+
+template <class Vector, class MatrixType, class FunctionType, size_t dim>
+void BackwardEuler<Vector, MatrixType, FunctionType, dim>::extractOldVelocity(
+    Vector &velocity) const {
+  velocity = v_o;
+}
diff --git a/src/timestepping/backward_euler.hh b/src/timestepping/backward_euler.hh
index aa80baa6..c598c8ff 100644
--- a/src/timestepping/backward_euler.hh
+++ b/src/timestepping/backward_euler.hh
@@ -15,6 +15,7 @@ class BackwardEuler : public TimeSteppingScheme<Vector, Matrix, Function, dim> {
   void postProcess(Vector const &) override;
   void extractDisplacement(Vector &) const override;
   void extractVelocity(Vector &) const override;
+  void extractOldVelocity(Vector &) const override;
 
 private:
   Matrix const &A;
diff --git a/src/timestepping/newmark.cc b/src/timestepping/newmark.cc
index 91dfa0e0..b6f90e31 100644
--- a/src/timestepping/newmark.cc
+++ b/src/timestepping/newmark.cc
@@ -123,3 +123,9 @@ void Newmark<Vector, Matrix, Function, dim>::extractVelocity(Vector &velocity)
 
   velocity = v;
 }
+
+template <class Vector, class MatrixType, class FunctionType, size_t dim>
+void Newmark<Vector, MatrixType, FunctionType, dim>::extractOldVelocity(
+    Vector &velocity) const {
+  velocity = v_o;
+}
diff --git a/src/timestepping/newmark.hh b/src/timestepping/newmark.hh
index 14a4632e..0d5774d6 100644
--- a/src/timestepping/newmark.hh
+++ b/src/timestepping/newmark.hh
@@ -16,6 +16,7 @@ class Newmark : public TimeSteppingScheme<Vector, Matrix, Function, dim> {
   void postProcess(Vector const &) override;
   void extractDisplacement(Vector &) const override;
   void extractVelocity(Vector &) const override;
+  void extractOldVelocity(Vector &) const override;
 
 private:
   Matrix const &A;
-- 
GitLab