From 60b4ea4eb832e015cb72afa3a0fe80687782a8fb Mon Sep 17 00:00:00 2001 From: heister Date: Mon, 15 Aug 2011 19:05:31 +0000 Subject: [PATCH] add colorized parameter in GridGenerator::half_hyper_shell() and update changes.h. git-svn-id: https://svn.dealii.org/trunk@24077 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/doc/news/changes.h | 10 ++++++++- deal.II/include/deal.II/grid/grid_generator.h | 17 ++++++++++++-- deal.II/source/grid/grid_generator.cc | 22 ++++++++++++++++--- 3 files changed, 43 insertions(+), 6 deletions(-) diff --git a/deal.II/doc/news/changes.h b/deal.II/doc/news/changes.h index f2eddb807e..8717958f3b 100644 --- a/deal.II/doc/news/changes.h +++ b/deal.II/doc/news/changes.h @@ -91,7 +91,15 @@ changed to use std_cxx1x::_1, std_cxx1x::_2, etc from now on.

General

    -
  1. Extended: Many operations on objects of type Point<0>, Quadrature<0>, etc +
  2. Extended: GridGenerator::half_hyper_shell() got the option +colorize, which assigns different boundary indicators to the +different parts of the boundary. Added GridGenerator::quarter_hyper_shell() +with the same options. +
    +(Timo Heister, 2011/08/15) + +
  3. Extended: Many operations on objects of +type Point<0>, Quadrature<0>, etc (including creation) were previously forbidden since such objects do not make much sense. However, this prevented a lot of code that could otherwise work in a dimension independent way, from working in 1d, e.g. integration on diff --git a/deal.II/include/deal.II/grid/grid_generator.h b/deal.II/include/deal.II/grid/grid_generator.h index 188f02aad6..0e5bc83357 100644 --- a/deal.II/include/deal.II/grid/grid_generator.h +++ b/deal.II/include/deal.II/grid/grid_generator.h @@ -673,6 +673,12 @@ class GridGenerator * computed adaptively such that * the resulting elements have * the least aspect ratio. + * + * If colorize is set to true, the + * inner, outer, left, and right + * boundary get indicator 0, 1, 2, + * and 3, respectively. Otherwise + * all indicators are set to 0. * * @note The triangulation needs to be * void upon calling this @@ -683,7 +689,8 @@ class GridGenerator const Point ¢er, const double inner_radius, const double outer_radius, - const unsigned int n_cells = 0); + const unsigned int n_cells = 0, + const bool colorize = false); /** @@ -706,7 +713,13 @@ class GridGenerator * the resulting elements have * the least aspect ratio. * - * @note The triangulation needs to be + * If colorize is set to true, the + * inner, outer, left, and right + * boundary get indicator 0, 1, 2, + * and 3, respectively. Otherwise + * all indicators are set to 0. + * + * @note The triangulation needs to be * void upon calling this * function. Only implemented in 2d so far. */ diff --git a/deal.II/source/grid/grid_generator.cc b/deal.II/source/grid/grid_generator.cc index 31007f3c5c..515f92b1f2 100644 --- a/deal.II/source/grid/grid_generator.cc +++ b/deal.II/source/grid/grid_generator.cc @@ -1208,7 +1208,8 @@ GridGenerator::half_hyper_shell (Triangulation<1>&, const Point<1>&, const double, const double, - const unsigned int) + const unsigned int, + const bool) { Assert (false, ExcNotImplemented()); } @@ -1635,7 +1636,8 @@ GridGenerator::half_hyper_shell (Triangulation<2> &tria, const Point<2> ¢er, const double inner_radius, const double outer_radius, - const unsigned int n_cells) + const unsigned int n_cells, + const bool colorize) { Assert ((inner_radius > 0) && (inner_radius < outer_radius), ExcInvalidRadii ()); @@ -1695,6 +1697,18 @@ GridGenerator::half_hyper_shell (Triangulation<2> &tria, }; tria.create_triangulation (vertices, cells, SubCellData()); + + if (colorize) + { + Triangulation<2>::cell_iterator cell = tria.begin(); + for (;cell!=tria.end();++cell) + { + cell->face(2)->set_boundary_indicator(1); + } + tria.begin()->face(0)->set_boundary_indicator(3); + + tria.last()->face(1)->set_boundary_indicator(2); + } } @@ -2624,10 +2638,12 @@ GridGenerator::half_hyper_shell (Triangulation<3>& tria, const Point<3>& center, const double inner_radius, const double outer_radius, - const unsigned int n) + const unsigned int n, + const bool colorize) { Assert ((inner_radius > 0) && (inner_radius < outer_radius), ExcInvalidRadii ()); + Assert(colorize == false, ExcNotImplemented()); if (n <= 5) { -- 2.39.5