A grid should be chosen to fit your problem space in the best way possible.
This chapter describes coarse grids for the triangulation of your domain.
</p>
-
+<p>Please remember throughout this chapter:
+<b>A triangulation must be void before it is initialized !</b>
+</p>
<p>
<acronym>deal.II</acronym> offers three fundamental grid types:
a <a href="#cube">hypercube</a>, a <a href="#ball">hyperball</a>
<p>
A hypercube can be created using the function<br>
-<code>void Triangulation::create_hypercube(const double left=0.,const double right=1.)</code><br>
+<code>void GridGenerator<dim>::hyper_cube(Triangulation<dim> &tria,const double left=0.,const double right=1.)</code><br>
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.
<pre class="example">
<code>
#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);
</code>
</pre>
<h3><a name="ball">Hyperball</a></h3>
<p>
A hyperball can be created using the function<br>
-<code>void Triangulation::create_hyper_ball(const Point<dim> center=0.,const double radius=1.)</code><br>
+<code>void GridGenerator<dim>::hyper_ball(Triangulation<dim> &tria,const Point<dim> center=0.,const double radius=1.)</code><br>
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.
</p>
<pre class="example">
<code>
#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);
</code>
</pre>
<h3><a name="L">Hyper-L</a></h3>
<p>
A hyper-L can be created using the function<br>
-<code>void Triangulation::create_hyper_L(const double left=-1.,const double right=1.)</code><br>
+<code>void GridGenerator::hyper_L(Triangulation<dim> &tria,const double left=-1.,const double right=1.)</code><br>
This will create a hyper-L consisting of 2<sup>dimension</sup>-1 cells.
The hyper-L is created from the hypercube [left,right]<sup>dimension</sup> by taking
away the hypercube [left+right/2,right]<sup>dimension</sup>.
<pre class="example">
<code>
#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);
</code>
</pre>