From 3475efbb915b7e821984a92185a078f8186f5269 Mon Sep 17 00:00:00 2001 From: wolf Date: Wed, 24 Sep 2003 15:48:34 +0000 Subject: [PATCH] Can't get this simpler than that, I guess. git-svn-id: https://svn.dealii.org/trunk@8026 0785d39b-7218-0410-832d-ea1e28bc413d --- tests/bits/coarsening_3d.cc | 108 ++++++++++++++++-------------------- 1 file changed, 49 insertions(+), 59 deletions(-) diff --git a/tests/bits/coarsening_3d.cc b/tests/bits/coarsening_3d.cc index 67ce04cfe0..2199f15527 100644 --- a/tests/bits/coarsening_3d.cc +++ b/tests/bits/coarsening_3d.cc @@ -21,6 +21,7 @@ #include #include #include +#include #include @@ -40,70 +41,59 @@ void create_coarse_grid (Triangulation<3> &coarse_grid) std::vector > 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); } -- 2.39.5