From: Wolfgang Bangerth Date: Thu, 8 Oct 2009 12:41:41 +0000 (+0000) Subject: Add SymmetricTensor<2,4>::component_to_unrolled_index for the benefit X-Git-Tag: v8.0.0~6956 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=eff0ef28448b6f001bb29671754df797f29fea1b;p=dealii.git Add SymmetricTensor<2,4>::component_to_unrolled_index for the benefit of DataOutBase when outputting symmetric tensors. git-svn-id: https://svn.dealii.org/trunk@19760 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/base/include/base/symmetric_tensor.h b/deal.II/base/include/base/symmetric_tensor.h index af7052545a..94e3490532 100644 --- a/deal.II/base/include/base/symmetric_tensor.h +++ b/deal.II/base/include/base/symmetric_tensor.h @@ -2084,6 +2084,25 @@ SymmetricTensor<2,3>::component_to_unrolled_index (const TableIndices<2> &indice +template <> +inline +unsigned int +SymmetricTensor<2,4>::component_to_unrolled_index (const TableIndices<2> &indices) +{ + const unsigned int dim = 4; + Assert (indices[0] < dim, ExcIndexRange(indices[0], 0, dim)); + Assert (indices[1] < dim, ExcIndexRange(indices[1], 0, dim)); + + static const unsigned int table[dim][dim] = {{0, 4, 5, 6}, + {4, 1, 7, 8}, + {5, 7, 2, 9}, + {6, 8, 9, 3}}; + + return table[indices[0]][indices[1]]; +} + + + template <> inline TableIndices<2>