Skip to content

Commit

Permalink
Merge pull request #16803 from bangerth/doc
Browse files Browse the repository at this point in the history
Augment documentation of class Tensor.
  • Loading branch information
kronbichler committed Mar 28, 2024
2 parents 40aaea9 + 56e9fc5 commit 16f23ad
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion include/deal.II/base/tensor.h
Original file line number Diff line number Diff line change
Expand Up @@ -541,7 +541,17 @@ class alignas(

/**
* 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<rank,dim> t;
* for (unsigned int i=0; i<Tensor<rank,dim>::n_independent_components; ++i)
* t[Tensor<rank,dim>::unrolled_to_component_indices(i)] = 1.0;
* @endcode
*/
static constexpr unsigned int n_independent_components =
Tensor<rank_ - 1, dim>::n_independent_components * dim;
Expand Down

0 comments on commit 16f23ad

Please sign in to comment.