From 1e72d54d602d6dec3a350690365a28493d7a3994 Mon Sep 17 00:00:00 2001
From: Elias Pipping <elias.pipping@fu-berlin.de>
Date: Fri, 16 Dec 2011 18:14:55 +0100
Subject: [PATCH] Constness

---
 src/one-body-sample.cc | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/src/one-body-sample.cc b/src/one-body-sample.cc
index e43f8169..773919f2 100644
--- a/src/one-body-sample.cc
+++ b/src/one-body-sample.cc
@@ -306,7 +306,7 @@ int main(int argc, char *argv[]) {
         // {{{ Linear Solver;
         auto linearBaseSolverStep =
             new TruncatedBlockGSStep<OperatorType, VectorType>;
-        auto baseEnergyNorm =
+        auto const baseEnergyNorm =
             new EnergyNorm<OperatorType, VectorType>(*linearBaseSolverStep);
         auto linearBaseSolver = new LoopSolver<VectorType>(
             linearBaseSolverStep, solver_maxIterations, solver_tolerance,
@@ -358,7 +358,7 @@ int main(int argc, char *argv[]) {
             parset.get<int>("solver.tnnmg.main.nu2"));
         multigridStep->ignoreNodes_ = &ignoreNodes;
 
-        auto energyNorm =
+        auto const energyNorm =
             new EnergyNorm<OperatorType, VectorType>(stiffnessMatrix);
 
         LoopSolver<VectorType> overallSolver(
@@ -381,7 +381,7 @@ int main(int argc, char *argv[]) {
       u4 += u4_diff;
 
       { // Compute von Mises stress and write everything to a file
-        auto displacement =
+        auto const displacement =
             Dune::make_shared<BasisGridFunction<P1Basis, VectorType> const>(
                 p1Basis, u4);
         VonMisesStressAssembler<GridType> localStressAssembler(E, nu,
@@ -392,10 +392,11 @@ int main(int argc, char *argv[]) {
         Dune::VTKWriter<GridView> writer(leafView);
         std::string filename((boost::format("obs%d") % run).str());
 
-        auto displacement_ptr =
+        // Note: These pointers cannot be const.
+        auto const displacement_ptr =
             Dune::make_shared<VTKBasisGridFunction<P1Basis, VectorType>>(
                 p1Basis, u4, "displacement");
-        auto vonmises_ptr =
+        auto const vonmises_ptr =
             Dune::make_shared<VTKBasisGridFunction<P0Basis, CellVectorType>>(
                 p0Basis, vonMisesStress, "stress");
         writer.addVertexData(displacement_ptr);
-- 
GitLab