]> https://gitweb.dealii.org/ - dealii.git/commitdiff
SymmetricTensor: add a comment on indexing. 16261/head
authorDavid Wells <drwells@email.unc.edu>
Sun, 12 Nov 2023 13:27:48 +0000 (08:27 -0500)
committerDavid Wells <drwells@email.unc.edu>
Sun, 12 Nov 2023 13:37:21 +0000 (08:37 -0500)
include/deal.II/base/symmetric_tensor.h

index 9ce3e5389566f0d04caef28a498bbdf83609ffd5..7a31df5539de053dc211a25f24c8ca2305beb3ae 100644 (file)
@@ -2057,7 +2057,11 @@ namespace internal
                 std::min(indices[0], indices[1]),
                 std::max(indices[0], indices[1]));
 
-              for (unsigned int d = 0, c = 0; d < dim; ++d)
+              // Here (d, e) are the row and column of the symmetric matrix and
+              // 'dim + c' is the index into the Tensor<1, dim> actually used
+              // for storage.
+              unsigned int c = 0;
+              for (unsigned int d = 0; d < dim; ++d)
                 for (unsigned int e = d + 1; e < dim; ++e, ++c)
                   if ((sorted_indices[0] == d) && (sorted_indices[1] == e))
                     return dim + c;

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.