From 03aacfb067f499c6c7591f24c1ba890e79ab0c1c Mon Sep 17 00:00:00 2001 From: bangerth Date: Fri, 25 Sep 2009 00:12:55 +0000 Subject: [PATCH] Provide access operator for all indices at once. git-svn-id: https://svn.dealii.org/trunk@19533 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/base/include/base/symmetric_tensor.h | 36 ++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/deal.II/base/include/base/symmetric_tensor.h b/deal.II/base/include/base/symmetric_tensor.h index 2fbc062406..af7052545a 100644 --- a/deal.II/base/include/base/symmetric_tensor.h +++ b/deal.II/base/include/base/symmetric_tensor.h @@ -877,6 +877,22 @@ class SymmetricTensor internal::SymmetricTensorAccessors::Accessor operator [] (const unsigned int row); + /** + * Access to an element where you + * specify the entire set of + * indices. + */ + double + operator [] (const TableIndices &indices) const; + + /** + * Access to an element where you + * specify the entire set of + * indices. + */ + double & + operator [] (const TableIndices &indices); + /** * Return the Frobenius-norm of a tensor, * i.e. the square root of the sum of @@ -1906,6 +1922,26 @@ SymmetricTensor::operator [] (const unsigned int row) +template +inline +double +SymmetricTensor::operator [] (const TableIndices &indices) const +{ + return data[component_to_unrolled_index(indices)]; +} + + + +template +inline +double & +SymmetricTensor::operator [] (const TableIndices &indices) +{ + return data[component_to_unrolled_index(indices)]; +} + + + template <> inline double -- 2.39.5