]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Accidentally broke 1000 tests. Fixed it now.
authorheltai <heltai@0785d39b-7218-0410-832d-ea1e28bc413d>
Thu, 30 Jan 2014 09:18:02 +0000 (09:18 +0000)
committerheltai <heltai@0785d39b-7218-0410-832d-ea1e28bc413d>
Thu, 30 Jan 2014 09:18:02 +0000 (09:18 +0000)
git-svn-id: https://svn.dealii.org/branches/branch_manifold_id@32346 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/source/grid/tria_boundary.cc
deal.II/source/grid/tria_boundary_lib.cc

index 9bfca6e8be96af7aa0801a0b3951a0f61c782988..e7c5040616cce8f68d9fa2d395647ed808b3bcec 100644 (file)
@@ -264,11 +264,20 @@ template <int dim, int spacedim>
 Point<spacedim>
 StraightBoundary<dim, spacedim>::project_to_manifold(const std::vector<Point<spacedim> > &v, 
                                                     const Point<spacedim> &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<dim, spacedim>::project_to_manifold(const std::vector<Point<spa
        return v[0] + s*(v[1]-v[0]);
       }
       break;
-    case 4:
-      {
+  case 34:
+    {
        // let's look at this for simplicity for a quad (dim==2) in a
        // space with spacedim>2:
 
@@ -345,14 +354,12 @@ StraightBoundary<dim, spacedim>::project_to_manifold(const std::vector<Point<spa
              break;
          }
        while (true);
-
        return x_k;
-      }
-      break;
-    default:
-      Assert(false, ExcNotImplemented());
-      return trial_point;
     }
+    break;
+  default:
+    return trial_point;
+  }
 }
 
 
index d7357be4be4870054a66e9a7b84757bf0a63ad76..149edb85398791ea5c84a2ada982ec1baa4e5941 100644 (file)
@@ -368,13 +368,14 @@ HyperShellBoundary<dim>::HyperShellBoundary (const Point<dim> &center)
   :
   PolarManifold<dim>(center)
 {}
+
 template <int dim>
 Point<dim>
 HyperShellBoundary<dim>::project_to_manifold(const std::vector<Point<dim> > &vertices, 
                                             const Point<dim> &p) const {
   double radius = vertices[0].norm();
   Point<dim> newp = p-this->center;
-  return (this->center + radius*p/p.norm());
+  return (this->center + radius*newp/newp.norm());
 }
 
 

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.