From: Wolfgang Bangerth Date: Thu, 28 Mar 2024 16:12:30 +0000 (-0600) Subject: Augment documentation of class Tensor. X-Git-Tag: v9.6.0-rc1~441^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F16803%2Fhead;p=dealii.git Augment documentation of class Tensor. --- diff --git a/include/deal.II/base/tensor.h b/include/deal.II/base/tensor.h index 07e53f92c8..9d877de5af 100644 --- a/include/deal.II/base/tensor.h +++ b/include/deal.II/base/tensor.h @@ -541,7 +541,17 @@ public: /** * Number of independent components of a tensor of current rank. This is dim - * times the number of independent components of each sub-tensor. + * times the number of independent components of each sub-tensor, which + * equates to `dim^rank`. + * + * This number can be used to loop over all of the entries of a tensor, + * using the unrolled_to_component_indices() function: + * @code + * // Fill a tensor of arbitrary rank with ones: + * Tensor t; + * for (unsigned int i=0; i::n_independent_components; ++i) + * t[Tensor::unrolled_to_component_indices(i)] = 1.0; + * @endcode */ static constexpr unsigned int n_independent_components = Tensor::n_independent_components * dim;