Reference documentation for deal.II version 8.5.1
grid_generator.h
1 // ---------------------------------------------------------------------
2 //
3 // Copyright (C) 1999 - 2017 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/std_cxx11/array.h>
22 #include <deal.II/base/exceptions.h>
23 #include <deal.II/base/point.h>
24 #include <deal.II/base/table.h>
25 #include <deal.II/base/function.h>
26 #include <deal.II/grid/tria.h>
27 #include <map>
28 
29 DEAL_II_NAMESPACE_OPEN
30 
43 namespace GridGenerator
44 {
48 
75  template <int dim, int spacedim>
77  const double left = 0.,
78  const double right= 1.,
79  const bool colorize= false);
80 
105  template <int dim>
106  void simplex(Triangulation<dim, dim> &tria,
107  const std::vector<Point<dim> > &vertices);
108 
122  template <int dim, int spacedim>
124  const unsigned int repetitions,
125  const double left = 0.,
126  const double right= 1.);
127 
161  template <int dim, int spacedim>
163  const Point<dim> &p1,
164  const Point<dim> &p2,
165  const bool colorize = false);
166 
215  template <int dim, int spacedim>
216  void
218  const std::vector<unsigned int> &repetitions,
219  const Point<dim> &p1,
220  const Point<dim> &p2,
221  const bool colorize=false);
222 
238  template <int dim>
239  void
241  const std::vector<std::vector<double> > &step_sizes,
242  const Point<dim> &p_1,
243  const Point<dim> &p_2,
244  const bool colorize=false);
245 
256  template <int dim>
257  void
259  const std::vector< std::vector<double> > &spacing,
260  const Point<dim> &p,
261  const Table<dim,types::material_id> &material_id,
262  const bool colorize=false);
263 
290  template <int dim, int spacedim>
291  void
293  const std::vector<unsigned int> &holes);
294 
309  template <int dim>
310  void
312  const std::vector<Point<dim> > &vertices,
313  const bool colorize = false);
314 
325  template <int dim>
326  void
328  const Point<dim> (&corners)[dim],
329  const bool colorize=false);
330 
345  template <int dim>
346  void
348  const Point<dim> (&corners) [dim],
349  const bool colorize = false);
350 
361  template <int dim>
362  void
364  const unsigned int n_subdivisions,
365  const Point<dim> (&corners) [dim],
366  const bool colorize = false);
367 
375  template <int dim>
376  void
378 #ifndef _MSC_VER
379  const unsigned int(&n_subdivisions)[dim],
380 #else
381  const unsigned int *n_subdivisions,
382 #endif
383  const Point<dim> (&corners) [dim],
384  const bool colorize = false);
385 
408  template <int dim, int spacedim>
409  void
411  const Point<spacedim> &origin,
412  const std_cxx11::array<Tensor<1,spacedim>,dim> &edges,
413  const std::vector<unsigned int> &subdivisions = std::vector<unsigned int>(),
414  const bool colorize = false);
415 
430  template <int dim>
432  const double left = 0.,
433  const double right= 1.,
434  const double thickness = 1.,
435  const bool colorize = false);
436 
455  template <int dim>
456  void hyper_ball (Triangulation<dim> &tria,
457  const Point<dim> &center = Point<dim>(),
458  const double radius = 1.);
459 
492  template <int dim, int spacedim>
494  const Point<spacedim> &center = Point<spacedim>(),
495  const double radius = 1.);
496 
508  template <int dim>
510  const Point<dim> &center = Point<dim>(),
511  const double radius = 1.);
512 
526  template <int dim>
528  const Point<dim> &center = Point<dim>(),
529  const double radius = 1.);
530 
551  template <int dim>
552  void cylinder (Triangulation<dim> &tria,
553  const double radius = 1.,
554  const double half_length = 1.);
555 
580  template <int dim>
581  void
583  const double radius_0 = 1.0,
584  const double radius_1 = 0.5,
585  const double half_length = 1.0);
586 
615  template <int dim, int spacedim>
617  const std::vector<unsigned int> &sizes,
618  const bool colorize_cells = false);
619 
652  template <int dim>
653  void hyper_L (Triangulation<dim> &tria,
654  const double left = -1.,
655  const double right= 1.,
656  const bool colorize = false);
657 
675  template <int dim>
677  const double left = 0.,
678  const double right = 1.,
679  const bool colorize = false);
680 
745  template <int dim>
746  void hyper_shell (Triangulation<dim> &tria,
747  const Point<dim> &center,
748  const double inner_radius,
749  const double outer_radius,
750  const unsigned int n_cells = 0,
751  bool colorize = false);
752 
774  template <int dim>
776  const Point<dim> &center,
777  const double inner_radius,
778  const double outer_radius,
779  const unsigned int n_cells = 0,
780  const bool colorize = false);
781 
782 
803  template <int dim>
805  const Point<dim> &center,
806  const double inner_radius,
807  const double outer_radius,
808  const unsigned int n_cells = 0,
809  const bool colorize = false);
810 
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 
859  template <int dim, int spacedim>
861  const double R,
862  const double r);
863 
864 
865 
886  template<int dim>
888  Triangulation<dim> &triangulation,
889  const double inner_radius = .25,
890  const double outer_radius = .5,
891  const double L = .5,
892  const unsigned int repetitions = 1,
893  const bool colorize = false);
894 
908  void moebius (Triangulation<3,3> &tria,
909  const unsigned int n_cells,
910  const unsigned int n_rotations,
911  const double R,
912  const double r);
913 
915 
919 
951  template <int dim, int spacedim>
952  void
953  merge_triangulations (const Triangulation<dim, spacedim> &triangulation_1,
954  const Triangulation<dim, spacedim> &triangulation_2,
956 
986  template <int dim, int spacedim>
987  void
989  const Triangulation<dim, spacedim> &triangulation_2,
991 
1024  template <int dim, int spacedim>
1025  void
1027  const std::set<typename Triangulation<dim, spacedim>::active_cell_iterator> &cells_to_remove,
1029 
1030 
1041  void
1043  const unsigned int n_slices,
1044  const double height,
1045  Triangulation<3,3> &result);
1046 
1073  template <int dim, int spacedim1, int spacedim2>
1075  Triangulation<dim,spacedim2> &out_tria);
1076 
1078 
1083 
1085 #ifdef _MSC_VER
1086  // Microsoft's VC++ has a bug where it doesn't want to recognize that
1087  // an implementation (definition) of the extract_boundary_mesh function
1088  // matches a declaration. This can apparently only be avoided by
1089  // doing some contortion with the return type using the following
1090  // intermediate type. This is only used when using MS VC++ and uses
1091  // the direct way of doing it otherwise
1092  template <template <int,int> class MeshType, int dim, int spacedim>
1093  struct ExtractBoundaryMesh
1094  {
1095  typedef
1096  std::map<typename MeshType<dim-1,spacedim>::cell_iterator,
1097  typename MeshType<dim,spacedim>::face_iterator>
1098  return_type;
1099  };
1100 #endif
1101 
1172  template <template <int,int> class MeshType, int dim, int spacedim>
1173 #ifndef _MSC_VER
1174  std::map<typename MeshType<dim-1,spacedim>::cell_iterator,
1175  typename MeshType<dim,spacedim>::face_iterator>
1176 #else
1177  typename ExtractBoundaryMesh<MeshType,dim,spacedim>::return_type
1178 #endif
1179  extract_boundary_mesh (const MeshType<dim,spacedim> &volume_mesh,
1180  MeshType<dim-1,spacedim> &surface_mesh,
1181  const std::set<types::boundary_id> &boundary_ids
1182  = std::set<types::boundary_id>());
1183 
1185 
1186 
1190 
1192 
1201  int,
1202  << "The number of repetitions " << arg1
1203  << " must be >=1.");
1208  int,
1209  << "The vector of repetitions must have "
1210  << arg1 << " elements.");
1211 
1216  "The input to this function is oriented in a way that will"
1217  " cause all cells to have negative measure.");
1219 }
1220 
1221 
1222 
1223 DEAL_II_NAMESPACE_CLOSE
1224 
1225 #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 hyper_sphere(Triangulation< dim, spacedim > &tria, const Point< spacedim > &center=Point< spacedim >(), const double radius=1.)
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)
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:564
void cylinder(Triangulation< dim > &tria, const double radius=1., const double half_length=1.)
#define DeclExceptionMsg(Exception, defaulttext)
Definition: exceptions.h:553
#define DeclException0(Exception0)
Definition: exceptions.h:541
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)
Definition: table.h:33
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 hyper_ball(Triangulation< dim > &tria, const Point< dim > &center=Point< dim >(), const double radius=1.)
void parallelepiped(Triangulation< dim > &tria, const Point< dim >(&corners) [dim], const bool colorize=false)
static ::ExceptionBase & ExcInvalidRepetitions(int arg1)