]> https://gitweb.dealii.org/ - dealii.git/commitdiff
experimental new grid
authorGuido Kanschat <dr.guido.kanschat@gmail.com>
Thu, 20 Apr 2000 14:40:27 +0000 (14:40 +0000)
committerGuido Kanschat <dr.guido.kanschat@gmail.com>
Thu, 20 Apr 2000 14:40:27 +0000 (14:40 +0000)
git-svn-id: https://svn.dealii.org/trunk@2760 0785d39b-7218-0410-832d-ea1e28bc413d

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

index 2766019c0b344a2a154ef307b83048bf04285a60..9675c23bac8f78dc6703db4e7c2e59672c305b9b 100644 (file)
@@ -107,6 +107,33 @@ class GridGenerator
                            const double        left = 0.,
                            const double        right= 1.);
 
+                                    /**
+                                     * Hypercube with a layer of
+                                     * hypercubes around it. The
+                                     * first two parameters give the
+                                     * lower and upper bound of the
+                                     * inner hypercube in all
+                                     * coordinate directions. @p
+                                     * thickness marks the size of
+                                     * the layer cells.
+                                     *
+                                     * If the flag colorize is set,
+                                     * the outer cells get material
+                                     * id's according tho the
+                                     * following scheme: extending
+                                     * over the inner cube in
+                                     * x-direction: 2. In y-direction
+                                     * 4, in z-direction 8. The cells
+                                     * at corners and edges (3d) get
+                                     * these values bitwise or'd.
+                                     */
+    template<int dim>
+    static void enclosed_hyper_cube (Triangulation<dim> &tria,
+                                    const double        left = 0.,
+                                    const double        right= 1.,
+                                    const double        thickness = 1.,
+                                    bool                colorize = false);
+
                                     /**
                                      * Initialize the given triangulation with a
                                      * hyperball, i.e. a circle or a ball.
index bee3e8b1eec9ec9ba1a79ae46f2b68e659f7ad22..e0cad384a8ce829b66bd33190613930d09905d3b 100644 (file)
@@ -76,7 +76,8 @@ void GridGenerator::hyper_shell<> (Triangulation<1> &,
 template <>
 void GridGenerator::hyper_cube<> (Triangulation<2> &tria,
                                  const double left,
-                                 const double right) {
+                                 const double right)
+{
   const Point<2> vertices[4] = { Point<2>(left,left),
                                 Point<2>(right,left),
                                 Point<2>(right,right),
@@ -90,9 +91,52 @@ void GridGenerator::hyper_cube<> (Triangulation<2> &tria,
   tria.create_triangulation (vector<Point<2> >(&vertices[0], &vertices[4]),
                             cells,
                             SubCellData());       // no boundary information
-};
+}
 
 
+
+template<>
+void GridGenerator::enclosed_hyper_cube (Triangulation<2> &tria,
+                                        const double l,
+                                        const double r,
+                                        const double d,
+                                        bool colorize)
+{
+  vector<Point<2> > vertices(16);
+  double coords[4];
+  coords[0] = l-d;
+  coords[1] = l;
+  coords[2] = r;
+  coords[3] = r+d;
+
+  unsigned int k=0;
+  for (unsigned int i0=0;i0<4;++i0)
+    for (unsigned int i1=0;i1<4;++i1)
+      vertices[k++] = Point<2>(coords[i1], coords[i0]);
+
+  const unsigned char materials[9] = { 6,4,6,
+                                      2,0,2,
+                                      6,4,6 
+  };
+  
+  vector<CellData<2> > cells(9);
+  k = 0;
+  for (unsigned int i0=0;i0<3;++i0)
+    for (unsigned int i1=0;i1<3;++i1)
+      {
+       cells[k].vertices[0] = i1+4*i0;
+       cells[k].vertices[1] = i1+4*i0+1;
+       cells[k].vertices[2] = i1+4*i0+5;
+       cells[k].vertices[3] = i1+4*i0+4;
+       if (colorize)
+         cells[k].material_id = materials[k];
+       ++k;
+      }
+  tria.create_triangulation (vertices,
+                            cells,
+                            SubCellData());       // no boundary information
+}
+  
 template <>
 void GridGenerator::hyper_cube_slit<> (Triangulation<2> &tria,
                                       const double left,

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.