From 6db9e271e4d47468b85c6451064f19955ba25808 Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Thu, 30 Jun 2016 12:49:12 -0500 Subject: [PATCH] Minor code cleanups. --- source/grid/manifold_lib.cc | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/source/grid/manifold_lib.cc b/source/grid/manifold_lib.cc index 4031bd58f1..1a8e0a4e36 100644 --- a/source/grid/manifold_lib.cc +++ b/source/grid/manifold_lib.cc @@ -116,10 +116,13 @@ SphericalManifold::pull_back(const Point &space_point) c switch (spacedim) { case 2: + { p[1] = atan2(R[1],R[0]); if (p[1] < 0) p[1] += 2*numbers::PI; break; + } + case 3: { const double z = R[2]; @@ -127,10 +130,11 @@ SphericalManifold::pull_back(const Point &space_point) c if (p[2] < 0) p[2] += 2*numbers::PI; // phi is periodic p[1] = atan2(sqrt(R[0]*R[0]+R[1]*R[1]),z); // theta + break; } - break; + default: - Assert(false, ExcInternalError()); + Assert(false, ExcNotImplemented()); } return p; } @@ -140,7 +144,7 @@ template DerivativeForm<1,spacedim,spacedim> SphericalManifold::push_forward_gradient(const Point &spherical_point) const { - Assert(spherical_point[0] >=0.0, + Assert(spherical_point[0] >= 0.0, ExcMessage("Negative radius for given point.")); const double rho = spherical_point[0]; const double theta = spherical_point[1]; @@ -150,11 +154,14 @@ SphericalManifold::push_forward_gradient(const Point &sp switch (spacedim) { case 2: + { DX[0][0] = cos(theta); DX[0][1] = -rho*sin(theta); DX[1][0] = sin(theta); DX[1][1] = rho*cos(theta); break; + } + case 3: { const double phi= spherical_point[2]; @@ -171,8 +178,9 @@ SphericalManifold::push_forward_gradient(const Point &sp DX[2][2] = 0; break; } + default: - Assert(false, ExcInternalError()); + Assert(false, ExcNotImplemented()); } return DX; } -- 2.39.5