From ce317691a965b7675bf5e8b3e0e2efb43b670597 Mon Sep 17 00:00:00 2001 From: bangerth Date: Thu, 8 Oct 2009 12:41:41 +0000 Subject: [PATCH] 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 --- deal.II/base/include/base/symmetric_tensor.h | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) 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> -- 2.39.5