From afef54600b08dc8ffdb915681309bb9dd9e68caa Mon Sep 17 00:00:00 2001
From: Elias Pipping <elias.pipping@fu-berlin.de>
Date: Mon, 10 Sep 2012 12:27:42 +0200
Subject: [PATCH] Rename: u -> u_old; use solution instead of u everywhere

---
 src/one-body-sample.cc | 27 +++++++++++++--------------
 1 file changed, 13 insertions(+), 14 deletions(-)

diff --git a/src/one-body-sample.cc b/src/one-body-sample.cc
index 9e83c61a..441355f9 100644
--- a/src/one-body-sample.cc
+++ b/src/one-body-sample.cc
@@ -191,13 +191,12 @@ int main(int argc, char *argv[]) {
             leafView, p1Basis, frictionalNodes);
 
     // {{{ Initialise vectors
-    VectorType u(finestSize);
-    u = 0.0; // Has to be zero!
-    VectorType u_previous;
+    VectorType u_old(finestSize);
+    u_old = 0.0; // Has to be zero!
+    VectorType u_old_old;
     VectorType u_diff(finestSize);
     u_diff = 0.0; // Has to be zero!
 
-    // temporary storage for u
     VectorType solution(finestSize);
 
     SingletonVectorType alpha_old(finestSize);
@@ -257,7 +256,7 @@ int main(int argc, char *argv[]) {
         VectorType problem_rhs(finestSize);
         VectorType problem_iterate(finestSize);
 
-        VectorType *u_old_old_ptr = (run == 1) ? nullptr : &u_previous;
+        VectorType *u_old_old_ptr = (run == 1) ? nullptr : &u_old_old;
 
         typedef TimeSteppingScheme<VectorType, MatrixType,
                                    decltype(dirichletFunction), dim> TS;
@@ -269,16 +268,16 @@ int main(int argc, char *argv[]) {
         Dune::shared_ptr<TS> timeSteppingScheme;
         if (run == 1 || !parset.get<bool>("implicitTwoStep"))
           timeSteppingScheme =
-              Dune::make_shared<IE>(ell, stiffnessMatrix, u, u_old_old_ptr,
+              Dune::make_shared<IE>(ell, stiffnessMatrix, u_old, u_old_old_ptr,
                                     ignoreNodes, dirichletFunction, time, tau);
         else
           timeSteppingScheme =
-              Dune::make_shared<ITS>(ell, stiffnessMatrix, u, u_old_old_ptr,
+              Dune::make_shared<ITS>(ell, stiffnessMatrix, u_old, u_old_old_ptr,
                                      ignoreNodes, dirichletFunction, time, tau);
 
         timeSteppingScheme->setup(problem_rhs, problem_iterate, problem_A);
 
-        VectorType solution_saved = u;
+        VectorType solution_saved = u_old;
         auto const state_fpi_max =
             parset.get<size_t>("solver.tnnmg.fixed_point_iterations");
         for (size_t state_fpi = 1; state_fpi <= state_fpi_max; ++state_fpi) {
@@ -346,8 +345,8 @@ int main(int argc, char *argv[]) {
           double out;
           neumannFunction.evaluate(time, out);
           octave_writer << alpha[first_frictional_node][0] << " "
-                        << u[first_frictional_node][0] * 1e6 << " " << out
-                        << std::endl;
+                        << solution[first_frictional_node][0] * 1e6 << " "
+                        << out << std::endl;
         }
 
         // Comparison with the analytic solution of a velocity stepping test
@@ -392,8 +391,8 @@ int main(int argc, char *argv[]) {
             std::cout << u_diff[i][0] * timesteps << " ";
         std::cout << std::endl;
       }
-      u_previous = u;
-      u = solution;
+      u_old_old = u_old;
+      u_old = solution;
       alpha_old = alpha;
 
       // Compute von Mises stress and write everything to a file
@@ -401,12 +400,12 @@ int main(int argc, char *argv[]) {
         VonMisesStressAssembler<GridType> localStressAssembler(
             E, nu,
             Dune::make_shared<BasisGridFunction<P1Basis, VectorType> const>(
-                p1Basis, u));
+                p1Basis, solution));
         FunctionalAssembler<P0Basis>(p0Basis)
             .assemble(localStressAssembler, vonMisesStress, true);
 
         writeVtk<P1Basis, P0Basis, VectorType, SingletonVectorType, GridView>(
-            p1Basis, u, alpha, p0Basis, vonMisesStress, leafView,
+            p1Basis, solution, alpha, p0Basis, vonMisesStress, leafView,
             (boost::format("obs%d") % run).str());
       }
     }
-- 
GitLab