From bfdd1319da9fae4218abb93859b781b2df4d1d15 Mon Sep 17 00:00:00 2001 From: Martin Kronbichler Date: Thu, 2 Nov 2017 13:57:48 +0100 Subject: [PATCH] Add test case. --- tests/manifold/chart_manifold_10.cc | 106 ++++++++++++++++++++++++ tests/manifold/chart_manifold_10.output | 49 +++++++++++ 2 files changed, 155 insertions(+) create mode 100644 tests/manifold/chart_manifold_10.cc create mode 100644 tests/manifold/chart_manifold_10.output diff --git a/tests/manifold/chart_manifold_10.cc b/tests/manifold/chart_manifold_10.cc new file mode 100644 index 0000000000..92a2dc820d --- /dev/null +++ b/tests/manifold/chart_manifold_10.cc @@ -0,0 +1,106 @@ +// --------------------------------------------------------------------- +// +// Copyright (C) 2017 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 ChartManifold::get_intermediate_point + +#include "../tests.h" + +#include +#include + + +template +void +print_intermediate_point (const Manifold &manifold, + const std::string &manifold_name, + const Point &p1, + const Point &p2, + const double weight) +{ + const std::vector > points({{p1, p2}}); + const std::vector weights({{1-weight, weight}}); + deallog.precision(3); + deallog << manifold_name << " between points [" << p1 << "] and [" + << p2 << "] with weight " << weight << std::endl; + deallog.precision(12); + deallog << "Intermediate point: " + << manifold.get_intermediate_point(p1, p2, weight) + << std::endl + << "get_new_point: " + << manifold.get_new_point(points, weights) << std::endl; +} + + +int +main() +{ + initlog(); + + const PolarManifold<2> polar; + { + Point<2> p1(1., 0.1); + Point<2> p2(0.1, 1); + print_intermediate_point(polar, "PolarManifold", p1, p2, 0.1); + print_intermediate_point(polar, "PolarManifold", p1, p2, 0.5); + print_intermediate_point(polar, "PolarManifold", p1, p2, 0.9); + } + { + Point<2> p1(1., 0.1); + Point<2> p2(1., -0.1); + print_intermediate_point(polar, "PolarManifold", p1, p2, 0.1); + print_intermediate_point(polar, "PolarManifold", p1, p2, 0.5); + print_intermediate_point(polar, "PolarManifold", p1, p2, 0.9); + } + { + Point<2> p1(1., 0.1); + Point<2> p2(-1., -0.099); + print_intermediate_point(polar, "PolarManifold", p1, p2, 0.5); + } + { + Point<2> p1(1., 0.1); + Point<2> p2(-1., -0.101); + print_intermediate_point(polar, "PolarManifold", p1, p2, 0.5); + } + + const CylindricalManifold<3> cylindrical(2); + { + Point<3> p1(1., 0.1, 0.2); + Point<3> p2(0.1, 1, 0.2); + print_intermediate_point(cylindrical, "CylindricalManifold", p1, p2, 0.1); + print_intermediate_point(cylindrical, "CylindricalManifold", p1, p2, 0.5); + print_intermediate_point(cylindrical, "CylindricalManifold", p1, p2, 0.9); + } + { + Point<3> p1(1., 0.1, 0.2); + Point<3> p2(-1, -0.099, 0.2); + print_intermediate_point(cylindrical, "CylindricalManifold", p1, p2, 0.5); + } + { + Point<3> p1(1., 0.1, 0.2); + Point<3> p2(-1, -0.101, 0.2); + print_intermediate_point(cylindrical, "CylindricalManifold", p1, p2, 0.5); + } + { + Point<3> p1(1., 0.1, 0.2); + Point<3> p2(-1, -0.101, 0.5); + print_intermediate_point(cylindrical, "CylindricalManifold", p1, p2, 0.1); + print_intermediate_point(cylindrical, "CylindricalManifold", p1, p2, 0.5); + print_intermediate_point(cylindrical, "CylindricalManifold", p1, p2, 0.9); + } + + + + return 0; +} diff --git a/tests/manifold/chart_manifold_10.output b/tests/manifold/chart_manifold_10.output new file mode 100644 index 0000000000..f078660880 --- /dev/null +++ b/tests/manifold/chart_manifold_10.output @@ -0,0 +1,49 @@ + +DEAL::PolarManifold between points [1.00 0.100] and [0.100 1.00] with weight 0.100 +DEAL::Intermediate point: 0.976938594605 0.235777400045 +DEAL::get_new_point: 0.976938594605 0.235777400045 +DEAL::PolarManifold between points [1.00 0.100] and [0.100 1.00] with weight 0.500 +DEAL::Intermediate point: 0.710633520178 0.710633520178 +DEAL::get_new_point: 0.710633520178 0.710633520178 +DEAL::PolarManifold between points [1.00 0.100] and [0.100 1.00] with weight 0.900 +DEAL::Intermediate point: 0.235777400045 0.976938594605 +DEAL::get_new_point: 0.235777400045 0.976938594605 +DEAL::PolarManifold between points [1.00 0.100] and [1.00 -0.100] with weight 0.100 +DEAL::Intermediate point: 1.00179457081 0.0800477225761 +DEAL::get_new_point: 1.00179457081 0.0800477225761 +DEAL::PolarManifold between points [1.00 0.100] and [1.00 -0.100] with weight 0.500 +DEAL::Intermediate point: 1.00498756211 9.06555268871e-17 +DEAL::get_new_point: 1.00498756211 9.06555268871e-17 +DEAL::PolarManifold between points [1.00 0.100] and [1.00 -0.100] with weight 0.900 +DEAL::Intermediate point: 1.00179457081 -0.0800477225761 +DEAL::get_new_point: 1.00179457081 -0.0800477225761 +DEAL::PolarManifold between points [1.00 0.100] and [-1.00 -0.0990] with weight 0.500 +DEAL::Intermediate point: -0.0994999878052 1.00000012499 +DEAL::get_new_point: -0.0994999878052 1.00000012499 +DEAL::PolarManifold between points [1.00 0.100] and [-1.00 -0.101] with weight 0.500 +DEAL::Intermediate point: 0.100499987687 -1.00000012499 +DEAL::get_new_point: 0.100499987687 -1.00000012499 +DEAL::CylindricalManifold between points [1.00 0.100 0.200] and [0.100 1.00 0.200] with weight 0.100 +DEAL::Intermediate point: 0.976938594605 0.235777400045 0.200000000000 +DEAL::get_new_point: 0.976938594605 0.235777400045 0.200000000000 +DEAL::CylindricalManifold between points [1.00 0.100 0.200] and [0.100 1.00 0.200] with weight 0.500 +DEAL::Intermediate point: 0.710633520178 0.710633520178 0.200000000000 +DEAL::get_new_point: 0.710633520178 0.710633520178 0.200000000000 +DEAL::CylindricalManifold between points [1.00 0.100 0.200] and [0.100 1.00 0.200] with weight 0.900 +DEAL::Intermediate point: 0.235777400045 0.976938594605 0.200000000000 +DEAL::get_new_point: 0.235777400045 0.976938594605 0.200000000000 +DEAL::CylindricalManifold between points [1.00 0.100 0.200] and [-1.00 -0.0990 0.200] with weight 0.500 +DEAL::Intermediate point: -0.0994999878052 1.00000012499 0.200000000000 +DEAL::get_new_point: -0.0994999878052 1.00000012499 0.200000000000 +DEAL::CylindricalManifold between points [1.00 0.100 0.200] and [-1.00 -0.101 0.200] with weight 0.500 +DEAL::Intermediate point: 0.100499987687 -1.00000012499 0.200000000000 +DEAL::get_new_point: 0.100499987687 -1.00000012499 0.200000000000 +DEAL::CylindricalManifold between points [1.00 0.100 0.200] and [-1.00 -0.101 0.500] with weight 0.100 +DEAL::Intermediate point: 0.981989158853 -0.213816255219 0.230000000000 +DEAL::get_new_point: 0.981989158853 -0.213816255219 0.230000000000 +DEAL::CylindricalManifold between points [1.00 0.100 0.200] and [-1.00 -0.101 0.500] with weight 0.500 +DEAL::Intermediate point: 0.100499987687 -1.00000012499 0.350000000000 +DEAL::get_new_point: 0.100499987687 -1.00000012499 0.350000000000 +DEAL::CylindricalManifold between points [1.00 0.100 0.200] and [-1.00 -0.101 0.500] with weight 0.900 +DEAL::Intermediate point: -0.919876745725 -0.404978606564 0.470000000000 +DEAL::get_new_point: -0.919876745725 -0.404978606564 0.470000000000 -- 2.39.5