]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Use PolarManifold in SphericalManifold for 2D 5404/head
authorDaniel Arndt <daniel.arndt@iwr.uni-heidelberg.de>
Sun, 5 Nov 2017 19:23:36 +0000 (20:23 +0100)
committerDaniel Arndt <daniel.arndt@iwr.uni-heidelberg.de>
Sun, 5 Nov 2017 21:30:35 +0000 (22:30 +0100)
include/deal.II/grid/manifold_lib.h
source/grid/manifold_lib.cc

index bb808be3dea2aefb50647195b523cd31087871df..6a0294afe5482ecb32798456f85392c672fa54d2 100644 (file)
@@ -248,6 +248,13 @@ public:
    * The center of the spherical coordinate system.
    */
   const Point<spacedim> center;
+
+private:
+
+  /**
+   * A manifold description to be used for get_new_point in 2D.
+   **/
+  const PolarManifold<spacedim> polar_manifold;
 };
 
 
index 5256a5ead9da32ae197dd5ec8c2ac01d55e806d1..94d25fc02efd0b22d30800a297c82923cc8ab0ea 100644 (file)
@@ -245,7 +245,8 @@ PolarManifold<dim,spacedim>::push_forward_gradient(const Point<spacedim> &spheri
 
 template <int dim, int spacedim>
 SphericalManifold<dim,spacedim>::SphericalManifold(const Point<spacedim> center):
-  center(center)
+  center(center),
+  polar_manifold(center)
 {}
 
 
@@ -403,8 +404,10 @@ get_new_point (const ArrayView<const Point<spacedim>> &vertices,
     rho /= total_weights;
   }
 
-  if (spacedim<2)
-    return center + rho*candidate;
+  // If not in 3D, just use the implementation from PolarManifold
+  // after we verified that the candidate is not the center.
+  if (spacedim<3)
+    return polar_manifold.get_new_point(vertices, weights);
 
   // Step 2:
   // Do Newton-style iterations to improve the estimate.

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.