From af042afd269035d49d97663819c9c0104452ef72 Mon Sep 17 00:00:00 2001 From: Elias Pipping <elias.pipping@fu-berlin.de> Date: Wed, 21 Jan 2015 15:38:16 +0100 Subject: [PATCH] [Cleanup] Add and use extractAcceleration --- src/rate/rateupdater.cc | 9 +++++++++ src/rate/rateupdater.hh | 1 + src/sand-wedge.cc | 1 + 3 files changed, 11 insertions(+) diff --git a/src/rate/rateupdater.cc b/src/rate/rateupdater.cc index 2de879b3..765b6b64 100644 --- a/src/rate/rateupdater.cc +++ b/src/rate/rateupdater.cc @@ -49,6 +49,15 @@ void RateUpdater<Vector, Matrix, Function, dim>::extractOldVelocity( oldVelocity = v_o; } +template <class Vector, class Matrix, class Function, size_t dim> +void RateUpdater<Vector, Matrix, Function, dim>::extractAcceleration( + Vector &acceleration) const { + if (!postProcessCalled) + DUNE_THROW(Dune::Exception, "It seems you forgot to call postProcess!"); + + acceleration = a; +} + #include "backward_euler.cc" #include "newmark.cc" #include "rateupdater_tmpl.cc" diff --git a/src/rate/rateupdater.hh b/src/rate/rateupdater.hh index 7b382e2e..19ec717d 100644 --- a/src/rate/rateupdater.hh +++ b/src/rate/rateupdater.hh @@ -24,6 +24,7 @@ class RateUpdater { void extractDisplacement(Vector &displacement) const; void extractVelocity(Vector &velocity) const; void extractOldVelocity(Vector &velocity) const; + void extractAcceleration(Vector &acceleration) const; std::shared_ptr<RateUpdater<Vector, Matrix, Function, dim>> virtual clone() const = 0; diff --git a/src/sand-wedge.cc b/src/sand-wedge.cc index bd7b8182..481e17eb 100644 --- a/src/sand-wedge.cc +++ b/src/sand-wedge.cc @@ -331,6 +331,7 @@ int main(int argc, char *argv[]) { programState.relativeTau = adaptiveTimeStepper.getRelativeTau(); current.second->extractDisplacement(programState.u); current.second->extractVelocity(programState.v); + current.second->extractAcceleration(programState.a); current.first->extractAlpha(programState.alpha); report(); -- GitLab