]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Improve tensor dimension check 10390/head
authorRene Gassmoeller <rene.gassmoeller@mailbox.org>
Thu, 28 May 2020 18:17:39 +0000 (11:17 -0700)
committerRene Gassmoeller <rene.gassmoeller@mailbox.org>
Thu, 28 May 2020 18:17:39 +0000 (11:17 -0700)
source/base/data_out_base.cc

index a2642d1ef36ef782377098bfa16bcac01c41f9a0..eb035a2db7418e35593ad72f7aa0335faea380db 100644 (file)
@@ -5415,13 +5415,24 @@ namespace DataOutBase
                   {
                     vtk_data[0][0] = data_vectors(first_component, n);
                   }
-                else if ((size == 4) || (size == 9))
-                  // 2D, 4 elements or 3D 9 elements
+                else if (size == 4)
+                  // 2D, 4 elements
                   {
                     for (unsigned int c = 0; c < size; ++c)
                       {
                         const auto ind =
-                          Tensor<2, spacedim>::unrolled_to_component_indices(c);
+                          Tensor<2, 2>::unrolled_to_component_indices(c);
+                        vtk_data[ind[0]][ind[1]] =
+                          data_vectors(first_component + c, n);
+                      }
+                  }
+                else if (size == 9)
+                  // 3D 9 elements
+                  {
+                    for (unsigned int c = 0; c < size; ++c)
+                      {
+                        const auto ind =
+                          Tensor<2, 3>::unrolled_to_component_indices(c);
                         vtk_data[ind[0]][ind[1]] =
                           data_vectors(first_component + c, n);
                       }

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.