31 template <
int dim,
int spacedim,
class... Arguments>
35 const std::string &arguments,
38 std::function<void(Arguments...)> wrapper =
39 [&tria, &generator](Arguments... args) { generator(tria, args...); };
41 bound_function.parse_arguments(arguments);
51 template <
int dim,
int spacedim>
52 std::enable_if_t<dim != spacedim, bool>
53 generate_codimension_zero_grid(
const std::string &,
67 generate_codimension_zero_grid(
const std::string &name,
68 const std::string &arguments,
71 if (name ==
"simplex")
72 parse_and_create<dim, dim, const std::vector<Point<dim>> &>(
simplex,
75 else if (name ==
"subdivided_hyper_rectangle")
85 const std::vector<unsigned int> &,
96 const std::vector<std::vector<double>> &,
104 else if (name ==
"plate_with_a_hole")
105 parse_and_create<dim,
119 else if (name ==
"channel_with_cylinder")
120 parse_and_create<dim, dim, double, unsigned int, double, bool>(
123 else if (name ==
"enclosed_hyper_cube")
124 parse_and_create<dim, dim, double, double, double, bool>(
127 else if (name ==
"hyper_ball")
128 parse_and_create<dim, dim, const Point<dim> &, double,
bool>(
hyper_ball,
131 else if (name ==
"hyper_ball_balanced")
132 parse_and_create<dim, dim, const Point<dim> &,
double>(
135 else if (name ==
"quarter_hyper_ball")
136 parse_and_create<dim, dim, const Point<dim> &,
double>(
139 else if (name ==
"half_hyper_ball")
140 parse_and_create<dim, dim, const Point<dim> &,
double>(
half_hyper_ball,
144 else if (name ==
"cylinder")
145 parse_and_create<dim, dim, double, double>(
cylinder, arguments, tria);
147 else if (name ==
"subdivided_cylinder")
148 parse_and_create<dim, dim, unsigned int, double, double>(
151 else if (name ==
"truncated_cone")
152 parse_and_create<dim, dim, double, double, double>(
truncated_cone,
156 else if (name ==
"pipe_junction")
157 parse_and_create<dim,
159 const std::vector<std::pair<Point<dim>,
double>> &,
160 const std::pair<Point<dim>,
double> &,
163 else if (name ==
"hyper_L")
164 parse_and_create<dim, dim, double, double, bool>(
hyper_L,
168 else if (name ==
"hyper_cube_slit")
173 else if (name ==
"hyper_shell")
174 parse_and_create<dim,
182 else if (name ==
"half_hyper_shell")
183 parse_and_create<dim,
191 else if (name ==
"quarter_hyper_shell")
192 parse_and_create<dim,
200 else if (name ==
"eccentric_hyper_shell")
201 parse_and_create<dim,
209 else if (name ==
"cylinder_shell")
210 parse_and_create<dim,
219 else if (name ==
"hyper_cube_with_cylindrical_hole")
220 parse_and_create<dim, dim, double, double, double, unsigned int, bool>(
223 else if (name ==
"concentric_hyper_shells")
224 parse_and_create<dim,
234 else if (name ==
"subdivided_hyper_cube_with_simplices")
235 parse_and_create<dim, dim, unsigned int, double, double, bool>(
238 else if (name ==
"subdivided_hyper_rectangle_with_simplices")
239 parse_and_create<dim,
241 const std::vector<unsigned int> &,
260 template <
int dim,
int spacedim>
261 std::enable_if_t<dim != spacedim - 1,
bool>
262 generate_codimension_one_grid(
const std::string &,
276 generate_codimension_one_grid(
const std::string &name,
277 const std::string &arguments,
280 if (name ==
"hyper_sphere")
281 parse_and_create<dim, dim + 1, const Point<dim + 1> &,
double>(
293 template <
int dim,
int spacedim>
295 generate_special(
const std::string &,
308 generate_special(
const std::string &name,
309 const std::string &arguments,
312 if (name ==
"moebius")
313 parse_and_create<3, 3, unsigned int, unsigned int, double, double>(
315 else if (name ==
"torus")
316 parse_and_create<3, 3, double, double, unsigned int, double>(
torus,
332 generate_special(
const std::string &name,
333 const std::string &arguments,
337 parse_and_create<2, 3, double, double, unsigned int, double>(
torus,
350 template <
int dim,
int spacedim>
353 const std::string &name,
354 const std::string &arguments)
358 if (name ==
"hyper_cube")
359 parse_and_create<dim, spacedim, double, double, bool>(
hyper_cube,
362 else if (name ==
"subdivided_hyper_cube")
363 parse_and_create<dim, spacedim, unsigned int, double, double, bool>(
365 else if (name ==
"hyper_rectangle")
366 parse_and_create<dim,
371 else if (name ==
"cheese")
372 parse_and_create<dim, spacedim, const std::vector<unsigned int> &>(
374 else if (name ==
"general_cell")
375 parse_and_create<dim,
377 const std::vector<Point<spacedim>> &,
379 else if (name ==
"hyper_cross")
380 parse_and_create<dim, spacedim, const std::vector<unsigned int> &,
bool>(
389 else if (generate_codimension_zero_grid(name, arguments, tria))
392 else if (generate_codimension_one_grid(name, arguments, tria))
395 else if (generate_special(name, arguments, tria))
402 ExcMessage(name +
"(" + arguments +
") not implemented"));
406#include "grid_generator_from_name.inst"
#define DEAL_II_NAMESPACE_OPEN
#define DEAL_II_NAMESPACE_CLOSE
static ::ExceptionBase & ExcNoMatch(std::string arg1, std::string arg2)
static ::ExceptionBase & ExcMessage(std::string arg1)
#define AssertThrow(cond, exc)
void subdivided_hyper_cube_with_simplices(Triangulation< dim, spacedim > &tria, const unsigned int repetitions, const double p1=0.0, const double p2=1.0, const bool colorize=false)
void hyper_cross(Triangulation< dim, spacedim > &tria, const std::vector< unsigned int > &sizes, const bool colorize_cells=false)
A center cell with stacks of cell protruding from each surface.
void hyper_cube_with_cylindrical_hole(Triangulation< dim, spacedim > &triangulation, const double inner_radius=.25, const double outer_radius=.5, const double L=.5, const unsigned int repetitions=1, const bool colorize=false)
void hyper_ball_balanced(Triangulation< dim > &tria, const Point< dim > ¢er=Point< dim >(), const double radius=1.)
void plate_with_a_hole(Triangulation< dim > &tria, const double inner_radius=0.4, const double outer_radius=1., const double pad_bottom=2., const double pad_top=2., const double pad_left=1., const double pad_right=1., const Point< dim > ¢er=Point< dim >(), const types::manifold_id polar_manifold_id=0, const types::manifold_id tfi_manifold_id=1, const double L=1., const unsigned int n_slices=2, const bool colorize=false)
Rectangular plate with an (offset) cylindrical hole.
void generate_from_name_and_arguments(Triangulation< dim, spacedim > &tria, const std::string &grid_generator_function_name, const std::string &grid_generator_function_arguments)
void enclosed_hyper_cube(Triangulation< dim > &tria, const double left=0., const double right=1., const double thickness=1., const bool colorize=false)
void general_cell(Triangulation< dim, spacedim > &tria, const std::vector< Point< spacedim > > &vertices, const bool colorize=false)
void subdivided_hyper_cube(Triangulation< dim, spacedim > &tria, const unsigned int repetitions, const double left=0., const double right=1., const bool colorize=false)
void hyper_shell(Triangulation< dim, spacedim > &tria, const Point< spacedim > ¢er, const double inner_radius, const double outer_radius, const unsigned int n_cells=0, bool colorize=false)
void hyper_L(Triangulation< dim > &tria, const double left=-1., const double right=1., const bool colorize=false)
void hyper_cube_slit(Triangulation< dim > &tria, const double left=0., const double right=1., const bool colorize=false)
void hyper_ball(Triangulation< dim > &tria, const Point< dim > ¢er=Point< dim >(), const double radius=1., const bool attach_spherical_manifold_on_boundary_cells=false)
void eccentric_hyper_shell(Triangulation< dim > &triangulation, const Point< dim > &inner_center, const Point< dim > &outer_center, const double inner_radius, const double outer_radius, const unsigned int n_cells)
void hyper_rectangle(Triangulation< dim, spacedim > &tria, const Point< dim > &p1, const Point< dim > &p2, const bool colorize=false)
void cylinder(Triangulation< dim > &tria, const double radius=1., const double half_length=1.)
void moebius(Triangulation< 3, 3 > &tria, const unsigned int n_cells, const unsigned int n_rotations, const double R, const double r)
void pipe_junction(Triangulation< dim, spacedim > &tria, const std::vector< std::pair< Point< spacedim >, double > > &openings, const std::pair< Point< spacedim >, double > &bifurcation, const double aspect_ratio=0.5)
void half_hyper_shell(Triangulation< dim > &tria, const Point< dim > ¢er, const double inner_radius, const double outer_radius, const unsigned int n_cells=0, const bool colorize=false)
void quarter_hyper_ball(Triangulation< dim > &tria, const Point< dim > ¢er=Point< dim >(), const double radius=1.)
void cheese(Triangulation< dim, spacedim > &tria, const std::vector< unsigned int > &holes)
Rectangular domain with rectangular pattern of holes.
void subdivided_hyper_rectangle_with_simplices(Triangulation< dim, spacedim > &tria, const std::vector< unsigned int > &repetitions, const Point< dim > &p1, const Point< dim > &p2, const bool colorize=false)
void subdivided_cylinder(Triangulation< dim > &tria, const unsigned int x_subdivisions, const double radius=1., const double half_length=1.)
void channel_with_cylinder(Triangulation< dim > &tria, const double shell_region_width=0.03, const unsigned int n_shells=2, const double skewness=2.0, const bool colorize=false)
void hyper_sphere(Triangulation< spacedim - 1, spacedim > &tria, const Point< spacedim > ¢er=Point< spacedim >(), const double radius=1.)
void concentric_hyper_shells(Triangulation< dim > &triangulation, const Point< dim > ¢er, const double inner_radius=0.125, const double outer_radius=0.25, const unsigned int n_shells=1, const double skewness=0.1, const unsigned int n_cells_per_shell=0, const bool colorize=false)
void subdivided_hyper_rectangle(Triangulation< dim, spacedim > &tria, const std::vector< unsigned int > &repetitions, const Point< dim > &p1, const Point< dim > &p2, const bool colorize=false)
void quarter_hyper_shell(Triangulation< dim > &tria, const Point< dim > ¢er, const double inner_radius, const double outer_radius, const unsigned int n_cells=0, const bool colorize=false)
void hyper_cube(Triangulation< dim, spacedim > &tria, const double left=0., const double right=1., const bool colorize=false)
void torus(Triangulation< dim, spacedim > &tria, const double centerline_radius, const double inner_radius, const unsigned int n_cells_toroidal=6, const double phi=2.0 *numbers::PI)
void simplex(Triangulation< dim, dim > &tria, const std::vector< Point< dim > > &vertices)
void truncated_cone(Triangulation< dim > &tria, const double radius_0=1.0, const double radius_1=0.5, const double half_length=1.0)
void half_hyper_ball(Triangulation< dim > &tria, const Point< dim > ¢er=Point< dim >(), const double radius=1.)
void cylinder_shell(Triangulation< dim > &tria, const double length, const double inner_radius, const double outer_radius, const unsigned int n_radial_cells=0, const unsigned int n_axial_cells=0, const bool colorize=false)
MutableBind< ReturnType, FunctionArgs... > mutable_bind(ReturnType(*function)(FunctionArgs...), std_cxx20::type_identity_t< FunctionArgs > &&...arguments)