From: Luca Heltai Date: Thu, 14 Jul 2016 17:00:38 +0000 (+0200) Subject: Refactored get_new_point with three arguments to get_intermediate_points. X-Git-Tag: v8.5.0-rc1~806^2~2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e11be5e9cebd6f6a026597a08e0e22274205376b;p=dealii.git Refactored get_new_point with three arguments to get_intermediate_points. --- diff --git a/include/deal.II/grid/manifold.h b/include/deal.II/grid/manifold.h index cf440ce88d..d5eadbf073 100644 --- a/include/deal.II/grid/manifold.h +++ b/include/deal.II/grid/manifold.h @@ -125,15 +125,19 @@ namespace Manifolds * @note Unlike almost all other cases in the library, we here interpret the points * in the quadrature object to be in real space, not on the reference cell. * - * Manifold::get_new_point() has a default implementation that can simplify - * this process somewhat: - * Internally, the function calls the Manifold::project_to_manifold() - * function after computing the weighted average of the quadrature points. - * This allows derived classes to only overload Manifold::project_to_manifold() - * for simple situations. This is often useful when describing manifolds that - * are embedded in higher dimensional space, e.g., the surface of a sphere. - * In those cases, the desired new point is simply the (weighted) average - * of the provided point, projected back out onto the sphere. + * Manifold::get_new_point() has a default implementation that can + * simplify this process somewhat: Internally, the function calls the + * Manifold::get_intermediate_point() to compute pair-wise + * intermediate points. Internally the + * Manifold::get_intermediate_point() calls the + * Manifold::project_to_manifold() function after computing the convex + * conbination of the given points. This allows derived classes to + * only overload Manifold::project_to_manifold() for simple + * situations. This is often useful when describing manifolds that are + * embedded in higher dimensional space, e.g., the surface of a + * sphere. In those cases, the desired new point maybe computed + * simply by the (weighted) average of the provided point, projected + * back out onto the sphere. * * *

Common use case: Computing tangent vectors

@@ -291,9 +295,9 @@ public: */ virtual Point - get_new_point (const Point &p1, - const Point &p2, - const double w) const; + get_intermediate_point (const Point &p1, + const Point &p2, + const double w) const; /** * Return the point which shall become the new vertex surrounded by the diff --git a/include/deal.II/grid/manifold_lib.h b/include/deal.II/grid/manifold_lib.h index b390d44dc5..f2d1ad9fa1 100644 --- a/include/deal.II/grid/manifold_lib.h +++ b/include/deal.II/grid/manifold_lib.h @@ -208,9 +208,9 @@ public: */ virtual Point - get_new_point(const Point &p1, - const Point &p2, - const double w) const; + get_intermediate_point(const Point &p1, + const Point &p2, + const double w) const; /** * Compute the derivative of the get_new_point function with diff --git a/source/grid/manifold.cc b/source/grid/manifold.cc index 2235b7daa3..46e5b6739e 100644 --- a/source/grid/manifold.cc +++ b/source/grid/manifold.cc @@ -45,9 +45,9 @@ project_to_manifold (const std::vector > &, template Point Manifold:: -get_new_point (const Point &p1, - const Point &p2, - const double w) const +get_intermediate_point (const Point &p1, + const Point &p2, + const double w) const { std::vector > vertices; vertices.push_back(p1); @@ -73,7 +73,7 @@ get_new_point (const Quadrature &quad) const for (unsigned int i=1; i::SphericalManifold(const Point center) template Point SphericalManifold:: -get_new_point (const Point &p1, - const Point &p2, - const double w) const +get_intermediate_point (const Point &p1, + const Point &p2, + const double w) const { Assert(w >=0.0 && w <= 1.0, ExcMessage("w should be in the range [0.0,1.0].")); diff --git a/tests/manifold/spherical_manifold_01.cc b/tests/manifold/spherical_manifold_01.cc index 79e4f47caf..1cef855d29 100644 --- a/tests/manifold/spherical_manifold_01.cc +++ b/tests/manifold/spherical_manifold_01.cc @@ -13,7 +13,7 @@ // // --------------------------------------------------------------------- -// Check SphericalManifold for get_new_point and get_tangent_vector issues. +// Check SphericalManifold for get_intermediate_point and get_tangent_vector issues. #include "../tests.h" @@ -36,24 +36,24 @@ main() Point<2> P1(1.0, 0.0); Point<2> P2(0.0, 1.0); - Point<2> Q = manifold.get_new_point(P1, P2, .5); + Point<2> Q = manifold.get_intermediate_point(P1, P2, .5); deallog << "=================================" << std::endl;; - deallog << manifold.get_new_point(P1, P2, .125) << std::endl; - deallog << manifold.get_new_point(P1, P2, .25) << std::endl; - deallog << manifold.get_new_point(P1, P2, .375) << std::endl; - deallog << manifold.get_new_point(P1, P2, .5) << std::endl; - deallog << manifold.get_new_point(P1, P2, .625) << std::endl; - deallog << manifold.get_new_point(P1, P2, .75) << std::endl; - deallog << manifold.get_new_point(P1, P2, .875) << std::endl; + deallog << manifold.get_intermediate_point(P1, P2, .125) << std::endl; + deallog << manifold.get_intermediate_point(P1, P2, .25) << std::endl; + deallog << manifold.get_intermediate_point(P1, P2, .375) << std::endl; + deallog << manifold.get_intermediate_point(P1, P2, .5) << std::endl; + deallog << manifold.get_intermediate_point(P1, P2, .625) << std::endl; + deallog << manifold.get_intermediate_point(P1, P2, .75) << std::endl; + deallog << manifold.get_intermediate_point(P1, P2, .875) << std::endl; deallog << "=================================" << std::endl; - deallog << manifold.get_new_point(P1, Q, .25) << std::endl; - deallog << manifold.get_new_point(P1, Q, .5) << std::endl; - deallog << manifold.get_new_point(P1, Q, .75) << std::endl; - deallog << manifold.get_new_point(P1, P2,.5) << std::endl; - deallog << manifold.get_new_point(Q, P2, .25) << std::endl; - deallog << manifold.get_new_point(Q, P2, .5) << std::endl; - deallog << manifold.get_new_point(Q, P2, .75) << std::endl; + deallog << manifold.get_intermediate_point(P1, Q, .25) << std::endl; + deallog << manifold.get_intermediate_point(P1, Q, .5) << std::endl; + deallog << manifold.get_intermediate_point(P1, Q, .75) << std::endl; + deallog << manifold.get_intermediate_point(P1, P2,.5) << std::endl; + deallog << manifold.get_intermediate_point(Q, P2, .25) << std::endl; + deallog << manifold.get_intermediate_point(Q, P2, .5) << std::endl; + deallog << manifold.get_intermediate_point(Q, P2, .75) << std::endl; deallog << "=================================" << std::endl; } @@ -64,24 +64,24 @@ main() Point<2> P1(1.0, 0.0); Point<2> P2(0.0, 1.0); - Point<2> Q = manifold.get_new_point(P1, P2, .5); + Point<2> Q = manifold.get_intermediate_point(P1, P2, .5); deallog << "=================================" << std::endl;; - deallog << manifold.get_new_point(P1, P2, .125) << std::endl; - deallog << manifold.get_new_point(P1, P2, .25) << std::endl; - deallog << manifold.get_new_point(P1, P2, .375) << std::endl; - deallog << manifold.get_new_point(P1, P2, .5) << std::endl; - deallog << manifold.get_new_point(P1, P2, .625) << std::endl; - deallog << manifold.get_new_point(P1, P2, .75) << std::endl; - deallog << manifold.get_new_point(P1, P2, .875) << std::endl; + deallog << manifold.get_intermediate_point(P1, P2, .125) << std::endl; + deallog << manifold.get_intermediate_point(P1, P2, .25) << std::endl; + deallog << manifold.get_intermediate_point(P1, P2, .375) << std::endl; + deallog << manifold.get_intermediate_point(P1, P2, .5) << std::endl; + deallog << manifold.get_intermediate_point(P1, P2, .625) << std::endl; + deallog << manifold.get_intermediate_point(P1, P2, .75) << std::endl; + deallog << manifold.get_intermediate_point(P1, P2, .875) << std::endl; deallog << "=================================" << std::endl; - deallog << manifold.get_new_point(P1, Q, .25) << std::endl; - deallog << manifold.get_new_point(P1, Q, .5) << std::endl; - deallog << manifold.get_new_point(P1, Q, .75) << std::endl; - deallog << manifold.get_new_point(P1, P2,.5) << std::endl; - deallog << manifold.get_new_point(Q, P2, .25) << std::endl; - deallog << manifold.get_new_point(Q, P2, .5) << std::endl; - deallog << manifold.get_new_point(Q, P2, .75) << std::endl; + deallog << manifold.get_intermediate_point(P1, Q, .25) << std::endl; + deallog << manifold.get_intermediate_point(P1, Q, .5) << std::endl; + deallog << manifold.get_intermediate_point(P1, Q, .75) << std::endl; + deallog << manifold.get_intermediate_point(P1, P2,.5) << std::endl; + deallog << manifold.get_intermediate_point(Q, P2, .25) << std::endl; + deallog << manifold.get_intermediate_point(Q, P2, .5) << std::endl; + deallog << manifold.get_intermediate_point(Q, P2, .75) << std::endl; deallog << "=================================" << std::endl; } @@ -92,24 +92,24 @@ main() Point<3> P1(1.0, 0.0, 0.0); Point<3> P2(0.0, 0.0, 1.0); - Point<3> Q = manifold.get_new_point(P1, P2, .5); + Point<3> Q = manifold.get_intermediate_point(P1, P2, .5); deallog << "=================================" << std::endl;; - deallog << manifold.get_new_point(P1, P2, .125) << std::endl; - deallog << manifold.get_new_point(P1, P2, .25) << std::endl; - deallog << manifold.get_new_point(P1, P2, .375) << std::endl; - deallog << manifold.get_new_point(P1, P2, .5) << std::endl; - deallog << manifold.get_new_point(P1, P2, .625) << std::endl; - deallog << manifold.get_new_point(P1, P2, .75) << std::endl; - deallog << manifold.get_new_point(P1, P2, .875) << std::endl; + deallog << manifold.get_intermediate_point(P1, P2, .125) << std::endl; + deallog << manifold.get_intermediate_point(P1, P2, .25) << std::endl; + deallog << manifold.get_intermediate_point(P1, P2, .375) << std::endl; + deallog << manifold.get_intermediate_point(P1, P2, .5) << std::endl; + deallog << manifold.get_intermediate_point(P1, P2, .625) << std::endl; + deallog << manifold.get_intermediate_point(P1, P2, .75) << std::endl; + deallog << manifold.get_intermediate_point(P1, P2, .875) << std::endl; deallog << "=================================" << std::endl; - deallog << manifold.get_new_point(P1, Q, .25) << std::endl; - deallog << manifold.get_new_point(P1, Q, .5) << std::endl; - deallog << manifold.get_new_point(P1, Q, .75) << std::endl; - deallog << manifold.get_new_point(P1, P2,.5) << std::endl; - deallog << manifold.get_new_point(Q, P2, .25) << std::endl; - deallog << manifold.get_new_point(Q, P2, .5) << std::endl; - deallog << manifold.get_new_point(Q, P2, .75) << std::endl; + deallog << manifold.get_intermediate_point(P1, Q, .25) << std::endl; + deallog << manifold.get_intermediate_point(P1, Q, .5) << std::endl; + deallog << manifold.get_intermediate_point(P1, Q, .75) << std::endl; + deallog << manifold.get_intermediate_point(P1, P2,.5) << std::endl; + deallog << manifold.get_intermediate_point(Q, P2, .25) << std::endl; + deallog << manifold.get_intermediate_point(Q, P2, .5) << std::endl; + deallog << manifold.get_intermediate_point(Q, P2, .75) << std::endl; deallog << "=================================" << std::endl; } @@ -120,12 +120,12 @@ main() Point<3> P1(2.0, 0.0, 0.0); Point<3> P2(0.0, std::sqrt(2), std::sqrt(2) ); - Point<3> Q = manifold.get_new_point(P1, P2, .5); + Point<3> Q = manifold.get_intermediate_point(P1, P2, .5); const unsigned int num_points = 20; deallog << "=================================" << std::endl;; for (unsigned int i = 0; i P5(0.707107, 0.707107, 0.0); Point<3> P4(0.0, 0.0, 1.0); - Point<3> R = manifold.get_new_point(P5, P4, 2.0/3.0); + Point<3> R = manifold.get_intermediate_point(P5, P4, 2.0/3.0); deallog << "=================================" << std::endl;; deallog << Q << std::endl; diff --git a/tests/manifold/spherical_manifold_02.cc b/tests/manifold/spherical_manifold_02.cc index 84b448c6cd..d29c7913ea 100644 --- a/tests/manifold/spherical_manifold_02.cc +++ b/tests/manifold/spherical_manifold_02.cc @@ -13,7 +13,7 @@ // // --------------------------------------------------------------------- -// Check SphericalManifold for get_new_point and get_tangent_vector issues. +// Check SphericalManifold for get_intermediate_point and get_tangent_vector issues. #include "../tests.h"