diff --git a/test/valuefactory.hh b/test/valuefactory.hh index 2969b1f6698bfd23bdaca1d8f368fdfcb3ba0729..63618eec2f355911bba1869c72f75e6fe359234e 100644 --- a/test/valuefactory.hh +++ b/test/valuefactory.hh @@ -32,13 +32,12 @@ class ValueFactory<RealTuple<double,1> > public: static void get(std::vector<RealTuple<double,1> >& values) { - int nTestPoints = 5; - double testPoints[5] = {-3, -1, 0, 2, 4}; + std::vector<double> testPoints = {-3, -1, 0, 2, 4}; - values.resize(nTestPoints); + values.resize(testPoints.size()); // Set up elements of S^1 - for (int i=0; i<nTestPoints; i++) + for (size_t i=0; i<values.size(); i++) values[i] = RealTuple<double,1>(testPoints[i]); } @@ -55,23 +54,16 @@ class ValueFactory<RealTuple<double,3> > public: static void get(std::vector<RealTuple<double,3> >& values) { - int nTestPoints = 10; - double testPoints[10][3] = {{1,0,0}, {0,1,0}, {-0.838114,0.356751,-0.412667}, + std::vector<Dune::FieldVector<double,3> > testPoints = {{1,0,0}, {0,1,0}, {-0.838114,0.356751,-0.412667}, {-0.490946,-0.306456,0.81551},{-0.944506,0.123687,-0.304319}, {-0.6,0.1,-0.2},{0.45,0.12,0.517}, {-0.1,0.3,-0.1},{-0.444506,0.123687,0.104319},{-0.7,-0.123687,-0.304319}}; - values.resize(nTestPoints); + values.resize(testPoints.size()); // Set up elements of S^1 - for (int i=0; i<nTestPoints; i++) { - - Dune::FieldVector<double,3> w; - for (int j=0; j<3; j++) - w[j] = testPoints[i][j]; - values[i] = RealTuple<double,3>(w); - - } + for (size_t i=0; i<values.size(); i++) + values[i] = RealTuple<double,3>(testPoints[i]); } @@ -87,18 +79,13 @@ class ValueFactory<UnitVector<double,2> > public: static void get(std::vector<UnitVector<double,2> >& values) { - int nTestPoints = 10; - double testPoints[10][2] = {{1,0}, {0.5,0.5}, {0,1}, {-0.5,0.5}, {-1,0}, {-0.5,-0.5}, {0,-1}, {0.5,-0.5}, {0.1,1}, {1,.1}}; + std::vector<std::array<double,2> > testPoints = {{1,0}, {0.5,0.5}, {0,1}, {-0.5,0.5}, {-1,0}, {-0.5,-0.5}, {0,-1}, {0.5,-0.5}, {0.1,1}, {1,.1}}; - values.resize(nTestPoints); + values.resize(testPoints.size()); // Set up elements of S^1 - for (int i=0; i<nTestPoints; i++) { - - Dune::array<double,2> w = {{testPoints[i][0], testPoints[i][1]}}; - values[i] = UnitVector<double,2>(w); - - } + for (size_t i=0; i<values.size(); i++) + values[i] = UnitVector<double,2>(testPoints[i]); } @@ -115,21 +102,16 @@ class ValueFactory<UnitVector<double,3> > public: static void get(std::vector<UnitVector<double,3> >& values) { - int nTestPoints = 10; - double testPoints[10][3] = {{1,0,0}, {0,1,0}, {-0.838114,0.356751,-0.412667}, + std::vector<std::array<double,3> > testPoints = {{1,0,0}, {0,1,0}, {-0.838114,0.356751,-0.412667}, {-0.490946,-0.306456,0.81551},{-0.944506,0.123687,-0.304319}, {-0.6,0.1,-0.2},{0.45,0.12,0.517}, {-0.1,0.3,-0.1},{-0.444506,0.123687,0.104319},{-0.7,-0.123687,-0.304319}}; - values.resize(nTestPoints); + values.resize(testPoints.size()); // Set up elements of S^1 - for (int i=0; i<nTestPoints; i++) { - - Dune::array<double,3> w = {{testPoints[i][0], testPoints[i][1], testPoints[i][2]}}; - values[i] = UnitVector<double,3>(w); - - } + for (size_t i=0; i<values.size(); i++) + values[i] = UnitVector<double,3>(testPoints[i]); } @@ -146,22 +128,17 @@ class ValueFactory<UnitVector<double,4> > public: static void get(std::vector<UnitVector<double,4> >& values) { - int nTestPoints = 10; - double testPoints[10][4] = {{1,0,0,0}, {0,1,0,0}, {-0.838114,0.356751,-0.412667,0.5}, + std::vector<std::array<double,4> > testPoints = {{1,0,0,0}, {0,1,0,0}, {-0.838114,0.356751,-0.412667,0.5}, {-0.490946,-0.306456,0.81551,0.23},{-0.944506,0.123687,-0.304319,-0.7}, {-0.6,0.1,-0.2,0.8},{0.45,0.12,0.517,0}, {-0.1,0.3,-0.1,0.73},{-0.444506,0.123687,0.104319,-0.23},{-0.7,-0.123687,-0.304319,0.72}}; - values.resize(nTestPoints); + values.resize(testPoints.size()); // Set up elements of S^1 - for (int i=0; i<nTestPoints; i++) { - - Dune::array<double,4> w = {{testPoints[i][0], testPoints[i][1], testPoints[i][2], testPoints[i][3]}}; - values[i] = UnitVector<double,4>(w); - - } + for (size_t i=0; i<values.size(); i++) + values[i] = UnitVector<double,4>(testPoints[i]); } @@ -178,22 +155,17 @@ class ValueFactory<Rotation<double,3> > public: static void get(std::vector<Rotation<double,3> >& values) { - int nTestPoints = 10; - double testPoints[10][4] = {{1,0,0,0}, {0,1,0,0}, {-0.838114,0.356751,-0.412667,0.5}, + std::vector<std::array<double,4> > testPoints = {{1,0,0,0}, {0,1,0,0}, {-0.838114,0.356751,-0.412667,0.5}, {-0.490946,-0.306456,0.81551,0.23},{-0.944506,0.123687,-0.304319,-0.7}, {-0.6,0.1,-0.2,0.8},{0.45,0.12,0.517,0}, {-0.1,0.3,-0.1,0.73},{-0.444506,0.123687,0.104319,-0.23},{-0.7,-0.123687,-0.304319,0.72}}; - values.resize(nTestPoints); + values.resize(testPoints.size()); // Set up elements of S^1 - for (int i=0; i<nTestPoints; i++) { - - Dune::array<double,4> w = {{testPoints[i][0], testPoints[i][1], testPoints[i][2], testPoints[i][3]}}; - values[i] = Rotation<double,3>(w); - - } + for (std::size_t i=0; i<values.size(); i++) + values[i] = Rotation<double,3>(testPoints[i]); } @@ -314,23 +286,16 @@ class ValueFactory<HyperbolicHalfspacePoint<double,2> > public: static void get(std::vector<HyperbolicHalfspacePoint<double,2> >& values) { - int nTestPoints = 10; - double testPoints[10][2] = {{0,2}, {0,1}, {0,0.5}, + std::vector<Dune::FieldVector<double,2> > testPoints = {{0,2}, {0,1}, {0,0.5}, {-0.490946,0.81551},{-0.944506,0.304319}, {-0.6,0.2},{0.45,0.517}, {-0.1,0.1},{-0.444506,0.104319},{-0.7,0.304319}}; - values.resize(nTestPoints); + values.resize(testPoints.size()); // Set up elements of S^1 - for (int i=0; i<nTestPoints; i++) { - - Dune::FieldVector<double,2> w; - for (int j=0; j<2; j++) - w[j] = testPoints[i][j]; - values[i] = HyperbolicHalfspacePoint<double,2>(w); - - } + for (size_t i=0; i<values.size(); i++) + values[i] = HyperbolicHalfspacePoint<double,2>(testPoints[i]); } @@ -346,23 +311,16 @@ class ValueFactory<HyperbolicHalfspacePoint<double,3> > public: static void get(std::vector<HyperbolicHalfspacePoint<double,3> >& values) { - int nTestPoints = 10; - double testPoints[10][3] = {{1,0,0.01}, {0,1,0.01}, {-0.838114,0.356751,0.412667}, + std::vector<Dune::FieldVector<double,3> > testPoints = {{1,0,0.01}, {0,1,0.01}, {-0.838114,0.356751,0.412667}, {-0.490946,-0.306456,0.81551},{-0.944506,0.123687,0.304319}, {-0.6,0.1,0.2},{0.45,0.12,0.517}, {-0.1,0.3,0.1},{-0.444506,0.123687,0.104319},{-0.7,-0.123687,0.304319}}; - values.resize(nTestPoints); + values.resize(testPoints.size()); // Set up elements of S^1 - for (int i=0; i<nTestPoints; i++) { - - Dune::FieldVector<double,3> w; - for (int j=0; j<3; j++) - w[j] = testPoints[i][j]; - values[i] = HyperbolicHalfspacePoint<double,3>(w); - - } + for (size_t i=0; i<values.size(); i++) + values[i] = HyperbolicHalfspacePoint<double,3>(testPoints[i]); }