Line | Branch | Exec | Source |
---|---|---|---|
1 | // SPDX-FileCopyrightText: 2022-2023 Dennis Gläser <dennis.glaeser@iws.uni-stuttgart.de> | ||
2 | // SPDX-License-Identifier: MIT | ||
3 | /*! | ||
4 | * \file | ||
5 | * \ingroup VTK | ||
6 | * \copydoc GridFormat::PVTSWriter | ||
7 | */ | ||
8 | #ifndef GRIDFORMAT_VTK_PVTS_WRITER_HPP_ | ||
9 | #define GRIDFORMAT_VTK_PVTS_WRITER_HPP_ | ||
10 | |||
11 | #include <ostream> | ||
12 | #include <string> | ||
13 | #include <fstream> | ||
14 | #include <algorithm> | ||
15 | #include <filesystem> | ||
16 | #include <array> | ||
17 | #include <tuple> | ||
18 | #include <cmath> | ||
19 | |||
20 | #include <gridformat/common/field.hpp> | ||
21 | #include <gridformat/common/ranges.hpp> | ||
22 | #include <gridformat/common/exceptions.hpp> | ||
23 | #include <gridformat/common/lvalue_reference.hpp> | ||
24 | |||
25 | #include <gridformat/parallel/communication.hpp> | ||
26 | #include <gridformat/parallel/helpers.hpp> | ||
27 | |||
28 | #include <gridformat/grid/grid.hpp> | ||
29 | #include <gridformat/xml/element.hpp> | ||
30 | #include <gridformat/vtk/parallel.hpp> | ||
31 | #include <gridformat/vtk/vts_writer.hpp> | ||
32 | |||
33 | namespace GridFormat { | ||
34 | |||
35 | /*! | ||
36 | * \ingroup VTK | ||
37 | * \brief Writer for parallel .pvts files | ||
38 | */ | ||
39 | template<Concepts::StructuredGrid Grid, | ||
40 | Concepts::Communicator Communicator> | ||
41 | class PVTSWriter : public VTK::XMLWriterBase<Grid, PVTSWriter<Grid, Communicator>> { | ||
42 | using ParentType = VTK::XMLWriterBase<Grid, PVTSWriter<Grid, Communicator>>; | ||
43 | using CT = CoordinateType<Grid>; | ||
44 | |||
45 | static constexpr std::size_t space_dim = 3; | ||
46 | static constexpr std::size_t dim = dimension<Grid>; | ||
47 | static constexpr int root_rank = 0; | ||
48 | |||
49 | public: | ||
50 | 12250 | explicit PVTSWriter(LValueReferenceOf<const Grid> grid, | |
51 | Communicator comm, | ||
52 | VTK::XMLOptions xml_opts = {}) | ||
53 | 12250 | : ParentType(grid.get(), ".pvts", true, xml_opts) | |
54 |
2/4✓ Branch 1 taken 6130 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 6130 times.
✗ Branch 5 not taken.
|
36750 | , _comm(comm) |
55 | 12250 | {} | |
56 | |||
57 | 26 | const Communicator& communicator() const { | |
58 | 26 | return _comm; | |
59 | } | ||
60 | |||
61 | private: | ||
62 | Communicator _comm; | ||
63 | |||
64 | 8400 | PVTSWriter _with(VTK::XMLOptions xml_opts) const override { | |
65 |
1/2✓ Branch 4 taken 4200 times.
✗ Branch 5 not taken.
|
8400 | return PVTSWriter{this->grid(), _comm, std::move(xml_opts)}; |
66 | } | ||
67 | |||
68 | ✗ | void _write(std::ostream&) const override { | |
69 | ✗ | throw InvalidState( | |
70 | "PVTSWriter does not support direct export into stream. " | ||
71 | "Use overload with filename instead!" | ||
72 | ); | ||
73 | } | ||
74 | |||
75 | 4112 | virtual void _write(const std::string& filename_with_ext) const override { | |
76 |
1/2✓ Branch 2 taken 8 times.
✗ Branch 3 not taken.
|
4112 | const auto& local_extents = extents(this->grid()); |
77 |
1/2✓ Branch 1 taken 2072 times.
✗ Branch 2 not taken.
|
4112 | const auto [origin, is_negative_axis] = _get_origin_and_orientations(local_extents); |
78 | |||
79 | 4112 | PVTK::StructuredParallelGridHelper helper{_comm}; | |
80 |
1/2✓ Branch 1 taken 2072 times.
✗ Branch 2 not taken.
|
4112 | const auto all_origins = Parallel::gather(_comm, origin, root_rank); |
81 |
1/2✓ Branch 1 taken 2072 times.
✗ Branch 2 not taken.
|
4112 | const auto all_extents = Parallel::gather(_comm, local_extents, root_rank); |
82 |
2/4✓ Branch 1 taken 2072 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 2072 times.
✗ Branch 5 not taken.
|
4112 | const auto [exts_begin, exts_end, whole_extent, _] = helper.compute_extents_and_origin( |
83 | all_origins, | ||
84 | all_extents, | ||
85 | is_negative_axis | ||
86 | ); | ||
87 | |||
88 |
1/2✓ Branch 1 taken 2072 times.
✗ Branch 2 not taken.
|
4112 | const auto my_whole_extent = Parallel::broadcast(_comm, whole_extent, root_rank); |
89 |
2/4✓ Branch 1 taken 2072 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 2072 times.
✗ Branch 5 not taken.
|
4112 | const auto my_extent_offset = Parallel::scatter(_comm, Ranges::flat(exts_begin), root_rank); |
90 | |||
91 |
3/4✓ Branch 1 taken 2072 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1832 times.
✓ Branch 5 taken 240 times.
|
4112 | _write_piece(filename_with_ext, Ranges::to_array<dim>(my_extent_offset), {my_whole_extent}); |
92 |
1/2✓ Branch 1 taken 1832 times.
✗ Branch 2 not taken.
|
3632 | Parallel::barrier(_comm); // ensure all pieces finished successfully |
93 |
3/4✓ Branch 1 taken 1832 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 616 times.
✓ Branch 4 taken 1216 times.
|
3632 | if (Parallel::rank(_comm) == 0) |
94 |
1/2✓ Branch 1 taken 616 times.
✗ Branch 2 not taken.
|
1216 | _write_pvts_file(filename_with_ext, my_whole_extent, exts_begin, exts_end); |
95 |
1/2✓ Branch 1 taken 1832 times.
✗ Branch 2 not taken.
|
3632 | Parallel::barrier(_comm); // ensure .pvts file is written before returning |
96 | 5552 | } | |
97 | |||
98 | 4112 | auto _get_origin_and_orientations(const std::ranges::range auto& extents) const { | |
99 | 4112 | auto is_negative_axis = Ranges::filled_array<dim>(false); | |
100 |
1/2✓ Branch 1 taken 2072 times.
✗ Branch 2 not taken.
|
15536 | std::ranges::for_each(extents, [&, dir=0] (const auto& e) mutable { |
101 |
2/4✓ Branch 0 taken 880 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4896 times.
✗ Branch 3 not taken.
|
5776 | if (e > 0) |
102 | 5776 | is_negative_axis[dir] = _is_negative_axis(dir); | |
103 | 5776 | dir++; | |
104 | }); | ||
105 | |||
106 | std::array<CT, dim> origin; | ||
107 | static constexpr auto origin_loc = _origin_location(); | ||
108 |
9/19✓ Branch 2 taken 8 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 8 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 41201 times.
✓ Branch 8 taken 8 times.
✗ Branch 9 not taken.
✓ Branch 11 taken 8 times.
✗ Branch 12 not taken.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
✓ Branch 17 taken 8 times.
✗ Branch 18 not taken.
✓ Branch 19 taken 8 times.
✗ Branch 20 not taken.
✗ Branch 22 not taken.
✓ Branch 23 taken 8 times.
✗ Branch 25 not taken.
✓ Branch 26 taken 8 times.
|
82042 | for (const auto& p : points(this->grid())) { |
109 | 82026 | const auto& loc = location(this->grid(), p); | |
110 |
1/2✓ Branch 2 taken 41209 times.
✗ Branch 3 not taken.
|
82026 | const auto& pos = coordinates(this->grid(), p); |
111 |
3/4✓ Branch 1 taken 41209 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 2072 times.
✓ Branch 4 taken 39137 times.
|
82026 | if (std::ranges::equal(loc, origin_loc)) { |
112 |
1/2✓ Branch 1 taken 2072 times.
✗ Branch 2 not taken.
|
4112 | std::ranges::copy(pos, origin.begin()); |
113 | 4120 | return std::make_tuple(std::move(origin), std::move(is_negative_axis)); | |
114 | } | ||
115 | } | ||
116 | |||
117 | ✗ | throw InvalidState("Could not determine origin"); | |
118 | } | ||
119 | |||
120 | static constexpr auto _origin_location() { | ||
121 | std::array<std::size_t, dim> origin; | ||
122 | std::ranges::fill(origin, 0); | ||
123 | return origin; | ||
124 | } | ||
125 | |||
126 | 11488 | bool _is_negative_axis(unsigned axis) const { | |
127 |
9/19✓ Branch 2 taken 16 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 16 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 8541 times.
✓ Branch 8 taken 16 times.
✗ Branch 9 not taken.
✓ Branch 11 taken 16 times.
✗ Branch 12 not taken.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
✓ Branch 17 taken 16 times.
✗ Branch 18 not taken.
✓ Branch 19 taken 16 times.
✗ Branch 20 not taken.
✗ Branch 22 not taken.
✓ Branch 23 taken 16 times.
✗ Branch 25 not taken.
✓ Branch 26 taken 16 times.
|
17072 | for (const auto& p0 : points(this->grid())) { |
128 |
1/2✓ Branch 3 taken 8557 times.
✗ Branch 4 not taken.
|
17040 | const auto i0 = Ranges::at(axis, location(this->grid(), p0)); |
129 |
2/4✓ Branch 2 taken 8557 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 8557 times.
✗ Branch 6 not taken.
|
17040 | const auto x0 = Ranges::at(axis, coordinates(this->grid(), p0)); |
130 |
10/19✓ Branch 2 taken 16 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 16 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 116707 times.
✓ Branch 8 taken 2797 times.
✗ Branch 9 not taken.
✓ Branch 11 taken 112 times.
✗ Branch 12 not taken.
✓ Branch 14 taken 96 times.
✗ Branch 15 not taken.
✓ Branch 17 taken 112 times.
✗ Branch 18 not taken.
✓ Branch 19 taken 112 times.
✗ Branch 20 not taken.
✗ Branch 22 not taken.
✓ Branch 23 taken 16 times.
✗ Branch 25 not taken.
✓ Branch 26 taken 16 times.
|
238728 | for (const auto& p1 : points(this->grid())) { |
131 |
1/2✓ Branch 3 taken 116819 times.
✗ Branch 4 not taken.
|
233048 | const auto i1 = Ranges::at(axis, location(this->grid(), p1)); |
132 |
2/4✓ Branch 2 taken 116819 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 116819 times.
✗ Branch 6 not taken.
|
233048 | const auto x1 = Ranges::at(axis, coordinates(this->grid(), p1)); |
133 |
2/2✓ Branch 0 taken 5776 times.
✓ Branch 1 taken 111043 times.
|
233048 | if (i1 > i0) |
134 | 11504 | return x1 < x0; | |
135 | } | ||
136 | } | ||
137 | ✗ | throw InvalidState("Could not determine axis orientation"); | |
138 | } | ||
139 | |||
140 | 4112 | void _write_piece(const std::string& par_filename, | |
141 | const std::array<std::size_t, dim>& offset, | ||
142 | typename VTSWriter<Grid>::Domain domain) const { | ||
143 |
1/2✓ Branch 2 taken 2072 times.
✗ Branch 3 not taken.
|
8224 | auto writer = VTSWriter{this->grid(), this->_xml_opts} |
144 |
2/4✓ Branch 2 taken 2072 times.
✗ Branch 3 not taken.
✓ Branch 6 taken 2072 times.
✗ Branch 7 not taken.
|
8224 | .as_piece_for(std::move(domain)) |
145 | .with_offset(offset); | ||
146 |
1/2✓ Branch 1 taken 2072 times.
✗ Branch 2 not taken.
|
4112 | this->copy_fields(writer); |
147 |
4/6✓ Branch 1 taken 2072 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 2072 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 1832 times.
✓ Branch 8 taken 240 times.
|
4592 | writer.write(PVTK::piece_basefilename(par_filename, Parallel::rank(_comm))); |
148 | 4112 | } | |
149 | |||
150 | 1216 | void _write_pvts_file(const std::string& filename_with_ext, | |
151 | const std::array<std::size_t, dim>& extents, | ||
152 | const std::vector<std::array<std::size_t, dim>>& proc_extents_begin, | ||
153 | const std::vector<std::array<std::size_t, dim>>& proc_extents_end) const { | ||
154 |
1/2✓ Branch 1 taken 616 times.
✗ Branch 2 not taken.
|
1216 | std::ofstream file_stream(filename_with_ext, std::ios::out); |
155 | |||
156 |
1/2✓ Branch 1 taken 616 times.
✗ Branch 2 not taken.
|
2432 | XMLElement pvtk_xml("VTKFile"); |
157 |
2/4✓ Branch 1 taken 616 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 616 times.
✗ Branch 5 not taken.
|
2432 | pvtk_xml.set_attribute("type", "PStructuredGrid"); |
158 | |||
159 |
2/4✓ Branch 1 taken 616 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 616 times.
✗ Branch 5 not taken.
|
1216 | XMLElement& grid = pvtk_xml.add_child("PStructuredGrid"); |
160 |
3/6✓ Branch 1 taken 616 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 616 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 616 times.
✗ Branch 8 not taken.
|
3648 | grid.set_attribute("WholeExtent", VTK::CommonDetail::extents_string(extents)); |
161 | |||
162 |
2/4✓ Branch 1 taken 616 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 616 times.
✗ Branch 5 not taken.
|
2432 | XMLElement& ppoint_data = grid.add_child("PPointData"); |
163 |
2/4✓ Branch 1 taken 616 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 616 times.
✗ Branch 5 not taken.
|
2432 | XMLElement& pcell_data = grid.add_child("PCellData"); |
164 |
2/4✓ Branch 1 taken 616 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 616 times.
✗ Branch 5 not taken.
|
1216 | XMLElement& pcoords = grid.add_child("PPoints"); |
165 | 1264 | std::visit([&] (const auto& encoder) { | |
166 | 1880 | std::visit([&] (const auto& data_format) { | |
167 | 616 | PVTK::PDataArrayHelper pdata_helper{encoder, data_format, ppoint_data}; | |
168 | 616 | PVTK::PDataArrayHelper cdata_helper{encoder, data_format, pcell_data}; | |
169 |
16/48✓ Branch 1 taken 32 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 32 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 80 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 80 times.
✗ Branch 11 not taken.
✓ Branch 13 taken 128 times.
✗ Branch 14 not taken.
✓ Branch 16 taken 128 times.
✗ Branch 17 not taken.
✓ Branch 19 taken 256 times.
✗ Branch 20 not taken.
✓ Branch 22 taken 256 times.
✗ Branch 23 not taken.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
✗ Branch 28 not taken.
✗ Branch 29 not taken.
✓ Branch 31 taken 8 times.
✗ Branch 32 not taken.
✓ Branch 34 taken 8 times.
✗ Branch 35 not taken.
✗ Branch 37 not taken.
✗ Branch 38 not taken.
✗ Branch 40 not taken.
✗ Branch 41 not taken.
✗ Branch 43 not taken.
✗ Branch 44 not taken.
✗ Branch 46 not taken.
✗ Branch 47 not taken.
✓ Branch 49 taken 32 times.
✗ Branch 50 not taken.
✓ Branch 52 taken 32 times.
✗ Branch 53 not taken.
✗ Branch 55 not taken.
✗ Branch 56 not taken.
✗ Branch 58 not taken.
✗ Branch 59 not taken.
✓ Branch 61 taken 16 times.
✗ Branch 62 not taken.
✓ Branch 64 taken 16 times.
✗ Branch 65 not taken.
✓ Branch 67 taken 64 times.
✗ Branch 68 not taken.
✓ Branch 70 taken 64 times.
✗ Branch 71 not taken.
|
8120 | std::ranges::for_each(this->_point_field_names(), [&] (const std::string& name) { |
170 | 3676 | pdata_helper.add(name, this->_get_point_field(name)); | |
171 | }); | ||
172 |
16/48✓ Branch 1 taken 32 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 32 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 80 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 80 times.
✗ Branch 11 not taken.
✓ Branch 13 taken 128 times.
✗ Branch 14 not taken.
✓ Branch 16 taken 128 times.
✗ Branch 17 not taken.
✓ Branch 19 taken 256 times.
✗ Branch 20 not taken.
✓ Branch 22 taken 256 times.
✗ Branch 23 not taken.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
✗ Branch 28 not taken.
✗ Branch 29 not taken.
✓ Branch 31 taken 8 times.
✗ Branch 32 not taken.
✓ Branch 34 taken 8 times.
✗ Branch 35 not taken.
✗ Branch 37 not taken.
✗ Branch 38 not taken.
✗ Branch 40 not taken.
✗ Branch 41 not taken.
✗ Branch 43 not taken.
✗ Branch 44 not taken.
✗ Branch 46 not taken.
✗ Branch 47 not taken.
✓ Branch 49 taken 32 times.
✗ Branch 50 not taken.
✓ Branch 52 taken 32 times.
✗ Branch 53 not taken.
✗ Branch 55 not taken.
✗ Branch 56 not taken.
✗ Branch 58 not taken.
✗ Branch 59 not taken.
✓ Branch 61 taken 16 times.
✗ Branch 62 not taken.
✓ Branch 64 taken 16 times.
✗ Branch 65 not taken.
✓ Branch 67 taken 64 times.
✗ Branch 68 not taken.
✓ Branch 70 taken 64 times.
✗ Branch 71 not taken.
|
8120 | std::ranges::for_each(this->_cell_field_names(), [&] (const std::string& name) { |
173 | 3676 | cdata_helper.add(name, this->_get_cell_field(name)); | |
174 | }); | ||
175 | |||
176 | 1880 | std::visit([&] <typename T> (const Precision<T>& prec) { | |
177 |
20/96✓ Branch 1 taken 32 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 32 times.
✗ Branch 5 not taken.
✓ Branch 10 taken 64 times.
✗ Branch 11 not taken.
✓ Branch 13 taken 64 times.
✗ Branch 14 not taken.
✓ Branch 19 taken 128 times.
✗ Branch 20 not taken.
✓ Branch 22 taken 128 times.
✗ Branch 23 not taken.
✓ Branch 28 taken 192 times.
✗ Branch 29 not taken.
✓ Branch 31 taken 192 times.
✗ Branch 32 not taken.
✗ Branch 37 not taken.
✗ Branch 38 not taken.
✗ Branch 40 not taken.
✗ Branch 41 not taken.
✗ Branch 46 not taken.
✗ Branch 47 not taken.
✗ Branch 49 not taken.
✗ Branch 50 not taken.
✓ Branch 55 taken 16 times.
✗ Branch 56 not taken.
✓ Branch 58 taken 16 times.
✗ Branch 59 not taken.
✓ Branch 64 taken 8 times.
✗ Branch 65 not taken.
✓ Branch 67 taken 8 times.
✗ Branch 68 not taken.
✗ Branch 73 not taken.
✗ Branch 74 not taken.
✗ Branch 76 not taken.
✗ Branch 77 not taken.
✗ Branch 82 not taken.
✗ Branch 83 not taken.
✗ Branch 85 not taken.
✗ Branch 86 not taken.
✗ Branch 91 not taken.
✗ Branch 92 not taken.
✗ Branch 94 not taken.
✗ Branch 95 not taken.
✓ Branch 100 taken 64 times.
✗ Branch 101 not taken.
✓ Branch 103 taken 64 times.
✗ Branch 104 not taken.
✓ Branch 109 taken 32 times.
✗ Branch 110 not taken.
✓ Branch 112 taken 32 times.
✗ Branch 113 not taken.
✗ Branch 118 not taken.
✗ Branch 119 not taken.
✗ Branch 121 not taken.
✗ Branch 122 not taken.
✗ Branch 127 not taken.
✗ Branch 128 not taken.
✗ Branch 130 not taken.
✗ Branch 131 not taken.
✗ Branch 136 not taken.
✗ Branch 137 not taken.
✗ Branch 139 not taken.
✗ Branch 140 not taken.
✗ Branch 145 not taken.
✗ Branch 146 not taken.
✗ Branch 148 not taken.
✗ Branch 149 not taken.
✓ Branch 154 taken 16 times.
✗ Branch 155 not taken.
✓ Branch 157 taken 16 times.
✗ Branch 158 not taken.
✗ Branch 163 not taken.
✗ Branch 164 not taken.
✗ Branch 166 not taken.
✗ Branch 167 not taken.
✗ Branch 172 not taken.
✗ Branch 173 not taken.
✗ Branch 175 not taken.
✗ Branch 176 not taken.
✗ Branch 181 not taken.
✗ Branch 182 not taken.
✗ Branch 184 not taken.
✗ Branch 185 not taken.
✓ Branch 190 taken 64 times.
✗ Branch 191 not taken.
✓ Branch 193 taken 64 times.
✗ Branch 194 not taken.
✗ Branch 199 not taken.
✗ Branch 200 not taken.
✗ Branch 202 not taken.
✗ Branch 203 not taken.
✗ Branch 208 not taken.
✗ Branch 209 not taken.
✗ Branch 211 not taken.
✗ Branch 212 not taken.
|
1232 | XMLElement& pdata_array = pcoords.add_child("PDataArray"); |
178 |
30/144✓ Branch 1 taken 32 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 32 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 32 times.
✗ Branch 8 not taken.
✓ Branch 15 taken 64 times.
✗ Branch 16 not taken.
✓ Branch 18 taken 64 times.
✗ Branch 19 not taken.
✓ Branch 21 taken 64 times.
✗ Branch 22 not taken.
✓ Branch 29 taken 128 times.
✗ Branch 30 not taken.
✓ Branch 32 taken 128 times.
✗ Branch 33 not taken.
✓ Branch 35 taken 128 times.
✗ Branch 36 not taken.
✓ Branch 43 taken 192 times.
✗ Branch 44 not taken.
✓ Branch 46 taken 192 times.
✗ Branch 47 not taken.
✓ Branch 49 taken 192 times.
✗ Branch 50 not taken.
✗ Branch 57 not taken.
✗ Branch 58 not taken.
✗ Branch 60 not taken.
✗ Branch 61 not taken.
✗ Branch 63 not taken.
✗ Branch 64 not taken.
✗ Branch 71 not taken.
✗ Branch 72 not taken.
✗ Branch 74 not taken.
✗ Branch 75 not taken.
✗ Branch 77 not taken.
✗ Branch 78 not taken.
✓ Branch 85 taken 16 times.
✗ Branch 86 not taken.
✓ Branch 88 taken 16 times.
✗ Branch 89 not taken.
✓ Branch 91 taken 16 times.
✗ Branch 92 not taken.
✓ Branch 99 taken 8 times.
✗ Branch 100 not taken.
✓ Branch 102 taken 8 times.
✗ Branch 103 not taken.
✓ Branch 105 taken 8 times.
✗ Branch 106 not taken.
✗ Branch 113 not taken.
✗ Branch 114 not taken.
✗ Branch 116 not taken.
✗ Branch 117 not taken.
✗ Branch 119 not taken.
✗ Branch 120 not taken.
✗ Branch 127 not taken.
✗ Branch 128 not taken.
✗ Branch 130 not taken.
✗ Branch 131 not taken.
✗ Branch 133 not taken.
✗ Branch 134 not taken.
✗ Branch 141 not taken.
✗ Branch 142 not taken.
✗ Branch 144 not taken.
✗ Branch 145 not taken.
✗ Branch 147 not taken.
✗ Branch 148 not taken.
✓ Branch 155 taken 64 times.
✗ Branch 156 not taken.
✓ Branch 158 taken 64 times.
✗ Branch 159 not taken.
✓ Branch 161 taken 64 times.
✗ Branch 162 not taken.
✓ Branch 169 taken 32 times.
✗ Branch 170 not taken.
✓ Branch 172 taken 32 times.
✗ Branch 173 not taken.
✓ Branch 175 taken 32 times.
✗ Branch 176 not taken.
✗ Branch 183 not taken.
✗ Branch 184 not taken.
✗ Branch 186 not taken.
✗ Branch 187 not taken.
✗ Branch 189 not taken.
✗ Branch 190 not taken.
✗ Branch 197 not taken.
✗ Branch 198 not taken.
✗ Branch 200 not taken.
✗ Branch 201 not taken.
✗ Branch 203 not taken.
✗ Branch 204 not taken.
✗ Branch 211 not taken.
✗ Branch 212 not taken.
✗ Branch 214 not taken.
✗ Branch 215 not taken.
✗ Branch 217 not taken.
✗ Branch 218 not taken.
✗ Branch 225 not taken.
✗ Branch 226 not taken.
✗ Branch 228 not taken.
✗ Branch 229 not taken.
✗ Branch 231 not taken.
✗ Branch 232 not taken.
✓ Branch 239 taken 16 times.
✗ Branch 240 not taken.
✓ Branch 242 taken 16 times.
✗ Branch 243 not taken.
✓ Branch 245 taken 16 times.
✗ Branch 246 not taken.
✗ Branch 253 not taken.
✗ Branch 254 not taken.
✗ Branch 256 not taken.
✗ Branch 257 not taken.
✗ Branch 259 not taken.
✗ Branch 260 not taken.
✗ Branch 267 not taken.
✗ Branch 268 not taken.
✗ Branch 270 not taken.
✗ Branch 271 not taken.
✗ Branch 273 not taken.
✗ Branch 274 not taken.
✗ Branch 281 not taken.
✗ Branch 282 not taken.
✗ Branch 284 not taken.
✗ Branch 285 not taken.
✗ Branch 287 not taken.
✗ Branch 288 not taken.
✓ Branch 295 taken 64 times.
✗ Branch 296 not taken.
✓ Branch 298 taken 64 times.
✗ Branch 299 not taken.
✓ Branch 301 taken 64 times.
✗ Branch 302 not taken.
✗ Branch 309 not taken.
✗ Branch 310 not taken.
✗ Branch 312 not taken.
✗ Branch 313 not taken.
✗ Branch 315 not taken.
✗ Branch 316 not taken.
✗ Branch 323 not taken.
✗ Branch 324 not taken.
✗ Branch 326 not taken.
✗ Branch 327 not taken.
✗ Branch 329 not taken.
✗ Branch 330 not taken.
|
1848 | pdata_array.set_attribute("NumberOfComponents", std::to_string(space_dim)); |
179 |
20/96✓ Branch 1 taken 32 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 32 times.
✗ Branch 5 not taken.
✓ Branch 10 taken 64 times.
✗ Branch 11 not taken.
✓ Branch 13 taken 64 times.
✗ Branch 14 not taken.
✓ Branch 19 taken 128 times.
✗ Branch 20 not taken.
✓ Branch 22 taken 128 times.
✗ Branch 23 not taken.
✓ Branch 28 taken 192 times.
✗ Branch 29 not taken.
✓ Branch 31 taken 192 times.
✗ Branch 32 not taken.
✗ Branch 37 not taken.
✗ Branch 38 not taken.
✗ Branch 40 not taken.
✗ Branch 41 not taken.
✗ Branch 46 not taken.
✗ Branch 47 not taken.
✗ Branch 49 not taken.
✗ Branch 50 not taken.
✓ Branch 55 taken 16 times.
✗ Branch 56 not taken.
✓ Branch 58 taken 16 times.
✗ Branch 59 not taken.
✓ Branch 64 taken 8 times.
✗ Branch 65 not taken.
✓ Branch 67 taken 8 times.
✗ Branch 68 not taken.
✗ Branch 73 not taken.
✗ Branch 74 not taken.
✗ Branch 76 not taken.
✗ Branch 77 not taken.
✗ Branch 82 not taken.
✗ Branch 83 not taken.
✗ Branch 85 not taken.
✗ Branch 86 not taken.
✗ Branch 91 not taken.
✗ Branch 92 not taken.
✗ Branch 94 not taken.
✗ Branch 95 not taken.
✓ Branch 100 taken 64 times.
✗ Branch 101 not taken.
✓ Branch 103 taken 64 times.
✗ Branch 104 not taken.
✓ Branch 109 taken 32 times.
✗ Branch 110 not taken.
✓ Branch 112 taken 32 times.
✗ Branch 113 not taken.
✗ Branch 118 not taken.
✗ Branch 119 not taken.
✗ Branch 121 not taken.
✗ Branch 122 not taken.
✗ Branch 127 not taken.
✗ Branch 128 not taken.
✗ Branch 130 not taken.
✗ Branch 131 not taken.
✗ Branch 136 not taken.
✗ Branch 137 not taken.
✗ Branch 139 not taken.
✗ Branch 140 not taken.
✗ Branch 145 not taken.
✗ Branch 146 not taken.
✗ Branch 148 not taken.
✗ Branch 149 not taken.
✓ Branch 154 taken 16 times.
✗ Branch 155 not taken.
✓ Branch 157 taken 16 times.
✗ Branch 158 not taken.
✗ Branch 163 not taken.
✗ Branch 164 not taken.
✗ Branch 166 not taken.
✗ Branch 167 not taken.
✗ Branch 172 not taken.
✗ Branch 173 not taken.
✗ Branch 175 not taken.
✗ Branch 176 not taken.
✗ Branch 181 not taken.
✗ Branch 182 not taken.
✗ Branch 184 not taken.
✗ Branch 185 not taken.
✓ Branch 190 taken 64 times.
✗ Branch 191 not taken.
✓ Branch 193 taken 64 times.
✗ Branch 194 not taken.
✗ Branch 199 not taken.
✗ Branch 200 not taken.
✗ Branch 202 not taken.
✗ Branch 203 not taken.
✗ Branch 208 not taken.
✗ Branch 209 not taken.
✗ Branch 211 not taken.
✗ Branch 212 not taken.
|
1232 | pdata_array.set_attribute("Name", "Coordinates"); |
180 |
30/144✓ Branch 1 taken 32 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 32 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 32 times.
✗ Branch 8 not taken.
✓ Branch 15 taken 64 times.
✗ Branch 16 not taken.
✓ Branch 18 taken 64 times.
✗ Branch 19 not taken.
✓ Branch 21 taken 64 times.
✗ Branch 22 not taken.
✓ Branch 29 taken 128 times.
✗ Branch 30 not taken.
✓ Branch 32 taken 128 times.
✗ Branch 33 not taken.
✓ Branch 35 taken 128 times.
✗ Branch 36 not taken.
✓ Branch 43 taken 192 times.
✗ Branch 44 not taken.
✓ Branch 46 taken 192 times.
✗ Branch 47 not taken.
✓ Branch 49 taken 192 times.
✗ Branch 50 not taken.
✗ Branch 57 not taken.
✗ Branch 58 not taken.
✗ Branch 60 not taken.
✗ Branch 61 not taken.
✗ Branch 63 not taken.
✗ Branch 64 not taken.
✗ Branch 71 not taken.
✗ Branch 72 not taken.
✗ Branch 74 not taken.
✗ Branch 75 not taken.
✗ Branch 77 not taken.
✗ Branch 78 not taken.
✓ Branch 85 taken 16 times.
✗ Branch 86 not taken.
✓ Branch 88 taken 16 times.
✗ Branch 89 not taken.
✓ Branch 91 taken 16 times.
✗ Branch 92 not taken.
✓ Branch 99 taken 8 times.
✗ Branch 100 not taken.
✓ Branch 102 taken 8 times.
✗ Branch 103 not taken.
✓ Branch 105 taken 8 times.
✗ Branch 106 not taken.
✗ Branch 113 not taken.
✗ Branch 114 not taken.
✗ Branch 116 not taken.
✗ Branch 117 not taken.
✗ Branch 119 not taken.
✗ Branch 120 not taken.
✗ Branch 127 not taken.
✗ Branch 128 not taken.
✗ Branch 130 not taken.
✗ Branch 131 not taken.
✗ Branch 133 not taken.
✗ Branch 134 not taken.
✗ Branch 141 not taken.
✗ Branch 142 not taken.
✗ Branch 144 not taken.
✗ Branch 145 not taken.
✗ Branch 147 not taken.
✗ Branch 148 not taken.
✓ Branch 155 taken 64 times.
✗ Branch 156 not taken.
✓ Branch 158 taken 64 times.
✗ Branch 159 not taken.
✓ Branch 161 taken 64 times.
✗ Branch 162 not taken.
✓ Branch 169 taken 32 times.
✗ Branch 170 not taken.
✓ Branch 172 taken 32 times.
✗ Branch 173 not taken.
✓ Branch 175 taken 32 times.
✗ Branch 176 not taken.
✗ Branch 183 not taken.
✗ Branch 184 not taken.
✗ Branch 186 not taken.
✗ Branch 187 not taken.
✗ Branch 189 not taken.
✗ Branch 190 not taken.
✗ Branch 197 not taken.
✗ Branch 198 not taken.
✗ Branch 200 not taken.
✗ Branch 201 not taken.
✗ Branch 203 not taken.
✗ Branch 204 not taken.
✗ Branch 211 not taken.
✗ Branch 212 not taken.
✗ Branch 214 not taken.
✗ Branch 215 not taken.
✗ Branch 217 not taken.
✗ Branch 218 not taken.
✗ Branch 225 not taken.
✗ Branch 226 not taken.
✗ Branch 228 not taken.
✗ Branch 229 not taken.
✗ Branch 231 not taken.
✗ Branch 232 not taken.
✓ Branch 239 taken 16 times.
✗ Branch 240 not taken.
✓ Branch 242 taken 16 times.
✗ Branch 243 not taken.
✓ Branch 245 taken 16 times.
✗ Branch 246 not taken.
✗ Branch 253 not taken.
✗ Branch 254 not taken.
✗ Branch 256 not taken.
✗ Branch 257 not taken.
✗ Branch 259 not taken.
✗ Branch 260 not taken.
✗ Branch 267 not taken.
✗ Branch 268 not taken.
✗ Branch 270 not taken.
✗ Branch 271 not taken.
✗ Branch 273 not taken.
✗ Branch 274 not taken.
✗ Branch 281 not taken.
✗ Branch 282 not taken.
✗ Branch 284 not taken.
✗ Branch 285 not taken.
✗ Branch 287 not taken.
✗ Branch 288 not taken.
✓ Branch 295 taken 64 times.
✗ Branch 296 not taken.
✓ Branch 298 taken 64 times.
✗ Branch 299 not taken.
✓ Branch 301 taken 64 times.
✗ Branch 302 not taken.
✗ Branch 309 not taken.
✗ Branch 310 not taken.
✗ Branch 312 not taken.
✗ Branch 313 not taken.
✗ Branch 315 not taken.
✗ Branch 316 not taken.
✗ Branch 323 not taken.
✗ Branch 324 not taken.
✗ Branch 326 not taken.
✗ Branch 327 not taken.
✗ Branch 329 not taken.
✗ Branch 330 not taken.
|
1848 | pdata_array.set_attribute("format", VTK::data_format_name(encoder, data_format)); |
181 |
30/144✓ Branch 2 taken 32 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 32 times.
✗ Branch 6 not taken.
✓ Branch 8 taken 32 times.
✗ Branch 9 not taken.
✓ Branch 16 taken 64 times.
✗ Branch 17 not taken.
✓ Branch 19 taken 64 times.
✗ Branch 20 not taken.
✓ Branch 22 taken 64 times.
✗ Branch 23 not taken.
✓ Branch 30 taken 128 times.
✗ Branch 31 not taken.
✓ Branch 33 taken 128 times.
✗ Branch 34 not taken.
✓ Branch 36 taken 128 times.
✗ Branch 37 not taken.
✓ Branch 44 taken 192 times.
✗ Branch 45 not taken.
✓ Branch 47 taken 192 times.
✗ Branch 48 not taken.
✓ Branch 50 taken 192 times.
✗ Branch 51 not taken.
✗ Branch 58 not taken.
✗ Branch 59 not taken.
✗ Branch 61 not taken.
✗ Branch 62 not taken.
✗ Branch 64 not taken.
✗ Branch 65 not taken.
✗ Branch 72 not taken.
✗ Branch 73 not taken.
✗ Branch 75 not taken.
✗ Branch 76 not taken.
✗ Branch 78 not taken.
✗ Branch 79 not taken.
✓ Branch 86 taken 16 times.
✗ Branch 87 not taken.
✓ Branch 89 taken 16 times.
✗ Branch 90 not taken.
✓ Branch 92 taken 16 times.
✗ Branch 93 not taken.
✓ Branch 100 taken 8 times.
✗ Branch 101 not taken.
✓ Branch 103 taken 8 times.
✗ Branch 104 not taken.
✓ Branch 106 taken 8 times.
✗ Branch 107 not taken.
✗ Branch 114 not taken.
✗ Branch 115 not taken.
✗ Branch 117 not taken.
✗ Branch 118 not taken.
✗ Branch 120 not taken.
✗ Branch 121 not taken.
✗ Branch 128 not taken.
✗ Branch 129 not taken.
✗ Branch 131 not taken.
✗ Branch 132 not taken.
✗ Branch 134 not taken.
✗ Branch 135 not taken.
✗ Branch 142 not taken.
✗ Branch 143 not taken.
✗ Branch 145 not taken.
✗ Branch 146 not taken.
✗ Branch 148 not taken.
✗ Branch 149 not taken.
✓ Branch 156 taken 64 times.
✗ Branch 157 not taken.
✓ Branch 159 taken 64 times.
✗ Branch 160 not taken.
✓ Branch 162 taken 64 times.
✗ Branch 163 not taken.
✓ Branch 170 taken 32 times.
✗ Branch 171 not taken.
✓ Branch 173 taken 32 times.
✗ Branch 174 not taken.
✓ Branch 176 taken 32 times.
✗ Branch 177 not taken.
✗ Branch 184 not taken.
✗ Branch 185 not taken.
✗ Branch 187 not taken.
✗ Branch 188 not taken.
✗ Branch 190 not taken.
✗ Branch 191 not taken.
✗ Branch 198 not taken.
✗ Branch 199 not taken.
✗ Branch 201 not taken.
✗ Branch 202 not taken.
✗ Branch 204 not taken.
✗ Branch 205 not taken.
✗ Branch 212 not taken.
✗ Branch 213 not taken.
✗ Branch 215 not taken.
✗ Branch 216 not taken.
✗ Branch 218 not taken.
✗ Branch 219 not taken.
✗ Branch 226 not taken.
✗ Branch 227 not taken.
✗ Branch 229 not taken.
✗ Branch 230 not taken.
✗ Branch 232 not taken.
✗ Branch 233 not taken.
✓ Branch 240 taken 16 times.
✗ Branch 241 not taken.
✓ Branch 243 taken 16 times.
✗ Branch 244 not taken.
✓ Branch 246 taken 16 times.
✗ Branch 247 not taken.
✗ Branch 254 not taken.
✗ Branch 255 not taken.
✗ Branch 257 not taken.
✗ Branch 258 not taken.
✗ Branch 260 not taken.
✗ Branch 261 not taken.
✗ Branch 268 not taken.
✗ Branch 269 not taken.
✗ Branch 271 not taken.
✗ Branch 272 not taken.
✗ Branch 274 not taken.
✗ Branch 275 not taken.
✗ Branch 282 not taken.
✗ Branch 283 not taken.
✗ Branch 285 not taken.
✗ Branch 286 not taken.
✗ Branch 288 not taken.
✗ Branch 289 not taken.
✓ Branch 296 taken 64 times.
✗ Branch 297 not taken.
✓ Branch 299 taken 64 times.
✗ Branch 300 not taken.
✓ Branch 302 taken 64 times.
✗ Branch 303 not taken.
✗ Branch 310 not taken.
✗ Branch 311 not taken.
✗ Branch 313 not taken.
✗ Branch 314 not taken.
✗ Branch 316 not taken.
✗ Branch 317 not taken.
✗ Branch 324 not taken.
✗ Branch 325 not taken.
✗ Branch 327 not taken.
✗ Branch 328 not taken.
✗ Branch 330 not taken.
✗ Branch 331 not taken.
|
1848 | pdata_array.set_attribute("type", VTK::attribute_name(prec)); |
182 |
8/24✓ Branch 1 taken 32 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 80 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 128 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 256 times.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✓ Branch 16 taken 8 times.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✓ Branch 25 taken 32 times.
✗ Branch 26 not taken.
✗ Branch 28 not taken.
✗ Branch 29 not taken.
✓ Branch 31 taken 16 times.
✗ Branch 32 not taken.
✓ Branch 34 taken 64 times.
✗ Branch 35 not taken.
|
616 | }, this->_xml_settings.coordinate_precision); |
183 |
6/12✓ Branch 1 taken 32 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 88 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 128 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 288 times.
✗ Branch 11 not taken.
✓ Branch 13 taken 16 times.
✗ Branch 14 not taken.
✓ Branch 16 taken 64 times.
✗ Branch 17 not taken.
|
616 | }, this->_xml_settings.data_format); |
184 |
1/2✓ Branch 1 taken 616 times.
✗ Branch 2 not taken.
|
1216 | }, this->_xml_settings.encoder); |
185 | |||
186 |
2/4✓ Branch 1 taken 616 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 616 times.
✗ Branch 5 not taken.
|
4816 | std::ranges::for_each(Parallel::ranks(_comm), [&] (int rank) { |
187 | std::array<std::size_t, dim> extents_begin; | ||
188 | std::array<std::size_t, dim> extents_end; | ||
189 |
4/4✓ Branch 0 taken 784 times.
✓ Branch 1 taken 392 times.
✓ Branch 2 taken 4320 times.
✓ Branch 3 taken 1440 times.
|
6936 | for (unsigned dir = 0; dir < dim; ++dir) { |
190 | 5104 | extents_begin[dir] = proc_extents_begin[rank][dir]; | |
191 | 5104 | extents_end[dir] = proc_extents_end[rank][dir]; | |
192 | } | ||
193 |
4/8✓ Branch 1 taken 392 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 392 times.
✗ Branch 5 not taken.
✓ Branch 9 taken 1440 times.
✗ Branch 10 not taken.
✓ Branch 12 taken 1440 times.
✗ Branch 13 not taken.
|
3664 | auto& piece = grid.add_child("Piece"); |
194 |
6/12✓ Branch 1 taken 392 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 392 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 392 times.
✗ Branch 8 not taken.
✓ Branch 14 taken 1440 times.
✗ Branch 15 not taken.
✓ Branch 17 taken 1440 times.
✗ Branch 18 not taken.
✓ Branch 20 taken 1440 times.
✗ Branch 21 not taken.
|
5496 | piece.set_attribute("Extent", VTK::CommonDetail::extents_string(extents_begin, extents_end)); |
195 |
6/12✓ Branch 1 taken 392 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 392 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 392 times.
✗ Branch 8 not taken.
✓ Branch 14 taken 1440 times.
✗ Branch 15 not taken.
✓ Branch 17 taken 1440 times.
✗ Branch 18 not taken.
✓ Branch 20 taken 1440 times.
✗ Branch 21 not taken.
|
5496 | piece.set_attribute("Source", std::filesystem::path{ |
196 |
4/8✓ Branch 1 taken 392 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 392 times.
✗ Branch 5 not taken.
✓ Branch 11 taken 1440 times.
✗ Branch 12 not taken.
✓ Branch 14 taken 1440 times.
✗ Branch 15 not taken.
|
3664 | PVTK::piece_basefilename(filename_with_ext, rank) + ".vts" |
197 |
2/4✓ Branch 1 taken 392 times.
✗ Branch 2 not taken.
✓ Branch 6 taken 1440 times.
✗ Branch 7 not taken.
|
5496 | }.filename()); |
198 | }); | ||
199 | |||
200 |
2/4✓ Branch 2 taken 616 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 616 times.
✗ Branch 6 not taken.
|
1216 | this->_set_default_active_fields(pvtk_xml.get_child("PStructuredGrid")); |
201 |
2/4✓ Branch 1 taken 616 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 616 times.
✗ Branch 5 not taken.
|
1216 | write_xml_with_version_header(pvtk_xml, file_stream, Indentation{{.width = 2}}); |
202 | 1216 | } | |
203 | }; | ||
204 | |||
205 | template<typename G, Concepts::Communicator C> | ||
206 | PVTSWriter(G&&, const C&, VTK::XMLOptions = {}) -> PVTSWriter<std::remove_cvref_t<G>, C>; | ||
207 | |||
208 | } // namespace GridFormat | ||
209 | |||
210 | #endif // GRIDFORMAT_VTK_PVTS_WRITER_HPP_ | ||
211 |