From 340590804a387aaacfe6082766d13d71b2407c97 Mon Sep 17 00:00:00 2001 From: Rene Gassmoeller Date: Thu, 28 May 2020 11:17:39 -0700 Subject: [PATCH] Improve tensor dimension check --- source/base/data_out_base.cc | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) 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); } -- 2.39.5