Skip to content
Snippets Groups Projects
Commit 9ea0e3f4 authored by Elias Pipping's avatar Elias Pipping Committed by Elias Pipping
Browse files

Constness

parent 421e16bd
No related branches found
No related tags found
No related merge requests found
...@@ -26,12 +26,12 @@ int main() { ...@@ -26,12 +26,12 @@ int main() {
typedef Functional::SmallMatrix SmallMatrix; typedef Functional::SmallMatrix SmallMatrix;
typedef Functional::SmallVector SmallVector; typedef Functional::SmallVector SmallVector;
SmallMatrix A = { { 4, 1.5 }, { 1.5, 3 } }; SmallMatrix const A = { { 4, 1.5 }, { 1.5, 3 } };
SmallVector b = { 1, 2 }; SmallVector const b = { 1, 2 };
auto const f = Dune::make_shared<Dune::SampleFunction<2> const>(); auto const f = Dune::make_shared<Dune::SampleFunction<2> const>();
auto const phi = Dune::make_shared<Functional::NonlinearityType const>(f); 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); Bisection const bisection(0.0, 1.0, 1e-12, false, 0);
......
...@@ -19,12 +19,12 @@ int main() { ...@@ -19,12 +19,12 @@ int main() {
typedef Functional::SmallMatrix SmallMatrix; typedef Functional::SmallMatrix SmallMatrix;
typedef Functional::SmallVector SmallVector; typedef Functional::SmallVector SmallVector;
SmallMatrix A = { { 3, 1.5 }, { 1.5, 4 } }; SmallMatrix const A = { { 3, 1.5 }, { 1.5, 4 } };
SmallVector b = { 1, 2 }; SmallVector const b = { 1, 2 };
auto const f = Dune::make_shared<Dune::HorribleFunctionLogarithmic const>(); auto const f = Dune::make_shared<Dune::HorribleFunctionLogarithmic const>();
auto const phi = Dune::make_shared<Functional::NonlinearityType const>(f); auto const phi = Dune::make_shared<Functional::NonlinearityType const>(f);
Functional J(A, b, phi); Functional const J(A, b, phi);
double ret1; double ret1;
{ {
......
...@@ -19,12 +19,12 @@ int main() { ...@@ -19,12 +19,12 @@ int main() {
typedef Functional::SmallMatrix SmallMatrix; typedef Functional::SmallMatrix SmallMatrix;
typedef Functional::SmallVector SmallVector; typedef Functional::SmallVector SmallVector;
SmallMatrix A = { { 3, 1.5 }, { 1.5, 4 } }; SmallMatrix const A = { { 3, 1.5 }, { 1.5, 4 } };
SmallVector b = { 1, 2 }; SmallVector const b = { 1, 2 };
auto const f = Dune::make_shared<Dune::HorribleFunction const>(); auto const f = Dune::make_shared<Dune::HorribleFunction const>();
auto const phi = Dune::make_shared<Functional::NonlinearityType const>(f); auto const phi = Dune::make_shared<Functional::NonlinearityType const>(f);
Functional J(A, b, phi); Functional const J(A, b, phi);
double ret1; double ret1;
{ {
......
...@@ -19,12 +19,12 @@ int main() { ...@@ -19,12 +19,12 @@ int main() {
typedef Functional::SmallMatrix SmallMatrix; typedef Functional::SmallMatrix SmallMatrix;
typedef Functional::SmallVector SmallVector; typedef Functional::SmallVector SmallVector;
SmallMatrix A = { { 3, 1.5 }, { 1.5, 4 } }; SmallMatrix const A = { { 3, 1.5 }, { 1.5, 4 } };
SmallVector b = { 1, 2 }; SmallVector const b = { 1, 2 };
auto const f = Dune::make_shared<Dune::LinearFunction const>(1); auto const f = Dune::make_shared<Dune::LinearFunction const>(1);
auto const phi = Dune::make_shared<Functional::NonlinearityType const>(f); auto const phi = Dune::make_shared<Functional::NonlinearityType const>(f);
Functional J(A, b, phi); Functional const J(A, b, phi);
double ret1; double ret1;
{ {
......
...@@ -21,15 +21,15 @@ int main() { ...@@ -21,15 +21,15 @@ int main() {
typedef Functional::SmallMatrix SmallMatrix; typedef Functional::SmallMatrix SmallMatrix;
typedef Functional::SmallVector SmallVector; typedef Functional::SmallVector SmallVector;
SmallMatrix A = { { 3, 1.5 }, { 1.5, 4 } }; SmallMatrix const A = { { 3, 1.5 }, { 1.5, 4 } };
SmallVector b = { 1, 2 }; SmallVector const b = { 1, 2 };
// |x|^2 as the nonlinearity is the same as having no nonlinearity // |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 // but twice the identity matrix added to A. In other words, we're
// solving A + 2*id = b // solving A + 2*id = b
auto const f = Dune::make_shared<Dune::Parabola const>(); auto const f = Dune::make_shared<Dune::Parabola const>();
auto const phi = Dune::make_shared<Functional::NonlinearityType const>(f); 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 SmallVector solution = { 4.0 / 37.0, 34.0 / 111.0 }; // Analytic solution
SmallMatrix M = A; SmallMatrix M = A;
......
...@@ -19,12 +19,12 @@ int main() { ...@@ -19,12 +19,12 @@ int main() {
typedef Functional::SmallMatrix SmallMatrix; typedef Functional::SmallMatrix SmallMatrix;
typedef Functional::SmallVector SmallVector; typedef Functional::SmallVector SmallVector;
SmallMatrix A = { { 3, 1.5, 0 }, { 1.5, 4, 1.5 }, { 0, 1.5, 5 } }; SmallMatrix const A = { { 3, 1.5, 0 }, { 1.5, 4, 1.5 }, { 0, 1.5, 5 } };
SmallVector b = { 1, 2, 3 }; SmallVector const b = { 1, 2, 3 };
auto const f = Dune::make_shared<Dune::SampleFunction<2> const>(); auto const f = Dune::make_shared<Dune::SampleFunction<2> const>();
auto const phi = Dune::make_shared<Functional::NonlinearityType const>(f); auto const phi = Dune::make_shared<Functional::NonlinearityType const>(f);
Functional J(A, b, phi); Functional const J(A, b, phi);
double ret1; double ret1;
{ {
......
...@@ -20,12 +20,12 @@ int main() { ...@@ -20,12 +20,12 @@ int main() {
typedef Functional::SmallMatrix SmallMatrix; typedef Functional::SmallMatrix SmallMatrix;
typedef Functional::SmallVector SmallVector; typedef Functional::SmallVector SmallVector;
SmallMatrix A = { { 3, 1.5 }, { 1.5, 4 } }; SmallMatrix const A = { { 3, 1.5 }, { 1.5, 4 } };
SmallVector b = { 1, 2 }; SmallVector const b = { 1, 2 };
auto const f = Dune::make_shared<Dune::SampleFunction<2> const>(); auto const f = Dune::make_shared<Dune::SampleFunction<2> const>();
auto const phi = Dune::make_shared<Functional::NonlinearityType const>(f); auto const phi = Dune::make_shared<Functional::NonlinearityType const>(f);
Functional J(A, b, phi); Functional const J(A, b, phi);
SmallVector start; SmallVector start;
/* /*
......
...@@ -19,12 +19,12 @@ int main() { ...@@ -19,12 +19,12 @@ int main() {
typedef Functional::SmallMatrix SmallMatrix; typedef Functional::SmallMatrix SmallMatrix;
typedef Functional::SmallVector SmallVector; typedef Functional::SmallVector SmallVector;
SmallMatrix A = { { 1, 0 }, { 0, 1 } }; SmallMatrix const A = { { 1, 0 }, { 0, 1 } };
SmallVector b = { 1, 2 }; SmallVector const b = { 1, 2 };
auto const f = Dune::make_shared<Dune::SampleFunction<2> const>(); auto const f = Dune::make_shared<Dune::SampleFunction<2> const>();
auto const phi = Dune::make_shared<Functional::NonlinearityType const>(f); auto const phi = Dune::make_shared<Functional::NonlinearityType const>(f);
Functional J(A, b, phi); Functional const J(A, b, phi);
double ret1; double ret1;
{ {
......
...@@ -19,12 +19,12 @@ int main() { ...@@ -19,12 +19,12 @@ int main() {
typedef Functional::SmallMatrix SmallMatrix; typedef Functional::SmallMatrix SmallMatrix;
typedef Functional::SmallVector SmallVector; typedef Functional::SmallVector SmallVector;
SmallMatrix A = { { 1, 0 }, { 0, 1 } }; SmallMatrix const A = { { 1, 0 }, { 0, 1 } };
SmallVector b = { 1, 2.5 }; SmallVector const b = { 1, 2.5 };
auto const f = Dune::make_shared<Dune::SampleFunction<2> const>(); auto const f = Dune::make_shared<Dune::SampleFunction<2> const>();
auto const phi = Dune::make_shared<Functional::NonlinearityType const>(f); auto const phi = Dune::make_shared<Functional::NonlinearityType const>(f);
Functional J(A, b, phi); Functional const J(A, b, phi);
double ret1; double ret1;
{ {
......
...@@ -19,12 +19,12 @@ int main() { ...@@ -19,12 +19,12 @@ int main() {
typedef Functional::SmallMatrix SmallMatrix; typedef Functional::SmallMatrix SmallMatrix;
typedef Functional::SmallVector SmallVector; typedef Functional::SmallVector SmallVector;
SmallMatrix A = { { 1, 0 }, { 0, 1 } }; SmallMatrix const A = { { 1, 0 }, { 0, 1 } };
SmallVector b = { 1, 2.5 }; SmallVector const b = { 1, 2.5 };
auto const f = Dune::make_shared<Dune::SampleFunction<100> const>(); auto const f = Dune::make_shared<Dune::SampleFunction<100> const>();
auto const phi = Dune::make_shared<Functional::NonlinearityType const>(f); auto const phi = Dune::make_shared<Functional::NonlinearityType const>(f);
Functional J(A, b, phi); Functional const J(A, b, phi);
double ret1; double ret1;
{ {
......
...@@ -21,12 +21,12 @@ int main() { ...@@ -21,12 +21,12 @@ int main() {
typedef Functional::SmallMatrix SmallMatrix; typedef Functional::SmallMatrix SmallMatrix;
typedef Functional::SmallVector SmallVector; typedef Functional::SmallVector SmallVector;
SmallMatrix A = { { 3, 1.5 }, { 1.5, 4 } }; SmallMatrix const A = { { 3, 1.5 }, { 1.5, 4 } };
SmallVector b = { 1, 2 }; SmallVector const b = { 1, 2 };
auto const f = Dune::make_shared<Dune::SampleFunction<2> const>(); auto const f = Dune::make_shared<Dune::SampleFunction<2> const>();
auto const phi = Dune::make_shared<Functional::NonlinearityType const>(f); auto const phi = Dune::make_shared<Functional::NonlinearityType const>(f);
Functional J(A, b, phi); Functional const J(A, b, phi);
/* /*
j(x) j(x)
......
...@@ -21,12 +21,12 @@ int main() { ...@@ -21,12 +21,12 @@ int main() {
typedef Functional::SmallMatrix SmallMatrix; typedef Functional::SmallMatrix SmallMatrix;
typedef Functional::SmallVector SmallVector; typedef Functional::SmallVector SmallVector;
SmallMatrix A = { { 1, 0 }, { 0, 1 } }; SmallMatrix const A = { { 1, 0 }, { 0, 1 } };
SmallVector b = { 1, 1 }; SmallVector const b = { 1, 1 };
auto const f = Dune::make_shared<Dune::SampleFunction<2> const>(); auto const f = Dune::make_shared<Dune::SampleFunction<2> const>();
auto const phi = Dune::make_shared<Functional::NonlinearityType const>(f); auto const phi = Dune::make_shared<Functional::NonlinearityType const>(f);
Functional J(A, b, phi); Functional const J(A, b, phi);
double ret1; double ret1;
{ {
......
...@@ -20,12 +20,12 @@ int main() { ...@@ -20,12 +20,12 @@ int main() {
typedef Functional::SmallMatrix SmallMatrix; typedef Functional::SmallMatrix SmallMatrix;
typedef Functional::SmallVector SmallVector; typedef Functional::SmallVector SmallVector;
SmallMatrix A = { { 3, 1.5 }, { 1.5, 4 } }; SmallMatrix const A = { { 3, 1.5 }, { 1.5, 4 } };
SmallVector b = { 1, 2 }; SmallVector const b = { 1, 2 };
auto const f = Dune::make_shared<Dune::TrivialFunction const>(); auto const f = Dune::make_shared<Dune::TrivialFunction const>();
auto const phi = Dune::make_shared<Functional::NonlinearityType const>(f); 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 SmallVector solution = { 4.0 / 39.0, 6.0 / 13.0 }; // Analytic solution
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment