From: schrage
Please remember throughout this chapter: +A triangulation must be void before it is initialized ! +
deal.II offers three fundamental grid types: a hypercube, a hyperball @@ -32,7 +34,7 @@ and a hyper_L. Furthermore it is possible to
A hypercube can be created using the function
-void Triangulation::create_hypercube(const double left=0.,const double right=1.)
+void GridGenerator<dim>::hyper_cube(Triangulation<dim> &tria,const double left=0.,const double right=1.)
The cube created is the tensor product of the left and right edges which
default to 0 and 1, creating the unit hypercube. The hypercube will consist of
exactly one cell. In two dimensions, this amounts to a unit square, in three, to a unit cube.
@@ -53,11 +55,12 @@ function calls needed. Be sure to use them in their appropriate places.
#include <grid/tria.h>
+#include <grid/grid_generator.h>
const unsigned int dim=2; // Two dimensions; to create a cube set to three
Triangulation<dim> tr;
-tr.create_hypercube(-1,1);
+GridGenerator<dim>::hyper_cube(tr,-1,1);
@@ -65,7 +68,7 @@ tr.create_hypercube(-1,1);
A hyperball can be created using the function
-void Triangulation::create_hyper_ball(const Point<dim> center=0.,const double radius=1.)
+void GridGenerator<dim>::hyper_ball(Triangulation<dim> &tria,const Point<dim> center=0.,const double radius=1.)
This will create a hyperball of given centre and radius where the location of the centre defaults to the origin and the radius to unity.
#include <grid/tria.h>
+#include <grid/grid_generator.h>
#include <base/point.h>
const unsigned int dim=2; // For example
Triangulation<dim> tr;
Point<dim> centre(1,0); // Taking (1,0) as the centre of the ball
-tr.create_hyperball(centre,1);
+GridGenerator<dim>::hyper_ball(tr,centre,1);
@@ -100,7 +104,7 @@ tr.create_hyperball(centre,1);
A hyper-L can be created using the function
-void Triangulation::create_hyper_L(const double left=-1.,const double right=1.)
+void GridGenerator::hyper_L(Triangulation<dim> &tria,const double left=-1.,const double right=1.)
This will create a hyper-L consisting of 2dimension-1 cells.
The hyper-L is created from the hypercube [left,right]dimension by taking
away the hypercube [left+right/2,right]dimension.
@@ -131,11 +135,12 @@ This example will create the default hyper-L.
#include <grid/tria.h>
+#include <grid/grid_generator.h>
const unsigned int dim=2; // For example
Triangulation<dim> tr;
-tr.create_hyper_L(-1,1);
+GridGenerator<dim>::hyper_L(tr,-1,1);