]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Externalize the grid generation functions from the Triangulation class to an own...
authorwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Mon, 3 May 1999 18:50:21 +0000 (18:50 +0000)
committerwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Mon, 3 May 1999 18:50:21 +0000 (18:50 +0000)
git-svn-id: https://svn.dealii.org/trunk@1256 0785d39b-7218-0410-832d-ea1e28bc413d

24 files changed:
deal.II/deal.II/Attic/examples/convergence/convergence.cc
deal.II/deal.II/Attic/examples/dof/dof_test.cc
deal.II/deal.II/Attic/examples/error-estimation/error-estimation.cc
deal.II/deal.II/Attic/examples/grid/grid_test.cc
deal.II/deal.II/Attic/examples/multigrid/multigrid.cc
deal.II/deal.II/Attic/examples/nonlinear/fixed-point-iteration/nonlinear.cc
deal.II/deal.II/Attic/examples/poisson/problem.cc
deal.II/deal.II/include/grid/grid_generator.h [new file with mode: 0644]
deal.II/deal.II/include/grid/tria.h
deal.II/deal.II/source/grid/grid_generator.cc [new file with mode: 0644]
deal.II/deal.II/source/grid/tria.cc
tests/big-tests/convergence/convergence.cc
tests/big-tests/dof/dof_test.cc
tests/big-tests/error-estimation/error-estimation.cc
tests/big-tests/grid/grid_test.cc
tests/big-tests/multigrid/multigrid.cc
tests/big-tests/nonlinear/fixed-point-iteration/nonlinear.cc
tests/big-tests/poisson/problem.cc
tests/deal.II/dof_test.cc
tests/deal.II/fe_tables.cc
tests/deal.II/gradients.cc
tests/deal.II/grid_test.cc
tests/deal.II/mg2.cc
tests/deal.II/second_derivatives.cc

index 597bb375f0ff4237250a475e434a2c31097eda37..5f7badedde2057fb0964ea7faf4e88d1894907b5 100644 (file)
@@ -9,6 +9,7 @@
 #include <grid/tria_iterator.h>
 #include <grid/tria_boundary.h>
 #include <grid/dof_constraints.h>
+#include <grid/grid_generator.h>
 #include <base/function.h>
 #include <basic/data_io.h>
 #include <fe/fe_lib.lagrange.h>
@@ -266,7 +267,7 @@ int PoissonProblem<dim>::run (const unsigned int level) {
   cout << ">" << endl;
   
   cout << "    Making grid... ";
-  tria->create_hyper_ball ();
+  GridGenerator::hyper_ball (*tria);
   HyperBallBoundary<dim> boundary_description;
   tria->set_boundary (&boundary_description);
   tria->begin_active()->set_refine_flag();
index d9ee2ee997af2f93d1a671767827ada335b79abe..44bd5cefcc97e2103ffd28b125c7c518ca22d9ee 100644 (file)
@@ -9,6 +9,7 @@
 #include <grid/tria_boundary.h>
 #include <grid/tria_iterator.h>
 #include <grid/tria_accessor.h>
+#include <grid/grid_generator.h>
 #include <lac/sparsematrix.h>
 #include <base/parameter_handler.h>
 #include <grid/dof_constraints.h>
@@ -199,7 +200,7 @@ void TestCases<dim>::create_new (const unsigned int) {
   if (tria != 0) delete tria;
 
   tria = new Triangulation<dim>();
-  tria->create_hypercube();
+  GridGenerator::hyper_cube(*tria);
 
   dof = new DoFHandler<dim> (tria);
 };
index 93d58e28cc44ed4a7e94de961574eacd0a595c99..26b768a808c2df0b50e225ef7b784bda9afa6aa0 100644 (file)
@@ -9,6 +9,7 @@
 #include <grid/tria_iterator.h>
 #include <grid/tria_boundary.h>
 #include <grid/dof_constraints.h>
+#include <grid/grid_generator.h>
 #include <base/function.h>
 #include <basic/data_io.h>
 #include <base/parameter_handler.h>
@@ -412,7 +413,7 @@ void PoissonProblem<dim>::run (ParameterHandler &prm) {
   cout << "Making initial grid... " << endl;
   const unsigned int start_level(prm.get_integer("Initial refinement"));
   tria->set_boundary (boundary);
-  tria->create_hyper_ball ();
+  GridGenerator::hyper_ball (*tria);
   tria->refine_global (start_level);
 
   if (prm.get("Test case")=="Gauss shape")
index f4aa02e899a952817ae7938baf9f85d09a8f3345..9d4e2457d21555c7a2a74d97374599e9cad1a14a 100644 (file)
@@ -6,6 +6,7 @@
 #include <grid/tria_accessor.h>
 #include <grid/tria_iterator.h>
 #include <grid/tria.h>
+#include <grid/grid_generator.h>
 #include <fstream>
 #include <string>
 #include <cmath>
@@ -159,7 +160,7 @@ void test (const int test_case) {
   cout << "Running testcase " << test_case
        << " in " << dim << " dimensions." << endl;
   Triangulation<dim> tria;
-  tria.create_hypercube();
+  GridGenerator::hyper_cube(tria);
   
   if ((dim==1) && ((test_case==2) || (test_case==3)))
     {
index 3f2d7303a2e44b182701f6e3fd09e351c3d2c72e..c8a052ef3f5dda358d9cbd35c1318d2499268601 100644 (file)
@@ -9,6 +9,7 @@
 #include <grid/tria_iterator.h>
 #include <grid/tria_boundary.h>
 #include <grid/dof_constraints.h>
+#include <grid/grid_generator.h>
 #include <base/function.h>
 #include <basic/data_io.h>
 #include <fe/fe_lib.lagrange.h>
@@ -426,7 +427,7 @@ int PoissonProblem<dim>::run (const unsigned int level) {
   cout << ">" << endl;
   
   cout << "    Making grid... ";
-  tria->create_hypercube ();
+  GridGenerator::hyper_cube (*tria);
   tria->refine_global (level+1);
   tria->begin_active()->set_refine_flag();
   (++(++(tria->begin_active())))->set_refine_flag();
index 357accccd65cff08b59aacf2eee66017e23bd1d9..dd4053a9e219ae0fe64638783514772f3c11f275 100644 (file)
@@ -11,6 +11,7 @@
 #include <grid/dof_accessor.h>
 #include <grid/tria_iterator.h>
 #include <grid/tria_boundary.h>
+#include <grid/grid_generator.h>
 #include <basic/data_io.h>
 #include <base/function.h>
 #include <fe/fe_lib.lagrange.h>
@@ -173,7 +174,7 @@ void NonlinearProblem<dim>::run () {
   dirichlet_bc[0] = &boundary_values;
 
 
-  tria->create_hypercube ();
+  GridGenerator::hypercube (*tria);
   tria->refine_global (4);
 
   for (unsigned int refinement_step=0; refinement_step<10; ++refinement_step)
index 56903c84e0c4a39c1a0505ddfb6b849a943baa3a..41d8e7566dfc6d2de6efe3fce0289794689f0ff3 100644 (file)
@@ -5,6 +5,7 @@
 
 #include "poisson.h"
 #include <lac/vector.h>
+#include <grid/grid_generator.h>
 
 
 
@@ -348,7 +349,7 @@ bool PoissonProblem<dim>::make_grid (ParameterHandler &prm) {
       {
            static const Point<dim> origin;
            boundary = new HyperBallBoundary<dim>(origin, 1.);
-           tria->create_hyper_ball (origin, 1.);
+           GridGenerator::hyper_ball (*tria, origin, 1.);
            tria->set_boundary (boundary);
            break;
       };
@@ -356,7 +357,7 @@ bool PoissonProblem<dim>::make_grid (ParameterHandler &prm) {
                                             // set the boundary function
       {
            boundary = new CurvedLine<dim>();
-           tria->create_hypercube ();
+           GridGenerator::hyper_cube (*tria);
            tria->set_boundary (boundary);
            break;
       };
@@ -368,12 +369,12 @@ bool PoissonProblem<dim>::make_grid (ParameterHandler &prm) {
       case 5:
            boundary = new StraightBoundary<dim>();
            tria->set_boundary (boundary);
-           tria->create_hypercube ();
+           GridGenerator::hyper_cube (*tria);
            break;
       case 6:
            boundary = new StraightBoundary<dim>();
            tria->set_boundary (boundary);
-           tria->create_hypercube ();
+           GridGenerator::hyper_cube (*tria);
            tria->refine_global (1);
            for (unsigned int i=0; i<5; ++i)
              {
@@ -385,7 +386,7 @@ bool PoissonProblem<dim>::make_grid (ParameterHandler &prm) {
       case 7:
            boundary = new StraightBoundary<dim>();
            tria->set_boundary (boundary);
-           tria->create_hyper_L ();
+           GridGenerator::hyper_L (*tria);
            break;
       default:
            return false;
@@ -405,7 +406,7 @@ bool PoissonProblem<dim>::make_grid (ParameterHandler &prm) {
 
 template <int dim>
 void PoissonProblem<dim>::make_zoom_in_grid () {
-  tria->create_hypercube ();
+  GridGenerator::hyper_cube (*tria);
                                   // refine first cell
   tria->begin_active()->set_refine_flag();
   tria->execute_coarsening_and_refinement ();
@@ -432,7 +433,7 @@ void PoissonProblem<dim>::make_zoom_in_grid () {
 
 template <int dim>
 void PoissonProblem<dim>::make_random_grid () {
-  tria->create_hypercube ();
+  GridGenerator::hyper_cube (*tria);
   tria->refine_global (1);
        
   Triangulation<dim>::active_cell_iterator cell, endc;
diff --git a/deal.II/deal.II/include/grid/grid_generator.h b/deal.II/deal.II/include/grid/grid_generator.h
new file mode 100644 (file)
index 0000000..12e4b82
--- /dev/null
@@ -0,0 +1,109 @@
+/*----------------------------   grid_generator.h     ---------------------------*/
+/*      $Id$                 */
+#ifndef __grid_generator_H
+#define __grid_generator_H
+/*----------------------------   grid_generator.h     ---------------------------*/
+
+
+#include <base/forward-declarations.h>
+#include <basic/forward-declarations.h>
+
+/**
+ * This class offers triangulations of some standard domains such as hypercubes,
+ * hyperball and the like. Following is a list of domains that can be generated
+ * by the functions of this class:
+ * \begin{itemize}
+ *    \item Hypercube triangulations: a hypercube triangulation is a
+ *       domain which is the tensor product of an interval $[a,b]$ in
+ *       the given number of spatial dimensions. If you want to create such
+ *       a domain, which is a common test case for model problems, call
+ *       #GridGenerator::create_hypercube (tria, a,b)#, which produces a
+ *       hypercube domain triangulated with exactly one element. You can
+ *       get tensor product meshes by successive refinement of this cell.
+ *
+ *    \item Generalized L-shape domain:
+ *      using the #GridGenerator::create_L_region (tria, a,b)# function produces
+ *      the hypercube with the interval $[a,b]$ without the hypercube
+ *      made out of the interval $[(a+b)/2,b]$. Let, for example, be $a=-1$
+ *      and $b=1$, then the hpyer-L in two dimensions is the region
+ *      $[-1,1]^2 - [0,1]^2$. To create a hyper-L in one dimension results in
+ *      an error. The function is also implemented for three space dimensions.
+ *
+ *    \item Hyper balls:
+ *      You get the circle or ball (or generalized: hyperball) around origin
+ *      #p# and with radius #r# by calling
+ *      #Triangulation<dim>::create_hyper_ball (p, r)#. The circle is triangulated
+ *      by five cells, the ball by seven cells. The diameter of the center cell is
+ *      chosen so that the aspect ratio of the boundary cells after one refinement
+ *      is minimized in some way. To create a hyperball in one dimension results in
+ *      an error.
+ *
+ *      Do not forget to attach a suitable
+ *      boundary approximation object if you want the triangulation to be refined
+ *      at the outer boundaries.
+ * \end{itemize}
+ *
+ * @author Wolfgang Bangerth, 1998, 1999
+ */
+class GridGenerator 
+{
+  public:
+
+                                    /**
+                                     * Initialize the given triangulation with a
+                                     * hypercube (line in 1D, square in 2D, etc)
+                                     * consisting of exactly one cell. The
+                                     * hypercube volume is the tensor product
+                                     * of the intervall $[left,right]$ in the
+                                     * present number of dimensions, where
+                                     * the limits are given as arguments. They
+                                     * default to zero and unity, then producing
+                                     * the unit hypercube.
+                                     *
+                                     * The triangulation needs to be void
+                                     * upon calling this function.
+                                     */
+    template <int dim>
+    static void hyper_cube (Triangulation<dim> &tria,
+                           const double        left = 0.,
+                           const double        right= 1.);
+
+                                    /**
+                                     * Initialize the given triangulation with a
+                                     * hyperball, i.e. a circle or a ball.
+                                     * See the general documentation for a
+                                     * more concise description. The center of
+                                     * the hyperball default to the origin,
+                                     * the radius defaults to unity.
+                                     *
+                                     * The triangulation needs to be void
+                                     * upon calling this function.
+                                     */    
+    template <int dim>
+    static void hyper_ball (Triangulation<dim> &tria,
+                           const Point<dim>   &center = Point<dim>(),
+                           const double        radius = 1.);
+
+                                    /**
+                                     * Initialize the given triangulation with a
+                                     * hyper-L consisting of exactly #2^dim-1#
+                                     * cells. See the general documentation for a
+                                     * description of the L-region. The limits
+                                     * default to minus unity and unity.
+                                     *
+                                     * The triangulation needs to be void
+                                     * upon calling this function.
+                                     */
+    template <int dim>
+    static void hyper_L (Triangulation<dim> &tria,
+                        const double        left = -1.,
+                        const double        right= 1.);
+};
+
+
+
+
+/*----------------------------   grid_generator.h     ---------------------------*/
+/* end of #ifndef __grid_generator_H */
+#endif
+/*----------------------------   grid_generator.h     ---------------------------*/
index d3abc49943b0fee5ae533d80b2c705113a0338f2..6564de365808577ca87a3142b6084d5c217d1203 100644 (file)
@@ -466,33 +466,12 @@ class TriaDimensionInfo<3> {
  *
  *  There are several possibilities to create a triangulation:
  *  \begin{itemize}
- *    \item Hypercube triangulations: a hypercube triangulation is a
- *       domain which is the tensor product of an interval $[a,b]$ in
- *       the given number of spatial dimensions. If you want to create such
- *       a domain, which is a common test case for model problems, call
- *       #Triangulation<dim>::create_hypercube (a,b)#, which produces a
- *       hypercube domain triangulated with exactly one element. You can
- *       get tensor product meshes by successive refinement of this cell.
- *
- *    \item Other standard regions: you can get the generalized L-shape domain
- *      using the #Triangulation<dim>::create_L_region (a,b)# function, which
- *      is the hypercube with the interval $[a,b]$ without the hypercube
- *      made out of the interval $[(a+b)/2,b]$. Let, for example, be $a=-1$
- *      and $b=1$, then the hpyer-L in two dimensions is the region
- *      $[-1,1]^2 - [0,1]^2$. To create a hyper-L in one dimension results in
- *      an error.
- *
- *      You get the circle or ball (or generalized: hyperball) around origin
- *      #p# and with radius #r# by calling
- *      #Triangulation<dim>::create_hyper_ball (p, r)#. The circle is triangulated
- *       by five cells, the ball by seven cells. The diameter of the center cell is
- *       chosen so that the aspect ratio of the boundary cells after one refinement
- *       is minimized in some way. To create a hyperball in one dimension results in
- *       an error.
- *
- *       Do not forget to attach a suitable
- *       boundary approximation object if you want the triangulation to be refined
- *       at the outer boundaries.
+ *    \item The most common domains, such as hypercubes (i.e. lines, squares,
+ *       cubes, etc), hyperballs (circles, balls, ...) and some other, more
+ *       weird domains such as the L-shape region and higher dimensional
+ *       generalizations and others, are provided by the #GridGenerator#
+ *       class which takes a triangulation and fills it by a division
+ *       of the required domain.
  *   
  *     \item Reading in a triangulation: By using an object of the #DataIn#
  *        class, you can read in fairly general triangulations. See there for
@@ -1597,50 +1576,6 @@ class Triangulation : public TriaDimensionInfo<dim>, public Subscriptor {
     void create_triangulation (const vector<Point<dim> >    &vertices,
                               const vector<CellData<dim> > &cells,
                               const SubCellData            &subcelldata);
-    
-                                    /**
-                                     * Initialize the triangulation with a
-                                     * hypercube (line in 1D, square in 2D, etc)
-                                     * consisting of exactly one cell. The
-                                     * hypercube volume is the tensor product
-                                     * of the intervall $[left,right]$ in the
-                                     * present number of dimensions, where
-                                     * the limits are given as arguments. They
-                                     * default to zero and unity, then producing
-                                     * the unit hypercube.
-                                     *
-                                     * The triangulation needs to be void
-                                     * upon calling this function.
-                                     */
-    void create_hypercube (const double left = 0.,
-                          const double right= 1.);
-
-                                    /**
-                                     * Initialize the triangulation with a
-                                     * hyper-L consisting of exactly #2^dim-1#
-                                     * cells. See the general documentation for a
-                                     * description of the L-region. The limits
-                                     * default to minus unity and unity.
-                                     *
-                                     * The triangulation needs to be void
-                                     * upon calling this function.
-                                     */
-    void create_hyper_L (const double left = -1.,
-                        const double right= 1.);
-
-                                    /**
-                                     * Initialize the triangulation with a
-                                     * hyperball, i.e. a circle or a ball.
-                                     * See the general documentation for a
-                                     * more concise description. The center of
-                                     * the hyperball default to the origin,
-                                     * the radius defaults to unity.
-                                     *
-                                     * The triangulation needs to be void
-                                     * upon calling this function.
-                                     */
-    void create_hyper_ball (const Point<dim> &center = Point<dim>(),
-                           const double radius = 1.);
 
                                     /**
                                      * Distort the grid by randomly moving
diff --git a/deal.II/deal.II/source/grid/grid_generator.cc b/deal.II/deal.II/source/grid/grid_generator.cc
new file mode 100644 (file)
index 0000000..ace7d6b
--- /dev/null
@@ -0,0 +1,312 @@
+/* $Id$ */
+
+
+#include <grid/grid_generator.h>
+#include <grid/tria.h>
+#include <cmath>
+
+
+
+
+
+#if deal_II_dimension == 1
+
+template <>
+void GridGenerator::hyper_cube<> (Triangulation<1> &tria,
+                                 const double left,
+                                 const double right) {
+  const Point<1> vertices[2] = { Point<1>(left), Point<1>(right) };
+  vector<CellData<1> > cells (1, CellData<1>());
+  cells[0].vertices[0] = 0;
+  cells[0].vertices[1] = 1;
+  cells[0].material_id = 0;
+  
+  tria.create_triangulation (vector<Point<1> >(&vertices[0], &vertices[2]),
+                            cells,
+                            SubCellData());       // no boundary information
+};
+
+
+
+template <>
+void GridGenerator::hyper_L<> (Triangulation<1> &,
+                              const double,
+                              const double) {
+  Assert (false, ExcInternalError());
+};
+
+
+
+template <>
+void GridGenerator::hyper_ball<> (Triangulation<1> &,
+                                 const Point<1> &,
+                                 const double) {
+  Assert (false, ExcInternalError());
+};
+
+#endif
+
+
+
+#if deal_II_dimension == 2
+
+template <>
+void GridGenerator::hyper_cube<> (Triangulation<2> &tria,
+                                 const double left,
+                                 const double right) {
+  const Point<2> vertices[4] = { Point<2>(left,left),
+                                Point<2>(right,left),
+                                Point<2>(right,right),
+                                Point<2>(left,right)  };
+  const int cell_vertices[1][4] = { { 0,1,2,3 } };
+  vector<CellData<2> > cells (1, CellData<2>());
+  for (unsigned int j=0; j<4; ++j)
+    cells[0].vertices[j] = cell_vertices[0][j];
+  cells[0].material_id = 0;
+  
+  tria.create_triangulation (vector<Point<2> >(&vertices[0], &vertices[4]),
+                            cells,
+                            SubCellData());       // no boundary information
+};
+
+
+
+template <>
+void GridGenerator::hyper_L<> (Triangulation<2> &tria,
+                              const double a,
+                              const double b) {
+  const unsigned int dim=2;
+  const Point<dim> vertices[8] = { Point<dim> (a,a),
+                                  Point<dim> ((a+b)/2,a),
+                                  Point<dim> (b,a),
+                                  Point<dim> (a,(a+b)/2),
+                                  Point<dim> ((a+b)/2,(a+b)/2),
+                                  Point<dim> (b,(a+b)/2),
+                                  Point<dim> (a,b),
+                                  Point<dim> ((a+b)/2,b)  };
+  const int cell_vertices[3][4] = {{0, 1, 4, 3},
+                                  {1, 2, 5, 4},
+                                  {3, 4, 7, 6}};
+
+  vector<CellData<2> > cells (3, CellData<2>());
+  
+  for (unsigned int i=0; i<3; ++i) 
+    {
+      for (unsigned int j=0; j<4; ++j)
+       cells[i].vertices[j] = cell_vertices[i][j];
+      cells[i].material_id = 0;
+    };
+  
+  tria.create_triangulation (vector<Point<dim> >(&vertices[0], &vertices[8]),
+                            cells,
+                            SubCellData());       // no boundary information
+};
+
+
+
+template <>
+void GridGenerator::hyper_ball<> (Triangulation<2> &tria,
+                                 const Point<2>    &p,
+                                 const double      radius) {
+  const double a = 1./(1+sqrt(2)); // equilibrate cell sizes at transition
+                                  // from the inner part to the radial
+                                  // cells
+  const Point<2> vertices[8] = { p+Point<2>(-1,-1)*(radius/sqrt(2)),
+                                p+Point<2>(+1,-1)*(radius/sqrt(2)),
+                                p+Point<2>(-1,-1)*(radius/sqrt(2)*a),
+                                p+Point<2>(+1,-1)*(radius/sqrt(2)*a),
+                                p+Point<2>(-1,+1)*(radius/sqrt(2)*a),
+                                p+Point<2>(+1,+1)*(radius/sqrt(2)*a),
+                                p+Point<2>(-1,+1)*(radius/sqrt(2)),
+                                p+Point<2>(+1,+1)*(radius/sqrt(2)) };
+  
+  const int cell_vertices[5][4] = {{0, 1, 3, 2},
+                                  {0, 2, 4, 6},
+                                  {2, 3, 5, 4},
+                                  {1, 7, 5, 3},
+                                  {6, 4, 5, 7}};
+
+  vector<CellData<2> > cells (5, CellData<2>());
+  
+  for (unsigned int i=0; i<5; ++i) 
+    {
+      for (unsigned int j=0; j<4; ++j)
+       cells[i].vertices[j] = cell_vertices[i][j];
+      cells[i].material_id = 0;
+    };
+  
+  tria.create_triangulation (vector<Point<2> >(&vertices[0], &vertices[8]),
+                            cells,
+                            SubCellData());       // no boundary information
+};
+
+#endif
+
+
+#if deal_II_dimension == 3
+
+template <>
+void GridGenerator::hyper_cube<> (Triangulation<3> &tria,
+                                 const double left,
+                                 const double right) {
+  const Point<3> vertices[8] = { Point<3>(left,left,left),
+                                Point<3>(right,left,left),
+                                Point<3>(right,left,right),
+                                Point<3>(left,left,right),
+
+                                Point<3>(left,right,left),                              
+                                Point<3>(right,right,left),
+                                Point<3>(right,right,right),
+                                Point<3>(left,right,right)};
+  const int cell_vertices[1][8] = { { 0,1,2,3,4,5,6,7 } };
+  vector<CellData<3> > cells (1, CellData<3>());
+  for (unsigned int j=0; j<8; ++j)
+    cells[0].vertices[j] = cell_vertices[0][j];
+  cells[0].material_id = 0;
+  
+  tria.create_triangulation (vector<Point<3> >(&vertices[0], &vertices[8]),
+                       cells,
+                       SubCellData());       // no boundary information
+};
+
+
+
+template <>
+void GridGenerator::hyper_L<> (Triangulation<3> &tria,
+                              const double a,
+                              const double b) {
+  const unsigned int dim=3;
+                                  // we slice out the top back right
+                                  // part of the cube
+  const Point<dim> vertices[26]
+    = {
+                                          // front face of the big cube
+         Point<dim> (a,      a,a),
+         Point<dim> ((a+b)/2,a,a),
+         Point<dim> (b,      a,a),
+         Point<dim> (a,      a,(a+b)/2),
+         Point<dim> ((a+b)/2,a,(a+b)/2),
+         Point<dim> (b,      a,(a+b)/2),
+         Point<dim> (a,      a,b),
+         Point<dim> ((a+b)/2,a,b),
+         Point<dim> (b,      a,b),
+                                          // middle face of the big cube
+         Point<dim> (a,      (a+b)/2,a),
+         Point<dim> ((a+b)/2,(a+b)/2,a),
+         Point<dim> (b,      (a+b)/2,a),
+         Point<dim> (a,      (a+b)/2,(a+b)/2),
+         Point<dim> ((a+b)/2,(a+b)/2,(a+b)/2),
+         Point<dim> (b,      (a+b)/2,(a+b)/2),
+         Point<dim> (a,      (a+b)/2,b),
+         Point<dim> ((a+b)/2,(a+b)/2,b),
+         Point<dim> (b,      (a+b)/2,b),
+                                          // back face of the big cube
+                                          // last (top right) point is missing
+         Point<dim> (a,      b,a),
+         Point<dim> ((a+b)/2,b,a),
+         Point<dim> (b,      b,a),
+         Point<dim> (a,      b,(a+b)/2),
+         Point<dim> ((a+b)/2,b,(a+b)/2),
+         Point<dim> (b,      b,(a+b)/2),
+         Point<dim> (a,      b,b),
+         Point<dim> ((a+b)/2,b,b)
+    };
+  const int cell_vertices[7][8] = {{0, 1, 4, 3, 9, 10, 13, 12},
+                                  {1, 2, 5, 4, 10, 11, 14, 13},
+                                  {3, 4, 7, 6, 12, 13, 16, 15},
+                                  {4, 5, 8, 7, 13, 14, 17, 16},
+                                  {9, 10, 13, 12, 18, 19, 22, 21},
+                                  {10, 11, 14, 13, 19, 20, 23, 22},
+                                  {12, 13, 16, 15, 21, 22, 25, 24}};
+
+  vector<CellData<3> > cells (7, CellData<3>());
+  
+  for (unsigned int i=0; i<7; ++i) 
+    {
+      for (unsigned int j=0; j<8; ++j)
+       cells[i].vertices[j] = cell_vertices[i][j];
+      cells[i].material_id = 0;
+    };
+  
+  tria.create_triangulation (vector<Point<dim> >(&vertices[0], &vertices[26]),
+                            cells,
+                            SubCellData());       // no boundary information
+};
+
+
+
+template <>
+void GridGenerator::hyper_ball<> (Triangulation<3> &tria,
+                                 const Point<3> &p,
+                                 const double radius) {
+  const double a = 1./(1+sqrt(3)); // equilibrate cell sizes at transition
+                                  // from the inner part to the radial
+                                  // cells
+  const unsigned int n_vertices = 16;
+  const Point<3> vertices[n_vertices]
+    = {
+                                          // first the vertices of the inner
+                                          // cell
+         p+Point<3>(-1,-1,-1)*(radius/sqrt(3)*a),
+         p+Point<3>(+1,-1,-1)*(radius/sqrt(3)*a),
+         p+Point<3>(+1,+1,-1)*(radius/sqrt(3)*a),
+         p+Point<3>(-1,+1,-1)*(radius/sqrt(3)*a),
+         p+Point<3>(-1,-1,+1)*(radius/sqrt(3)*a),
+         p+Point<3>(+1,-1,+1)*(radius/sqrt(3)*a),
+         p+Point<3>(+1,+1,+1)*(radius/sqrt(3)*a),
+         p+Point<3>(-1,+1,+1)*(radius/sqrt(3)*a),
+                                          // now the eight vertices at
+                                          // the outer sphere
+         p+Point<3>(-1,-1,-1)*(radius/sqrt(3)),
+         p+Point<3>(+1,-1,-1)*(radius/sqrt(3)),
+         p+Point<3>(+1,+1,-1)*(radius/sqrt(3)),
+         p+Point<3>(-1,+1,-1)*(radius/sqrt(3)),
+         p+Point<3>(-1,-1,+1)*(radius/sqrt(3)),
+         p+Point<3>(+1,-1,+1)*(radius/sqrt(3)),
+         p+Point<3>(+1,+1,+1)*(radius/sqrt(3)),
+         p+Point<3>(-1,+1,+1)*(radius/sqrt(3))
+    };
+
+                                  // one needs to draw the seven cubes to
+                                  // understand what's going on here
+  const unsigned int n_cells = 7;
+  const int cell_vertices[n_cells][8] = {{0, 1, 2, 3, 4, 5, 6, 7},
+                                        {8, 9, 10, 11, 0, 1, 2, 3},
+                                        {9, 13, 14, 10, 1, 5, 6, 2},
+                                        {12, 4, 7, 15, 13, 5, 6, 14},
+                                        {8, 0, 3, 11, 12, 4, 7, 15},
+                                        {11, 10,14, 15, 3, 2, 6, 7},
+                                        {8, 9, 13, 12, 0, 1, 5, 4}};
+
+  vector<CellData<3> > cells (n_cells, CellData<3>());
+  
+  for (unsigned int i=0; i<n_cells; ++i) 
+    {
+      for (unsigned int j=0; j<GeometryInfo<3>::vertices_per_cell; ++j)
+       cells[i].vertices[j] = cell_vertices[i][j];
+      cells[i].material_id = 0;
+    };
+  
+  tria.create_triangulation (vector<Point<3> >(&vertices[0], &vertices[n_vertices]),
+                            cells,
+                            SubCellData());       // no boundary information
+};
+
+
+
+#endif
+
+
+
+
+// explicit instantiations
+// template void GridGenerator::hyper_cube (Triangulation<deal_II_dimension> &,
+//                                      const double,
+//                                      const double);
+// template void GridGenerator::hyper_L (Triangulation<deal_II_dimension> &,
+//                                   const double,
+//                                   const double);
+// template void GridGenerator::hyper_ball (Triangulation<deal_II_dimension> &,
+//                                      const Point<deal_II_dimension> &,
+//                                      const double);
+
index 02ba3e0aa14afb98fe3b6d9a6a6f8a6635a128bb..67f7e0c640c2d307eda14254f19a69e5ab279155 100644 (file)
@@ -302,40 +302,6 @@ void Triangulation<1>::create_triangulation (const vector<Point<1> >    &v,
        };
 };
 
-
-
-
-template <>
-void Triangulation<1>::create_hypercube (const double left,
-                                        const double right) {
-  Assert (vertices.size() == 0, ExcTriangulationNotEmpty());
-  Assert (n_lines() == 0, ExcTriangulationNotEmpty());
-
-  const Point<1> vertices[2] = { Point<1>(left), Point<1>(right) };
-  vector<CellData<1> > cells (1, CellData<1>());
-  cells[0].vertices[0] = 0;
-  cells[0].vertices[1] = 1;
-  cells[0].material_id = 0;
-  
-  create_triangulation (vector<Point<1> >(&vertices[0], &vertices[2]),
-                       cells,
-                       SubCellData());       // no boundary information
-};
-
-
-
-template <>
-void Triangulation<1>::create_hyper_L (const double, const double) {
-  Assert (false, ExcInternalError());
-};
-
-
-
-template <>
-void Triangulation<1>::create_hyper_ball (const Point<1> &, const double) {
-  Assert (false, ExcInternalError());
-};
-
 #endif
 
 
@@ -627,97 +593,6 @@ void Triangulation<2>::create_triangulation (const vector<Point<2> >    &v,
                            adjacent_cells[cell->line(side)->index()][0]);
 };
 
-
-  
-template <>
-void Triangulation<2>::create_hypercube (const double left,
-                                        const double right) {
-  Assert (vertices.size() == 0, ExcTriangulationNotEmpty());
-  Assert (n_lines() == 0, ExcTriangulationNotEmpty());
-  Assert (n_quads() == 0, ExcTriangulationNotEmpty());
-
-  const Point<2> vertices[4] = { Point<2>(left,left),
-                                Point<2>(right,left),
-                                Point<2>(right,right),
-                                Point<2>(left,right)  };
-  const int cell_vertices[1][4] = { { 0,1,2,3 } };
-  vector<CellData<2> > cells (1, CellData<2>());
-  for (unsigned int j=0; j<4; ++j)
-    cells[0].vertices[j] = cell_vertices[0][j];
-  cells[0].material_id = 0;
-  
-  create_triangulation (vector<Point<2> >(&vertices[0], &vertices[4]),
-                       cells,
-                       SubCellData());       // no boundary information
-};
-
-
-
-template <>
-void Triangulation<2>::create_hyper_L (const double a, const double b) {
-  const unsigned int dim=2;
-  const Point<dim> vertices[8] = { Point<dim> (a,a),
-                                  Point<dim> ((a+b)/2,a),
-                                  Point<dim> (b,a),
-                                  Point<dim> (a,(a+b)/2),
-                                  Point<dim> ((a+b)/2,(a+b)/2),
-                                  Point<dim> (b,(a+b)/2),
-                                  Point<dim> (a,b),
-                                  Point<dim> ((a+b)/2,b)  };
-  const int cell_vertices[3][4] = {{0, 1, 4, 3},
-                                  {1, 2, 5, 4},
-                                  {3, 4, 7, 6}};
-
-  vector<CellData<2> > cells (3, CellData<2>());
-  
-  for (unsigned int i=0; i<3; ++i) 
-    {
-      for (unsigned int j=0; j<4; ++j)
-       cells[i].vertices[j] = cell_vertices[i][j];
-      cells[i].material_id = 0;
-    };
-  
-  create_triangulation (vector<Point<dim> >(&vertices[0], &vertices[8]),
-                       cells,
-                       SubCellData());       // no boundary information
-};
-
-
-
-template <>
-void Triangulation<2>::create_hyper_ball (const Point<2> &p, const double radius) {
-  const double a = 1./(1+sqrt(2)); // equilibrate cell sizes at transition
-                                  // from the inner part to the radial
-                                  // cells
-  const Point<2> vertices[8] = { p+Point<2>(-1,-1)*(radius/sqrt(2)),
-                                p+Point<2>(+1,-1)*(radius/sqrt(2)),
-                                p+Point<2>(-1,-1)*(radius/sqrt(2)*a),
-                                p+Point<2>(+1,-1)*(radius/sqrt(2)*a),
-                                p+Point<2>(-1,+1)*(radius/sqrt(2)*a),
-                                p+Point<2>(+1,+1)*(radius/sqrt(2)*a),
-                                p+Point<2>(-1,+1)*(radius/sqrt(2)),
-                                p+Point<2>(+1,+1)*(radius/sqrt(2)) };
-  
-  const int cell_vertices[5][4] = {{0, 1, 3, 2},
-                                  {0, 2, 4, 6},
-                                  {2, 3, 5, 4},
-                                  {1, 7, 5, 3},
-                                  {6, 4, 5, 7}};
-
-  vector<CellData<2> > cells (5, CellData<2>());
-  
-  for (unsigned int i=0; i<5; ++i) 
-    {
-      for (unsigned int j=0; j<4; ++j)
-       cells[i].vertices[j] = cell_vertices[i][j];
-      cells[i].material_id = 0;
-    };
-  
-  create_triangulation (vector<Point<2> >(&vertices[0], &vertices[8]),
-                       cells,
-                       SubCellData());       // no boundary information
-};
-
 #endif
 
 
@@ -1221,157 +1096,6 @@ void Triangulation<3>::create_triangulation (const vector<Point<3> >    &v,
                            adjacent_cells[cell->quad(face)->index()][0]);
 };
 
-
-
-template <>
-void Triangulation<3>::create_hypercube (const double left,
-                                        const double right) {
-  Assert (vertices.size() == 0, ExcTriangulationNotEmpty());
-  Assert (n_lines() == 0, ExcTriangulationNotEmpty());
-  Assert (n_quads() == 0, ExcTriangulationNotEmpty());
-  Assert (n_hexs() == 0, ExcTriangulationNotEmpty());
-
-  const Point<3> vertices[8] = { Point<3>(left,left,left),
-                                Point<3>(right,left,left),
-                                Point<3>(right,left,right),
-                                Point<3>(left,left,right),
-
-                                Point<3>(left,right,left),                              
-                                Point<3>(right,right,left),
-                                Point<3>(right,right,right),
-                                Point<3>(left,right,right)};
-  const int cell_vertices[1][8] = { { 0,1,2,3,4,5,6,7 } };
-  vector<CellData<3> > cells (1, CellData<3>());
-  for (unsigned int j=0; j<8; ++j)
-    cells[0].vertices[j] = cell_vertices[0][j];
-  cells[0].material_id = 0;
-  
-  create_triangulation (vector<Point<3> >(&vertices[0], &vertices[8]),
-                       cells,
-                       SubCellData());       // no boundary information
-};
-
-
-
-template <>
-void Triangulation<3>::create_hyper_L (const double a, const double b) {
-  const unsigned int dim=3;
-                                  // we slice out the top back right
-                                  // part of the cube
-  const Point<dim> vertices[26]
-    = {
-                                          // front face of the big cube
-         Point<dim> (a,      a,a),
-         Point<dim> ((a+b)/2,a,a),
-         Point<dim> (b,      a,a),
-         Point<dim> (a,      a,(a+b)/2),
-         Point<dim> ((a+b)/2,a,(a+b)/2),
-         Point<dim> (b,      a,(a+b)/2),
-         Point<dim> (a,      a,b),
-         Point<dim> ((a+b)/2,a,b),
-         Point<dim> (b,      a,b),
-                                          // middle face of the big cube
-         Point<dim> (a,      (a+b)/2,a),
-         Point<dim> ((a+b)/2,(a+b)/2,a),
-         Point<dim> (b,      (a+b)/2,a),
-         Point<dim> (a,      (a+b)/2,(a+b)/2),
-         Point<dim> ((a+b)/2,(a+b)/2,(a+b)/2),
-         Point<dim> (b,      (a+b)/2,(a+b)/2),
-         Point<dim> (a,      (a+b)/2,b),
-         Point<dim> ((a+b)/2,(a+b)/2,b),
-         Point<dim> (b,      (a+b)/2,b),
-                                          // back face of the big cube
-                                          // last (top right) point is missing
-         Point<dim> (a,      b,a),
-         Point<dim> ((a+b)/2,b,a),
-         Point<dim> (b,      b,a),
-         Point<dim> (a,      b,(a+b)/2),
-         Point<dim> ((a+b)/2,b,(a+b)/2),
-         Point<dim> (b,      b,(a+b)/2),
-         Point<dim> (a,      b,b),
-         Point<dim> ((a+b)/2,b,b)
-    };
-  const int cell_vertices[7][8] = {{0, 1, 4, 3, 9, 10, 13, 12},
-                                  {1, 2, 5, 4, 10, 11, 14, 13},
-                                  {3, 4, 7, 6, 12, 13, 16, 15},
-                                  {4, 5, 8, 7, 13, 14, 17, 16},
-                                  {9, 10, 13, 12, 18, 19, 22, 21},
-                                  {10, 11, 14, 13, 19, 20, 23, 22},
-                                  {12, 13, 16, 15, 21, 22, 25, 24}};
-
-  vector<CellData<3> > cells (7, CellData<3>());
-  
-  for (unsigned int i=0; i<7; ++i) 
-    {
-      for (unsigned int j=0; j<8; ++j)
-       cells[i].vertices[j] = cell_vertices[i][j];
-      cells[i].material_id = 0;
-    };
-  
-  create_triangulation (vector<Point<dim> >(&vertices[0], &vertices[26]),
-                       cells,
-                       SubCellData());       // no boundary information
-};
-
-
-
-template <>
-void Triangulation<3>::create_hyper_ball (const Point<3> &p, const double radius) {
-  const double a = 1./(1+sqrt(3)); // equilibrate cell sizes at transition
-                                  // from the inner part to the radial
-                                  // cells
-  const unsigned int n_vertices = 16;
-  const Point<3> vertices[n_vertices]
-    = {
-                                          // first the vertices of the inner
-                                          // cell
-         p+Point<3>(-1,-1,-1)*(radius/sqrt(3)*a),
-         p+Point<3>(+1,-1,-1)*(radius/sqrt(3)*a),
-         p+Point<3>(+1,+1,-1)*(radius/sqrt(3)*a),
-         p+Point<3>(-1,+1,-1)*(radius/sqrt(3)*a),
-         p+Point<3>(-1,-1,+1)*(radius/sqrt(3)*a),
-         p+Point<3>(+1,-1,+1)*(radius/sqrt(3)*a),
-         p+Point<3>(+1,+1,+1)*(radius/sqrt(3)*a),
-         p+Point<3>(-1,+1,+1)*(radius/sqrt(3)*a),
-                                          // now the eight vertices at
-                                          // the outer sphere
-         p+Point<3>(-1,-1,-1)*(radius/sqrt(3)),
-         p+Point<3>(+1,-1,-1)*(radius/sqrt(3)),
-         p+Point<3>(+1,+1,-1)*(radius/sqrt(3)),
-         p+Point<3>(-1,+1,-1)*(radius/sqrt(3)),
-         p+Point<3>(-1,-1,+1)*(radius/sqrt(3)),
-         p+Point<3>(+1,-1,+1)*(radius/sqrt(3)),
-         p+Point<3>(+1,+1,+1)*(radius/sqrt(3)),
-         p+Point<3>(-1,+1,+1)*(radius/sqrt(3))
-    };
-
-                                  // one needs to draw the seven cubes to
-                                  // understand what's going on here
-  const unsigned int n_cells = 7;
-  const int cell_vertices[n_cells][8] = {{0, 1, 2, 3, 4, 5, 6, 7},
-                                        {8, 9, 10, 11, 0, 1, 2, 3},
-                                        {9, 13, 14, 10, 1, 5, 6, 2},
-                                        {12, 4, 7, 15, 13, 5, 6, 14},
-                                        {8, 0, 3, 11, 12, 4, 7, 15},
-                                        {11, 10,14, 15, 3, 2, 6, 7},
-                                        {8, 9, 13, 12, 0, 1, 5, 4}};
-
-  vector<CellData<3> > cells (n_cells, CellData<3>());
-  
-  for (unsigned int i=0; i<n_cells; ++i) 
-    {
-      for (unsigned int j=0; j<GeometryInfo<3>::vertices_per_cell; ++j)
-       cells[i].vertices[j] = cell_vertices[i][j];
-      cells[i].material_id = 0;
-    };
-  
-  create_triangulation (vector<Point<3> >(&vertices[0], &vertices[n_vertices]),
-                       cells,
-                       SubCellData());       // no boundary information
-};
-
-
-
 #endif
 
 
index 597bb375f0ff4237250a475e434a2c31097eda37..5f7badedde2057fb0964ea7faf4e88d1894907b5 100644 (file)
@@ -9,6 +9,7 @@
 #include <grid/tria_iterator.h>
 #include <grid/tria_boundary.h>
 #include <grid/dof_constraints.h>
+#include <grid/grid_generator.h>
 #include <base/function.h>
 #include <basic/data_io.h>
 #include <fe/fe_lib.lagrange.h>
@@ -266,7 +267,7 @@ int PoissonProblem<dim>::run (const unsigned int level) {
   cout << ">" << endl;
   
   cout << "    Making grid... ";
-  tria->create_hyper_ball ();
+  GridGenerator::hyper_ball (*tria);
   HyperBallBoundary<dim> boundary_description;
   tria->set_boundary (&boundary_description);
   tria->begin_active()->set_refine_flag();
index d9ee2ee997af2f93d1a671767827ada335b79abe..44bd5cefcc97e2103ffd28b125c7c518ca22d9ee 100644 (file)
@@ -9,6 +9,7 @@
 #include <grid/tria_boundary.h>
 #include <grid/tria_iterator.h>
 #include <grid/tria_accessor.h>
+#include <grid/grid_generator.h>
 #include <lac/sparsematrix.h>
 #include <base/parameter_handler.h>
 #include <grid/dof_constraints.h>
@@ -199,7 +200,7 @@ void TestCases<dim>::create_new (const unsigned int) {
   if (tria != 0) delete tria;
 
   tria = new Triangulation<dim>();
-  tria->create_hypercube();
+  GridGenerator::hyper_cube(*tria);
 
   dof = new DoFHandler<dim> (tria);
 };
index 93d58e28cc44ed4a7e94de961574eacd0a595c99..26b768a808c2df0b50e225ef7b784bda9afa6aa0 100644 (file)
@@ -9,6 +9,7 @@
 #include <grid/tria_iterator.h>
 #include <grid/tria_boundary.h>
 #include <grid/dof_constraints.h>
+#include <grid/grid_generator.h>
 #include <base/function.h>
 #include <basic/data_io.h>
 #include <base/parameter_handler.h>
@@ -412,7 +413,7 @@ void PoissonProblem<dim>::run (ParameterHandler &prm) {
   cout << "Making initial grid... " << endl;
   const unsigned int start_level(prm.get_integer("Initial refinement"));
   tria->set_boundary (boundary);
-  tria->create_hyper_ball ();
+  GridGenerator::hyper_ball (*tria);
   tria->refine_global (start_level);
 
   if (prm.get("Test case")=="Gauss shape")
index f4aa02e899a952817ae7938baf9f85d09a8f3345..9d4e2457d21555c7a2a74d97374599e9cad1a14a 100644 (file)
@@ -6,6 +6,7 @@
 #include <grid/tria_accessor.h>
 #include <grid/tria_iterator.h>
 #include <grid/tria.h>
+#include <grid/grid_generator.h>
 #include <fstream>
 #include <string>
 #include <cmath>
@@ -159,7 +160,7 @@ void test (const int test_case) {
   cout << "Running testcase " << test_case
        << " in " << dim << " dimensions." << endl;
   Triangulation<dim> tria;
-  tria.create_hypercube();
+  GridGenerator::hyper_cube(tria);
   
   if ((dim==1) && ((test_case==2) || (test_case==3)))
     {
index 3f2d7303a2e44b182701f6e3fd09e351c3d2c72e..c8a052ef3f5dda358d9cbd35c1318d2499268601 100644 (file)
@@ -9,6 +9,7 @@
 #include <grid/tria_iterator.h>
 #include <grid/tria_boundary.h>
 #include <grid/dof_constraints.h>
+#include <grid/grid_generator.h>
 #include <base/function.h>
 #include <basic/data_io.h>
 #include <fe/fe_lib.lagrange.h>
@@ -426,7 +427,7 @@ int PoissonProblem<dim>::run (const unsigned int level) {
   cout << ">" << endl;
   
   cout << "    Making grid... ";
-  tria->create_hypercube ();
+  GridGenerator::hyper_cube (*tria);
   tria->refine_global (level+1);
   tria->begin_active()->set_refine_flag();
   (++(++(tria->begin_active())))->set_refine_flag();
index 357accccd65cff08b59aacf2eee66017e23bd1d9..dd4053a9e219ae0fe64638783514772f3c11f275 100644 (file)
@@ -11,6 +11,7 @@
 #include <grid/dof_accessor.h>
 #include <grid/tria_iterator.h>
 #include <grid/tria_boundary.h>
+#include <grid/grid_generator.h>
 #include <basic/data_io.h>
 #include <base/function.h>
 #include <fe/fe_lib.lagrange.h>
@@ -173,7 +174,7 @@ void NonlinearProblem<dim>::run () {
   dirichlet_bc[0] = &boundary_values;
 
 
-  tria->create_hypercube ();
+  GridGenerator::hypercube (*tria);
   tria->refine_global (4);
 
   for (unsigned int refinement_step=0; refinement_step<10; ++refinement_step)
index 56903c84e0c4a39c1a0505ddfb6b849a943baa3a..41d8e7566dfc6d2de6efe3fce0289794689f0ff3 100644 (file)
@@ -5,6 +5,7 @@
 
 #include "poisson.h"
 #include <lac/vector.h>
+#include <grid/grid_generator.h>
 
 
 
@@ -348,7 +349,7 @@ bool PoissonProblem<dim>::make_grid (ParameterHandler &prm) {
       {
            static const Point<dim> origin;
            boundary = new HyperBallBoundary<dim>(origin, 1.);
-           tria->create_hyper_ball (origin, 1.);
+           GridGenerator::hyper_ball (*tria, origin, 1.);
            tria->set_boundary (boundary);
            break;
       };
@@ -356,7 +357,7 @@ bool PoissonProblem<dim>::make_grid (ParameterHandler &prm) {
                                             // set the boundary function
       {
            boundary = new CurvedLine<dim>();
-           tria->create_hypercube ();
+           GridGenerator::hyper_cube (*tria);
            tria->set_boundary (boundary);
            break;
       };
@@ -368,12 +369,12 @@ bool PoissonProblem<dim>::make_grid (ParameterHandler &prm) {
       case 5:
            boundary = new StraightBoundary<dim>();
            tria->set_boundary (boundary);
-           tria->create_hypercube ();
+           GridGenerator::hyper_cube (*tria);
            break;
       case 6:
            boundary = new StraightBoundary<dim>();
            tria->set_boundary (boundary);
-           tria->create_hypercube ();
+           GridGenerator::hyper_cube (*tria);
            tria->refine_global (1);
            for (unsigned int i=0; i<5; ++i)
              {
@@ -385,7 +386,7 @@ bool PoissonProblem<dim>::make_grid (ParameterHandler &prm) {
       case 7:
            boundary = new StraightBoundary<dim>();
            tria->set_boundary (boundary);
-           tria->create_hyper_L ();
+           GridGenerator::hyper_L (*tria);
            break;
       default:
            return false;
@@ -405,7 +406,7 @@ bool PoissonProblem<dim>::make_grid (ParameterHandler &prm) {
 
 template <int dim>
 void PoissonProblem<dim>::make_zoom_in_grid () {
-  tria->create_hypercube ();
+  GridGenerator::hyper_cube (*tria);
                                   // refine first cell
   tria->begin_active()->set_refine_flag();
   tria->execute_coarsening_and_refinement ();
@@ -432,7 +433,7 @@ void PoissonProblem<dim>::make_zoom_in_grid () {
 
 template <int dim>
 void PoissonProblem<dim>::make_random_grid () {
-  tria->create_hypercube ();
+  GridGenerator::hyper_cube (*tria);
   tria->refine_global (1);
        
   Triangulation<dim>::active_cell_iterator cell, endc;
index b975fd17e218554cfc7355230129d7d38a705394..bec350bc8a279755fd98857464c1822189e55bb7 100644 (file)
@@ -8,6 +8,7 @@
 
 #include <grid/dof.h>
 #include <grid/tria.h>
+#include <grid/grid_generator.h>
 #include <fe/fe_lib.lagrange.h>
 #include <grid/tria_boundary.h>
 #include <grid/tria_iterator.h>
@@ -198,7 +199,7 @@ void TestCases<dim>::create_new () {
   if (tria != 0) delete tria;
 
   tria = new Triangulation<dim>();
-  tria->create_hypercube();
+  GridGenerator::hyper_cube(*tria);
 
   dof = new DoFHandler<dim> (tria);
 };
index 03e1b8d536a57a6e31bbe0a35afae49ebc9a7c72..ab5ca42e519e889c393c792f6fe730a018f5895f 100644 (file)
@@ -15,6 +15,7 @@
 #include <grid/tria_boundary.h>
 #include <grid/dof.h>
 #include <grid/dof_accessor.h>
+#include <grid/grid_generator.h>
 #include <iomanip>
 #include <base/logstream.h>
 
@@ -32,7 +33,7 @@ inline void
 print_fe_statistics(const FiniteElement<dim>& fe)
 {
   Triangulation<dim> tr;
-  tr.create_hypercube(-1,1);
+  GridGenerator::hyper_cube(tr,-1,1);
   DoFHandler<dim> dof(&tr);
   dof.distribute_dofs(fe);
   StraightBoundary<dim> boundary;
index 079c65442f6c84a39a9ea2ac0e47b2e635820d26..3963071d7387fad26333dd7dfb2419beb72f8cec 100644 (file)
@@ -15,6 +15,7 @@
 #include <grid/tria.h>
 #include <grid/tria_boundary.h>
 #include <grid/dof.h>
+#include <grid/grid_generator.h>
 #include <fe/fe_values.h>
 #include <fe/fe_lib.lagrange.h>
 #include <base/quadrature_lib.h>
@@ -27,7 +28,7 @@
 
 int main () {
   Triangulation<2> tria;
-  tria.create_hypercube (0,1);
+  GridGenerator::hyper_cube (tria,0,1);
   tria.begin_active()->vertex(2)(0) = 2;
 
   FELinear<2> fe;
index 1d520a84ed5b75cd9a1eef8a048cb72b23b912b7..7bbcd56750fd09ab9f8251a972fe60ff497b7e1e 100644 (file)
@@ -13,6 +13,7 @@
 #include <grid/tria_accessor.h>
 #include <grid/tria_iterator.h>
 #include <grid/tria.h>
+#include <grid/grid_generator.h>
 #include <cmath>
 #include <cstdlib>
 
@@ -163,7 +164,7 @@ void test (const int test_case) {
   cout << "Running testcase " << test_case
        << " in " << dim << " dimensions." << endl;
   Triangulation<dim> tria;
-  tria.create_hypercube();
+  GridGenerator::hyper_cube(tria);
   
   if ((dim==1) && ((test_case==2) || (test_case==3)))
     {
index 6e3ace4dace0a84d9ace96b3a91e83dd0ea93f39..44dd281b4a07e17ae41f49db3bccb6da17d72b5f 100644 (file)
@@ -7,6 +7,7 @@
 #include <numerics/mg_smoother.h>
 #include <grid/tria.h>
 #include <grid/mg_dof.h>
+#include <grid/grid_generator.h>
 #include <fe/fe_lib.lagrange.h>
 
 main()
@@ -15,7 +16,7 @@ main()
   MGDoFHandler<2> dof(&tr);
   FELinear<2> fe;
   
-  tr.create_hypercube(-1.,1.);
+  GridGenerator::hyper_cube(tr,-1.,1.);
   tr.refine_global(3);
   dof.distribute_dofs(fe);
 }
index df675fb3c860446e645ae338a5542bec850799ed..2ad62be46c59fdf8cd29874bdfc63d360ed3e542 100644 (file)
@@ -7,6 +7,7 @@
 #include <grid/tria.h>
 #include <grid/tria_boundary.h>
 #include <grid/dof.h>
+#include <grid/grid_generator.h>
 #include <fe/fe_values.h>
 #include <fe/fe_lib.lagrange.h>
 #include <base/quadrature_lib.h>
@@ -19,7 +20,7 @@
 
 int main () {
   Triangulation<2> tria;
-  tria.create_hypercube (0,1);
+  GridGenerator::hyper_cube (tria,0,1);
 
   FELinear<2> fe;
   DoFHandler<2> dof(&tria);

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.