This function can only work for dim==spacedim-1, and this is also documented.
Consequently, get rid of the dim template argument.
/**
* 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
* @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> ¢er = Point<spacedim>(),
- const double radius = 1.);
+ template <int spacedim>
+ void hyper_sphere (Triangulation<spacedim-1,spacedim> &tria,
+ const Point<spacedim> ¢er = Point<spacedim>(),
+ const double radius = 1.);
/**
* This class produces a hyper-ball intersected with the positive orthant
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);
}
// explicit instantiations
-namespace GridGenerator
-{
-
- template void
- hyper_sphere< 1, 2 > (Triangulation< 1, 2> &,
- const Point<2> ¢er,
- const double radius);
- template void
- hyper_sphere< 2, 3 > (Triangulation< 2, 3> &,
- const Point<3> ¢er,
- const double radius);
-}
#include "grid_generator.inst"
DEAL_II_NAMESPACE_CLOSE
}
+
+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 \{