Reference documentation for deal.II version Git 180dc024a7 2020-01-22 00:40:46 -0500
\(\newcommand{\vcentcolon}{\mathrel{\mathop{:}}}\) \(\newcommand{\dealcoloneq}{\vcentcolon\mathrel{\mkern-1.2mu}=}\) \(\newcommand{\jump}[1]{\left[\!\left[ #1 \right]\!\right]}\) \(\newcommand{\average}[1]{\left\{\!\left\{ #1 \right\}\!\right\}}\)
grid_generator.h
1 // ---------------------------------------------------------------------
2 //
3 // Copyright (C) 1999 - 2019 by the deal.II authors
4 //
5 // This file is part of the deal.II library.
6 //
7 // The deal.II library is free software; you can use it, redistribute
8 // it, and/or modify it under the terms of the GNU Lesser General
9 // Public License as published by the Free Software Foundation; either
10 // version 2.1 of the License, or (at your option) any later version.
11 // The full text of the license can be found in the file LICENSE.md at
12 // the top level directory of deal.II.
13 //
14 // ---------------------------------------------------------------------
15 
16 #ifndef dealii_grid_generator_h
17 #define dealii_grid_generator_h
18 
19 
20 #include <deal.II/base/config.h>
21 
22 #include <deal.II/base/exceptions.h>
23 #include <deal.II/base/function.h>
24 #include <deal.II/base/parameter_handler.h>
25 #include <deal.II/base/point.h>
26 #include <deal.II/base/table.h>
27 
28 #include <deal.II/grid/tria.h>
29 
30 #include <array>
31 #include <map>
32 
33 DEAL_II_NAMESPACE_OPEN
34 
57 namespace GridGenerator
58 {
62 
92  template <int dim, int spacedim>
93  void
95  const double left = 0.,
96  const double right = 1.,
97  const bool colorize = false);
98 
128  template <int dim>
129  void
131  const std::vector<Point<dim>> &vertices);
132 
161  template <int dim, int spacedim>
162  void
164  const unsigned int repetitions,
165  const double left = 0.,
166  const double right = 1.,
167  const bool colorize = false);
168 
204  template <int dim, int spacedim>
205  void
207  const Point<dim> & p1,
208  const Point<dim> & p2,
209  const bool colorize = false);
210 
261  template <int dim, int spacedim>
262  void
264  const std::vector<unsigned int> &repetitions,
265  const Point<dim> & p1,
266  const Point<dim> & p2,
267  const bool colorize = false);
268 
284  template <int dim>
285  void
287  const std::vector<std::vector<double>> &step_sizes,
288  const Point<dim> & p_1,
289  const Point<dim> & p_2,
290  const bool colorize = false);
291 
302  template <int dim>
303  void
305  const std::vector<std::vector<double>> &spacing,
306  const Point<dim> & p,
307  const Table<dim, types::material_id> &material_id,
308  const bool colorize = false);
309 
335  template <int dim, int spacedim>
336  void
338  const std::vector<unsigned int> &holes);
339 
385  template <int dim>
386  void
388  const double inner_radius = 0.4,
389  const double outer_radius = 1.,
390  const double pad_bottom = 2.,
391  const double pad_top = 2.,
392  const double pad_left = 1.,
393  const double pad_right = 1.,
394  const Point<dim> center = Point<dim>(),
395  const types::manifold_id polar_manifold_id = 0,
396  const types::manifold_id tfi_manifold_id = 1,
397  const double L = 1.,
398  const unsigned int n_slices = 2,
399  const bool colorize = false);
400 
487  template <int dim>
488  void
490  const double shell_region_width = 0.03,
491  const unsigned int n_shells = 2,
492  const double skewness = 2.0,
493  const bool colorize = false);
494 
517  template <int dim, int spacedim>
518  void
520  const std::vector<Point<spacedim>> &vertices,
521  const bool colorize = false);
522 
539  template <int dim>
540  void
542  const Point<dim> (&corners)[dim],
543  const bool colorize = false);
544 
560  template <int dim>
561  void
563  const Point<dim> (&corners)[dim],
564  const bool colorize = false);
565 
577  template <int dim>
578  void
580  const unsigned int n_subdivisions,
581  const Point<dim> (&corners)[dim],
582  const bool colorize = false);
583 
592  template <int dim>
593  void
595 #ifndef _MSC_VER
596  const unsigned int (&n_subdivisions)[dim],
597 #else
598  const unsigned int *n_subdivisions,
599 #endif
600  const Point<dim> (&corners)[dim],
601  const bool colorize = false);
602 
626  template <int dim, int spacedim>
627  void
629  const Point<spacedim> & origin,
630  const std::array<Tensor<1, spacedim>, dim> &edges,
631  const std::vector<unsigned int> &subdivisions = {},
632  const bool colorize = false);
633 
650  template <int dim>
651  void
653  const double left = 0.,
654  const double right = 1.,
655  const double thickness = 1.,
656  const bool colorize = false);
657 
734  template <int dim>
735  void
737  const Point<dim> & center = Point<dim>(),
738  const double radius = 1.,
739  const bool attach_spherical_manifold_on_boundary_cells = false);
740 
767  template <int spacedim>
769  const Point<spacedim> &center = Point<spacedim>(),
770  const double radius = 1.);
771 
783  template <int dim>
784  void
786  const Point<dim> & center = Point<dim>(),
787  const double radius = 1.);
788 
801  template <int dim>
802  void
804  const Point<dim> & center = Point<dim>(),
805  const double radius = 1.);
806 
835  template <int dim>
836  void
838  const double radius = 1.,
839  const double half_length = 1.);
840 
873  template <int dim>
874  void
876  const double radius_0 = 1.0,
877  const double radius_1 = 0.5,
878  const double half_length = 1.0);
879 
908  template <int dim, int spacedim>
909  void
911  const std::vector<unsigned int> &sizes,
912  const bool colorize_cells = false);
913 
949  template <int dim>
950  void
952  const double left = -1.,
953  const double right = 1.,
954  const bool colorize = false);
955 
987  template <int dim, int spacedim>
988  void
990  const std::vector<unsigned int> &repetitions,
991  const Point<dim> & bottom_left,
992  const Point<dim> & top_right,
993  const std::vector<int> & n_cells_to_remove);
994 
1014  template <int dim>
1015  void
1017  const double left = 0.,
1018  const double right = 1.,
1019  const bool colorize = false);
1020 
1060  template <int dim>
1061  void
1063  const Point<dim> & center,
1064  const double inner_radius,
1065  const double outer_radius,
1066  const unsigned int n_cells = 0,
1067  bool colorize = false);
1068 
1102  template <int dim>
1103  void
1105  const Point<dim> & inner_center,
1106  const Point<dim> & outer_center,
1107  const double inner_radius,
1108  const double outer_radius,
1109  const unsigned int n_cells);
1110 
1138  template <int dim>
1139  void
1141  const Point<dim> & center,
1142  const double inner_radius,
1143  const double outer_radius,
1144  const unsigned int n_cells = 0,
1145  const bool colorize = false);
1146 
1147 
1173  template <int dim>
1174  void
1176  const Point<dim> & center,
1177  const double inner_radius,
1178  const double outer_radius,
1179  const unsigned int n_cells = 0,
1180  const bool colorize = false);
1181 
1209  template <int dim>
1210  void
1212  const double length,
1213  const double inner_radius,
1214  const double outer_radius,
1215  const unsigned int n_radial_cells = 0,
1216  const unsigned int n_axial_cells = 0);
1217 
1267  template <int dim, int spacedim>
1268  void
1270  const double R,
1271  const double r,
1272  const unsigned int n_cells_toroidal = 6,
1273  const double phi = 2.0 * numbers::PI);
1274 
1304  template <int dim>
1305  void
1307  const double inner_radius = .25,
1308  const double outer_radius = .5,
1309  const double L = .5,
1310  const unsigned int repetitions = 1,
1311  const bool colorize = false);
1312 
1384  template <int dim>
1385  void
1387  const Point<dim> & center,
1388  const double inner_radius = 0.125,
1389  const double outer_radius = 0.25,
1390  const unsigned int n_shells = 1,
1391  const double skewness = 0.1,
1392  const unsigned int n_cells_per_shell = 0,
1393  const bool colorize = false);
1394 
1408  void moebius(Triangulation<3, 3> &tria,
1409  const unsigned int n_cells,
1410  const unsigned int n_rotations,
1411  const double R,
1412  const double r);
1413 
1451  template <int dim, int spacedim>
1452  void
1455  const std::string & grid_generator_function_name,
1456  const std::string & grid_generator_function_arguments);
1458 
1462 
1523  template <int dim, int spacedim>
1524  void
1525  merge_triangulations(const Triangulation<dim, spacedim> &triangulation_1,
1526  const Triangulation<dim, spacedim> &triangulation_2,
1528  const double duplicated_vertex_tolerance = 1.0e-12,
1529  const bool copy_manifold_ids = false);
1530 
1545  template <int dim, int spacedim>
1546  void
1548  const std::initializer_list<const Triangulation<dim, spacedim> *const>
1549  & triangulations,
1551  const double duplicated_vertex_tolerance = 1.0e-12,
1552  const bool copy_manifold_ids = false);
1553 
1590  template <int dim, int spacedim>
1591  void
1593  const Triangulation<dim, spacedim> &triangulation_1,
1594  const Triangulation<dim, spacedim> &triangulation_2,
1595  Triangulation<dim, spacedim> & result);
1596 
1632  template <int dim, int spacedim>
1633  void
1635  const Triangulation<dim, spacedim> &input_triangulation,
1637  & cells_to_remove,
1639 
1694  void
1696  const Triangulation<2, 2> & input,
1697  const unsigned int n_slices,
1698  const double height,
1699  Triangulation<3, 3> & result,
1700  const bool copy_manifold_ids = false,
1701  const std::vector<types::manifold_id> &manifold_priorities = {});
1702 
1723  void
1725  const Triangulation<2, 2> & input,
1726  const std::vector<double> & slice_coordinates,
1727  Triangulation<3, 3> & result,
1728  const bool copy_manifold_ids = false,
1729  const std::vector<types::manifold_id> &manifold_priorities = {});
1730 
1731 
1766  template <int dim, int spacedim1, int spacedim2>
1767  void
1769  Triangulation<dim, spacedim2> & out_tria);
1770 
1771 
1778  namespace Airfoil
1779  {
1785  {
1790  std::string airfoil_type;
1791 
1799  std::string naca_id;
1800 
1807 
1813 
1818  double height;
1819 
1823  double length_b2;
1824 
1841 
1848  double bias_factor;
1849 
1853  unsigned int refinements;
1854 
1858  unsigned int n_subdivision_x_0;
1859 
1863  unsigned int n_subdivision_x_1;
1864 
1868  unsigned int n_subdivision_x_2;
1869 
1873  unsigned int n_subdivision_y;
1874 
1887 
1891  AdditionalData();
1892 
1898  void
1900  };
1901 
1902 
1903 
1933  template <int dim>
1934  void
1937  const AdditionalData & additional_data = AdditionalData());
1938 
1939 
1940 
1953  template <int dim>
1954  void
1956  Triangulation<dim, dim> & tria,
1957  std::vector<GridTools::PeriodicFacePair<
1958  typename Triangulation<dim, dim>::cell_iterator>> &periodic_faces,
1959  const AdditionalData &additional_data = AdditionalData());
1960 
1961  } // namespace Airfoil
1962 
1964 
1970 
1972 #ifdef _MSC_VER
1973  // Microsoft's VC++ has a bug where it doesn't want to recognize that
1974  // an implementation (definition) of the extract_boundary_mesh function
1975  // matches a declaration. This can apparently only be avoided by
1976  // doing some contortion with the return type using the following
1977  // intermediate type. This is only used when using MS VC++ and uses
1978  // the direct way of doing it otherwise
1979  template <template <int, int> class MeshType, int dim, int spacedim>
1980  struct ExtractBoundaryMesh
1981  {
1982  using return_type =
1983  std::map<typename MeshType<dim - 1, spacedim>::cell_iterator,
1984  typename MeshType<dim, spacedim>::face_iterator>;
1985  };
1986 #endif
1987 
2063  template <template <int, int> class MeshType, int dim, int spacedim>
2064 #ifndef _MSC_VER
2065  std::map<typename MeshType<dim - 1, spacedim>::cell_iterator,
2066  typename MeshType<dim, spacedim>::face_iterator>
2067 #else
2068  typename ExtractBoundaryMesh<MeshType, dim, spacedim>::return_type
2069 #endif
2070  extract_boundary_mesh(const MeshType<dim, spacedim> & volume_mesh,
2071  MeshType<dim - 1, spacedim> & surface_mesh,
2072  const std::set<types::boundary_id> &boundary_ids =
2073  std::set<types::boundary_id>());
2074 
2076 
2077 
2081 
2083 
2092  int,
2093  << "The number of repetitions " << arg1 << " must be >=1.");
2098  int,
2099  << "The vector of repetitions must have " << arg1
2100  << " elements.");
2101 
2106  "The input to this function is oriented in a way that will"
2107  " cause all cells to have negative measure.");
2109 
2110 #ifndef DOXYGEN
2111  // These functions are only implemented with specializations; declare them
2112  // here
2113  template <>
2115  const double,
2116  const double,
2117  const double,
2118  const unsigned int,
2119  const bool);
2120 
2121  template <>
2123  const double,
2124  const double,
2125  const double,
2126  const unsigned int,
2127  const bool);
2128 
2129  template <>
2131  const double,
2132  const double,
2133  const double,
2134  const unsigned int,
2135  const bool);
2136 
2137  template <>
2139  const double,
2140  const unsigned int,
2141  const double,
2142  const bool);
2143 
2144  template <>
2146  const double,
2147  const unsigned int,
2148  const double,
2149  const bool);
2150 
2151  template <>
2153  const double,
2154  const unsigned int,
2155  const double,
2156  const bool);
2157 #endif
2158 } // namespace GridGenerator
2159 
2160 
2161 
2162 DEAL_II_NAMESPACE_CLOSE
2163 
2164 #endif
void create_union_triangulation(const Triangulation< dim, spacedim > &triangulation_1, const Triangulation< dim, spacedim > &triangulation_2, Triangulation< dim, spacedim > &result)
unsigned int manifold_id
Definition: types.h:137
void torus(Triangulation< dim, spacedim > &tria, const double R, const double r, 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 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 concentric_hyper_shells(Triangulation< dim > &triangulation, const Point< dim > &center, 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 general_cell(Triangulation< dim, spacedim > &tria, const std::vector< Point< spacedim >> &vertices, const bool colorize=false)
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 hyper_rectangle(Triangulation< dim, spacedim > &tria, const Point< dim > &p1, const Point< dim > &p2, const bool colorize=false)
void moebius(Triangulation< 3, 3 > &tria, const unsigned int n_cells, const unsigned int n_rotations, const double R, const double r)
void flatten_triangulation(const Triangulation< dim, spacedim1 > &in_tria, Triangulation< dim, spacedim2 > &out_tria)
void quarter_hyper_shell(Triangulation< dim > &tria, const Point< dim > &center, const double inner_radius, const double outer_radius, const unsigned int n_cells=0, const bool colorize=false)
void enclosed_hyper_cube(Triangulation< dim > &tria, const double left=0., const double right=1., const double thickness=1., const bool colorize=false)
void subdivided_parallelepiped(Triangulation< dim > &tria, const unsigned int n_subdivisions, const Point< dim >(&corners)[dim], const bool colorize=false)
static ::ExceptionBase & ExcInvalidRepetitionsDimension(int arg1)
void parallelogram(Triangulation< dim > &tria, const Point< dim >(&corners)[dim], 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 > &tria, const Point< dim > &center, const double inner_radius, const double outer_radius, const unsigned int n_cells=0, bool colorize=false)
static ::ExceptionBase & ExcInvalidInputOrientation()
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)
void create_triangulation(Triangulation< dim, dim > &tria, const AdditionalData &additional_data=AdditionalData())
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_L(Triangulation< dim > &tria, const double left=-1., const double right=1., const bool colorize=false)
void half_hyper_ball(Triangulation< dim > &tria, const Point< dim > &center=Point< dim >(), const double radius=1.)
#define DeclException1(Exception1, type1, outsequence)
Definition: exceptions.h:518
void hyper_sphere(Triangulation< spacedim - 1, spacedim > &tria, const Point< spacedim > &center=Point< spacedim >(), const double radius=1.)
void cylinder(Triangulation< dim > &tria, const double radius=1., const double half_length=1.)
#define DeclExceptionMsg(Exception, defaulttext)
Definition: exceptions.h:496
#define DeclException0(Exception0)
Definition: exceptions.h:473
void quarter_hyper_ball(Triangulation< dim > &tria, const Point< dim > &center=Point< dim >(), const double radius=1.)
void create_triangulation_with_removed_cells(const Triangulation< dim, spacedim > &input_triangulation, const std::set< typename Triangulation< dim, spacedim >::active_cell_iterator > &cells_to_remove, Triangulation< dim, spacedim > &result)
void subdivided_hyper_L(Triangulation< dim, spacedim > &tria, const std::vector< unsigned int > &repetitions, const Point< dim > &bottom_left, const Point< dim > &top_right, const std::vector< int > &n_cells_to_remove)
void extrude_triangulation(const Triangulation< 2, 2 > &input, const unsigned int n_slices, const double height, Triangulation< 3, 3 > &result, const bool copy_manifold_ids=false, const std::vector< types::manifold_id > &manifold_priorities={})
void add_parameters(ParameterHandler &prm)
void hyper_cube_slit(Triangulation< dim > &tria, const double left=0., const double right=1., 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 merge_triangulations(const Triangulation< dim, spacedim > &triangulation_1, const Triangulation< dim, spacedim > &triangulation_2, Triangulation< dim, spacedim > &result, const double duplicated_vertex_tolerance=1.0e-12, const bool copy_manifold_ids=false)
void generate_from_name_and_arguments(Triangulation< dim, spacedim > &tria, const std::string &grid_generator_function_name, const std::string &grid_generator_function_arguments)
static ::ExceptionBase & ExcInvalidRadii()
void cheese(Triangulation< dim, spacedim > &tria, const std::vector< unsigned int > &holes)
Rectangular domain with rectangular pattern of holes.
__global__ void set(Number *val, const Number s, const size_type N)
void parallelepiped(Triangulation< dim > &tria, const Point< dim >(&corners)[dim], const bool colorize=false)
void half_hyper_shell(Triangulation< dim > &tria, const Point< dim > &center, const double inner_radius, const double outer_radius, const unsigned int n_cells=0, const bool colorize=false)
static constexpr double PI
Definition: numbers.h:238
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_cube(Triangulation< dim, spacedim > &tria, const double left=0., const double right=1., const bool colorize=false)
std::map< typename MeshType< dim - 1, spacedim >::cell_iterator, typename MeshType< dim, spacedim >::face_iterator > extract_boundary_mesh(const MeshType< dim, spacedim > &volume_mesh, MeshType< dim - 1, spacedim > &surface_mesh, const std::set< types::boundary_id > &boundary_ids=std::set< types::boundary_id >())
void hyper_ball(Triangulation< dim > &tria, const Point< dim > &center=Point< dim >(), const double radius=1., const bool attach_spherical_manifold_on_boundary_cells=false)
Definition: table.h:699
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 > center=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 hyper_cube_with_cylindrical_hole(Triangulation< dim > &triangulation, const double inner_radius=.25, const double outer_radius=.5, const double L=.5, const unsigned int repetitions=1, const bool colorize=false)
static ::ExceptionBase & ExcInvalidRepetitions(int arg1)