]> https://gitweb.dealii.org/ - dealii.git/commitdiff
enclosed_hyper_cube in 3d
authorGuido Kanschat <dr.guido.kanschat@gmail.com>
Fri, 26 May 2000 19:18:23 +0000 (19:18 +0000)
committerGuido Kanschat <dr.guido.kanschat@gmail.com>
Fri, 26 May 2000 19:18:23 +0000 (19:18 +0000)
git-svn-id: https://svn.dealii.org/trunk@2961 0785d39b-7218-0410-832d-ea1e28bc413d

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

index 347e24d60c78d3b32bd2e48e127d15ec3ad0d3ee..f1e1a0e68f06418154e248229878ff72278cd835 100644 (file)
@@ -262,7 +262,7 @@ enum NormType {
  * if access to an object describing the exact form of the boundary is needed, the
  * pointer stored within the triangulation object is accessed.
  *
- * @author Wolfgang Bangerth, 1998
+ * @author Wolfgang Bangerth, Guido Kanschat, 1998, 2000
  */
 class VectorTools
 {
index d5690361fc32542f1b5ac13b0133cfe7c1bd05d0..b44f8eadb0bc4ca3273f19525fbc5532c441155c 100644 (file)
@@ -335,6 +335,61 @@ void GridGenerator::hyper_cube_slit<> (Triangulation<3> &,
 };
 
 
+template<>
+void GridGenerator::enclosed_hyper_cube (Triangulation<3> &tria,
+                                        const double l,
+                                        const double r,
+                                        const double d,
+                                        bool colorize)
+{
+  vector<Point<3> > vertices(64);
+  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)
+      for (unsigned int i2=0;i2<4;++i2)
+       vertices[k++] = Point<3>(coords[i2], coords[i1], coords[i0]);
+
+  const unsigned char materials[27] = {
+       21,20,22,
+       17,16,18,
+       25,24,26,
+       5 , 4, 6,
+       1 , 0, 2,
+       9 , 8,10,
+       37,36,38,
+       33,32,34,
+       41,40,42
+  };
+  
+  vector<CellData<3> > cells(27);
+  k = 0;
+  for (unsigned int i0=0;i0<3;++i0)
+    for (unsigned int i1=0;i1<3;++i1)
+      for (unsigned int i2=0;i2<3;++i2)
+       {
+         cells[k].vertices[0] = i2+4*i1+16*i0;
+         cells[k].vertices[1] = i2+4*i1+16*i0+1;
+         cells[k].vertices[2] = i2+4*i1+16*i0+5;
+         cells[k].vertices[3] = i2+4*i1+16*i0+4;
+         cells[k].vertices[4] = i2+4*i1+16*i0+16;
+         cells[k].vertices[5] = i2+4*i1+16*i0+17;
+         cells[k].vertices[6] = i2+4*i1+16*i0+21;
+         cells[k].vertices[7] = i2+4*i1+16*i0+20;
+         if (colorize)
+           cells[k].material_id = materials[k];
+         ++k;
+       }
+  tria.create_triangulation (vertices,
+                            cells,
+                            SubCellData());       // no boundary information
+}
+  
 template <>
 void GridGenerator::hyper_L<> (Triangulation<3> &tria,
                               const double a,

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.