]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
add a colorizing function and remove specialization declarations
authorkanschat <kanschat@0785d39b-7218-0410-832d-ea1e28bc413d>
Fri, 8 Jun 2007 02:22:32 +0000 (02:22 +0000)
committerkanschat <kanschat@0785d39b-7218-0410-832d-ea1e28bc413d>
Fri, 8 Jun 2007 02:22:32 +0000 (02:22 +0000)
git-svn-id: https://svn.dealii.org/trunk@14767 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/deal.II/include/grid/grid_generator.h
deal.II/deal.II/source/grid/grid_generator.cc

index 1ac18b463324c3ef04e79da8203906f875ab8cb3..793575b2e9e08f2cb110d3188b138ea4f87a0f22 100644 (file)
@@ -780,12 +780,6 @@ class GridGenerator
     template <int dim>
     static void colorize_hyper_rectangle (Triangulation<dim> &tria);
 
-                                    /**
-                                     * Declaration of the above
-                                     * function for 1d.
-                                     */
-    static void colorize_hyper_rectangle (Triangulation<1> &tria);
-    
                                     /**
                                      * Perform the action specified
                                      * by the @p colorize flag of
@@ -805,16 +799,18 @@ class GridGenerator
                                         const double        epsilon);
 
                                     /**
-                                     * Declaration of the above
-                                     * function for 1d.
+                                     * Assign boundary number zero to
+                                     * the inner shell boundary and 1
+                                     * to the outer.
                                      */
+    template<int dim>
     static
     void
-    colorize_subdivided_hyper_rectangle (Triangulation<1> &tria,
-                                        const Point<1>   &p1,
-                                        const Point<1>   &p2,
-                                        const double      epsilon);
-
+    colorize_hyper_shell (Triangulation<dim>& tria,
+                         const Point<dim>& center,
+                         const double inner_radius,
+                         const double outer_radius);
+    
                                     /**
                                      * Solve the Laplace equation for
                                      * @p laplace_transformation
index 8f7f154eb9d885925e8c71a770a98bcebf5bb4c7..81e5e8553c1556c5afdef875990eaaf38019ab0f 100644 (file)
@@ -142,8 +142,9 @@ GridGenerator::hyper_rectangle (Triangulation<dim> &tria,
 #if deal_II_dimension == 1
 
 // Implementation for 1D only
+template <int dim>
 void
-GridGenerator::colorize_hyper_rectangle (Triangulation<1> &)
+GridGenerator::colorize_hyper_rectangle (Triangulation<dim> &)
 {
                                   // nothing to do in 1d
 }
@@ -1017,10 +1018,11 @@ subdivided_hyper_rectangle (Triangulation<3>&                           tria,
 #if deal_II_dimension == 1
 
 // Implementation for 1D only
+template <int dim>
 void
-GridGenerator::colorize_subdivided_hyper_rectangle (Triangulation<1> &,
-                                                   const Point<1>   &,
-                                                   const Point<1>   &,
+GridGenerator::colorize_subdivided_hyper_rectangle (Triangulation<dim> &,
+                                                   const Point<dim>   &,
+                                                   const Point<dim>   &,
                                                    const double      )
 {
                                   // nothing to do in 1d
@@ -1152,6 +1154,16 @@ void GridGenerator::hyper_shell (Triangulation<dim> &,
   Assert (false, ExcNotImplemented());
 }
 
+// Implementation for 1D only
+template <int dim>
+void GridGenerator::colorize_hyper_shell (Triangulation<dim> &,
+                                         const Point<dim> &,
+                                         const double,
+                                         const double)
+{
+  Assert (false, ExcNotImplemented());
+}
+
 // Implementation for 1D only
 template <int dim>
 void GridGenerator::cylinder_shell (Triangulation<dim>&,
@@ -2588,6 +2600,38 @@ void GridGenerator::hyper_cube_with_cylindrical_hole(Triangulation<dim> &triangu
 #endif
 
 
+#if deal_II_dimension != 1
+
+// Empty implementation for 1d is above
+template <int dim>
+void
+GridGenerator::colorize_hyper_shell(
+  Triangulation<dim>& tria,
+  const Point<dim>& center,
+  const double inner_radius,
+  const double outer_radius)
+{
+  double divide = .5*(inner_radius+outer_radius);
+  divide *= divide;
+  
+  for (typename Triangulation<dim>::cell_iterator it = tria.begin();
+       it != tria.end(); ++it)
+    for (unsigned int f=0;f<GeometryInfo<dim>::faces_per_cell;++f)
+      if (it->at_boundary(f))
+       {
+                                          // Take first vertex of
+                                          // boundary face
+         Point<dim> p = it->face(f)->vertex(0);
+         p -= center;
+         if (p.square() > divide)
+           it->face(f)->set_boundary_indicator(1);
+       }
+}
+
+
+#endif
+
+
 // explicit instantiations
 template void
 GridGenerator::hyper_cube<deal_II_dimension> (
@@ -2672,6 +2716,11 @@ GridGenerator::hyper_cube_with_cylindrical_hole (
   Triangulation<deal_II_dimension> &,
   const double, const double, const double, const unsigned int, bool);
 
+template void
+GridGenerator::colorize_hyper_shell(
+  Triangulation<deal_II_dimension>& tria,
+  const Point<deal_II_dimension>& center,
+  const double inner_radius, const double outer_radius);
 
 template void
 GridGenerator::

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.