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.
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),
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,