]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Add SymmetricTensor<2,4>::component_to_unrolled_index for the benefit
authorWolfgang Bangerth <bangerth@math.tamu.edu>
Thu, 8 Oct 2009 12:41:41 +0000 (12:41 +0000)
committerWolfgang Bangerth <bangerth@math.tamu.edu>
Thu, 8 Oct 2009 12:41:41 +0000 (12:41 +0000)
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

index af7052545afafc94385cf6b5261bb9a0fc45b6fd..94e3490532972bcc861b90cc36cbef1e535231b5 100644 (file)
@@ -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>

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.