From: David Wells Date: Sun, 12 Nov 2023 12:41:52 +0000 (-0500) Subject: SymmetricTensor: use ndarray. X-Git-Tag: relicensing~304^2~1 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8d66107a20b6db7465b65d20039f5f1a537a0940;p=dealii.git SymmetricTensor: use ndarray. --- diff --git a/include/deal.II/base/symmetric_tensor.h b/include/deal.II/base/symmetric_tensor.h index 5bf97c94b5..9ce3e53895 100644 --- a/include/deal.II/base/symmetric_tensor.h +++ b/include/deal.II/base/symmetric_tensor.h @@ -19,6 +19,7 @@ #include +#include #include #include #include @@ -2025,30 +2026,27 @@ namespace internal { return 0; } - case 2: { - constexpr unsigned int table[2][2] = {{0, 2}, {2, 1}}; + constexpr dealii::ndarray table = { + {{{0, 2}}, {{2, 1}}}}; return table[indices[0]][indices[1]]; } - case 3: { - constexpr unsigned int table[3][3] = {{0, 3, 4}, - {3, 1, 5}, - {4, 5, 2}}; + constexpr dealii::ndarray table = { + {{{0, 3, 4}}, {{3, 1, 5}}, {{4, 5, 2}}}}; return table[indices[0]][indices[1]]; } - case 4: { - constexpr unsigned int table[4][4] = {{0, 4, 5, 6}, - {4, 1, 7, 8}, - {5, 7, 2, 9}, - {6, 8, 9, 3}}; + constexpr dealii::ndarray table = { + {{{0, 4, 5, 6}}, + {{4, 1, 7, 8}}, + {{5, 7, 2, 9}}, + {{6, 8, 9, 3}}}}; return table[indices[0]][indices[1]]; } - default: // for the remainder, manually figure out the numbering {