Class notes for 2008/09/01

Tasks for today: Talk about project presentation schedule. Go over how templates in C++ work, and how they are used in deal.II. For this, review this presentation. step-1. step-2.

Grid classes

GeometryInfo was already mentioned:

Triangulation ( Creation typically using the GridGenerator class

	Triangulation<dim> triangulation;
	GridGenerator::hyper_cube (triangulation);
	GridGenerator::hyper_ball (triangulation);

Triangulation is essentially a container class to store the data about vertices and their connection to lines, faces, and cells. Just like with STL containers, the Triangulation class does not have very many functions that actually do something with the data:

	Triangulation<dim> triangulation;
	triangulation.n_cells ();
	triangulation.n_active_cells ();
	triangulation.refine_global ();
	triangulation.execute_coarsening_and_refinement ();

Data is stored in a level-wise hierarchy. Triangulations allow to get access to this data using iterators:

	Triangulation<dim>::cell_iterator cell = triangulation.begin();
	Triangulation<dim>::active_cell_iterator cell = triangulation.begin_active();

Iterators are like pointers: they point to an object that one can manipulate or ask for information. However, these objects are not consecutive in memory, so we can't just use a simple pointer but instead use a class that acts like a pointer (an iterator type). In addition, active iterators can simply skip over non-active cells, i.e. they provide a view on a subset of all cells.

Usually, iterators point to objects with data. In our case, we don't even do that: iterators point to accessors -- objects that do not store the data itself, but have functions that can be used to access the data that is stored elsewhere. For example:

	cell->vertex (3);
	cell->neighbor (1);
	cell->set_refine_flag ();// only active
	cell->child (2);         // only non-active
	cell->at_boundary (0);
	cell->diameter ();
	cell->measure ();
	cell->get_tria ();

A complete listing of functions can be found here: and