]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Fixed: The
authorbangerth <bangerth@0785d39b-7218-0410-832d-ea1e28bc413d>
Thu, 8 Mar 2007 21:00:41 +0000 (21:00 +0000)
committerbangerth <bangerth@0785d39b-7218-0410-832d-ea1e28bc413d>
Thu, 8 Mar 2007 21:00:41 +0000 (21:00 +0000)
       <code>GridGenerator::cylinder</code> function in 3d properly
       set the boundary indicators of the end faces of the generated
       cylinder to a different value than the outer faces, but it
       forgot to also adjust the boundary indicators of the edges
       purely in the interior to the ends of the cylinder. This is now
       fixed.

git-svn-id: https://svn.dealii.org/trunk@14555 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/deal.II/source/grid/grid_generator.cc
deal.II/doc/news/changes.html

index 716c97b841c3b4aefb17ac7f6af5bcdbc74bfc14..7918fd9e440e36640e7f57c2bef9198397ab438a 100644 (file)
@@ -33,6 +33,7 @@
 #include <fe/fe_q.h>
 #include <numerics/matrices.h>
 
+#include <iostream>
 #include <cmath>
 #include <limits>
 
@@ -1831,6 +1832,8 @@ GridGenerator::cylinder (Triangulation<dim> &tria,
                         const double radius,
                         const double half_length)
 {
+  Assert (dim <= 3, ExcNotImplemented());
+  
                                   // Copy the base from hyper_ball<dim>
                                   // and transform it to yz
   const double d = radius/std::sqrt(2.0);
@@ -1894,23 +1897,46 @@ GridGenerator::cylinder (Triangulation<dim> &tria,
     cells,
     SubCellData());       // no boundary information
 
+                                  // set boundary indicators for the
+                                  // faces at the ends to 1 and 2,
+                                  // respectively. note that we also
+                                  // have to deal with those lines
+                                  // that are purely in the interior
+                                  // of the ends. we determine wether
+                                  // an edge is purely in the
+                                  // interior if one of its vertices
+                                  // is at coordinates '+-a' as set
+                                  // above
   typename Triangulation<dim>::cell_iterator cell = tria.begin();
   typename Triangulation<dim>::cell_iterator end = tria.end();
   
-  while (cell != end)
-    {
-      for (unsigned int i=0;i<GeometryInfo<dim>::faces_per_cell;++i)
+  for (; cell != end; ++cell)
+    for (unsigned int i=0; i<GeometryInfo<dim>::faces_per_cell; ++i)
+      if (cell->at_boundary(i))
        {
-         if (cell->face(i)->boundary_indicator() == 255)
-           continue;
-         
          if (cell->face(i)->center()(0) > half_length-1.e-5)
-           cell->face(i)->set_boundary_indicator(2);
+           {
+             cell->face(i)->set_boundary_indicator(2);
+
+             for (unsigned int e=0; e<GeometryInfo<dim>::lines_per_face; ++e)
+               if ((std::fabs(cell->face(i)->line(e)->vertex(0)[1]) == a) ||
+                   (std::fabs(cell->face(i)->line(e)->vertex(0)[2]) == a) ||
+                   (std::fabs(cell->face(i)->line(e)->vertex(1)[1]) == a) ||
+                   (std::fabs(cell->face(i)->line(e)->vertex(1)[2]) == a))
+                 cell->face(i)->line(e)->set_boundary_indicator(2);
+           }
          else if (cell->face(i)->center()(0) < -half_length+1.e-5)
-           cell->face(i)->set_boundary_indicator(1);
+           {
+             cell->face(i)->set_boundary_indicator(1);
+
+             for (unsigned int e=0; e<GeometryInfo<dim>::lines_per_face; ++e)
+               if ((std::fabs(cell->face(i)->line(e)->vertex(0)[1]) == a) ||
+                   (std::fabs(cell->face(i)->line(e)->vertex(0)[2]) == a) ||
+                   (std::fabs(cell->face(i)->line(e)->vertex(1)[1]) == a) ||
+                   (std::fabs(cell->face(i)->line(e)->vertex(1)[2]) == a))
+                 cell->face(i)->line(e)->set_boundary_indicator(1);
+           }
        }
-      ++cell;
-    }
 }
 
 
index ef97f3433d762b21a5c3659c3b8da3f17de87fd3..27662bfb7828a4889849b01e13d8dabb6771f26a 100644 (file)
@@ -1023,6 +1023,17 @@ inconvenience this causes.
 <h3>deal.II</h3>
 
 <ol>
+   <li> <p>Fixed: The
+       <code>GridGenerator::cylinder</code> function in 3d properly
+       set the boundary indicators of the end faces of the generated
+       cylinder to a different value than the outer faces, but it
+       forgot to also adjust the boundary indicators of the edges
+       purely in the interior to the ends of the cylinder. This is now
+       fixed.
+       <br>
+       (WB 2007/03/08)
+       </p>
+
    <li> <p>Improved: The
        <code>CylinderBoundary</code> class can now describe the
        boundaries of arbitrarily oriented cylinders, not only does

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.