dealii/dealii — pull request #295 by bangerth (2014-12-11 13:09:43+00:00)
Title: Reorganize code in symmetric_tensor.h.

The current implementation of SymmetricTensor::unrolled_to_component_indices
and its inverse function was only implemented for rank=2 and looked essentially like this:

Assert (rank == 2, ExcNotImplemented());
Assert (i < n_independent_components, ExcIndexRange(i, 0, n_independent_components));
switch (dim)
{
case 1:
return TableIndices<2>(0,0);
...

Such code cannot be generalized to rank=4 (in fact, it doesn't even compile
for rank=4) because we would have to return objects of different types
in any switch on rank. The only way around this is to use dispatch to
different functions that do the work for a particular rank.

This patch does the first part of this: set up the dispatch. Later patches
may in fact implement this function and its inverse for other ranks than 2.