From: Denis Davydov Date: Mon, 30 Jan 2017 10:11:31 +0000 (+0100) Subject: another test for spherical-cartesian transformation X-Git-Tag: v8.5.0-rc1~188^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2452ec69faa9dacdbed7ca1a199286f4d5d5e54f;p=dealii.git another test for spherical-cartesian transformation --- diff --git a/tests/base/geometric_utilities_02.cc b/tests/base/geometric_utilities_02.cc new file mode 100644 index 0000000000..3f6e5a66ab --- /dev/null +++ b/tests/base/geometric_utilities_02.cc @@ -0,0 +1,68 @@ +// --------------------------------------------------------------------- +// +// Copyright (C) 2016 by the deal.II authors +// +// This file is part of the deal.II library. +// +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + + + +// check GeometricUtilities::Coordinates::to_spherical and +// GeometricUtilities::Coordinates::from_spherical. + +#include "../tests.h" +#include +#include +#include + +#include +#include + +DeclException3(DifferentComponent, + int, + double, + double, + << arg1 <<"-th component is different: " << arg2 << "!=" << arg3); + + +template +void test () +{ + for (double r = 0.1; r < 10; r+= 0.35) + for (double theta = 0; theta < 2*numbers::PI; theta+= numbers::PI/3.) + // Note: for phi=0 or Pi, \theta can be arbitrary and thereby we can't + // have one-to-one correspondence + for (double phi = 0.01; phi <= numbers::PI; phi+= numbers::PI/4.) + { + std_cxx11::array sp; + sp[0] = r; + sp[1] = theta; + sp[2] = phi; + Point p = GeometricUtilities::Coordinates::from_spherical(sp); + const std_cxx11::array sp2 = GeometricUtilities::Coordinates::to_spherical(p); + for (unsigned int i = 0; i (); + + return 0; +} diff --git a/tests/base/geometric_utilities_02.output b/tests/base/geometric_utilities_02.output new file mode 100644 index 0000000000..0fd8fc12f0 --- /dev/null +++ b/tests/base/geometric_utilities_02.output @@ -0,0 +1,2 @@ + +DEAL::OK