From 55f7842f52b8f86db3e77c325948a2fa1f48d811 Mon Sep 17 00:00:00 2001
From: Elias Pipping <elias.pipping@fu-berlin.de>
Date: Sun, 10 Feb 2013 21:43:24 +0100
Subject: [PATCH] camlCase; move writer to a block; rename variable

---
 src/one-body-sample.cc | 75 +++++++++++++++++++++---------------------
 1 file changed, 38 insertions(+), 37 deletions(-)

diff --git a/src/one-body-sample.cc b/src/one-body-sample.cc
index f95fc84d..dc29c3e4 100644
--- a/src/one-body-sample.cc
+++ b/src/one-body-sample.cc
@@ -340,30 +340,31 @@ int main(int argc, char *argv[]) {
     // }}}
 
     // Set up TNNMG solver
-    auto const solver_tolerance = parset.get<double>("solver.tolerance");
+    auto const solverTolerance = parset.get<double>("solver.tolerance");
     typedef MyConvexProblem<MatrixType, VectorType> MyConvexProblemType;
     typedef MyBlockProblem<MyConvexProblemType> MyBlockProblemType;
     MySolver<dims, MatrixType, VectorType, GridType, MyBlockProblemType>
-    mySolver(parset.sub("solver.tnnmg"), refinements, solver_tolerance, *grid,
-             ignoreNodes);
-    auto multigridStep = mySolver.getSolver();
+    solverHost(parset.sub("solver.tnnmg"), refinements, solverTolerance, *grid,
+               ignoreNodes);
+    auto multigridStep = solverHost.getSolver();
     Solver::VerbosityMode const verbosity =
         parset.get<bool>("verbose") ? Solver::FULL : Solver::QUIET;
 
-    std::fstream coordinate_writer("coordinates", std::fstream::out);
-    for (size_t i = 0; i < frictionalNodes.size(); ++i)
-      if (frictionalNodes[i][0])
-        coordinate_writer << coordinates[i] << std::endl;
-    coordinate_writer.close();
-
-    std::fstream state_writer("states", std::fstream::out);
-    std::fstream displacement_writer("displacements", std::fstream::out);
-    std::fstream velocity_writer("velocities", std::fstream::out);
-    std::fstream coefficient_writer("coefficients", std::fstream::out);
+    {
+      std::fstream coordinateWriter("coordinates", std::fstream::out);
+      for (size_t i = 0; i < frictionalNodes.size(); ++i)
+        if (frictionalNodes[i][0])
+          coordinateWriter << coordinates[i] << std::endl;
+      coordinateWriter.close();
+    }
+    std::fstream stateWriter("states", std::fstream::out);
+    std::fstream displacementWriter("displacements", std::fstream::out);
+    std::fstream velocityWriter("velocities", std::fstream::out);
+    std::fstream coefficientWriter("coefficients", std::fstream::out);
     ;
-    std::fstream iteration_writer("iterations", std::fstream::out);
+    std::fstream iterationWriter("iterations", std::fstream::out);
     ;
-    std::fstream damping_writer("damping", std::fstream::out);
+    std::fstream dampingWriter("damping", std::fstream::out);
     ;
 
     auto timeSteppingScheme =
@@ -408,7 +409,7 @@ int main(int argc, char *argv[]) {
 
       LoopSolver<VectorType> velocityProblemSolver(
           multigridStep, parset.get<size_t>("solver.tnnmg.maxiterations"),
-          solver_tolerance, &velocityEnergyNorm, verbosity,
+          solverTolerance, &velocityEnergyNorm, verbosity,
           false); // absolute error
 
       size_t iterationCounter;
@@ -447,11 +448,11 @@ int main(int argc, char *argv[]) {
           if (state_fpi <= 2 // Let the first two steps pass through unchanged
               || correction < minimalCorrectionReduction * lastCorrection) {
             alpha = computed_state;
-            damping_writer << "N ";
+            dampingWriter << "N ";
           } else {
             alpha *= damping;
             alpha.axpy(1.0 - damping, computed_state);
-            damping_writer << "Y ";
+            dampingWriter << "Y ";
           }
           lastCorrection = correction;
         }
@@ -461,7 +462,7 @@ int main(int argc, char *argv[]) {
         timeSteppingScheme->extractDisplacement(u);
         timeSteppingScheme->extractVelocity(ud);
 
-        iteration_writer << iterationCounter << " ";
+        iterationWriter << iterationCounter << " ";
         if (parset.get<bool>("printProgress")) {
           std::cerr << '.';
           std::cerr.flush();
@@ -487,19 +488,19 @@ int main(int argc, char *argv[]) {
 
       for (size_t i = 0; i < frictionalNodes.size(); ++i)
         if (frictionalNodes[i][0]) {
-          state_writer << alpha[i][0] << " ";
-          displacement_writer << u[i][0] << " ";
-          velocity_writer << ud[i][0] << " ";
-          coefficient_writer << computeCOF(mu0, a, b, V0, L, ud[i].two_norm(),
-                                           alpha[i]) << " ";
+          stateWriter << alpha[i][0] << " ";
+          displacementWriter << u[i][0] << " ";
+          velocityWriter << ud[i][0] << " ";
+          coefficientWriter << computeCOF(mu0, a, b, V0, L, ud[i].two_norm(),
+                                          alpha[i]) << " ";
         }
 
-      state_writer << std::endl;
-      displacement_writer << std::endl;
-      velocity_writer << std::endl;
-      coefficient_writer << std::endl;
-      iteration_writer << std::endl;
-      damping_writer << std::endl;
+      stateWriter << std::endl;
+      displacementWriter << std::endl;
+      velocityWriter << std::endl;
+      coefficientWriter << std::endl;
+      iterationWriter << std::endl;
+      dampingWriter << std::endl;
 
       if (parset.get<bool>("writeVTK")) {
         SingletonVectorType vonMisesStress;
@@ -520,12 +521,12 @@ int main(int argc, char *argv[]) {
                 << timer.elapsed() << "s" << std::endl;
     ;
 
-    state_writer.close();
-    displacement_writer.close();
-    velocity_writer.close();
-    coefficient_writer.close();
-    iteration_writer.close();
-    damping_writer.close();
+    stateWriter.close();
+    displacementWriter.close();
+    velocityWriter.close();
+    coefficientWriter.close();
+    iterationWriter.close();
+    dampingWriter.close();
 
     Python::stop();
   }
-- 
GitLab