]> https://gitweb.dealii.org/ - dealii.git/commit
Reorganize code in symmetric_tensor.h. 295/head
authorWolfgang Bangerth <bangerth@math.tamu.edu>
Thu, 11 Dec 2014 13:09:03 +0000 (07:09 -0600)
committerWolfgang Bangerth <bangerth@math.tamu.edu>
Thu, 11 Dec 2014 13:09:03 +0000 (07:09 -0600)
commit60c79222624a527283e13b7eea744b2b38ddf894
treec617f13453e8131d135019a904398ea32b839ef7
parent18ff1ea7679c7809b3e4cf17f834b3bfa369f850
Reorganize code in symmetric_tensor.h.

The current implementation of SymmetricTensor<rank,dim,Number>::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.
include/deal.II/base/symmetric_tensor.h

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.