]> https://gitweb.dealii.org/ - dealii.git/commitdiff
boundary components for rectangle
authorGuido Kanschat <dr.guido.kanschat@gmail.com>
Sun, 13 May 2001 16:13:55 +0000 (16:13 +0000)
committerGuido Kanschat <dr.guido.kanschat@gmail.com>
Sun, 13 May 2001 16:13:55 +0000 (16:13 +0000)
git-svn-id: https://svn.dealii.org/trunk@4596 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/deal.II/include/grid/grid_generator.h
deal.II/deal.II/source/grid/grid_generator.cc

index 9efb8109733df7fe5ef904b6abedc03dbd17cb08..981cb1bf169db6782e94cb13eb8b1d1903dba5b6 100644 (file)
@@ -130,6 +130,18 @@ class GridGenerator
                                      * diagonally opposite corner
                                      * points @p{p1} and @p{p2}.
                                      *
+                                     * If the @p{colorize} flag is
+                                     * set, the
+                                     * @p{boundary_indicator}s of the
+                                     * surfaces are assigned, such
+                                     * that the lower one in
+                                     * @p{x}-direction is 0, the
+                                     * upper one is 1. The indicators
+                                     * for the surfaces in
+                                     * @p{y}-direction are 2 and 3,
+                                     * the ones for @p{z} are 4 and
+                                     * 6.
+                                     * 
                                      * The triangulation needs to be
                                      * void upon calling this
                                      * function.
@@ -137,7 +149,8 @@ class GridGenerator
     template <int dim>
     static void hyper_rectangle (Triangulation<dim> &tria,
                                 const Point<dim>& p1,
-                                const Point<dim>& p2);
+                                const Point<dim>& p2,
+                                bool colorize = false);
 
                                     /**
                                      * Hypercube with a layer of
index d7bf33148ad42fa53889cc3701acfd71b2ad29b1..ff3ed658234c525f3ed53ef9107ec604644a1c85 100644 (file)
 
 #include <grid/grid_generator.h>
 #include <grid/tria.h>
+#include <grid/tria_accessor.h>
+#include <grid/tria_iterator.h>
 #include <cmath>
 
 
 template <int dim>
 void GridGenerator::hyper_rectangle (Triangulation<dim>& tria,
                                     const Point<dim>& p_1,
-                                    const Point<dim>& p_2)
+                                    const Point<dim>& p_2,
+                                    bool colorize)
 {
                                   // First, normalize input such that
                                   // p1 is lower in all coordinate directions.
@@ -89,6 +92,34 @@ void GridGenerator::hyper_rectangle (Triangulation<dim>& tria,
   cells[0].material_id = 0;
 
   tria.create_triangulation (vertices, cells, SubCellData());
+
+                                  // Have to do this, since there are
+                                  // no faces in 1D
+#if (deal_II_dimension>1)
+                                  // Assign boundary indicators
+  if (colorize)
+    {
+      typename Triangulation<dim>::cell_iterator cell = tria.begin();
+      switch(dim)
+       {
+         case 2:
+           cell->face(0)->set_boundary_indicator (2);
+           cell->face(1)->set_boundary_indicator (1);
+           cell->face(2)->set_boundary_indicator (3);
+           cell->face(3)->set_boundary_indicator (0);
+           break;
+         case 3:
+           cell->face(0)->set_boundary_indicator (2);
+           cell->face(1)->set_boundary_indicator (3);
+           cell->face(2)->set_boundary_indicator (4);
+           cell->face(3)->set_boundary_indicator (1);
+           cell->face(4)->set_boundary_indicator (5);
+           cell->face(5)->set_boundary_indicator (0);
+         default:
+           Assert(false, ExcNotImplemented());
+       }
+    }
+#endif
 }
 
 

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.