Class notes for 2006/01/25

Tasks for today: Take a look at the DoFHandler classes.


Since Triangulation objects only store information about the geometry (location of vertices) and topology (connection of vertices to lines and cells), we need a different object that extends this information to hold data that describes where degrees of freedom are located. The class that does that is the DoFHandler class: it allocates the necessary data structures to manage the degrees of freedom that a finite element says it wants. A DoFHandler is associated with a triangulation, but it is not a derived class. In fact, several DoFHandler objects can be associated with the same triangulation at the same time.

What one can do with a DoFHandler (see for complete listing):

	   Triangulation<dim> triangulation;
	   DoFHandler<dim> dof_handler (triangulation);
	   FE_Q<dim> fe(3);
	   dof_handler.distribute_dofs (fe); 

That's essentially the same situation as with Triangulation: a DoFHandler doesn't offer much of an interface, it only stores data. Data is accessed through Iterators/Accessors, however:

	  DoFHandler<dim>::active_cell_iterator cell = dof_handler.begin_active();

	  // this is simply handled by the triangulation this DoFHandler is associated with:
	  cell->vertex (3);
	  cell->set_refine_flag ();
	  cell->at_boundary (0);
	  cell->diameter ();
	  cell->measure ();
	  cell->get_tria ();

	  // this is new, though:
	  cell->dof_index (3);

	  std::vector<unsigned int> local_dof_indices (fe.dofs_per_cell);
	  cell->get_dof_indices (local_dof_indices);

	  Vector<double> global_solution (dof_handler.n_dofs());
	  std::vector<double> local_solution_values;
	  cell->get_dof_values (global_solution, local_solution_values);


Full listing of capabilities of DoFHandler iterators: and

Discuss step-2 tutorial program: