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::PVTRWriter | ||
7 | */ | ||
8 | #ifndef GRIDFORMAT_VTK_PVTR_WRITER_HPP_ | ||
9 | #define GRIDFORMAT_VTK_PVTR_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 | |||
19 | #include <gridformat/common/field.hpp> | ||
20 | #include <gridformat/common/ranges.hpp> | ||
21 | #include <gridformat/common/exceptions.hpp> | ||
22 | #include <gridformat/common/lvalue_reference.hpp> | ||
23 | |||
24 | #include <gridformat/parallel/communication.hpp> | ||
25 | #include <gridformat/parallel/helpers.hpp> | ||
26 | |||
27 | #include <gridformat/grid/grid.hpp> | ||
28 | #include <gridformat/xml/element.hpp> | ||
29 | #include <gridformat/vtk/parallel.hpp> | ||
30 | #include <gridformat/vtk/vtr_writer.hpp> | ||
31 | |||
32 | namespace GridFormat { | ||
33 | |||
34 | /*! | ||
35 | * \ingroup VTK | ||
36 | * \brief Writer for parallel .pvtr files | ||
37 | */ | ||
38 | template<Concepts::RectilinearGrid Grid, | ||
39 | Concepts::Communicator Communicator> | ||
40 | class PVTRWriter : public VTK::XMLWriterBase<Grid, PVTRWriter<Grid, Communicator>> { | ||
41 | using ParentType = VTK::XMLWriterBase<Grid, PVTRWriter<Grid, Communicator>>; | ||
42 | using CT = CoordinateType<Grid>; | ||
43 | |||
44 | static constexpr std::size_t space_dim = 3; | ||
45 | static constexpr std::size_t dim = dimension<Grid>; | ||
46 | static constexpr int root_rank = 0; | ||
47 | |||
48 | public: | ||
49 | 12260 | explicit PVTRWriter(LValueReferenceOf<const Grid> grid, | |
50 | Communicator comm, | ||
51 | VTK::XMLOptions xml_opts = {}) | ||
52 | 12260 | : ParentType(grid.get(), ".pvtr", true, xml_opts) | |
53 |
2/4✓ Branch 1 taken 6140 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 6140 times.
✗ Branch 5 not taken.
|
36780 | , _comm(comm) |
54 | 12260 | {} | |
55 | |||
56 | 26 | const Communicator& communicator() const { | |
57 | 26 | return _comm; | |
58 | } | ||
59 | |||
60 | private: | ||
61 | Communicator _comm; | ||
62 | |||
63 | 8400 | PVTRWriter _with(VTK::XMLOptions xml_opts) const override { | |
64 |
1/2✓ Branch 4 taken 4200 times.
✗ Branch 5 not taken.
|
8400 | return PVTRWriter{this->grid(), _comm, std::move(xml_opts)}; |
65 | } | ||
66 | |||
67 | ✗ | void _write(std::ostream&) const override { | |
68 | ✗ | throw InvalidState( | |
69 | "PVTRWriter does not support direct export into stream. " | ||
70 | "Use overload with filename instead!" | ||
71 | ); | ||
72 | } | ||
73 | |||
74 | 4122 | virtual void _write(const std::string& filename_with_ext) const override { | |
75 |
1/2✓ Branch 2 taken 18 times.
✗ Branch 3 not taken.
|
4122 | const auto& local_extents = extents(this->grid()); |
76 |
1/2✓ Branch 1 taken 2082 times.
✗ Branch 2 not taken.
|
4122 | const auto [origin, is_negative_axis] = _get_origin_and_orientations(); |
77 | |||
78 | 4122 | PVTK::StructuredParallelGridHelper helper{_comm}; | |
79 |
1/2✓ Branch 1 taken 2082 times.
✗ Branch 2 not taken.
|
4122 | const auto all_origins = Parallel::gather(_comm, origin, root_rank); |
80 |
1/2✓ Branch 1 taken 2082 times.
✗ Branch 2 not taken.
|
4122 | const auto all_extents = Parallel::gather(_comm, local_extents, root_rank); |
81 |
2/4✓ Branch 1 taken 2082 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 2082 times.
✗ Branch 5 not taken.
|
4122 | const auto [exts_begin, exts_end, whole_extent, _] = helper.compute_extents_and_origin( |
82 | all_origins, | ||
83 | all_extents, | ||
84 | is_negative_axis | ||
85 | ); | ||
86 | |||
87 |
1/2✓ Branch 1 taken 2082 times.
✗ Branch 2 not taken.
|
4122 | const auto my_whole_extent = Parallel::broadcast(_comm, whole_extent, root_rank); |
88 |
2/4✓ Branch 1 taken 2082 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 2082 times.
✗ Branch 5 not taken.
|
4122 | const auto my_extent_offset = Parallel::scatter(_comm, Ranges::flat(exts_begin), root_rank); |
89 | |||
90 |
3/4✓ Branch 1 taken 2082 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1842 times.
✓ Branch 5 taken 240 times.
|
4122 | _write_piece(filename_with_ext, Ranges::to_array<dim>(my_extent_offset), {my_whole_extent}); |
91 |
1/2✓ Branch 1 taken 1842 times.
✗ Branch 2 not taken.
|
3642 | Parallel::barrier(_comm); // ensure all pieces finished successfully |
92 |
3/4✓ Branch 1 taken 1842 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 619 times.
✓ Branch 4 taken 1223 times.
|
3642 | if (Parallel::rank(_comm) == 0) |
93 |
1/2✓ Branch 1 taken 619 times.
✗ Branch 2 not taken.
|
1219 | _write_pvtr_file(filename_with_ext, my_whole_extent, exts_begin, exts_end); |
94 |
1/2✓ Branch 1 taken 1842 times.
✗ Branch 2 not taken.
|
3642 | Parallel::barrier(_comm); // ensure .pvtr file is written before returning |
95 | 5562 | } | |
96 | |||
97 | 4122 | auto _get_origin_and_orientations() const { | |
98 | std::array<CT, dim> origin; | ||
99 | std::array<bool, dim> is_negative_axis; | ||
100 |
2/2✓ Branch 0 taken 5796 times.
✓ Branch 1 taken 2082 times.
|
15630 | for (unsigned dir = 0; dir < dim; ++dir) { |
101 | 11508 | std::array<CT, 2> ordinates_01{0, 0}; | |
102 |
1/2✓ Branch 2 taken 5796 times.
✗ Branch 3 not taken.
|
11508 | const auto& dir_ordinates = ordinates(this->grid(), dir); |
103 |
2/4✓ Branch 1 taken 5796 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 5796 times.
✗ Branch 5 not taken.
|
11508 | std::ranges::copy(std::views::take(dir_ordinates, 2), ordinates_01.begin()); |
104 | 11508 | origin[dir] = ordinates_01[0]; | |
105 | 11508 | is_negative_axis[dir] = ordinates_01[1] - ordinates_01[0] < CT{0}; | |
106 | } | ||
107 | 8244 | return std::make_tuple(origin, is_negative_axis); | |
108 | } | ||
109 | |||
110 | 4122 | void _write_piece(const std::string& par_filename, | |
111 | const std::array<std::size_t, dim>& offset, | ||
112 | typename VTRWriter<Grid>::Domain domain) const { | ||
113 |
1/2✓ Branch 2 taken 2082 times.
✗ Branch 3 not taken.
|
8244 | auto writer = VTRWriter{this->grid(), this->_xml_opts} |
114 |
2/4✓ Branch 2 taken 2082 times.
✗ Branch 3 not taken.
✓ Branch 6 taken 2082 times.
✗ Branch 7 not taken.
|
8244 | .as_piece_for(std::move(domain)) |
115 | .with_offset(offset); | ||
116 |
1/2✓ Branch 1 taken 2082 times.
✗ Branch 2 not taken.
|
4122 | this->copy_fields(writer); |
117 |
4/6✓ Branch 1 taken 2082 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 2082 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 1842 times.
✓ Branch 8 taken 240 times.
|
4602 | writer.write(PVTK::piece_basefilename(par_filename, Parallel::rank(_comm))); |
118 | 4122 | } | |
119 | |||
120 | 1219 | void _write_pvtr_file(const std::string& filename_with_ext, | |
121 | const std::array<std::size_t, dim>& extents, | ||
122 | const std::vector<std::array<std::size_t, dim>>& proc_extents_begin, | ||
123 | const std::vector<std::array<std::size_t, dim>>& proc_extents_end) const { | ||
124 |
1/2✓ Branch 1 taken 619 times.
✗ Branch 2 not taken.
|
1219 | std::ofstream file_stream(filename_with_ext, std::ios::out); |
125 | |||
126 |
1/2✓ Branch 1 taken 619 times.
✗ Branch 2 not taken.
|
2438 | XMLElement pvtk_xml("VTKFile"); |
127 |
2/4✓ Branch 1 taken 619 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 619 times.
✗ Branch 5 not taken.
|
2438 | pvtk_xml.set_attribute("type", "PRectilinearGrid"); |
128 | |||
129 |
2/4✓ Branch 1 taken 619 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 619 times.
✗ Branch 5 not taken.
|
1219 | XMLElement& grid = pvtk_xml.add_child("PRectilinearGrid"); |
130 |
3/6✓ Branch 1 taken 619 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 619 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 619 times.
✗ Branch 8 not taken.
|
3657 | grid.set_attribute("WholeExtent", VTK::CommonDetail::extents_string(extents)); |
131 | |||
132 |
2/4✓ Branch 1 taken 619 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 619 times.
✗ Branch 5 not taken.
|
2438 | XMLElement& ppoint_data = grid.add_child("PPointData"); |
133 |
2/4✓ Branch 1 taken 619 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 619 times.
✗ Branch 5 not taken.
|
2438 | XMLElement& pcell_data = grid.add_child("PCellData"); |
134 |
2/4✓ Branch 1 taken 619 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 619 times.
✗ Branch 5 not taken.
|
1219 | XMLElement& pcoords = grid.add_child("PCoordinates"); |
135 | 1276 | std::visit([&] (const auto& encoder) { | |
136 | 1895 | std::visit([&] (const auto& data_format) { | |
137 | 619 | PVTK::PDataArrayHelper pdata_helper{encoder, data_format, ppoint_data}; | |
138 | 619 | PVTK::PDataArrayHelper cdata_helper{encoder, data_format, pcell_data}; | |
139 |
16/48✓ Branch 1 taken 32 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 32 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 83 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 83 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.
|
8135 | std::ranges::for_each(this->_point_field_names(), [&] (const std::string& name) { |
140 | 3679 | pdata_helper.add(name, this->_get_point_field(name)); | |
141 | }); | ||
142 |
16/48✓ Branch 1 taken 32 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 32 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 83 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 83 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.
|
8131 | std::ranges::for_each(this->_cell_field_names(), [&] (const std::string& name) { |
143 | 3678 | cdata_helper.add(name, this->_get_cell_field(name)); | |
144 | }); | ||
145 | |||
146 | 1257 | std::visit([&] <typename T> (const Precision<T>& prec) { | |
147 |
20/48✓ Branch 0 taken 96 times.
✓ Branch 1 taken 32 times.
✓ Branch 2 taken 201 times.
✓ Branch 3 taken 67 times.
✓ Branch 4 taken 384 times.
✓ Branch 5 taken 128 times.
✓ Branch 6 taken 576 times.
✓ Branch 7 taken 192 times.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✓ Branch 12 taken 48 times.
✓ Branch 13 taken 16 times.
✓ Branch 14 taken 24 times.
✓ Branch 15 taken 8 times.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✓ Branch 22 taken 192 times.
✓ Branch 23 taken 64 times.
✓ Branch 24 taken 96 times.
✓ Branch 25 taken 32 times.
✗ Branch 26 not taken.
✗ Branch 27 not taken.
✗ Branch 28 not taken.
✗ Branch 29 not taken.
✗ Branch 30 not taken.
✗ Branch 31 not taken.
✗ Branch 32 not taken.
✗ Branch 33 not taken.
✓ Branch 34 taken 48 times.
✓ Branch 35 taken 16 times.
✗ Branch 36 not taken.
✗ Branch 37 not taken.
✗ Branch 38 not taken.
✗ Branch 39 not taken.
✗ Branch 40 not taken.
✗ Branch 41 not taken.
✓ Branch 42 taken 192 times.
✓ Branch 43 taken 64 times.
✗ Branch 44 not taken.
✗ Branch 45 not taken.
✗ Branch 46 not taken.
✗ Branch 47 not taken.
|
2476 | for (unsigned int i = 0; i < space_dim; ++i) { |
148 |
20/96✓ Branch 1 taken 96 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 96 times.
✗ Branch 5 not taken.
✓ Branch 10 taken 201 times.
✗ Branch 11 not taken.
✓ Branch 13 taken 201 times.
✗ Branch 14 not taken.
✓ Branch 19 taken 384 times.
✗ Branch 20 not taken.
✓ Branch 22 taken 384 times.
✗ Branch 23 not taken.
✓ Branch 28 taken 576 times.
✗ Branch 29 not taken.
✓ Branch 31 taken 576 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 48 times.
✗ Branch 56 not taken.
✓ Branch 58 taken 48 times.
✗ Branch 59 not taken.
✓ Branch 64 taken 24 times.
✗ Branch 65 not taken.
✓ Branch 67 taken 24 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 192 times.
✗ Branch 101 not taken.
✓ Branch 103 taken 192 times.
✗ Branch 104 not taken.
✓ Branch 109 taken 96 times.
✗ Branch 110 not taken.
✓ Branch 112 taken 96 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 48 times.
✗ Branch 155 not taken.
✓ Branch 157 taken 48 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 192 times.
✗ Branch 191 not taken.
✓ Branch 193 taken 192 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.
|
3714 | XMLElement& pdata_array = pcoords.add_child("PDataArray"); |
149 |
20/96✓ Branch 1 taken 96 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 96 times.
✗ Branch 5 not taken.
✓ Branch 10 taken 201 times.
✗ Branch 11 not taken.
✓ Branch 13 taken 201 times.
✗ Branch 14 not taken.
✓ Branch 19 taken 384 times.
✗ Branch 20 not taken.
✓ Branch 22 taken 384 times.
✗ Branch 23 not taken.
✓ Branch 28 taken 576 times.
✗ Branch 29 not taken.
✓ Branch 31 taken 576 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 48 times.
✗ Branch 56 not taken.
✓ Branch 58 taken 48 times.
✗ Branch 59 not taken.
✓ Branch 64 taken 24 times.
✗ Branch 65 not taken.
✓ Branch 67 taken 24 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 192 times.
✗ Branch 101 not taken.
✓ Branch 103 taken 192 times.
✗ Branch 104 not taken.
✓ Branch 109 taken 96 times.
✗ Branch 110 not taken.
✓ Branch 112 taken 96 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 48 times.
✗ Branch 155 not taken.
✓ Branch 157 taken 48 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 192 times.
✗ Branch 191 not taken.
✓ Branch 193 taken 192 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.
|
3714 | pdata_array.set_attribute("NumberOfComponents", "1"); |
150 |
30/144✓ Branch 2 taken 96 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 96 times.
✗ Branch 6 not taken.
✓ Branch 8 taken 96 times.
✗ Branch 9 not taken.
✓ Branch 19 taken 201 times.
✗ Branch 20 not taken.
✓ Branch 22 taken 201 times.
✗ Branch 23 not taken.
✓ Branch 25 taken 201 times.
✗ Branch 26 not taken.
✓ Branch 36 taken 384 times.
✗ Branch 37 not taken.
✓ Branch 39 taken 384 times.
✗ Branch 40 not taken.
✓ Branch 42 taken 384 times.
✗ Branch 43 not taken.
✓ Branch 53 taken 576 times.
✗ Branch 54 not taken.
✓ Branch 56 taken 576 times.
✗ Branch 57 not taken.
✓ Branch 59 taken 576 times.
✗ Branch 60 not taken.
✗ Branch 70 not taken.
✗ Branch 71 not taken.
✗ Branch 73 not taken.
✗ Branch 74 not taken.
✗ Branch 76 not taken.
✗ Branch 77 not taken.
✗ Branch 87 not taken.
✗ Branch 88 not taken.
✗ Branch 90 not taken.
✗ Branch 91 not taken.
✗ Branch 93 not taken.
✗ Branch 94 not taken.
✓ Branch 104 taken 48 times.
✗ Branch 105 not taken.
✓ Branch 107 taken 48 times.
✗ Branch 108 not taken.
✓ Branch 110 taken 48 times.
✗ Branch 111 not taken.
✓ Branch 121 taken 24 times.
✗ Branch 122 not taken.
✓ Branch 124 taken 24 times.
✗ Branch 125 not taken.
✓ Branch 127 taken 24 times.
✗ Branch 128 not taken.
✗ Branch 138 not taken.
✗ Branch 139 not taken.
✗ Branch 141 not taken.
✗ Branch 142 not taken.
✗ Branch 144 not taken.
✗ Branch 145 not taken.
✗ Branch 155 not taken.
✗ Branch 156 not taken.
✗ Branch 158 not taken.
✗ Branch 159 not taken.
✗ Branch 161 not taken.
✗ Branch 162 not taken.
✗ Branch 172 not taken.
✗ Branch 173 not taken.
✗ Branch 175 not taken.
✗ Branch 176 not taken.
✗ Branch 178 not taken.
✗ Branch 179 not taken.
✓ Branch 189 taken 192 times.
✗ Branch 190 not taken.
✓ Branch 192 taken 192 times.
✗ Branch 193 not taken.
✓ Branch 195 taken 192 times.
✗ Branch 196 not taken.
✓ Branch 206 taken 96 times.
✗ Branch 207 not taken.
✓ Branch 209 taken 96 times.
✗ Branch 210 not taken.
✓ Branch 212 taken 96 times.
✗ Branch 213 not taken.
✗ Branch 223 not taken.
✗ Branch 224 not taken.
✗ Branch 226 not taken.
✗ Branch 227 not taken.
✗ Branch 229 not taken.
✗ Branch 230 not taken.
✗ Branch 240 not taken.
✗ Branch 241 not taken.
✗ Branch 243 not taken.
✗ Branch 244 not taken.
✗ Branch 246 not taken.
✗ Branch 247 not taken.
✗ Branch 257 not taken.
✗ Branch 258 not taken.
✗ Branch 260 not taken.
✗ Branch 261 not taken.
✗ Branch 263 not taken.
✗ Branch 264 not taken.
✗ Branch 274 not taken.
✗ Branch 275 not taken.
✗ Branch 277 not taken.
✗ Branch 278 not taken.
✗ Branch 280 not taken.
✗ Branch 281 not taken.
✓ Branch 291 taken 48 times.
✗ Branch 292 not taken.
✓ Branch 294 taken 48 times.
✗ Branch 295 not taken.
✓ Branch 297 taken 48 times.
✗ Branch 298 not taken.
✗ Branch 308 not taken.
✗ Branch 309 not taken.
✗ Branch 311 not taken.
✗ Branch 312 not taken.
✗ Branch 314 not taken.
✗ Branch 315 not taken.
✗ Branch 325 not taken.
✗ Branch 326 not taken.
✗ Branch 328 not taken.
✗ Branch 329 not taken.
✗ Branch 331 not taken.
✗ Branch 332 not taken.
✗ Branch 342 not taken.
✗ Branch 343 not taken.
✗ Branch 345 not taken.
✗ Branch 346 not taken.
✗ Branch 348 not taken.
✗ Branch 349 not taken.
✓ Branch 359 taken 192 times.
✗ Branch 360 not taken.
✓ Branch 362 taken 192 times.
✗ Branch 363 not taken.
✓ Branch 365 taken 192 times.
✗ Branch 366 not taken.
✗ Branch 376 not taken.
✗ Branch 377 not taken.
✗ Branch 379 not taken.
✗ Branch 380 not taken.
✗ Branch 382 not taken.
✗ Branch 383 not taken.
✗ Branch 393 not taken.
✗ Branch 394 not taken.
✗ Branch 396 not taken.
✗ Branch 397 not taken.
✗ Branch 399 not taken.
✗ Branch 400 not taken.
|
5571 | pdata_array.set_attribute("Name", "X_" + std::to_string(i)); |
151 |
30/144✓ Branch 1 taken 96 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 96 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 96 times.
✗ Branch 8 not taken.
✓ Branch 15 taken 201 times.
✗ Branch 16 not taken.
✓ Branch 18 taken 201 times.
✗ Branch 19 not taken.
✓ Branch 21 taken 201 times.
✗ Branch 22 not taken.
✓ Branch 29 taken 384 times.
✗ Branch 30 not taken.
✓ Branch 32 taken 384 times.
✗ Branch 33 not taken.
✓ Branch 35 taken 384 times.
✗ Branch 36 not taken.
✓ Branch 43 taken 576 times.
✗ Branch 44 not taken.
✓ Branch 46 taken 576 times.
✗ Branch 47 not taken.
✓ Branch 49 taken 576 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 48 times.
✗ Branch 86 not taken.
✓ Branch 88 taken 48 times.
✗ Branch 89 not taken.
✓ Branch 91 taken 48 times.
✗ Branch 92 not taken.
✓ Branch 99 taken 24 times.
✗ Branch 100 not taken.
✓ Branch 102 taken 24 times.
✗ Branch 103 not taken.
✓ Branch 105 taken 24 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 192 times.
✗ Branch 156 not taken.
✓ Branch 158 taken 192 times.
✗ Branch 159 not taken.
✓ Branch 161 taken 192 times.
✗ Branch 162 not taken.
✓ Branch 169 taken 96 times.
✗ Branch 170 not taken.
✓ Branch 172 taken 96 times.
✗ Branch 173 not taken.
✓ Branch 175 taken 96 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 48 times.
✗ Branch 240 not taken.
✓ Branch 242 taken 48 times.
✗ Branch 243 not taken.
✓ Branch 245 taken 48 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 192 times.
✗ Branch 296 not taken.
✓ Branch 298 taken 192 times.
✗ Branch 299 not taken.
✓ Branch 301 taken 192 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.
|
5571 | pdata_array.set_attribute("format", VTK::data_format_name(encoder, data_format)); |
152 |
30/144✓ Branch 2 taken 96 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 96 times.
✗ Branch 6 not taken.
✓ Branch 8 taken 96 times.
✗ Branch 9 not taken.
✓ Branch 16 taken 201 times.
✗ Branch 17 not taken.
✓ Branch 19 taken 201 times.
✗ Branch 20 not taken.
✓ Branch 22 taken 201 times.
✗ Branch 23 not taken.
✓ Branch 30 taken 384 times.
✗ Branch 31 not taken.
✓ Branch 33 taken 384 times.
✗ Branch 34 not taken.
✓ Branch 36 taken 384 times.
✗ Branch 37 not taken.
✓ Branch 44 taken 576 times.
✗ Branch 45 not taken.
✓ Branch 47 taken 576 times.
✗ Branch 48 not taken.
✓ Branch 50 taken 576 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 48 times.
✗ Branch 87 not taken.
✓ Branch 89 taken 48 times.
✗ Branch 90 not taken.
✓ Branch 92 taken 48 times.
✗ Branch 93 not taken.
✓ Branch 100 taken 24 times.
✗ Branch 101 not taken.
✓ Branch 103 taken 24 times.
✗ Branch 104 not taken.
✓ Branch 106 taken 24 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 192 times.
✗ Branch 157 not taken.
✓ Branch 159 taken 192 times.
✗ Branch 160 not taken.
✓ Branch 162 taken 192 times.
✗ Branch 163 not taken.
✓ Branch 170 taken 96 times.
✗ Branch 171 not taken.
✓ Branch 173 taken 96 times.
✗ Branch 174 not taken.
✓ Branch 176 taken 96 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 48 times.
✗ Branch 241 not taken.
✓ Branch 243 taken 48 times.
✗ Branch 244 not taken.
✓ Branch 246 taken 48 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 192 times.
✗ Branch 297 not taken.
✓ Branch 299 taken 192 times.
✗ Branch 300 not taken.
✓ Branch 302 taken 192 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.
|
5571 | pdata_array.set_attribute("type", VTK::attribute_name(prec)); |
153 | } | ||
154 |
8/24✓ Branch 1 taken 32 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 83 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.
|
619 | }, this->_xml_settings.coordinate_precision); |
155 |
6/12✓ Branch 1 taken 32 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 91 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.
|
619 | }, this->_xml_settings.data_format); |
156 |
1/2✓ Branch 1 taken 619 times.
✗ Branch 2 not taken.
|
1219 | }, this->_xml_settings.encoder); |
157 | |||
158 |
2/4✓ Branch 1 taken 619 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 619 times.
✗ Branch 5 not taken.
|
4819 | std::ranges::for_each(Parallel::ranks(_comm), [&] (int rank) { |
159 | std::array<std::size_t, dim> extents_begin; | ||
160 | std::array<std::size_t, dim> extents_end; | ||
161 |
4/4✓ Branch 0 taken 804 times.
✓ Branch 1 taken 402 times.
✓ Branch 2 taken 4320 times.
✓ Branch 3 taken 1440 times.
|
6966 | for (unsigned dir = 0; dir < dim; ++dir) { |
162 | 5124 | extents_begin[dir] = proc_extents_begin[rank][dir]; | |
163 | 5124 | extents_end[dir] = proc_extents_end[rank][dir]; | |
164 | } | ||
165 |
4/8✓ Branch 1 taken 402 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 402 times.
✗ Branch 5 not taken.
✓ Branch 9 taken 1440 times.
✗ Branch 10 not taken.
✓ Branch 12 taken 1440 times.
✗ Branch 13 not taken.
|
3684 | auto& piece = grid.add_child("Piece"); |
166 |
6/12✓ Branch 1 taken 402 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 402 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 402 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.
|
5526 | piece.set_attribute("Extent", VTK::CommonDetail::extents_string(extents_begin, extents_end)); |
167 |
6/12✓ Branch 1 taken 402 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 402 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 402 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.
|
5526 | piece.set_attribute("Source", std::filesystem::path{ |
168 |
4/8✓ Branch 1 taken 402 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 402 times.
✗ Branch 5 not taken.
✓ Branch 11 taken 1440 times.
✗ Branch 12 not taken.
✓ Branch 14 taken 1440 times.
✗ Branch 15 not taken.
|
3684 | PVTK::piece_basefilename(filename_with_ext, rank) + ".vtr" |
169 |
2/4✓ Branch 1 taken 402 times.
✗ Branch 2 not taken.
✓ Branch 6 taken 1440 times.
✗ Branch 7 not taken.
|
5526 | }.filename()); |
170 | }); | ||
171 | |||
172 |
2/4✓ Branch 2 taken 619 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 619 times.
✗ Branch 6 not taken.
|
1219 | this->_set_default_active_fields(pvtk_xml.get_child("PRectilinearGrid")); |
173 |
2/4✓ Branch 1 taken 619 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 619 times.
✗ Branch 5 not taken.
|
1219 | write_xml_with_version_header(pvtk_xml, file_stream, Indentation{{.width = 2}}); |
174 | 1219 | } | |
175 | }; | ||
176 | |||
177 | template<typename G, Concepts::Communicator C> | ||
178 | PVTRWriter(G&&, const C&, VTK::XMLOptions = {}) -> PVTRWriter<std::remove_cvref_t<G>, C>; | ||
179 | |||
180 | namespace Traits { | ||
181 | |||
182 | template<typename... Args> | ||
183 | struct WritesConnectivity<PVTRWriter<Args...>> : public std::false_type {}; | ||
184 | |||
185 | } // namespace Traits | ||
186 | } // namespace GridFormat | ||
187 | |||
188 | #endif // GRIDFORMAT_VTK_PVTR_WRITER_HPP_ | ||
189 |