From 4f346fa379ca1aa1fe8f4f03726cbb0f201e0b48 Mon Sep 17 00:00:00 2001 From: Elias Pipping <elias.pipping@fu-berlin.de> Date: Thu, 4 Jul 2013 11:23:41 +0200 Subject: [PATCH] [Cleanup] Move ell/createRHS out of the loop This will allow us to compute the initial acceleration --- src/one-body-sample.cc | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/one-body-sample.cc b/src/one-body-sample.cc index 0c01069e..60d96e82 100644 --- a/src/one-body-sample.cc +++ b/src/one-body-sample.cc @@ -325,6 +325,15 @@ int main(int argc, char *argv[]) { auto myGlobalNonlinearity = assemble_nonlinearity<MatrixType, VectorType>( frictionalNodes, *nodalIntegrals, frictionData); + // Problem formulation: right-hand side + auto const createRHS = [&](double _time, VectorType &_ell) { + assemble_neumann(leafView, p1Assembler, neumannNodes, _ell, + neumannFunction, _time); + _ell += gravityFunctional; + }; + VectorType ell(finestSize); + + // {{{ Initial conditions VectorType u_initial(finestSize); u_initial = 0.0; VectorType v_initial(finestSize); @@ -371,11 +380,6 @@ int main(int argc, char *argv[]) { auto const timesteps = parset.get<size_t>("timeSteps"); auto const tau = parset.get<double>("endOfTime") / timesteps; - auto const createRHS = [&](double _time, VectorType &_ell) { - assemble_neumann(leafView, p1Assembler, neumannNodes, _ell, - neumannFunction, _time); - _ell += gravityFunctional; - }; VectorType v = v_initial; SingletonVectorType alpha = alpha_initial; @@ -389,8 +393,6 @@ int main(int argc, char *argv[]) { timeSteppingScheme->nextTimeStep(); double const time = tau * run; - - VectorType ell(finestSize); createRHS(time, ell); MatrixType problem_AB; -- GitLab