From c361e259e0d0a81f227bbe722c256745a832a228 Mon Sep 17 00:00:00 2001 From: heltai Date: Thu, 30 Jan 2014 09:18:02 +0000 Subject: [PATCH] Accidentally broke 1000 tests. Fixed it now. git-svn-id: https://svn.dealii.org/branches/branch_manifold_id@32346 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/source/grid/tria_boundary.cc | 33 ++++++++++++++---------- deal.II/source/grid/tria_boundary_lib.cc | 3 ++- 2 files changed, 22 insertions(+), 14 deletions(-) diff --git a/deal.II/source/grid/tria_boundary.cc b/deal.II/source/grid/tria_boundary.cc index 9bfca6e8be..e7c5040616 100644 --- a/deal.II/source/grid/tria_boundary.cc +++ b/deal.II/source/grid/tria_boundary.cc @@ -264,11 +264,20 @@ template Point StraightBoundary::project_to_manifold(const std::vector > &v, const Point &trial_point) const { - if(spacedim <= 1) - return trial_point; - else - switch(v.size()) { - case 2: + // the following number uniquely identifies all possible situations: + // 22: project to a line, i.e., on a boundary, in 2d + // 32: project to a line, i.e., on a boundary, in 3d + // 24: project to a quad in 2d, i.e., in the interior of the domain + // 34: project to a quad in 3d, i.e., on a boundary + const unsigned int magic = spacedim+10*v.size(); + + // The default behavior is "do nothing", but there are cases when we + // are on a "flat boundary", and we want to project to it. This is a + // hack to maintain backward compatibility with the old boundary + // classes. + switch(magic) { + case 22: + case 32: { // find the point that lies on the line p1--p2. the formulas // pan out to something rather simple because the mapping to @@ -277,8 +286,8 @@ StraightBoundary::project_to_manifold(const std::vector2: @@ -345,14 +354,12 @@ StraightBoundary::project_to_manifold(const std::vector::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()); + return (this->center + radius*newp/newp.norm()); } -- 2.39.5