]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Refactored get_new_point with three arguments to get_intermediate_points.
authorLuca Heltai <luca.heltai@sissa.it>
Thu, 14 Jul 2016 17:00:38 +0000 (19:00 +0200)
committerLuca Heltai <luca.heltai@sissa.it>
Thu, 4 Aug 2016 08:44:10 +0000 (10:44 +0200)
include/deal.II/grid/manifold.h
include/deal.II/grid/manifold_lib.h
source/grid/manifold.cc
source/grid/manifold_lib.cc
tests/manifold/spherical_manifold_01.cc
tests/manifold/spherical_manifold_02.cc

index cf440ce88d510714f2006275d78339b0a57e4d83..d5eadbf073a81097bda05debc4710244391292a3 100644 (file)
@@ -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.
  *
  *
  * <h3>Common use case: Computing tangent vectors</h3>
@@ -291,9 +295,9 @@ public:
    */
   virtual
   Point<spacedim>
-  get_new_point (const Point<spacedim> &p1,
-                 const Point<spacedim> &p2,
-                 const double w) const;
+  get_intermediate_point (const Point<spacedim> &p1,
+                          const Point<spacedim> &p2,
+                          const double w) const;
 
   /**
    * Return the point which shall become the new vertex surrounded by the
index b390d44dc5388f144291030f3fd24e6fae7a9bfb..f2d1ad9fa1e0e2c1c70a672fbad67f46fdb4d801 100644 (file)
@@ -208,9 +208,9 @@ public:
    */
   virtual
   Point<spacedim>
-  get_new_point(const Point<spacedim> &p1,
-                const Point<spacedim> &p2,
-                const double w) const;
+  get_intermediate_point(const Point<spacedim> &p1,
+                         const Point<spacedim> &p2,
+                         const double w) const;
 
   /**
    * Compute the derivative of the get_new_point function with
index 2235b7daa3aa7233ace80de2fcee423ff53a954f..46e5b6739e08b7c2f135fd2322a4218d80772fb3 100644 (file)
@@ -45,9 +45,9 @@ project_to_manifold (const std::vector<Point<spacedim> > &,
 template <int dim, int spacedim>
 Point<spacedim>
 Manifold<dim, spacedim>::
-get_new_point (const Point<spacedim> &p1,
-               const Point<spacedim> &p2,
-               const double w) const
+get_intermediate_point (const Point<spacedim> &p1,
+                        const Point<spacedim> &p2,
+                        const double w) const
 {
   std::vector<Point<spacedim> > vertices;
   vertices.push_back(p1);
@@ -73,7 +73,7 @@ get_new_point (const Quadrature<spacedim> &quad) const
   for (unsigned int i=1; i<sorted_quad.size(); ++i)
     {
       if ( w != 0 )
-        p = get_new_point(p, sorted_quad.point(i) , w/(sorted_quad.weight(i) + w) );
+        p = get_intermediate_point(p, sorted_quad.point(i) , w/(sorted_quad.weight(i) + w) );
       w += sorted_quad.weight(i);
     }
 
index 85faf3cdfedc3602852dfc1307025496b2dfa70f..690d57ea02c069ac835899ff17a170c76383bdcc 100644 (file)
@@ -171,9 +171,9 @@ SphericalManifold<dim,spacedim>::SphericalManifold(const Point<spacedim> center)
 template <int dim, int spacedim>
 Point<spacedim>
 SphericalManifold<dim,spacedim>::
-get_new_point (const Point<spacedim> &p1,
-               const Point<spacedim> &p2,
-               const double w) const
+get_intermediate_point (const Point<spacedim> &p1,
+                        const Point<spacedim> &p2,
+                        const double w) const
 {
   Assert(w >=0.0 && w <= 1.0,
          ExcMessage("w should be in the range [0.0,1.0]."));
index 79e4f47caf588f8edf46a8a467b20a194c6c853f..1cef855d296d62dd03295fca89ddd1ce3b7fcf75 100644 (file)
@@ -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<num_points; i++)
-      deallog << manifold.get_new_point(P1, P2, (1.0*i)/(num_points-1)) << std::endl;
+      deallog << manifold.get_intermediate_point(P1, P2, (1.0*i)/(num_points-1)) << std::endl;
     deallog << "=================================" << std::endl;
   }
 
@@ -168,7 +168,7 @@ main()
 
     Point<3> 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;
index 84b448c6cdcf199b98515db1e80f55e79623cef4..d29c7913ea993d8c3b46d6169c7cdd04b6e67fd1 100644 (file)
@@ -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"
 

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.