]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Fixed projection.
authorheltai <heltai@0785d39b-7218-0410-832d-ea1e28bc413d>
Wed, 29 Jan 2014 08:56:25 +0000 (08:56 +0000)
committerheltai <heltai@0785d39b-7218-0410-832d-ea1e28bc413d>
Wed, 29 Jan 2014 08:56:25 +0000 (08:56 +0000)
git-svn-id: https://svn.dealii.org/branches/branch_manifold_id@32340 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/include/deal.II/grid/manifold.h
deal.II/include/deal.II/grid/tria_boundary_lib.h
deal.II/source/grid/manifold.cc
deal.II/source/grid/tria_boundary_lib.cc

index 48016a8286e98ac4f8fd4f3c658cb338edeab4c9..5743e42d6c188cd218c32e4f7e68994be101fd46 100644 (file)
@@ -204,6 +204,9 @@ public:
     get_new_point(const std::vector<Point<spacedim> > &surrounding_points,
                  const std::vector<double> &weights) const;
   
+  
+  using Manifold<spacedim>::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<spacedim> project_to_manifold (const Point<spacedim> &candidate) const;
+
 private:
   const Point<spacedim> periodicity;
 };
index ee1a6319b4a324c8ef26e97e132fb51dfd100b34..a83b3d89a6b7398bc8928e910001cf38a5ad23eb 100644 (file)
@@ -390,13 +390,17 @@ class HyperShellBoundary : public PolarManifold<dim>
 {
 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<dim> &center = Point<dim>());
+  
+  /**
+   * Project to manifold. The vertices are used to compute
+   * automatically the radius.
+   */
+  virtual Point<dim>
+  project_to_manifold(const std::vector<Point<dim> > &vertices, 
+                     const Point<dim> &p) const;
 };
 
 
index 325430448ff264bec2867d2560b29ec5a6e6fd8f..dc59e03bf18347110b8671605e1ab65ce4fc5dcb 100644 (file)
@@ -117,7 +117,7 @@ get_new_point (const std::vector<Point<spacedim> > &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 <int spacedim>
index 920e3e8840eea7948052aad6b1239809c6269d25..831775a029a3c09bdc739f92d8e1e0f5183721d1 100644 (file)
@@ -361,6 +361,15 @@ 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());
+}
+
 
 
 /* ---------------------------------------------------------------------- */

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.