]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Corrected 2 small bugs that rendered the half_hyper_ball unusable in 3d.
authorLuca Heltai <luca.heltai@sissa.it>
Fri, 10 Feb 2006 00:23:04 +0000 (00:23 +0000)
committerLuca Heltai <luca.heltai@sissa.it>
Fri, 10 Feb 2006 00:23:04 +0000 (00:23 +0000)
git-svn-id: https://svn.dealii.org/trunk@12289 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/deal.II/source/grid/grid_generator.cc
tests/bits/grid_generator_01/cmp/generic

index a0a24c986c16537102139b3d0aaf3e6c297e7317..b456408dea37f2358bff8bb18c310b1379ac2e29 100644 (file)
@@ -1336,8 +1336,8 @@ GridGenerator::half_hyper_ball (Triangulation<dim>& 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<dim> vertices[16] = {
        center+Point<dim>( 0,  d, -d),
@@ -1392,16 +1392,31 @@ GridGenerator::half_hyper_ball (Triangulation<dim>& tria,
            if (cell->face(i)->boundary_indicator() == 255)
                continue;
 
-           // If the center is on the plane x=0, this is a plan
+           // 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<GeometryInfo<dim>::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<GeometryInfo<dim>::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<GeometryInfo<dim>::lines_per_face;++j) 
+                   cell->face(i)->line(j)->set_boundary_indicator(0);
+           }
        }
        ++cell;
     }
 }
 
-
 // Implementation for 3D only
 template <int dim>
 void GridGenerator::hyper_shell (Triangulation<dim>&,
index 14b2fb4f0b024573858858c7e5c7f278e83098b1..e4f086da48fe92ac6df6c8f71931c00beb761e1f 100644 (file)
@@ -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

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.