]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Provide access operator for all indices at once.
authorWolfgang Bangerth <bangerth@math.tamu.edu>
Fri, 25 Sep 2009 00:12:55 +0000 (00:12 +0000)
committerWolfgang Bangerth <bangerth@math.tamu.edu>
Fri, 25 Sep 2009 00:12:55 +0000 (00:12 +0000)
git-svn-id: https://svn.dealii.org/trunk@19533 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/base/include/base/symmetric_tensor.h

index 2fbc0624067f85369ede471d8acdadba015ec4eb..af7052545afafc94385cf6b5261bb9a0fc45b6fd 100644 (file)
@@ -877,6 +877,22 @@ class SymmetricTensor
     internal::SymmetricTensorAccessors::Accessor<rank,dim,false,rank-1>
     operator [] (const unsigned int row);
 
+                                    /**
+                                     * Access to an element where you
+                                     * specify the entire set of
+                                     * indices.
+                                     */
+    double
+    operator [] (const TableIndices<rank> &indices) const;
+
+                                    /**
+                                     * Access to an element where you
+                                     * specify the entire set of
+                                     * indices.
+                                     */
+    double &
+    operator [] (const TableIndices<rank> &indices);
+
                                      /**
                                       * Return the Frobenius-norm of a tensor,
                                       * i.e. the square root of the sum of
@@ -1906,6 +1922,26 @@ SymmetricTensor<rank,dim>::operator [] (const unsigned int row)
 
 
 
+template <int rank, int dim>
+inline
+double
+SymmetricTensor<rank,dim>::operator [] (const TableIndices<rank> &indices) const
+{
+  return data[component_to_unrolled_index(indices)];
+}
+
+
+
+template <int rank, int dim>
+inline
+double &
+SymmetricTensor<rank,dim>::operator [] (const TableIndices<rank> &indices)
+{
+  return data[component_to_unrolled_index(indices)];
+}
+
+
+
 template <>
 inline
 double

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.