From: heltai Date: Wed, 29 Jan 2014 08:56:25 +0000 (+0000) Subject: Fixed projection. X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d1333abe3a23077e07613b51a9bba4fb774ce201;p=dealii-svn.git Fixed projection. git-svn-id: https://svn.dealii.org/branches/branch_manifold_id@32340 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/include/deal.II/grid/manifold.h b/deal.II/include/deal.II/grid/manifold.h index 48016a8286..5743e42d6c 100644 --- a/deal.II/include/deal.II/grid/manifold.h +++ b/deal.II/include/deal.II/grid/manifold.h @@ -204,6 +204,9 @@ public: get_new_point(const std::vector > &surrounding_points, const std::vector &weights) const; + + using Manifold::project_to_manifold; + /** * Project to FlatManifold: do nothing. Note however that this * function can be overloaded by derived classes, which will then @@ -213,6 +216,7 @@ public: */ virtual Point project_to_manifold (const Point &candidate) const; + private: const Point periodicity; }; diff --git a/deal.II/include/deal.II/grid/tria_boundary_lib.h b/deal.II/include/deal.II/grid/tria_boundary_lib.h index ee1a6319b4..a83b3d89a6 100644 --- a/deal.II/include/deal.II/grid/tria_boundary_lib.h +++ b/deal.II/include/deal.II/grid/tria_boundary_lib.h @@ -390,13 +390,17 @@ class HyperShellBoundary : public PolarManifold { public: /** - * Constructor. The center of the - * spheres defaults to the - * origin. - * - * This class is really just a proxy of its base class. + * Constructor. The center of the spheres defaults to the origin. */ HyperShellBoundary (const Point ¢er = Point()); + + /** + * Project to manifold. The vertices are used to compute + * automatically the radius. + */ + virtual Point + project_to_manifold(const std::vector > &vertices, + const Point &p) const; }; diff --git a/deal.II/source/grid/manifold.cc b/deal.II/source/grid/manifold.cc index 325430448f..dc59e03bf1 100644 --- a/deal.II/source/grid/manifold.cc +++ b/deal.II/source/grid/manifold.cc @@ -117,7 +117,7 @@ get_new_point (const std::vector > &surrounding_points, if(periodicity[d] > 0) p[d] = std::fmod(p[d], periodicity[d]); - return project_to_manifold(p); + return project_to_manifold(surrounding_points, p); } template diff --git a/deal.II/source/grid/tria_boundary_lib.cc b/deal.II/source/grid/tria_boundary_lib.cc index 920e3e8840..831775a029 100644 --- a/deal.II/source/grid/tria_boundary_lib.cc +++ b/deal.II/source/grid/tria_boundary_lib.cc @@ -361,6 +361,15 @@ HyperShellBoundary::HyperShellBoundary (const Point ¢er) : PolarManifold(center) {} +template +Point +HyperShellBoundary::project_to_manifold(const std::vector > &vertices, + const Point &p) const { + double radius = vertices[0].norm(); + Point newp = p-this->center; + return (this->center + radius*p/p.norm()); +} + /* ---------------------------------------------------------------------- */