From 2b302ed4a6265371ef95490741d892312cb8c874 Mon Sep 17 00:00:00 2001 From: wolf Date: Thu, 16 Dec 1999 14:27:00 +0000 Subject: [PATCH] Add HalfHyperBallBoundary and move implementation of constructors of HyperBallBoundary to .cc file. git-svn-id: https://svn.dealii.org/trunk@2073 0785d39b-7218-0410-832d-ea1e28bc413d --- .../deal.II/include/grid/tria_boundary_lib.h | 42 +++++++++++++++-- .../deal.II/source/grid/tria_boundary_lib.cc | 45 +++++++++++++++++++ 2 files changed, 84 insertions(+), 3 deletions(-) diff --git a/deal.II/deal.II/include/grid/tria_boundary_lib.h b/deal.II/deal.II/include/grid/tria_boundary_lib.h index 5f4839d907..1145323449 100644 --- a/deal.II/deal.II/include/grid/tria_boundary_lib.h +++ b/deal.II/deal.II/include/grid/tria_boundary_lib.h @@ -31,8 +31,8 @@ class HyperBallBoundary : public StraightBoundary { /** * Constructor */ - HyperBallBoundary (const Point p=Point(), const double radius=1.0) : - center(p), radius(radius) {}; + HyperBallBoundary (const Point p = Point(), + const double radius = 1.0); /** * Refer to the general documentation of @@ -51,7 +51,7 @@ class HyperBallBoundary : public StraightBoundary { get_new_point_on_quad (const typename Triangulation::quad_iterator &quad) const; - private: + protected: /** * Center point of the hyperball. */ @@ -63,6 +63,42 @@ class HyperBallBoundary : public StraightBoundary { const double radius; }; + + +/** + * Variant of #HyperBallBoundary# which denotes a half hyper ball + * where the first coordinate is restricted to the range $x>=0$ (or + * $x>=center(0)$). In two dimensions, this equals the right half + * circle, in three space dimensions it is a half ball. + * + * @author Wolfgang Bangerth, 1999 + */ +template +class HalfHyperBallBoundary : public HyperBallBoundary { + public: + /** + * Constructor + */ + HalfHyperBallBoundary (const Point p = Point(), + const double radius = 1.0); + + /** + * Check if on the line #x==0#, + * otherwise pass to the base + * class. + */ + virtual Point + get_new_point_on_line (const typename Triangulation::line_iterator &line) const; + + /** + * Check if on the line #x==0#, + * otherwise pass to the base + * class. + */ + virtual Point + get_new_point_on_quad (const typename Triangulation::quad_iterator &quad) const; +}; + diff --git a/deal.II/deal.II/source/grid/tria_boundary_lib.cc b/deal.II/deal.II/source/grid/tria_boundary_lib.cc index d2d012b320..2aed965181 100644 --- a/deal.II/deal.II/source/grid/tria_boundary_lib.cc +++ b/deal.II/deal.II/source/grid/tria_boundary_lib.cc @@ -10,6 +10,14 @@ +template +HyperBallBoundary::HyperBallBoundary (const Point p, + const double radius) : + center(p), radius(radius) +{}; + + + template Point HyperBallBoundary::get_new_point_on_line (const typename Triangulation::line_iterator &line) const @@ -59,6 +67,42 @@ get_new_point_on_quad (const typename Triangulation::quad_iterator &quad) c +template +HalfHyperBallBoundary::HalfHyperBallBoundary (const Point center, + const double radius) : + HyperBallBoundary (center, radius) +{}; + + + +template +Point +HalfHyperBallBoundary:: +get_new_point_on_line (const typename Triangulation::line_iterator &line) const +{ + const Point line_center = line->center(); + if (line_center(0) == center(0)) + return line_center; + else + return HyperBallBoundary::get_new_point_on_line (line); +}; + + + + +template +Point +HalfHyperBallBoundary:: +get_new_point_on_quad (const typename Triangulation::quad_iterator &quad) const +{ + const Point quad_center = quad->center(); + if (quad_center(0) == center(0)) + return quad_center; + else + return HyperBallBoundary::get_new_point_on_quad (quad); +}; + + template HyperShellBoundary::HyperShellBoundary (const Point ¢er) : @@ -129,4 +173,5 @@ get_new_point_on_quad (const typename Triangulation::quad_iterator &quad) c // explicit instantiations template class HyperBallBoundary; +template class HalfHyperBallBoundary; template class HyperShellBoundary; -- 2.39.5