From ceb9f23a6cae4e8915fb5b21289c2e3b970fd043 Mon Sep 17 00:00:00 2001 From: guido Date: Thu, 7 Nov 2002 09:43:07 +0000 Subject: [PATCH] colorize for slit domain git-svn-id: https://svn.dealii.org/trunk@6738 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/deal.II/include/grid/grid_generator.h | 26 +++++++++++++++---- deal.II/deal.II/source/grid/grid_generator.cc | 17 +++++++++--- 2 files changed, 35 insertions(+), 8 deletions(-) diff --git a/deal.II/deal.II/include/grid/grid_generator.h b/deal.II/deal.II/include/grid/grid_generator.h index a036785a06..d27009c435 100644 --- a/deal.II/deal.II/include/grid/grid_generator.h +++ b/deal.II/deal.II/include/grid/grid_generator.h @@ -100,14 +100,18 @@ template class SparseMatrix; * of the eight child-cubes from one of their neighbors. * @end{itemize} * + * Some of these functions receive a flag @p{colorize}. If this is + * set, parts of the boundary receive different boundary numbers, + * allowing them to be distinguished by application programs. See the + * documentation of the functions for details. + * * Additionally this class provides a function * (@p{laplace_transformation}) that smoothly transforms a grid * according to given new boundary points. This can be used to * transform (simple-shaped) grids to a more complicated ones, like a * shell onto a grid of an airfoil, for example. * - * @author Wolfgang Bangerth, 1998, 1999. Slit domain by Stefan - * Nauber, 1999. Laplace transformation by Ralf Hartmann, 2001. + * @author Wolfgang Bangerth, Ralf Hartmann, Guido Kanschat, Stefan Nauber, 1998, 1999, 2000, 2001, 2002. */ class GridGenerator { @@ -360,23 +364,35 @@ class GridGenerator */ static void hyper_cube_slit (Triangulation<1> &tria, const double left = 0., - const double right= 1.); + const double right= 1., + const bool colorize = false); /** * Declaration of same function * for different space dimension. + * + * If colorize is selected, then + * the two edges forming the slit + * carry numbers 1 and 2, while + * the outer boundary has number + * 0. */ static void hyper_cube_slit (Triangulation<2> &tria, const double left = 0., - const double right= 1.); + const double right= 1., + const bool colorize = false); /** * Declaration of same function * for different space dimension. + * + * Colorization is not + * implemented in 3D. */ static void hyper_cube_slit (Triangulation<3> &tria, const double left = 0., - const double right= 1.); + const double right= 1., + const bool colorize = false); /** * Produce a hyper-shell, diff --git a/deal.II/deal.II/source/grid/grid_generator.cc b/deal.II/deal.II/source/grid/grid_generator.cc index 9d45b7ba7b..b3a67b781c 100644 --- a/deal.II/deal.II/source/grid/grid_generator.cc +++ b/deal.II/deal.II/source/grid/grid_generator.cc @@ -162,7 +162,8 @@ void GridGenerator::hyper_cube (Triangulation &tria, void GridGenerator::hyper_cube_slit (Triangulation<1> &, const double, - const double) + const double, + const bool) { Assert (false, ExcNotImplemented()); }; @@ -257,7 +258,8 @@ void GridGenerator::enclosed_hyper_cube (Triangulation<2> &tria, void GridGenerator::hyper_cube_slit (Triangulation<2> &tria, const double left, - const double right) + const double right, + const bool colorize) { const double rl2=(right+left)/2; const Point<2> vertices[10] = { Point<2>(left, left ), @@ -284,6 +286,14 @@ GridGenerator::hyper_cube_slit (Triangulation<2> &tria, tria.create_triangulation (std::vector >(&vertices[0], &vertices[10]), cells, SubCellData()); // no boundary information + + if (colorize) + { + Triangulation<2>::cell_iterator cell = tria.begin(); + cell->face(1)->set_boundary_indicator(1); + ++cell; + cell->face(3)->set_boundary_indicator(2); + } }; @@ -531,7 +541,8 @@ GridGenerator::half_hyper_shell (Triangulation<2> &tria, void GridGenerator::hyper_cube_slit (Triangulation<3> &, const double, - const double) + const double, + const bool) { Assert (false, ExcNotImplemented()); }; -- 2.39.5