Reference documentation for deal.II version 9.0.0
grid_generator.h
1 // ---------------------------------------------------------------------
2 //
3 // Copyright (C) 1999 - 2018 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 at
12 // the top level of the deal.II distribution.
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 #include <deal.II/base/exceptions.h>
22 #include <deal.II/base/point.h>
23 #include <deal.II/base/table.h>
24 #include <deal.II/base/function.h>
25 #include <deal.II/grid/tria.h>
26 
27 #include <array>
28 #include <map>
29 
30 DEAL_II_NAMESPACE_OPEN
31 
53 namespace GridGenerator
54 {
58 
85  template <int dim, int spacedim>
87  const double left = 0.,
88  const double right= 1.,
89  const bool colorize= false);
90 
115  template <int dim>
116  void simplex(Triangulation<dim, dim> &tria,
117  const std::vector<Point<dim> > &vertices);
118 
132  template <int dim, int spacedim>
134  const unsigned int repetitions,
135  const double left = 0.,
136  const double right= 1.);
137 
167  template <int dim, int spacedim>
169  const Point<dim> &p1,
170  const Point<dim> &p2,
171  const bool colorize = false);
172 
221  template <int dim, int spacedim>
222  void
224  const std::vector<unsigned int> &repetitions,
225  const Point<dim> &p1,
226  const Point<dim> &p2,
227  const bool colorize=false);
228 
244  template <int dim>
245  void
247  const std::vector<std::vector<double> > &step_sizes,
248  const Point<dim> &p_1,
249  const Point<dim> &p_2,
250  const bool colorize=false);
251 
262  template <int dim>
263  void
265  const std::vector< std::vector<double> > &spacing,
266  const Point<dim> &p,
267  const Table<dim,types::material_id> &material_id,
268  const bool colorize=false);
269 
296  template <int dim, int spacedim>
297  void
299  const std::vector<unsigned int> &holes);
300 
315  template <int dim>
316  void
318  const std::vector<Point<dim> > &vertices,
319  const bool colorize = false);
320 
331  template <int dim>
332  void
334  const Point<dim> (&corners)[dim],
335  const bool colorize=false);
336 
351  template <int dim>
352  void
354  const Point<dim> (&corners) [dim],
355  const bool colorize = false);
356 
367  template <int dim>
368  void
370  const unsigned int n_subdivisions,
371  const Point<dim> (&corners) [dim],
372  const bool colorize = false);
373 
381  template <int dim>
382  void
384 #ifndef _MSC_VER
385  const unsigned int(&n_subdivisions)[dim],
386 #else
387  const unsigned int *n_subdivisions,
388 #endif
389  const Point<dim> (&corners) [dim],
390  const bool colorize = false);
391 
414  template <int dim, int spacedim>
415  void
417  const Point<spacedim> &origin,
418  const std::array<Tensor<1,spacedim>,dim> &edges,
419  const std::vector<unsigned int> &subdivisions = std::vector<unsigned int>(),
420  const bool colorize = false);
421 
436  template <int dim>
438  const double left = 0.,
439  const double right= 1.,
440  const double thickness = 1.,
441  const bool colorize = false);
442 
477  template <int dim>
478  void hyper_ball (Triangulation<dim> &tria,
479  const Point<dim> &center = Point<dim>(),
480  const double radius = 1.,
481  const bool attach_spherical_manifold_on_boundary_cells=false);
482 
508  template <int spacedim>
510  const Point<spacedim> &center = Point<spacedim>(),
511  const double radius = 1.);
512 
524  template <int dim>
526  const Point<dim> &center = Point<dim>(),
527  const double radius = 1.);
528 
540  template <int dim>
542  const Point<dim> &center = Point<dim>(),
543  const double radius = 1.);
544 
568  template <int dim>
569  void cylinder (Triangulation<dim> &tria,
570  const double radius = 1.,
571  const double half_length = 1.);
572 
597  template <int dim>
598  void
600  const double radius_0 = 1.0,
601  const double radius_1 = 0.5,
602  const double half_length = 1.0);
603 
632  template <int dim, int spacedim>
634  const std::vector<unsigned int> &sizes,
635  const bool colorize_cells = false);
636 
670  template <int dim>
671  void hyper_L (Triangulation<dim> &tria,
672  const double left = -1.,
673  const double right= 1.,
674  const bool colorize = false);
675 
693  template <int dim>
695  const double left = 0.,
696  const double right = 1.,
697  const bool colorize = false);
698 
736  template <int dim>
737  void hyper_shell (Triangulation<dim> &tria,
738  const Point<dim> &center,
739  const double inner_radius,
740  const double outer_radius,
741  const unsigned int n_cells = 0,
742  bool colorize = false);
743 
768  template <int dim>
770  const Point<dim> &center,
771  const double inner_radius,
772  const double outer_radius,
773  const unsigned int n_cells = 0,
774  const bool colorize = false);
775 
776 
800  template <int dim>
802  const Point<dim> &center,
803  const double inner_radius,
804  const double outer_radius,
805  const unsigned int n_cells = 0,
806  const bool colorize = false);
807 
827  template <int dim>
829  const double length,
830  const double inner_radius,
831  const double outer_radius,
832  const unsigned int n_radial_cells = 0,
833  const unsigned int n_axial_cells = 0);
834 
835 
836 
858  template <int dim, int spacedim>
860  const double R,
861  const double r);
862 
890  template <int dim>
892  Triangulation<dim> &triangulation,
893  const double inner_radius = .25,
894  const double outer_radius = .5,
895  const double L = .5,
896  const unsigned int repetitions = 1,
897  const bool colorize = false);
898 
912  void moebius (Triangulation<3,3> &tria,
913  const unsigned int n_cells,
914  const unsigned int n_rotations,
915  const double R,
916  const double r);
917 
919 
923 
958  template <int dim, int spacedim>
959  void
960  merge_triangulations (const Triangulation<dim, spacedim> &triangulation_1,
961  const Triangulation<dim, spacedim> &triangulation_2,
963 
997  template <int dim, int spacedim>
998  void
1000  const Triangulation<dim, spacedim> &triangulation_2,
1002 
1038  template <int dim, int spacedim>
1039  void
1041  const std::set<typename Triangulation<dim, spacedim>::active_cell_iterator> &cells_to_remove,
1043 
1058  void
1060  const unsigned int n_slices,
1061  const double height,
1062  Triangulation<3,3> &result);
1063 
1082  void
1084  const std::vector<double> &slice_coordinates,
1085  Triangulation<3,3> &result);
1086 
1087 
1118  template <int dim, int spacedim1, int spacedim2>
1120  Triangulation<dim,spacedim2> &out_tria);
1121 
1123 
1128 
1130 #ifdef _MSC_VER
1131  // Microsoft's VC++ has a bug where it doesn't want to recognize that
1132  // an implementation (definition) of the extract_boundary_mesh function
1133  // matches a declaration. This can apparently only be avoided by
1134  // doing some contortion with the return type using the following
1135  // intermediate type. This is only used when using MS VC++ and uses
1136  // the direct way of doing it otherwise
1137  template <template <int,int> class MeshType, int dim, int spacedim>
1138  struct ExtractBoundaryMesh
1139  {
1140  typedef
1141  std::map<typename MeshType<dim-1,spacedim>::cell_iterator,
1142  typename MeshType<dim,spacedim>::face_iterator>
1143  return_type;
1144  };
1145 #endif
1146 
1221  template <template <int,int> class MeshType, int dim, int spacedim>
1222 #ifndef _MSC_VER
1223  std::map<typename MeshType<dim-1,spacedim>::cell_iterator,
1224  typename MeshType<dim,spacedim>::face_iterator>
1225 #else
1226  typename ExtractBoundaryMesh<MeshType,dim,spacedim>::return_type
1227 #endif
1228  extract_boundary_mesh (const MeshType<dim,spacedim> &volume_mesh,
1229  MeshType<dim-1,spacedim> &surface_mesh,
1230  const std::set<types::boundary_id> &boundary_ids
1231  = std::set<types::boundary_id>());
1232 
1234 
1235 
1239 
1241 
1250  int,
1251  << "The number of repetitions " << arg1
1252  << " must be >=1.");
1257  int,
1258  << "The vector of repetitions must have "
1259  << arg1 << " elements.");
1260 
1265  "The input to this function is oriented in a way that will"
1266  " cause all cells to have negative measure.");
1268 }
1269 
1270 
1271 
1272 DEAL_II_NAMESPACE_CLOSE
1273 
1274 #endif
void create_union_triangulation(const Triangulation< dim, spacedim > &triangulation_1, const Triangulation< dim, spacedim > &triangulation_2, Triangulation< dim, spacedim > &result)
void torus(Triangulation< dim, spacedim > &tria, const double R, const double r)
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 extrude_triangulation(const Triangulation< 2, 2 > &input, const unsigned int n_slices, const double height, Triangulation< 3, 3 > &result)
void enclosed_hyper_cube(Triangulation< dim > &tria, const double left=0., const double right=1., const double thickness=1., const bool colorize=false)
static ::ExceptionBase & ExcInvalidRepetitionsDimension(int arg1)
void parallelogram(Triangulation< dim > &tria, const Point< dim >(&corners)[dim], 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)
void hyper_sphere(Triangulation< spacedim-1, spacedim > &tria, const Point< spacedim > &center=Point< spacedim >(), const double radius=1.)
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 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 general_cell(Triangulation< dim > &tria, const std::vector< Point< dim > > &vertices, const bool colorize=false)
void hyper_L(Triangulation< dim > &tria, const double left=-1., const double right=1., const bool colorize=false)
void merge_triangulations(const Triangulation< dim, spacedim > &triangulation_1, const Triangulation< dim, spacedim > &triangulation_2, Triangulation< dim, spacedim > &result)
void subdivided_parallelepiped(Triangulation< dim > &tria, const unsigned int n_subdivisions, const Point< dim >(&corners) [dim], const bool colorize=false)
void half_hyper_ball(Triangulation< dim > &tria, const Point< dim > &center=Point< dim >(), const double radius=1.)
void simplex(Triangulation< dim, dim > &tria, const std::vector< Point< dim > > &vertices)
Triangulation of a d-simplex with (d+1) vertices and mesh cells.
#define DeclException1(Exception1, type1, outsequence)
Definition: exceptions.h:346
void cylinder(Triangulation< dim > &tria, const double radius=1., const double half_length=1.)
#define DeclExceptionMsg(Exception, defaulttext)
Definition: exceptions.h:335
#define DeclException0(Exception0)
Definition: exceptions.h:323
void quarter_hyper_ball(Triangulation< dim > &tria, const Point< dim > &center=Point< dim >(), const double radius=1.)
void subdivided_hyper_cube(Triangulation< dim, spacedim > &tria, const unsigned int repetitions, const double left=0., const double right=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)
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_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)
static ::ExceptionBase & ExcInvalidRadii()
void cheese(Triangulation< dim, spacedim > &tria, const std::vector< unsigned int > &holes)
Rectangular domain with rectangular pattern of holes.
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)
void hyper_cube(Triangulation< dim, spacedim > &tria, const double left=0., const double right=1., const bool colorize=false)
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:34
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)
void parallelepiped(Triangulation< dim > &tria, const Point< dim >(&corners) [dim], const bool colorize=false)
static ::ExceptionBase & ExcInvalidRepetitions(int arg1)