From ed262e5566aac469fc3dfb871c91436c073ee9dd Mon Sep 17 00:00:00 2001 From: Luca Heltai Date: Fri, 10 Feb 2006 00:23:04 +0000 Subject: [PATCH] Corrected 2 small bugs that rendered the half_hyper_ball unusable in 3d. git-svn-id: https://svn.dealii.org/trunk@12289 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/deal.II/source/grid/grid_generator.cc | 25 +++++++++++++++---- tests/bits/grid_generator_01/cmp/generic | 16 ++++++------ 2 files changed, 28 insertions(+), 13 deletions(-) diff --git a/deal.II/deal.II/source/grid/grid_generator.cc b/deal.II/deal.II/source/grid/grid_generator.cc index a0a24c986c..b456408dea 100644 --- a/deal.II/deal.II/source/grid/grid_generator.cc +++ b/deal.II/deal.II/source/grid/grid_generator.cc @@ -1336,8 +1336,8 @@ GridGenerator::half_hyper_ball (Triangulation& tria, const double b = a/2.0; const double c = d/2.0; // And so are these - const double hb = a*std::sqrt(3.0)/2.0; - const double hc = d*std::sqrt(3.0)/2.0; + const double hb = radius*std::sqrt(3.0)/4.0; + const double hc = radius*std::sqrt(3.0)/2.0; Point vertices[16] = { center+Point( 0, d, -d), @@ -1392,16 +1392,31 @@ GridGenerator::half_hyper_ball (Triangulation& tria, if (cell->face(i)->boundary_indicator() == 255) continue; - // If the center is on the plane x=0, this is a plane + // If the center is on the plane x=0, this is a planar // element - if (cell->face(i)->center()(0) < center(0)+1.e-5) + if (cell->face(i)->center()(0) < center(0)+1.e-5) { cell->face(i)->set_boundary_indicator(1); + for (unsigned int j=0;j::lines_per_face;++j) + cell->face(i)->line(j)->set_boundary_indicator(1); + } + } + // With this loop we restore back the indicator of the outer lines + for (unsigned int i=0;i::faces_per_cell;++i) + { + if (cell->face(i)->boundary_indicator() == 255) + continue; + + // If the center is not on the plane x=0, this is a curvilinear + // element + if (cell->face(i)->center()(0) > center(0)+1.e-5) { + for (unsigned int j=0;j::lines_per_face;++j) + cell->face(i)->line(j)->set_boundary_indicator(0); + } } ++cell; } } - // Implementation for 3D only template void GridGenerator::hyper_shell (Triangulation&, diff --git a/tests/bits/grid_generator_01/cmp/generic b/tests/bits/grid_generator_01/cmp/generic index 14b2fb4f0b..e4f086da48 100644 --- a/tests/bits/grid_generator_01/cmp/generic +++ b/tests/bits/grid_generator_01/cmp/generic @@ -1996,14 +1996,14 @@ object "vertices" class array type float rank 1 shape 3 items 16 data follows 2.00000 -1.87868 0.878680 2.00000 1.12132 2.12132 2.00000 -3.12132 2.12132 - 3.83712 0.0606602 -1.06066 - 3.83712 -2.06066 -1.06066 - 2.76096 -0.560660 -0.439340 - 2.76096 -1.43934 -0.439340 - 2.76096 -0.560660 0.439340 - 2.76096 -1.43934 0.439340 - 3.83712 0.0606602 1.06066 - 3.83712 -2.06066 1.06066 + 4.59808 0.0606602 -1.06066 + 4.59808 -2.06066 -1.06066 + 3.29904 -0.560660 -0.439340 + 3.29904 -1.43934 -0.439340 + 3.29904 -0.560660 0.439340 + 3.29904 -1.43934 0.439340 + 4.59808 0.0606602 1.06066 + 4.59808 -2.06066 1.06066 object "cells" class array type int rank 1 shape 8 items 6 data follows 0 2 8 10 1 3 9 11 0 6 8 14 2 4 10 12 -- 2.39.5