From 098adbb522f70d46e8819978f0b1d0413e5a7ed8 Mon Sep 17 00:00:00 2001 From: kanschat Date: Thu, 20 Dec 2007 20:50:33 +0000 Subject: [PATCH] new colorizing scheme for subdivided_hyper_rectangle git-svn-id: https://svn.dealii.org/trunk@15610 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/deal.II/include/grid/grid_generator.h | 24 ++++++++++--- deal.II/deal.II/source/grid/grid_generator.cc | 36 ++++++++++++------- deal.II/doc/news/changes.h | 17 ++++++++- 3 files changed, 60 insertions(+), 17 deletions(-) diff --git a/deal.II/deal.II/include/grid/grid_generator.h b/deal.II/deal.II/include/grid/grid_generator.h index c1fd6359bf..3f80fd465f 100644 --- a/deal.II/deal.II/include/grid/grid_generator.h +++ b/deal.II/deal.II/include/grid/grid_generator.h @@ -109,7 +109,7 @@ class GridGenerator /** * Create a coordinate-parallel - * parallelepiped from the two + * brick from the two * diagonally opposite corner * points @p p1 and @p p2. * @@ -123,9 +123,17 @@ class GridGenerator * for the surfaces in * @p y-direction are 2 and 3, * the ones for @p z are 4 and - * 5. + * 5. Additionally, material ids + * are assigned to the cells + * according to the octant their + * center is in: being in the right half + * plane for any coordinate + * direction xi + * adds 2i. For + * instance, the center point + * (1,-1,1) yields a material id 5. * - * The triangulation needs to be + * @note The triangulation needs to be * void upon calling this * function. */ @@ -167,7 +175,15 @@ class GridGenerator * for the surfaces in * @p y-direction are 2 and 3, * the ones for @p z are 4 and - * 5. + * 5. Additionally, material ids + * are assigned to the cells + * according to the octant their + * center is in: being in the right half + * plane for any coordinate + * direction xi + * adds 2i. For + * instance, the center point + * (1,-1,1) yields a material id 5. * * @note The triangulation needs to be * void upon calling this diff --git a/deal.II/deal.II/source/grid/grid_generator.cc b/deal.II/deal.II/source/grid/grid_generator.cc index b437e0adf7..2fa852a476 100644 --- a/deal.II/deal.II/source/grid/grid_generator.cc +++ b/deal.II/deal.II/source/grid/grid_generator.cc @@ -146,7 +146,7 @@ template void GridGenerator::colorize_hyper_rectangle (Triangulation &) { - // nothing to do in 1d + // Nothing to do in 1D } @@ -389,12 +389,12 @@ GridGenerator::subdivided_hyper_cube (Triangulation &tria, template void -GridGenerator:: -subdivided_hyper_rectangle (Triangulation &tria, - const std::vector &repetitions, - const Point &p_1, - const Point &p_2, - const bool colorize) +GridGenerator::subdivided_hyper_rectangle ( + Triangulation &tria, + const std::vector &repetitions, + const Point &p_1, + const Point &p_2, + const bool colorize) { // contributed by Joerg R. Weimar // (j.weimar@jweimar.de) 2003 @@ -1020,12 +1020,16 @@ subdivided_hyper_rectangle (Triangulation<3>& tria, // Implementation for 1D only template void -GridGenerator::colorize_subdivided_hyper_rectangle (Triangulation &, - const Point &, - const Point &, - const double ) +GridGenerator::colorize_subdivided_hyper_rectangle ( + Triangulation& tria, + const Point&, + const Point&, + const double) { - // nothing to do in 1d + for (typename Triangulation::cell_iterator cell = tria.begin(); + cell != tria.end(); ++cell) + if (cell->center()(0) > 0) + cell->set_material_id(1); // boundary indicators are set to // 0 (left) and 1 (right) by default. } @@ -1076,6 +1080,14 @@ GridGenerator::colorize_subdivided_hyper_rectangle (Triangulation &tria, } } + for (typename Triangulation::cell_iterator cell = tria.begin(); + cell != tria.end(); ++cell) + { + char id = 0; + for (unsigned int d=0;dcenter()(d) > 0) id += 1 << d; + cell->set_material_id(id); + } } #endif diff --git a/deal.II/doc/news/changes.h b/deal.II/doc/news/changes.h index 078933294d..8f0c23c108 100644 --- a/deal.II/doc/news/changes.h +++ b/deal.II/doc/news/changes.h @@ -173,6 +173,14 @@ inconvenience this causes.
    +
  1. Improved: All GrowingVectorMemory objects of one type will access +the same memory pool. Therefore, it is now not a crime to just create +one and discard later. Furthermore, logging of statistics has been +switched off by default, such that linear solvers remain silent. +
    +(GK 2007/12/16) +
  2. +
  3. Fixed: Vector::operator/= can't work when the scaling factor is zero, but it happened to check whether the factor was positive. That's of course bogus, the check should have been whether it is non-zero. This has now been @@ -203,6 +211,13 @@ constraints individually.
      +
    1. Improved: GridGenerator::subdivided_hyper_rectangle now also colorizes + cells according to the octant they are in. +
      + (GK 2007/12/20) +

    2. + +
    3. New: The DataOut, DataOutRotation, DataOutStack, and DataOutFaces can now deal with vector-valued data if the functions in DataOutBase that write in a particular graphical output format can deal with it. @@ -210,7 +225,7 @@ constraints individually. they were all output as logically independent scalar components; most visualization programs then allowed to display vector fields by composing them of individual scalar fields for each vector component. -

      +

      With the new scheme, the DataOut_DoFData::add_data_vector() functions inherited by the classes listed above take an additional parameter that may be used to indicate that certain components of the data -- 2.39.5