]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Can't get this simpler than that, I guess.
authorwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Wed, 24 Sep 2003 15:48:34 +0000 (15:48 +0000)
committerwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Wed, 24 Sep 2003 15:48:34 +0000 (15:48 +0000)
git-svn-id: https://svn.dealii.org/trunk@8026 0785d39b-7218-0410-832d-ea1e28bc413d

tests/bits/coarsening_3d.cc

index 67ce04cfe069ed2f7722ce208973f95bbe0226f7..2199f155278dda914b9e34b50506393eedcf71ea 100644 (file)
@@ -21,6 +21,7 @@
 #include <grid/tria_accessor.h>
 #include <grid/tria_iterator.h>
 #include <grid/grid_reordering.h>
+#include <grid/grid_generator.h>
 
 #include <fstream>
 
@@ -40,70 +41,59 @@ void create_coarse_grid (Triangulation<3> &coarse_grid)
   std::vector<CellData<3> > cells;
   SubCellData               sub_cell_data;
   
-                                   // first build up the cells of the
-                                   // cylinder
-  {
-                                     // the vertices in each plane of
-                                     // the cylinder are located on
-                                     // three concentric rings of
-                                     // radii r0, r1, and r2,
-                                     // respectively. first generate
-                                     // these three rings
-    const Point<3> ring_points[8] = { Point<3>(-1,0,0),
-                                      Point<3>(-1,-1,0) / std::sqrt(2.),
-                                      Point<3>(0,-1,0),
-                                      Point<3>(+1,-1,0) / std::sqrt(2.),
-                                      Point<3>(+1,0,0),
-                                      Point<3>(+1,+1,0) / std::sqrt(2.),
-                                      Point<3>(0,+1,0),
-                                      Point<3>(-1,+1,0) / std::sqrt(2.) };
-
-                                     // first the point in the middle
-                                     // and the rest of those on the
-                                     // upper surface
-    vertices.push_back (Point<3>(0,0,0));
-    for (unsigned int i=0; i<8; ++i)
-      vertices.push_back (ring_points[i]);
-
-                                     // then points on lower surface
-    vertices.push_back (Point<3>(0,0,-PhantomGeometry::dz));
-    for (unsigned int i=0; i<8; ++i)
-      vertices.push_back (ring_points[i]
-                          +
-                          Point<3>(0,0,-PhantomGeometry::dz));
-
-    const unsigned int n_vertices_per_surface = 9;
-    Assert (vertices.size() == n_vertices_per_surface*2,
-            ExcInternalError());
+  const Point<3> outer_points[8] = { Point<3>(-1,0,0),
+                                     Point<3>(-1,-1,0),
+                                     Point<3>(0,-1,0),
+                                     Point<3>(+1,-1,0),
+                                     Point<3>(+1,0,0),
+                                     Point<3>(+1,+1,0),
+                                     Point<3>(0,+1,0),
+                                     Point<3>(-1,+1,0) };
+
+                                   // first the point in the middle
+                                   // and the rest of those on the
+                                   // upper surface
+  vertices.push_back (Point<3>(0,0,0));
+  for (unsigned int i=0; i<8; ++i)
+    vertices.push_back (outer_points[i]);
+
+                                   // then points on lower surface
+  vertices.push_back (Point<3>(0,0,-PhantomGeometry::dz));
+  for (unsigned int i=0; i<8; ++i)
+    vertices.push_back (outer_points[i]
+                        +
+                        Point<3>(0,0,-PhantomGeometry::dz));
+
+  const unsigned int n_vertices_per_surface = 9;
+  Assert (vertices.size() == n_vertices_per_surface*2,
+          ExcInternalError());
     
-                                     // next create cells from these
-                                     // vertices. only store the
-                                     // vertices of the upper surface,
-                                     // the lower ones are the same
-                                     // +12
-    const unsigned int connectivity[4][4]
-      = { { 1, 2, 3, 0 },
-          { 3, 4, 5, 0 },
-          { 0, 5, 6, 7 },
-          { 1, 0, 7, 8 } };
+                                   // next create cells from these
+                                   // vertices. only store the
+                                   // vertices of the upper surface,
+                                   // the lower ones are the same
+                                   // +12
+  const unsigned int connectivity[4][4]
+    = { { 1, 2, 3, 0 },
+        { 3, 4, 5, 0 },
+        { 0, 5, 6, 7 },
+        { 1, 0, 7, 8 } };
       
-                                     // now create cells out of this
-    for (unsigned int i=0; i<4; ++i)
-      {
-        CellData<3> cell;
-        for (unsigned int j=0; j<4; ++j)
-          {
-            cell.vertices[j]   = connectivity[i][j];
-            cell.vertices[j+4] = connectivity[i][j]+n_vertices_per_surface;
-          }
-        cell.material_id = 0;
-        cells.push_back (cell);
-      }   
-  }
+                                   // now create cells out of this
+  for (unsigned int i=0; i<3; ++i)
+    {
+      CellData<3> cell;
+      for (unsigned int j=0; j<4; ++j)
+        {
+          cell.vertices[j]   = connectivity[i][j];
+          cell.vertices[j+4] = connectivity[i][j]+n_vertices_per_surface;
+        }
+      cell.material_id = 0;
+      cells.push_back (cell);
+    }
 
                                    // finally generate a triangulation
                                    // out of this
-  GridReordering<3>::reorder_cells (cells);
   coarse_grid.create_triangulation (vertices, cells, sub_cell_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.