From: Peter Munch Date: Sun, 18 Sep 2022 08:16:53 +0000 (+0200) Subject: Fix high-order output for vtu in parallel X-Git-Tag: v9.5.0-rc1~953^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=78370f6520c650cfeca123ee29204f80e6c5c1a1;p=dealii.git Fix high-order output for vtu in parallel --- diff --git a/doc/news/changes/incompatibilities/20220918Munch b/doc/news/changes/incompatibilities/20220918Munch new file mode 100644 index 0000000000..dad86fd957 --- /dev/null +++ b/doc/news/changes/incompatibilities/20220918Munch @@ -0,0 +1,5 @@ +Updated: The version of the vtu output has been increased to 2.2 +if high-order output is requested. +This is necessary to fix visualization issues in Paraview. +
+(Peter Munch, Magdalena Schreter, 2022/09/18) diff --git a/source/base/data_out_base.cc b/source/base/data_out_base.cc index 0ebfb4e285..6ff70bee33 100644 --- a/source/base/data_out_base.cc +++ b/source/base/data_out_base.cc @@ -921,7 +921,8 @@ namespace vtk_point_index_from_ijk(const unsigned i, const unsigned j, const unsigned, - const std::array &order) + const std::array &order, + const bool) { const bool ibdy = (i == 0 || i == order[0]); const bool jbdy = (j == 0 || j == order[1]); @@ -964,12 +965,19 @@ namespace * * Modified from * https://github.com/Kitware/VTK/blob/265ca48a/Common/DataModel/vtkLagrangeHexahedron.cxx#L734 + * (legacy_format=true) and from + * https://github.com/Kitware/VTK/blob/256fe70de00e3441f126276ca4a8c5477d0bcb86/Common/DataModel/vtkHigherOrderHexahedron.cxx#L593 + * (legacy_format=false). The two versions differ regarding the ordering of + * lines 10 and 11 (clockwise vs. anti-clockwise). See also: + * https://github.com/Kitware/VTK/blob/7a0b92864c96680b1f42ee84920df556fc6ebaa3/Documentation/release/dev/node-numbering-change-for-VTK_LAGRANGE_HEXAHEDRON.md + * */ int vtk_point_index_from_ijk(const unsigned i, const unsigned j, const unsigned k, - const std::array &order) + const std::array &order, + const bool legacy_format) { const bool ibdy = (i == 0 || i == order[0]); const bool jbdy = (j == 0 || j == order[1]); @@ -1000,10 +1008,16 @@ namespace } // !kbdy, On k axis offset += 4 * (order[0] - 1) + 4 * (order[1] - 1); - return (k - 1) + - (order[2] - 1) * - (i != 0u ? (j != 0u ? 3 : 1) : (j != 0u ? 2 : 0)) + - offset; + if (legacy_format) + return (k - 1) + + (order[2] - 1) * + (i != 0u ? (j != 0u ? 3 : 1) : (j != 0u ? 2 : 0)) + + offset; + else + return (k - 1) + + (order[2] - 1) * + (i != 0u ? (j != 0u ? 2 : 1) : (j != 0u ? 3 : 0)) + + offset; } offset += 4 * (order[0] - 1 + order[1] - 1 + order[2] - 1); @@ -1040,7 +1054,8 @@ namespace vtk_point_index_from_ijk(const unsigned, const unsigned, const unsigned, - const std::array &) + const std::array &, + const bool) { Assert(false, ExcNotImplemented()); return 0; @@ -1052,7 +1067,8 @@ namespace vtk_point_index_from_ijk(const unsigned, const unsigned, const unsigned, - const std::array &) + const std::array &, + const bool) { Assert(false, ExcNotImplemented()); return 0; @@ -2965,7 +2981,8 @@ namespace DataOutBase template void write_high_order_cells(const std::vector> &patches, - StreamType & out) + StreamType & out, + const bool legacy_format) { Assert(dim <= 3 && dim > 1, ExcNotImplemented()); unsigned int first_vertex_of_patch = 0; @@ -3013,7 +3030,8 @@ namespace DataOutBase const unsigned int local_index = i3 * d3 + i2 * d2 + i1 * d1; const unsigned int connectivity_index = - vtk_point_index_from_ijk(i1, i2, i3, cell_order); + vtk_point_index_from_ijk( + i1, i2, i3, cell_order, legacy_format); connectivity[connectivity_index] = local_index; } @@ -5653,7 +5671,7 @@ namespace DataOutBase // now for the cells out << "CELLS " << n_cells << ' ' << n_points_and_n_cells << '\n'; if (flags.write_higher_order_cells) - write_high_order_cells(patches, vtk_out); + write_high_order_cells(patches, vtk_out, /* legacy_format = */ true); else write_cells(patches, vtk_out); out << '\n'; @@ -5802,7 +5820,11 @@ namespace DataOutBase else out << '.'; out << "\n-->\n"; - out << "\n"; if (flags.write_higher_order_cells) - write_high_order_cells(patches, vtu_out); + write_high_order_cells(patches, vtu_out, /* legacy_format = */ false); else write_cells(patches, vtu_out); out << " \n"; diff --git a/tests/data_out/data_out_base_vtu_04.with_zlib=on.output b/tests/data_out/data_out_base_vtu_04.with_zlib=on.output index dfc381a0b8..1f924321ad 100644 --- a/tests/data_out/data_out_base_vtu_04.with_zlib=on.output +++ b/tests/data_out/data_out_base_vtu_04.with_zlib=on.output @@ -4,7 +4,7 @@ # vtk DataFile Version 3.0 #This file was generated --> - + diff --git a/tests/data_out/data_out_base_vtu_05.with_zlib=on.output b/tests/data_out/data_out_base_vtu_05.with_zlib=on.output index b22925431b..9da92020c9 100644 --- a/tests/data_out/data_out_base_vtu_05.with_zlib=on.output +++ b/tests/data_out/data_out_base_vtu_05.with_zlib=on.output @@ -4,7 +4,7 @@ # vtk DataFile Version 3.0 #This file was generated --> - + @@ -15,7 +15,7 @@ AQAAAAASAAAAEgAAOgQAAA==eNrVl19k1WEYx9kfOYrUFNEiRReZ6WaRzvcRi6aLionUJNnFLtau0lUl -AQAAAAAGAAAABgAARwIAAA==eNol02O7HgQAANB3xp1tm3e272zbtm3VbNRWs70aa0bNZs22VeN5nn04P+EEAoFAGKIThWByUYzChCI0EQgiKtEIS0RykJN8FKIIRclNfmKQgtikJglZSE524pCANGQgPolJT2ZiEouUpCIpychKNsIRnkhEJg95KUBB4hKPhCQiLenISCaKU4qqVKIbPRnKIEpQkrJUpDJVCKEc3elBXwYymCH0oh/VaEZNWtKITjSlK7WoRyvaUZeGtKUj1alBc1rQmCZ0pgulKUN5KtCbPvRnALWpQ30a0Jo2tKcDwxjJZCawgd/ZzQ6GM4IfGc9EJjGKMWzkN7byJzvZxSa2MYUFTGcxv7CG+axnBj+xhBXMZi7LWc1UprGQRfzKPNayjtH8wFjGsZktbOcPZjKLn5nDUpaxklXsYT8nOcYLXvOVT+xlH39zlOOc4ACHeMkr3vORz3zhDR84xQ3OcpsrPOE6zznHJe7wgIv8y30ec5oz3OQWV7nGU55xkL84zBHe8o7/+J/zXOAy/3CXezzkUeB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