]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Restrict the template arguments of GridGenerator::hyper_sphere.
authorWolfgang Bangerth <bangerth@colostate.edu>
Thu, 25 Jan 2018 17:45:45 +0000 (10:45 -0700)
committerWolfgang Bangerth <bangerth@colostate.edu>
Thu, 25 Jan 2018 17:45:45 +0000 (10:45 -0700)
This function can only work for dim==spacedim-1, and this is also documented.
Consequently, get rid of the dim template argument.

include/deal.II/grid/grid_generator.h
source/grid/grid_generator.cc
source/grid/grid_generator.inst.in

index a2b392a013274fd1b708933fc664b47a6c86955d..c9ba00a1c1a8af1f975e660bfbc48b3a4ea942fa 100644 (file)
@@ -461,7 +461,7 @@ namespace GridGenerator
   /**
    * Creates a hyper sphere, i.e., a surface of a ball in @p spacedim
    * dimensions. This function only exists for dim+1=spacedim in 2 and 3 space
-   * dimensions.
+   * dimensions. (To create a mesh of a ball, use GridGenerator::hyper_ball().)
    *
    * You should attach a SphericalManifold to the cells and faces for correct
    * placement of vertices upon refinement and to be able to use higher order
@@ -490,10 +490,10 @@ namespace GridGenerator
    * @note The triangulation needs to be void upon calling this function.
    */
 
-  template <int dim, int spacedim>
-  void hyper_sphere (Triangulation<dim,spacedim> &tria,
-                     const Point<spacedim>   &center = Point<spacedim>(),
-                     const double        radius = 1.);
+  template <int spacedim>
+  void hyper_sphere (Triangulation<spacedim-1,spacedim> &tria,
+                     const Point<spacedim>              &center = Point<spacedim>(),
+                     const double                        radius = 1.);
 
   /**
    * This class produces a hyper-ball intersected with the positive orthant
index 67cbecd2555fcd99123067a040511fb312fa4bb9..550411a1dcee3eeab820986ecc7e4911dd5a5ff8 100644 (file)
@@ -3060,11 +3060,13 @@ namespace GridGenerator
       SubCellData());       // no boundary information
   }
 
-  template <int dim, int spacedim>
+
+
+  template <int spacedim>
   void
-  hyper_sphere (Triangulation<dim,spacedim> &tria,
-                const Point<spacedim>   &p,
-                const double      radius)
+  hyper_sphere (Triangulation<spacedim-1,spacedim> &tria,
+                const Point<spacedim>              &p,
+                const double                        radius)
   {
     Triangulation<spacedim> volume_mesh;
     GridGenerator::hyper_ball(volume_mesh,p,radius);
@@ -4646,18 +4648,6 @@ namespace GridGenerator
 }
 
 // explicit instantiations
-namespace GridGenerator
-{
-
-  template void
-  hyper_sphere< 1,  2 > (Triangulation< 1,   2> &,
-                         const Point<2>   &center,
-                         const double        radius);
-  template void
-  hyper_sphere< 2,  3 > (Triangulation< 2,   3> &,
-                         const Point<3>   &center,
-                         const double        radius);
-}
 #include "grid_generator.inst"
 
 DEAL_II_NAMESPACE_CLOSE
index 5a7783f5938b23a17b9916776317bcf23ab93b03..5913a232b032632c839389735ab1ebe46e1c2c74 100644 (file)
@@ -167,6 +167,20 @@ for (deal_II_dimension : DIMENSIONS)
 }
 
 
+
+for (deal_II_space_dimension : DIMENSIONS)
+{
+    namespace GridGenerator \{
+
+#if deal_II_space_dimension >= 2
+    template void
+    hyper_sphere<deal_II_space_dimension> (
+        Triangulation<deal_II_space_dimension-1, deal_II_space_dimension> &, const Point<deal_II_space_dimension> &, double);
+#endif
+
+    \}
+}
+
 for (deal_II_dimension : DIMENSIONS ; deal_II_space_dimension : SPACE_DIMENSIONS; deal_II_space_dimension_2 : SPACE_DIMENSIONS)
 {
     namespace GridGenerator \{

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.