From 9ea0e3f41e4d070bfc58fc3620e24295ebc0552f Mon Sep 17 00:00:00 2001 From: Elias Pipping <elias.pipping@fu-berlin.de> Date: Fri, 3 Aug 2012 17:10:53 +0200 Subject: [PATCH] Constness --- src/test-circle.cc | 6 +++--- src/test-gradient-horrible-logarithmic.cc | 6 +++--- src/test-gradient-horrible.cc | 6 +++--- src/test-gradient-identity.cc | 6 +++--- src/test-gradient-parabola.cc | 6 +++--- src/test-gradient-sample-3d.cc | 6 +++--- src/test-gradient-sample-nonsmooth.cc | 6 +++--- src/test-gradient-sample-steep.cc | 6 +++--- src/test-gradient-sample-steep2.cc | 6 +++--- src/test-gradient-sample-verysteep.cc | 6 +++--- src/test-gradient-sample.cc | 6 +++--- src/test-gradient-sample2.cc | 6 +++--- src/test-gradient-trivial.cc | 6 +++--- 13 files changed, 39 insertions(+), 39 deletions(-) diff --git a/src/test-circle.cc b/src/test-circle.cc index 9489723c..e0b8080d 100644 --- a/src/test-circle.cc +++ b/src/test-circle.cc @@ -26,12 +26,12 @@ int main() { typedef Functional::SmallMatrix SmallMatrix; typedef Functional::SmallVector SmallVector; - SmallMatrix A = { { 4, 1.5 }, { 1.5, 3 } }; - SmallVector b = { 1, 2 }; + SmallMatrix const A = { { 4, 1.5 }, { 1.5, 3 } }; + SmallVector const b = { 1, 2 }; auto const f = Dune::make_shared<Dune::SampleFunction<2> const>(); auto const phi = Dune::make_shared<Functional::NonlinearityType const>(f); - Functional J(A, b, phi); + Functional const J(A, b, phi); Bisection const bisection(0.0, 1.0, 1e-12, false, 0); diff --git a/src/test-gradient-horrible-logarithmic.cc b/src/test-gradient-horrible-logarithmic.cc index 950a776c..f1a8bcd7 100644 --- a/src/test-gradient-horrible-logarithmic.cc +++ b/src/test-gradient-horrible-logarithmic.cc @@ -19,12 +19,12 @@ int main() { typedef Functional::SmallMatrix SmallMatrix; typedef Functional::SmallVector SmallVector; - SmallMatrix A = { { 3, 1.5 }, { 1.5, 4 } }; - SmallVector b = { 1, 2 }; + SmallMatrix const A = { { 3, 1.5 }, { 1.5, 4 } }; + SmallVector const b = { 1, 2 }; auto const f = Dune::make_shared<Dune::HorribleFunctionLogarithmic const>(); auto const phi = Dune::make_shared<Functional::NonlinearityType const>(f); - Functional J(A, b, phi); + Functional const J(A, b, phi); double ret1; { diff --git a/src/test-gradient-horrible.cc b/src/test-gradient-horrible.cc index 14de1df5..da5e45ff 100644 --- a/src/test-gradient-horrible.cc +++ b/src/test-gradient-horrible.cc @@ -19,12 +19,12 @@ int main() { typedef Functional::SmallMatrix SmallMatrix; typedef Functional::SmallVector SmallVector; - SmallMatrix A = { { 3, 1.5 }, { 1.5, 4 } }; - SmallVector b = { 1, 2 }; + SmallMatrix const A = { { 3, 1.5 }, { 1.5, 4 } }; + SmallVector const b = { 1, 2 }; auto const f = Dune::make_shared<Dune::HorribleFunction const>(); auto const phi = Dune::make_shared<Functional::NonlinearityType const>(f); - Functional J(A, b, phi); + Functional const J(A, b, phi); double ret1; { diff --git a/src/test-gradient-identity.cc b/src/test-gradient-identity.cc index a9ba32e8..7010f8a6 100644 --- a/src/test-gradient-identity.cc +++ b/src/test-gradient-identity.cc @@ -19,12 +19,12 @@ int main() { typedef Functional::SmallMatrix SmallMatrix; typedef Functional::SmallVector SmallVector; - SmallMatrix A = { { 3, 1.5 }, { 1.5, 4 } }; - SmallVector b = { 1, 2 }; + SmallMatrix const A = { { 3, 1.5 }, { 1.5, 4 } }; + SmallVector const b = { 1, 2 }; auto const f = Dune::make_shared<Dune::LinearFunction const>(1); auto const phi = Dune::make_shared<Functional::NonlinearityType const>(f); - Functional J(A, b, phi); + Functional const J(A, b, phi); double ret1; { diff --git a/src/test-gradient-parabola.cc b/src/test-gradient-parabola.cc index a1d3d802..7226d93b 100644 --- a/src/test-gradient-parabola.cc +++ b/src/test-gradient-parabola.cc @@ -21,15 +21,15 @@ int main() { typedef Functional::SmallMatrix SmallMatrix; typedef Functional::SmallVector SmallVector; - SmallMatrix A = { { 3, 1.5 }, { 1.5, 4 } }; - SmallVector b = { 1, 2 }; + SmallMatrix const A = { { 3, 1.5 }, { 1.5, 4 } }; + SmallVector const b = { 1, 2 }; // |x|^2 as the nonlinearity is the same as having no nonlinearity // but twice the identity matrix added to A. In other words, we're // solving A + 2*id = b auto const f = Dune::make_shared<Dune::Parabola const>(); auto const phi = Dune::make_shared<Functional::NonlinearityType const>(f); - Functional J(A, b, phi); + Functional const J(A, b, phi); SmallVector solution = { 4.0 / 37.0, 34.0 / 111.0 }; // Analytic solution SmallMatrix M = A; diff --git a/src/test-gradient-sample-3d.cc b/src/test-gradient-sample-3d.cc index e57d2b84..52e4a959 100644 --- a/src/test-gradient-sample-3d.cc +++ b/src/test-gradient-sample-3d.cc @@ -19,12 +19,12 @@ int main() { typedef Functional::SmallMatrix SmallMatrix; typedef Functional::SmallVector SmallVector; - SmallMatrix A = { { 3, 1.5, 0 }, { 1.5, 4, 1.5 }, { 0, 1.5, 5 } }; - SmallVector b = { 1, 2, 3 }; + SmallMatrix const A = { { 3, 1.5, 0 }, { 1.5, 4, 1.5 }, { 0, 1.5, 5 } }; + SmallVector const b = { 1, 2, 3 }; auto const f = Dune::make_shared<Dune::SampleFunction<2> const>(); auto const phi = Dune::make_shared<Functional::NonlinearityType const>(f); - Functional J(A, b, phi); + Functional const J(A, b, phi); double ret1; { diff --git a/src/test-gradient-sample-nonsmooth.cc b/src/test-gradient-sample-nonsmooth.cc index e684f204..9f136978 100644 --- a/src/test-gradient-sample-nonsmooth.cc +++ b/src/test-gradient-sample-nonsmooth.cc @@ -20,12 +20,12 @@ int main() { typedef Functional::SmallMatrix SmallMatrix; typedef Functional::SmallVector SmallVector; - SmallMatrix A = { { 3, 1.5 }, { 1.5, 4 } }; - SmallVector b = { 1, 2 }; + SmallMatrix const A = { { 3, 1.5 }, { 1.5, 4 } }; + SmallVector const b = { 1, 2 }; auto const f = Dune::make_shared<Dune::SampleFunction<2> const>(); auto const phi = Dune::make_shared<Functional::NonlinearityType const>(f); - Functional J(A, b, phi); + Functional const J(A, b, phi); SmallVector start; /* diff --git a/src/test-gradient-sample-steep.cc b/src/test-gradient-sample-steep.cc index 3bc51bef..6b39276f 100644 --- a/src/test-gradient-sample-steep.cc +++ b/src/test-gradient-sample-steep.cc @@ -19,12 +19,12 @@ int main() { typedef Functional::SmallMatrix SmallMatrix; typedef Functional::SmallVector SmallVector; - SmallMatrix A = { { 1, 0 }, { 0, 1 } }; - SmallVector b = { 1, 2 }; + SmallMatrix const A = { { 1, 0 }, { 0, 1 } }; + SmallVector const b = { 1, 2 }; auto const f = Dune::make_shared<Dune::SampleFunction<2> const>(); auto const phi = Dune::make_shared<Functional::NonlinearityType const>(f); - Functional J(A, b, phi); + Functional const J(A, b, phi); double ret1; { diff --git a/src/test-gradient-sample-steep2.cc b/src/test-gradient-sample-steep2.cc index f77c3788..6f27d54d 100644 --- a/src/test-gradient-sample-steep2.cc +++ b/src/test-gradient-sample-steep2.cc @@ -19,12 +19,12 @@ int main() { typedef Functional::SmallMatrix SmallMatrix; typedef Functional::SmallVector SmallVector; - SmallMatrix A = { { 1, 0 }, { 0, 1 } }; - SmallVector b = { 1, 2.5 }; + SmallMatrix const A = { { 1, 0 }, { 0, 1 } }; + SmallVector const b = { 1, 2.5 }; auto const f = Dune::make_shared<Dune::SampleFunction<2> const>(); auto const phi = Dune::make_shared<Functional::NonlinearityType const>(f); - Functional J(A, b, phi); + Functional const J(A, b, phi); double ret1; { diff --git a/src/test-gradient-sample-verysteep.cc b/src/test-gradient-sample-verysteep.cc index 372787ae..78e1ec89 100644 --- a/src/test-gradient-sample-verysteep.cc +++ b/src/test-gradient-sample-verysteep.cc @@ -19,12 +19,12 @@ int main() { typedef Functional::SmallMatrix SmallMatrix; typedef Functional::SmallVector SmallVector; - SmallMatrix A = { { 1, 0 }, { 0, 1 } }; - SmallVector b = { 1, 2.5 }; + SmallMatrix const A = { { 1, 0 }, { 0, 1 } }; + SmallVector const b = { 1, 2.5 }; auto const f = Dune::make_shared<Dune::SampleFunction<100> const>(); auto const phi = Dune::make_shared<Functional::NonlinearityType const>(f); - Functional J(A, b, phi); + Functional const J(A, b, phi); double ret1; { diff --git a/src/test-gradient-sample.cc b/src/test-gradient-sample.cc index 47927377..742bbf09 100644 --- a/src/test-gradient-sample.cc +++ b/src/test-gradient-sample.cc @@ -21,12 +21,12 @@ int main() { typedef Functional::SmallMatrix SmallMatrix; typedef Functional::SmallVector SmallVector; - SmallMatrix A = { { 3, 1.5 }, { 1.5, 4 } }; - SmallVector b = { 1, 2 }; + SmallMatrix const A = { { 3, 1.5 }, { 1.5, 4 } }; + SmallVector const b = { 1, 2 }; auto const f = Dune::make_shared<Dune::SampleFunction<2> const>(); auto const phi = Dune::make_shared<Functional::NonlinearityType const>(f); - Functional J(A, b, phi); + Functional const J(A, b, phi); /* j(x) diff --git a/src/test-gradient-sample2.cc b/src/test-gradient-sample2.cc index ff80966d..a8009a07 100644 --- a/src/test-gradient-sample2.cc +++ b/src/test-gradient-sample2.cc @@ -21,12 +21,12 @@ int main() { typedef Functional::SmallMatrix SmallMatrix; typedef Functional::SmallVector SmallVector; - SmallMatrix A = { { 1, 0 }, { 0, 1 } }; - SmallVector b = { 1, 1 }; + SmallMatrix const A = { { 1, 0 }, { 0, 1 } }; + SmallVector const b = { 1, 1 }; auto const f = Dune::make_shared<Dune::SampleFunction<2> const>(); auto const phi = Dune::make_shared<Functional::NonlinearityType const>(f); - Functional J(A, b, phi); + Functional const J(A, b, phi); double ret1; { diff --git a/src/test-gradient-trivial.cc b/src/test-gradient-trivial.cc index 6368580f..28fecb60 100644 --- a/src/test-gradient-trivial.cc +++ b/src/test-gradient-trivial.cc @@ -20,12 +20,12 @@ int main() { typedef Functional::SmallMatrix SmallMatrix; typedef Functional::SmallVector SmallVector; - SmallMatrix A = { { 3, 1.5 }, { 1.5, 4 } }; - SmallVector b = { 1, 2 }; + SmallMatrix const A = { { 3, 1.5 }, { 1.5, 4 } }; + SmallVector const b = { 1, 2 }; auto const f = Dune::make_shared<Dune::TrivialFunction const>(); auto const phi = Dune::make_shared<Functional::NonlinearityType const>(f); - Functional J(A, b, phi); + Functional const J(A, b, phi); SmallVector solution = { 4.0 / 39.0, 6.0 / 13.0 }; // Analytic solution -- GitLab