]> https://gitweb.dealii.org/ - dealii.git/commitdiff
fix type in Physics rotation_matrix_2d and 3d 11129/head
authorTimo Heister <timo.heister@gmail.com>
Mon, 2 Nov 2020 19:19:18 +0000 (14:19 -0500)
committerTimo Heister <timo.heister@gmail.com>
Mon, 2 Nov 2020 19:19:18 +0000 (14:19 -0500)
The values were computed as doubles, which means this function can not
be used with Number=float (no constructor for Tensor exists). Fix this.

include/deal.II/physics/transformations.h

index 5ec91326c4a4267bf36890b6ad918c10c4bdee71..d0a365c6f162ac01e21c00520655eb26d91fa37c 100644 (file)
@@ -944,7 +944,7 @@ template <typename Number>
 Tensor<2, 2, Number>
 Physics::Transformations::Rotations::rotation_matrix_2d(const Number &angle)
 {
-  const double rotation[2][2] = {{std::cos(angle), -std::sin(angle)},
+  const Number rotation[2][2] = {{std::cos(angle), -std::sin(angle)},
                                  {std::sin(angle), std::cos(angle)}};
   return Tensor<2, 2>(rotation);
 }
@@ -962,7 +962,7 @@ Physics::Transformations::Rotations::rotation_matrix_3d(
   const Number c              = std::cos(angle);
   const Number s              = std::sin(angle);
   const Number t              = 1. - c;
-  const double rotation[3][3] = {{t * axis[0] * axis[0] + c,
+  const Number rotation[3][3] = {{t * axis[0] * axis[0] + c,
                                   t * axis[0] * axis[1] - s * axis[2],
                                   t * axis[0] * axis[2] + s * axis[1]},
                                  {t * axis[0] * axis[1] + s * axis[2],

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.