From ae71e7fba7cf8907b8272f88192de7d0c8a9444f Mon Sep 17 00:00:00 2001 From: Guido Kanschat Date: Mon, 23 Jun 2014 09:52:13 +0000 Subject: [PATCH] colorize hypercubes git-svn-id: https://svn.dealii.org/trunk@33079 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/doc/news/changes.h | 6 ++++++ deal.II/include/deal.II/grid/grid_generator.h | 20 +++++++++++-------- deal.II/source/grid/grid_generator.cc | 5 +++-- deal.II/source/grid/grid_generator.inst.in | 2 +- 4 files changed, 22 insertions(+), 11 deletions(-) diff --git a/deal.II/doc/news/changes.h b/deal.II/doc/news/changes.h index 957f6ddb4d..c8ca073a36 100644 --- a/deal.II/doc/news/changes.h +++ b/deal.II/doc/news/changes.h @@ -148,6 +148,12 @@ inconvenience this causes.

Specific improvements

    +
  1. Improved: GridGenerator::hyper_cube() accepts a + colorize argument. +
    + (Guido Kanschat, 2014/06/23) +
  2. +
  3. New: Functions DoFTools::extract_locally_relevant_dofs(), parallel::distributed::refine_and_coarsen_fixed_number() and parallel::distributed::refine_and_coarsen_fixed_fraction() are diff --git a/deal.II/include/deal.II/grid/grid_generator.h b/deal.II/include/deal.II/grid/grid_generator.h index 27b5dfee0b..6918354afd 100644 --- a/deal.II/include/deal.II/grid/grid_generator.h +++ b/deal.II/include/deal.II/grid/grid_generator.h @@ -54,13 +54,16 @@ template class SparseMatrix; namespace GridGenerator { /** - * Initialize the given triangulation with a hypercube (line in 1D, square - * in 2D, etc) consisting of exactly one cell. The hypercube volume is the - * tensor product interval [left,right]dim in the present - * number of dimensions, where the limits are given as arguments. They - * default to zero and unity, then producing the unit hypercube. All - * boundary indicators are set to zero ("not colorized") for 2d and 3d. In - * 1d the indicators are colorized, see hyper_rectangle(). + * Initialize the given triangulation with a hypercube (line in 1D, + * square in 2D, etc) consisting of exactly one cell. The hypercube + * volume is the tensor product interval + * \f$ [left,right]^{\text{dim}}\f$ in the present number of + * dimensions, where the limits are given as arguments. They default + * to zero and unity, then producing the unit hypercube. If the + * argument `colorize` is false, all boundary indicators are set to + * zero ("not colorized") for 2d and 3d. If it is true, the boundary + * is colorized as in hyper_rectangle(). In 1d the indicators are + * always colorized, see hyper_rectangle(). * * @image html hyper_cubes.png * @@ -73,7 +76,8 @@ namespace GridGenerator template void hyper_cube (Triangulation &tria, const double left = 0., - const double right= 1.); + const double right= 1., + const bool colorize= false); /** * Same as hyper_cube(), but with the difference that not only one cell is diff --git a/deal.II/source/grid/grid_generator.cc b/deal.II/source/grid/grid_generator.cc index 06a3b147e7..7595d5612c 100644 --- a/deal.II/source/grid/grid_generator.cc +++ b/deal.II/source/grid/grid_generator.cc @@ -421,7 +421,8 @@ namespace GridGenerator template void hyper_cube (Triangulation &tria, const double left, - const double right) + const double right, + const bool colorize) { Assert (left < right, ExcMessage ("Invalid left-to-right bounds of hypercube")); @@ -437,7 +438,7 @@ namespace GridGenerator p1(i) = left; p2(i) = right; } - hyper_rectangle (tria, p1, p2); + hyper_rectangle (tria, p1, p2, colorize); } diff --git a/deal.II/source/grid/grid_generator.inst.in b/deal.II/source/grid/grid_generator.inst.in index 913a91ab07..4101f47e36 100644 --- a/deal.II/source/grid/grid_generator.inst.in +++ b/deal.II/source/grid/grid_generator.inst.in @@ -28,7 +28,7 @@ namespace GridGenerator template void hyper_cube ( - Triangulation &, const double, const double); + Triangulation &, const double, const double, const bool); template void -- 2.39.5