]> https://gitweb.dealii.org/ - dealii.git/commitdiff
new colorizing scheme for subdivided_hyper_rectangle
authorGuido Kanschat <dr.guido.kanschat@gmail.com>
Thu, 20 Dec 2007 20:50:33 +0000 (20:50 +0000)
committerGuido Kanschat <dr.guido.kanschat@gmail.com>
Thu, 20 Dec 2007 20:50:33 +0000 (20:50 +0000)
git-svn-id: https://svn.dealii.org/trunk@15610 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/deal.II/include/grid/grid_generator.h
deal.II/deal.II/source/grid/grid_generator.cc
deal.II/doc/news/changes.h

index c1fd6359bf416a173d5b389bb697bdabe3ac7077..3f80fd465fafa3185ca9faec11c0a4b34f5f5783 100644 (file)
@@ -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 <i>x<sub>i</sub></i>
+                                     * adds 2<sup>i</sup>. 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 <i>x<sub>i</sub></i>
+                                     * adds 2<sup>i</sup>. For
+                                     * instance, the center point
+                                     * (1,-1,1) yields a material id 5.
                                      *
                                      * @note The triangulation needs to be
                                      * void upon calling this
index b437e0adf7a84f40f9f044d234f6faf1f9770e8a..2fa852a476abd69ec573a5713497fd278198ab03 100644 (file)
@@ -146,7 +146,7 @@ template <int dim>
 void
 GridGenerator::colorize_hyper_rectangle (Triangulation<dim> &)
 {
-                                  // nothing to do in 1d
+                                  // Nothing to do in 1D
 }
 
 
@@ -389,12 +389,12 @@ GridGenerator::subdivided_hyper_cube (Triangulation<dim> &tria,
 
 template <int dim>
 void
-GridGenerator::
-subdivided_hyper_rectangle (Triangulation<dim>              &tria,
-                            const std::vector<unsigned int> &repetitions,
-                            const Point<dim>                &p_1,
-                            const Point<dim>                &p_2,
-                            const bool                       colorize)
+GridGenerator::subdivided_hyper_rectangle (
+  Triangulation<dim>              &tria,
+  const std::vector<unsigned int> &repetitions,
+  const Point<dim>                &p_1,
+  const Point<dim>                &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 <int dim>
 void
-GridGenerator::colorize_subdivided_hyper_rectangle (Triangulation<dim> &,
-                                                   const Point<dim>   &,
-                                                   const Point<dim>   &,
-                                                   const double      )
+GridGenerator::colorize_subdivided_hyper_rectangle (
+  Triangulation<dim>& tria,
+  const Point<dim>&,
+  const Point<dim>&,
+  const double)
 {
-                                  // nothing to do in 1d
+  for (typename Triangulation<dim>::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<dim> &tria,
          
        }
     }
+  for (typename Triangulation<dim>::cell_iterator cell = tria.begin();
+       cell != tria.end(); ++cell)
+    {
+      char id = 0;
+      for (unsigned int d=0;d<dim;++d)
+       if (cell->center()(d) > 0) id += 1 << d;
+      cell->set_material_id(id);
+    }
 }
 
 #endif
index 078933294dd8de370908189b2c34203eadf4c63f..8f0c23c108fd9d6270a9be1924fbeee1a76ff7a5 100644 (file)
@@ -173,6 +173,14 @@ inconvenience this causes.
 
 <ol>
 
+<li> 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.
+<br>
+(GK 2007/12/16)
+</li>
+
 <li> 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.
 
 <ol> 
 
+  <li> <p>Improved: GridGenerator::subdivided_hyper_rectangle now also colorizes
+  cells according to the octant they are in.
+  <br>
+  (GK 2007/12/20)
+  </p></li>
+
+
   <li> <p>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.
-  <p>
+  </p><p>
   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

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.