From cb811462a439e36659599614225a2005196b3b61 Mon Sep 17 00:00:00 2001
From: Elias Pipping <elias.pipping@fu-berlin.de>
Date: Fri, 2 Nov 2012 15:17:11 +0100
Subject: [PATCH] Use lambda

---
 src/one-body-sample.org | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/src/one-body-sample.org b/src/one-body-sample.org
index 39bd10a8..56a4df03 100644
--- a/src/one-body-sample.org
+++ b/src/one-body-sample.org
@@ -364,6 +364,12 @@
     auto const timesteps = parset.get<size_t>("timeSteps");
     auto const tau = parset.get<double>("endOfTime") / timesteps;
   
+    auto createRHS = [&](double _time, VectorType &_ell) {
+      assemble_neumann<GridType, GridView, SmallVector, P1Basis>
+      (leafView, p1Basis, neumannNodes, _ell, neumannFunction, _time);
+      _ell += gravityFunctional;
+    };
+  
     auto const state_fpi_max
       = parset.get<size_t>("solver.tnnmg.fixed_point_iterations");
     for (size_t run = 1; run <= timesteps; ++run) {
@@ -378,9 +384,7 @@
       double const time = tau * run;
   
       VectorType ell(finestSize);
-      assemble_neumann<GridType, GridView, SmallVector, P1Basis>
-        (leafView, p1Basis, neumannNodes, ell, neumannFunction, time);
-      ell += gravityFunctional;
+      createRHS(time, ell);
   
       MatrixType problem_A;
       VectorType problem_rhs(finestSize);
-- 
GitLab