From: Rene Gassmoeller Date: Thu, 28 May 2020 18:17:39 +0000 (-0700) Subject: Improve tensor dimension check X-Git-Tag: v9.3.0-rc1~1523^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=340590804a387aaacfe6082766d13d71b2407c97;p=dealii.git Improve tensor dimension check --- diff --git a/source/base/data_out_base.cc b/source/base/data_out_base.cc index a2642d1ef3..eb035a2db7 100644 --- a/source/base/data_out_base.cc +++ b/source/base/data_out_base.cc @@ -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); }