GCC Code Coverage Report


Directory: ../../../builds/dumux-repositories/
File: /builds/dumux-repositories/dumux/dumux/io/vtkoutputmodule.hh
Date: 2024-09-21 20:52:54
Exec Total Coverage
Lines: 232 265 87.5%
Functions: 1438 2930 49.1%
Branches: 783 2352 33.3%

Line Branch Exec Source
1 // -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2 // vi: set et ts=4 sw=4 sts=4:
3 //
4 // SPDX-FileCopyrightInfo: Copyright © DuMux Project contributors, see AUTHORS.md in root folder
5 // SPDX-License-Identifier: GPL-3.0-or-later
6 //
7 /*!
8 * \file
9 * \ingroup InputOutput
10 * \brief A VTK output module to simplify writing dumux simulation data to VTK format
11 */
12 #ifndef DUMUX_IO_VTK_OUTPUT_MODULE_HH
13 #define DUMUX_IO_VTK_OUTPUT_MODULE_HH
14
15 #include <functional>
16 #include <memory>
17 #include <string>
18
19 #include <dune/common/timer.hh>
20 #include <dune/common/fvector.hh>
21 #include <dune/common/typetraits.hh>
22
23 #include <dune/geometry/type.hh>
24 #include <dune/geometry/multilineargeometry.hh>
25
26 #include <dune/grid/common/mcmgmapper.hh>
27 #include <dune/grid/common/partitionset.hh>
28 #include <dune/grid/io/file/vtk/vtkwriter.hh>
29 #include <dune/grid/io/file/vtk/vtksequencewriter.hh>
30 #include <dune/grid/common/partitionset.hh>
31
32 #include <dumux/common/parameters.hh>
33 #include <dumux/io/format.hh>
34 #include <dumux/discretization/method.hh>
35
36 #include <dumux/io/vtk/function.hh>
37 #include <dumux/io/vtk/fieldtype.hh>
38 #include "velocityoutput.hh"
39
40 namespace Dumux {
41
42 /*!
43 * \ingroup InputOutput
44 * \brief A VTK output module to simplify writing dumux simulation data to VTK format
45 * \note This is a base class providing only rudimentary features
46 */
47 template<class GridGeometry>
48 class VtkOutputModuleBase
49 {
50 using GridView = typename GridGeometry::GridView;
51 static constexpr int dim = GridView::dimension;
52
53 public:
54 //! the type of Field that can be added to this writer
55 using Field = Vtk::template Field<GridView>;
56
57 923 VtkOutputModuleBase(const GridGeometry& gridGeometry,
58 const std::string& name,
59 const std::string& paramGroup = "",
60 Dune::VTK::DataMode dm = Dune::VTK::conforming,
61 bool verbose = true)
62 : gridGeometry_(gridGeometry)
63 , name_(name)
64 , paramGroup_(paramGroup)
65 , dm_(dm)
66
17/30
✓ Branch 2 taken 677 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 6 times.
✓ Branch 5 taken 576 times.
✓ Branch 6 taken 95 times.
✓ Branch 7 taken 582 times.
✓ Branch 8 taken 518 times.
✓ Branch 9 taken 159 times.
✓ Branch 10 taken 429 times.
✓ Branch 11 taken 242 times.
✗ Branch 12 not taken.
✓ Branch 13 taken 524 times.
✓ Branch 14 taken 140 times.
✓ Branch 15 taken 442 times.
✓ Branch 16 taken 95 times.
✓ Branch 17 taken 140 times.
✓ Branch 18 taken 442 times.
✓ Branch 19 taken 95 times.
✗ Branch 20 not taken.
✓ Branch 21 taken 442 times.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
✗ Branch 27 not taken.
✗ Branch 28 not taken.
✗ Branch 29 not taken.
✗ Branch 30 not taken.
✗ Branch 31 not taken.
980 , verbose_(gridGeometry.gridView().comm().rank() == 0 && verbose)
67 {
68
1/2
✓ Branch 1 taken 677 times.
✗ Branch 2 not taken.
923 const auto precisionString = getParamFromGroup<std::string>(paramGroup, "Vtk.Precision", "Float32");
69
2/4
✓ Branch 1 taken 677 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 677 times.
✗ Branch 5 not taken.
1846 precision_ = Dumux::Vtk::stringToPrecision(precisionString);
70
4/10
✓ Branch 1 taken 677 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 677 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 677 times.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✓ Branch 10 taken 677 times.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
923 const auto coordPrecision = Dumux::Vtk::stringToPrecision(getParamFromGroup<std::string>(paramGroup, "Vtk.CoordPrecision", precisionString));
71
4/8
✓ Branch 1 taken 677 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 677 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 677 times.
✗ Branch 8 not taken.
✓ Branch 9 taken 677 times.
1846 writer_ = std::make_shared<Dune::VTKWriter<GridView>>(gridGeometry.gridView(), dm, coordPrecision);
72
3/6
✓ Branch 1 taken 677 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 677 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 677 times.
923 sequenceWriter_ = std::make_unique<Dune::VTKSequenceWriter<GridView>>(writer_, name);
73
2/6
✓ Branch 1 taken 677 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 677 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
923 addProcessRank_ = getParamFromGroup<bool>(this->paramGroup(), "Vtk.AddProcessRank", true);
74 923 }
75
76
5/8
✓ Branch 1 taken 677 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 677 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✓ Branch 6 taken 677 times.
✓ Branch 7 taken 623 times.
✓ Branch 8 taken 54 times.
4062 virtual ~VtkOutputModuleBase() = default;
77
78 //! the parameter group for getting parameter from the parameter tree
79 const std::string& paramGroup() const
80
3/86
✓ Branch 1 taken 47 times.
✓ Branch 2 taken 29 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 29 times.
✗ Branch 6 not taken.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
✗ Branch 28 not taken.
✗ Branch 29 not taken.
✗ Branch 31 not taken.
✗ Branch 32 not taken.
✗ Branch 35 not taken.
✗ Branch 36 not taken.
✗ Branch 38 not taken.
✗ Branch 39 not taken.
✗ Branch 45 not taken.
✗ Branch 46 not taken.
✗ Branch 48 not taken.
✗ Branch 49 not taken.
✗ Branch 51 not taken.
✗ Branch 52 not taken.
✗ Branch 54 not taken.
✗ Branch 55 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 66 not taken.
✗ Branch 67 not taken.
✗ Branch 69 not taken.
✗ Branch 70 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 81 not taken.
✗ Branch 82 not taken.
✗ Branch 84 not taken.
✗ Branch 85 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 96 not taken.
✗ Branch 97 not taken.
✗ Branch 102 not taken.
✗ Branch 103 not taken.
✗ Branch 105 not taken.
✗ Branch 106 not taken.
✗ Branch 108 not taken.
✗ Branch 109 not taken.
✗ Branch 111 not taken.
✗ Branch 112 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 123 not taken.
✗ Branch 124 not taken.
✗ Branch 126 not taken.
✗ Branch 127 not taken.
✗ Branch 129 not taken.
✗ Branch 130 not taken.
✗ Branch 132 not taken.
✗ Branch 133 not taken.
✗ Branch 135 not taken.
✗ Branch 136 not taken.
✗ Branch 139 not taken.
✗ Branch 140 not taken.
✗ Branch 142 not taken.
✗ Branch 143 not taken.
708 { return paramGroup_; }
81
82 /*!
83 * \brief Add a scalar or vector valued vtk field
84 *
85 * \param v The field to be added. Can be any indexable container. Its value type can be a number or itself an indexable container.
86 * \param name The name of the field
87 * \param fieldType The type of the field.
88 * This determines whether the values are associated with vertices or elements.
89 * By default, the method automatically deduces the correct type for the given input.
90 */
91 template<typename Vector>
92 void addField(const Vector& v,
93 const std::string& name,
94 Vtk::FieldType fieldType = Vtk::FieldType::automatic)
95
26/40
✓ Branch 1 taken 168 times.
✓ Branch 2 taken 17 times.
✓ Branch 3 taken 1 times.
✓ Branch 4 taken 114 times.
✓ Branch 5 taken 17 times.
✓ Branch 6 taken 1 times.
✓ Branch 7 taken 55 times.
✓ Branch 8 taken 17 times.
✓ Branch 9 taken 1 times.
✓ Branch 10 taken 36 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 2 times.
✓ Branch 13 taken 5 times.
✗ Branch 14 not taken.
✓ Branch 15 taken 2 times.
✓ Branch 16 taken 1 times.
✗ Branch 17 not taken.
✓ Branch 18 taken 2 times.
✓ Branch 19 taken 1 times.
✗ Branch 20 not taken.
✓ Branch 21 taken 2 times.
✗ Branch 22 not taken.
✓ Branch 24 taken 2 times.
✗ Branch 25 not taken.
✓ Branch 27 taken 2 times.
✗ Branch 28 not taken.
✓ Branch 30 taken 2 times.
✗ Branch 31 not taken.
✓ Branch 33 taken 2 times.
✗ Branch 34 not taken.
✓ Branch 36 taken 2 times.
✗ Branch 37 not taken.
✓ Branch 39 taken 1 times.
✗ Branch 40 not taken.
✓ Branch 42 taken 1 times.
✗ Branch 43 not taken.
✓ Branch 45 taken 1 times.
✗ Branch 46 not taken.
✓ Branch 48 taken 1 times.
✗ Branch 49 not taken.
542 { addField(v, name, this->precision(), fieldType); }
96
97 /*!
98 * \brief Add a scalar or vector valued vtk field
99 *
100 * \param v The field to be added. Can be any indexable container. Its value type can be a number or itself an indexable container.
101 * \param name The name of the field
102 * \param fieldType The type of the field.
103 * This determines whether the values are associated with vertices or elements.
104 * By default, the method automatically deduces the correct type for the given input.
105 * \param precision The output precision of this field (see Dune::VTK::Precision)
106 */
107 template<typename Vector>
108 912 void addField(const Vector& v,
109 const std::string& name,
110 Dumux::Vtk::Precision precision,
111 Vtk::FieldType fieldType = Vtk::FieldType::automatic)
112 {
113 // Deduce the number of components from the given vector type
114 1047 const auto nComp = getNumberOfComponents_(v);
115
116
4/6
✓ Branch 0 taken 378 times.
✓ Branch 1 taken 166 times.
✓ Branch 2 taken 259 times.
✓ Branch 3 taken 165 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
1639 const auto numElemDofs = gridGeometry().elementMapper().size();
117
4/4
✓ Branch 0 taken 388 times.
✓ Branch 1 taken 166 times.
✓ Branch 2 taken 319 times.
✓ Branch 3 taken 166 times.
1738 const auto numVertexDofs = gridGeometry().vertexMapper().size();
118
119 // Automatically deduce the field type ...
120
2/2
✓ Branch 0 taken 388 times.
✓ Branch 1 taken 166 times.
912 if(fieldType == Vtk::FieldType::automatic)
121 {
122
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 388 times.
580 if(numElemDofs == numVertexDofs)
123 DUNE_THROW(Dune::InvalidStateException, "Automatic deduction of FieldType failed. Please explicitly specify FieldType::element or FieldType::vertex.");
124
125
4/4
✓ Branch 0 taken 59 times.
✓ Branch 1 taken 329 times.
✓ Branch 2 taken 50 times.
✓ Branch 3 taken 329 times.
1147 if(v.size() == numElemDofs)
126 fieldType = Vtk::FieldType::element;
127
1/4
✗ Branch 0 not taken.
✓ Branch 1 taken 59 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
70 else if(v.size() == numVertexDofs)
128 fieldType = Vtk::FieldType::vertex;
129 else
130 DUNE_THROW(Dune::RangeError, "Size mismatch of added field!");
131 }
132 // ... or check if the user-specified type matches the size of v
133 else
134 {
135
2/2
✓ Branch 0 taken 115 times.
✓ Branch 1 taken 51 times.
332 if(fieldType == Vtk::FieldType::element)
136
2/4
✗ Branch 0 not taken.
✓ Branch 1 taken 115 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 115 times.
460 if(v.size() != numElemDofs)
137 DUNE_THROW(Dune::RangeError, "Size mismatch of added field!");
138
139
2/2
✓ Branch 0 taken 51 times.
✓ Branch 1 taken 115 times.
332 if(fieldType == Vtk::FieldType::vertex)
140
2/4
✗ Branch 0 not taken.
✓ Branch 1 taken 51 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 51 times.
204 if(v.size() != numVertexDofs)
141 DUNE_THROW(Dune::RangeError, "Size mismatch of added field!");
142 }
143
144 // add the appropriate field
145
2/2
✓ Branch 0 taken 115 times.
✓ Branch 1 taken 51 times.
332 if (fieldType == Vtk::FieldType::element)
146 2220 fields_.emplace_back(gridGeometry_.gridView(), gridGeometry_.elementMapper(), v, name, nComp, 0, dm_, precision);
147 else
148 516 fields_.emplace_back(gridGeometry_.gridView(), gridGeometry_.vertexMapper(), v, name, nComp, dim, dm_, precision);
149 912 }
150
151 /*!
152 * \brief Add a scalar or vector valued vtk field
153 * \param field The parameters passed on to the field constructor
154 */
155 void addField(Field&& field)
156 {
157 fields_.push_back(std::move(field));
158 }
159
160 //! Write the data for this timestep to file in four steps
161 //! (1) We assemble all registered variable fields
162 //! (2) We register them with the vtk writer
163 //! (3) The writer writes the output for us
164 //! (4) Clear the writer for the next time step
165 7677 void write(double time, Dune::VTK::OutputType type = Dune::VTK::ascii)
166 {
167 7677 Dune::Timer timer;
168
169 // write to file depending on data mode
170
2/2
✓ Branch 0 taken 6561 times.
✓ Branch 1 taken 52 times.
7677 if (dm_ == Dune::VTK::conforming)
171 7605 writeConforming_(time, type);
172
1/2
✓ Branch 0 taken 52 times.
✗ Branch 1 not taken.
72 else if (dm_ == Dune::VTK::nonconforming)
173 72 writeNonConforming_(time, type);
174 else
175 DUNE_THROW(Dune::NotImplemented, "Output for provided VTK data mode");
176
177 //! output
178 7677 timer.stop();
179
2/2
✓ Branch 0 taken 6245 times.
✓ Branch 1 taken 368 times.
7677 if (verbose_)
180
2/6
✓ Branch 4 taken 6245 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 6245 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
15725 std::cout << Fmt::format("Writing output for problem \"{}\". Took {:.2g} seconds.\n", name_, timer.elapsed());
181 7677 }
182
183 protected:
184 const GridGeometry& gridGeometry() const { return gridGeometry_; }
185
186 bool verbose() const { return verbose_; }
187
1/2
✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
212 const std::string& name() const { return name_; }
188 Dune::VTK::DataMode dataMode() const { return dm_; }
189 Dumux::Vtk::Precision precision() const { return precision_; }
190
191 13638 Dune::VTKWriter<GridView>& writer() { return *writer_; }
192
6/40
✓ Branch 1 taken 2060 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 2060 times.
✗ Branch 5 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✓ Branch 19 taken 206 times.
✗ Branch 20 not taken.
✓ Branch 22 taken 206 times.
✗ Branch 23 not taken.
✓ Branch 29 taken 206 times.
✗ Branch 30 not taken.
✓ Branch 32 taken 206 times.
✗ Branch 33 not taken.
✗ Branch 35 not taken.
✗ Branch 36 not taken.
✗ Branch 38 not taken.
✗ Branch 39 not taken.
✗ Branch 41 not taken.
✗ Branch 42 not taken.
✗ Branch 44 not taken.
✗ Branch 45 not taken.
✗ Branch 47 not taken.
✗ Branch 48 not taken.
✗ Branch 50 not taken.
✗ Branch 51 not taken.
✗ Branch 53 not taken.
✗ Branch 54 not taken.
✗ Branch 56 not taken.
✗ Branch 57 not taken.
✗ Branch 63 not taken.
✗ Branch 64 not taken.
✗ Branch 66 not taken.
✗ Branch 67 not taken.
204534 Dune::VTKSequenceWriter<GridView>& sequenceWriter() { return *sequenceWriter_; }
193
194
0/4
✗ Branch 0 not taken.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
6818 const std::vector<Field>& fields() const { return fields_; }
195
196 private:
197 //! Assembles the fields and adds them to the writer (conforming output)
198 5 virtual void writeConforming_(double time, Dune::VTK::OutputType type)
199 {
200 //////////////////////////////////////////////////////////////
201 //! (1) Assemble all variable fields and add to writer
202 //////////////////////////////////////////////////////////////
203
204 // process rank
205
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 5 times.
5 std::vector<int> rank;
206
207 //! Abort if no data was registered
208
2/6
✗ Branch 0 not taken.
✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 5 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
10 if (!fields_.empty() || addProcessRank_)
209 {
210
4/6
✓ Branch 0 taken 1 times.
✓ Branch 1 taken 4 times.
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 4 times.
✗ Branch 5 not taken.
10 const auto numCells = gridGeometry_.gridView().size(0);
211
212 // maybe allocate space for the process rank
213
1/2
✓ Branch 0 taken 5 times.
✗ Branch 1 not taken.
5 if (addProcessRank_)
214 {
215
1/2
✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
5 rank.resize(numCells);
216
217
5/17
✓ Branch 1 taken 4 times.
✓ Branch 2 taken 10 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 13 times.
✓ Branch 5 taken 1 times.
✓ Branch 6 taken 20 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
67 for (const auto& element : elements(gridGeometry_.gridView(), Dune::Partitions::interior))
218 {
219
0/6
✗ Branch 0 not taken.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
50 const auto eIdxGlobal = gridGeometry_.elementMapper().index(element);
220
2/13
✗ Branch 0 not taken.
✓ Branch 1 taken 16 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 16 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
77 rank[eIdxGlobal] = gridGeometry_.gridView().comm().rank();
221 }
222 }
223
224 //////////////////////////////////////////////////////////////
225 //! (2) Register data fields with the vtk writer
226 //////////////////////////////////////////////////////////////
227
228 // the process rank
229
1/2
✓ Branch 0 taken 5 times.
✗ Branch 1 not taken.
5 if (addProcessRank_)
230
10/26
✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 5 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 5 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 5 times.
✗ Branch 11 not taken.
✓ Branch 13 taken 5 times.
✗ Branch 14 not taken.
✓ Branch 16 taken 5 times.
✗ Branch 17 not taken.
✓ Branch 20 taken 5 times.
✗ Branch 21 not taken.
✓ Branch 22 taken 5 times.
✗ Branch 23 not taken.
✓ Branch 24 taken 5 times.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
✓ Branch 27 taken 5 times.
✗ Branch 28 not taken.
✗ Branch 29 not taken.
✗ Branch 30 not taken.
✗ Branch 31 not taken.
✗ Branch 32 not taken.
✗ Branch 33 not taken.
25 this->sequenceWriter().addCellData(Field(gridGeometry_.gridView(), gridGeometry_.elementMapper(), rank, "process rank", 1, 0).get());
231
232 // also register additional (non-standardized) user fields if any
233
4/4
✓ Branch 0 taken 18 times.
✓ Branch 1 taken 5 times.
✓ Branch 2 taken 18 times.
✓ Branch 3 taken 5 times.
33 for (auto&& field : fields_)
234 {
235
1/2
✓ Branch 0 taken 18 times.
✗ Branch 1 not taken.
18 if (field.codim() == 0)
236
2/6
✓ Branch 3 taken 18 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 18 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
54 this->sequenceWriter().addCellData(field.get());
237 else if (field.codim() == dim)
238 this->sequenceWriter().addVertexData(field.get());
239 else
240 DUNE_THROW(Dune::RangeError, "Cannot add wrongly sized vtk scalar field!");
241 }
242 }
243
244 //////////////////////////////////////////////////////////////
245 //! (2) The writer writes the output for us
246 //////////////////////////////////////////////////////////////
247
2/4
✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 5 times.
✗ Branch 5 not taken.
10 this->sequenceWriter().write(time, type);
248
249 //////////////////////////////////////////////////////////////
250 //! (3) Clear the writer
251 //////////////////////////////////////////////////////////////
252
1/2
✓ Branch 2 taken 5 times.
✗ Branch 3 not taken.
10 this->writer().clear();
253 5 }
254
255 //! Assembles the fields and adds them to the writer (nonconforming output)
256 virtual void writeNonConforming_(double time, Dune::VTK::OutputType type)
257 {
258 DUNE_THROW(Dune::NotImplemented, "Non-conforming VTK output");
259 }
260
261 //! Deduces the number of components of the value type of a vector of values
262 template<class Vector>
263 std::size_t getNumberOfComponents_(const Vector& v)
264 {
265 if constexpr (Dune::IsIndexable<decltype(std::declval<Vector>()[0])>::value)
266
3/4
✓ Branch 0 taken 48 times.
✓ Branch 1 taken 4 times.
✓ Branch 2 taken 19 times.
✗ Branch 3 not taken.
71 return v[0].size();
267 else
268 return 1;
269 }
270
271 const GridGeometry& gridGeometry_;
272 std::string name_;
273 const std::string paramGroup_;
274 Dune::VTK::DataMode dm_;
275 bool verbose_;
276 Dumux::Vtk::Precision precision_;
277
278 std::shared_ptr<Dune::VTKWriter<GridView>> writer_;
279 std::unique_ptr<Dune::VTKSequenceWriter<GridView>> sequenceWriter_;
280
281 std::vector<Field> fields_; //!< Registered scalar and vector fields
282
283 bool addProcessRank_ = true;
284 };
285
286 /*!
287 * \ingroup InputOutput
288 * \brief A VTK output module to simplify writing dumux simulation data to VTK format
289 *
290 * \tparam GridVariables The grid variables
291 * \tparam SolutionVector The solution vector
292 *
293 * Handles the output of scalar and vector fields to VTK formatted file for multiple
294 * variables and timesteps. Certain predefined fields can be registered on
295 * initialization and/or be turned on/off using the designated properties. Additionally
296 * non-standardized scalar and vector fields can be added to the writer manually.
297 */
298 template<class GridVariables, class SolutionVector>
299 class VtkOutputModule : public VtkOutputModuleBase<typename GridVariables::GridGeometry>
300 {
301 using ParentType = VtkOutputModuleBase<typename GridVariables::GridGeometry>;
302 using GridGeometry = typename GridVariables::GridGeometry;
303
304 using VV = typename GridVariables::VolumeVariables;
305 using Scalar = typename GridVariables::Scalar;
306
307 using GridView = typename GridGeometry::GridView;
308
309 enum {
310 dim = GridView::dimension,
311 dimWorld = GridView::dimensionworld
312 };
313
314 using Element = typename GridView::template Codim<0>::Entity;
315 using VolVarsVector = Dune::FieldVector<Scalar, dimWorld>;
316
317 static constexpr bool isBox = GridGeometry::discMethod == DiscretizationMethods::box;
318 static constexpr bool isDiamond = GridGeometry::discMethod == DiscretizationMethods::fcdiamond;
319 static constexpr bool isPQ1Bubble = GridGeometry::discMethod == DiscretizationMethods::pq1bubble;
320
321 struct VolVarScalarDataInfo { std::function<Scalar(const VV&)> get; std::string name; Dumux::Vtk::Precision precision_; };
322 struct VolVarVectorDataInfo { std::function<VolVarsVector(const VV&)> get; std::string name; Dumux::Vtk::Precision precision_; };
323
324 using VelocityOutputType = Dumux::VelocityOutput<GridVariables>;
325
326 public:
327 //! the type of Field that can be added to this writer
328 using Field = Vtk::template Field<GridView>;
329 //! export type of the volume variables for the outputfields
330 using VolumeVariables = VV;
331
332 930 VtkOutputModule(const GridVariables& gridVariables,
333 const SolutionVector& sol,
334 const std::string& name,
335 const std::string& paramGroup = "",
336 Dune::VTK::DataMode dm = Dune::VTK::conforming,
337 bool verbose = true)
338 : ParentType(gridVariables.gridGeometry(), name, paramGroup, dm, verbose)
339 , gridVariables_(gridVariables)
340 , sol_(sol)
341
3/6
✓ Branch 3 taken 672 times.
✗ Branch 4 not taken.
✓ Branch 6 taken 672 times.
✗ Branch 7 not taken.
✓ Branch 9 taken 672 times.
✗ Branch 10 not taken.
1860 , velocityOutput_(std::make_shared<VelocityOutputType>())
342 {
343
1/2
✓ Branch 1 taken 672 times.
✗ Branch 2 not taken.
930 enableVelocityOutput_ = getParamFromGroup<bool>(this->paramGroup(), "Vtk.AddVelocity", false);
344
1/4
✓ Branch 1 taken 672 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
930 addProcessRank_ = getParamFromGroup<bool>(this->paramGroup(), "Vtk.AddProcessRank", true);
345 930 }
346
347 //////////////////////////////////////////////////////////////////////////////////////////////
348 //! Methods to conveniently add primary and secondary variables upon initialization
349 //! Do not call these methods after initialization i.e. _not_ within the time loop
350 //////////////////////////////////////////////////////////////////////////////////////////////
351
352 /*!
353 * \brief Add a velocity output policy
354 *
355 * \param velocityOutput the output policy
356 * \note the default policy does not add any velocity output
357 */
358 void addVelocityOutput(std::shared_ptr<VelocityOutputType> velocityOutput)
359
2/48
✓ Branch 1 taken 360 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 29 times.
✗ Branch 5 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
✗ Branch 28 not taken.
✗ Branch 29 not taken.
✗ Branch 31 not taken.
✗ Branch 32 not taken.
✗ Branch 34 not taken.
✗ 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 not taken.
✗ Branch 50 not taken.
✗ Branch 52 not taken.
✗ Branch 53 not taken.
✗ Branch 55 not taken.
✗ Branch 56 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 67 not taken.
✗ Branch 68 not taken.
✗ Branch 70 not taken.
✗ Branch 71 not taken.
389 { velocityOutput_ = velocityOutput; }
360
361 //! Output a scalar volume variable
362 //! \param name The name of the vtk field
363 //! \param f A function taking a VolumeVariables object and returning the desired scalar
364 4600 void addVolumeVariable(std::function<Scalar(const VolumeVariables&)>&& f,
365 const std::string& name)
366 {
367
1/2
✓ Branch 3 taken 3920 times.
✗ Branch 4 not taken.
4600 volVarScalarDataInfo_.push_back(VolVarScalarDataInfo{f, name, this->precision()});
368 4600 }
369
370 //! Add a vector-valued variable
371 //! \param f A function taking a VolumeVariables object and returning the desired vector
372 //! \param name The name of the vtk field
373 //! \note This method is only available for dimWorld > 1. For 1-D problems, the overload for volVar methods returning a Scalar will be used.
374 template<class VVV = VolVarsVector, typename std::enable_if_t<(VVV::dimension > 1), int> = 0>
375 68 void addVolumeVariable(std::function<VolVarsVector(const VolumeVariables&)>&& f,
376 const std::string& name)
377 {
378
1/2
✓ Branch 3 taken 68 times.
✗ Branch 4 not taken.
68 volVarVectorDataInfo_.push_back(VolVarVectorDataInfo{f, name, this->precision()});
379 68 }
380
381 protected:
382 // some return functions for differing implementations to use
383
22/39
✓ Branch 3 taken 17 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✓ Branch 6 taken 17 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 1 times.
✓ Branch 9 taken 17 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 1 times.
✓ Branch 12 taken 17 times.
✗ Branch 13 not taken.
✓ Branch 14 taken 1 times.
✓ Branch 15 taken 17 times.
✗ Branch 16 not taken.
✓ Branch 17 taken 1 times.
✓ Branch 18 taken 17 times.
✗ Branch 19 not taken.
✓ Branch 20 taken 1 times.
✗ Branch 21 not taken.
✓ Branch 23 taken 2 times.
✗ Branch 24 not taken.
✓ Branch 26 taken 2 times.
✗ Branch 27 not taken.
✓ Branch 29 taken 2 times.
✗ Branch 30 not taken.
✓ Branch 32 taken 2 times.
✗ Branch 33 not taken.
✓ Branch 35 taken 2 times.
✗ Branch 36 not taken.
✓ Branch 38 taken 2 times.
✗ Branch 39 not taken.
✓ Branch 43 taken 4368 times.
✗ Branch 44 not taken.
✓ Branch 46 taken 4368 times.
✗ Branch 47 not taken.
✓ Branch 51 taken 2014 times.
✗ Branch 52 not taken.
✓ Branch 54 taken 2014 times.
✗ Branch 55 not taken.
455268 const auto& problem() const { return gridVariables_.curGridVolVars().problem(); }
384 const GridVariables& gridVariables() const { return gridVariables_; }
385
11/315
✗ Branch 0 not taken.
✓ Branch 1 taken 206 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 206 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 375679 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 48615 times.
✓ Branch 8 taken 327064 times.
✗ Branch 9 not taken.
✓ Branch 11 taken 2123 times.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✓ Branch 14 taken 2123 times.
✗ Branch 15 not taken.
✓ Branch 17 taken 63 times.
✗ Branch 18 not taken.
✓ Branch 20 taken 63 times.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 26 not taken.
✗ Branch 27 not taken.
✗ Branch 28 not taken.
✓ Branch 29 taken 206 times.
✗ Branch 30 not taken.
✗ Branch 31 not taken.
✓ Branch 32 taken 206 times.
✗ Branch 33 not taken.
✗ Branch 34 not taken.
✗ Branch 35 not taken.
✗ Branch 36 not taken.
✗ Branch 37 not taken.
✗ Branch 38 not taken.
✗ Branch 39 not taken.
✗ Branch 40 not taken.
✗ Branch 42 not taken.
✗ Branch 43 not taken.
✗ Branch 44 not taken.
✗ Branch 45 not taken.
✗ Branch 46 not taken.
✗ Branch 47 not taken.
✗ Branch 48 not taken.
✗ Branch 49 not taken.
✗ Branch 51 not taken.
✗ Branch 52 not taken.
✗ Branch 53 not taken.
✗ Branch 54 not taken.
✗ Branch 55 not taken.
✗ Branch 57 not taken.
✗ Branch 58 not taken.
✗ Branch 60 not taken.
✗ Branch 61 not taken.
✗ Branch 62 not taken.
✗ Branch 63 not taken.
✗ Branch 64 not taken.
✗ Branch 66 not taken.
✗ Branch 67 not taken.
✗ Branch 68 not taken.
✗ Branch 69 not taken.
✗ Branch 70 not taken.
✗ Branch 71 not taken.
✗ Branch 76 not taken.
✗ Branch 77 not taken.
✗ Branch 78 not taken.
✗ Branch 79 not taken.
✗ Branch 84 not taken.
✗ Branch 85 not taken.
✗ Branch 86 not taken.
✗ Branch 87 not taken.
✗ Branch 92 not taken.
✗ Branch 93 not taken.
✗ Branch 94 not taken.
✗ Branch 95 not taken.
✗ Branch 100 not taken.
✗ Branch 101 not taken.
✗ Branch 102 not taken.
✗ Branch 103 not taken.
✗ Branch 108 not taken.
✗ Branch 109 not taken.
✗ Branch 110 not taken.
✗ Branch 111 not taken.
✗ Branch 116 not taken.
✗ Branch 117 not taken.
✗ Branch 118 not taken.
✗ Branch 119 not taken.
✗ Branch 124 not taken.
✗ Branch 125 not taken.
✗ Branch 126 not taken.
✗ Branch 127 not taken.
✗ Branch 132 not taken.
✗ Branch 133 not taken.
✗ Branch 134 not taken.
✗ Branch 135 not taken.
✗ Branch 140 not taken.
✗ Branch 141 not taken.
✗ Branch 142 not taken.
✗ Branch 143 not taken.
✗ Branch 148 not taken.
✗ Branch 149 not taken.
✗ Branch 150 not taken.
✗ Branch 151 not taken.
✗ Branch 156 not taken.
✗ Branch 157 not taken.
✗ Branch 158 not taken.
✗ Branch 159 not taken.
✗ Branch 164 not taken.
✗ Branch 165 not taken.
✗ Branch 166 not taken.
✗ Branch 167 not taken.
✗ Branch 172 not taken.
✗ Branch 173 not taken.
✗ Branch 174 not taken.
✗ Branch 175 not taken.
✗ Branch 180 not taken.
✗ Branch 181 not taken.
✗ Branch 182 not taken.
✗ Branch 183 not taken.
✗ Branch 188 not taken.
✗ Branch 189 not taken.
✗ Branch 190 not taken.
✗ Branch 191 not taken.
✗ Branch 195 not taken.
✗ Branch 196 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 209 not taken.
✗ Branch 210 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 223 not taken.
✗ Branch 224 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 237 not taken.
✗ Branch 238 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 251 not taken.
✗ Branch 252 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 265 not taken.
✗ Branch 266 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 279 not taken.
✗ Branch 280 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 293 not taken.
✗ Branch 294 not taken.
✗ Branch 296 not taken.
✗ Branch 297 not taken.
✗ Branch 299 not taken.
✗ Branch 300 not taken.
✗ Branch 302 not taken.
✗ Branch 303 not taken.
✗ Branch 307 not taken.
✗ Branch 308 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 321 not taken.
✗ Branch 322 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.
✗ Branch 335 not taken.
✗ Branch 336 not taken.
✗ Branch 338 not taken.
✗ Branch 339 not taken.
✗ Branch 341 not taken.
✗ Branch 342 not taken.
✗ Branch 344 not taken.
✗ Branch 345 not taken.
✗ Branch 349 not taken.
✗ Branch 350 not taken.
✗ Branch 352 not taken.
✗ Branch 353 not taken.
✗ Branch 355 not taken.
✗ Branch 356 not taken.
✗ Branch 358 not taken.
✗ Branch 359 not taken.
✗ Branch 363 not taken.
✗ Branch 364 not taken.
✗ Branch 366 not taken.
✗ Branch 367 not taken.
✗ Branch 369 not taken.
✗ Branch 370 not taken.
✗ Branch 372 not taken.
✗ Branch 373 not taken.
✗ Branch 377 not taken.
✗ Branch 378 not taken.
✗ Branch 380 not taken.
✗ Branch 381 not taken.
✗ Branch 383 not taken.
✗ Branch 384 not taken.
✗ Branch 386 not taken.
✗ Branch 387 not taken.
✗ Branch 391 not taken.
✗ Branch 392 not taken.
✗ Branch 394 not taken.
✗ Branch 395 not taken.
✗ Branch 397 not taken.
✗ Branch 398 not taken.
✗ Branch 400 not taken.
✗ Branch 401 not taken.
✗ Branch 405 not taken.
✗ Branch 406 not taken.
✗ Branch 408 not taken.
✗ Branch 409 not taken.
✗ Branch 411 not taken.
✗ Branch 412 not taken.
✗ Branch 414 not taken.
✗ Branch 415 not taken.
✗ Branch 419 not taken.
✗ Branch 420 not taken.
✗ Branch 422 not taken.
✗ Branch 423 not taken.
✗ Branch 425 not taken.
✗ Branch 426 not taken.
✗ Branch 428 not taken.
✗ Branch 429 not taken.
✗ Branch 433 not taken.
✗ Branch 434 not taken.
✗ Branch 436 not taken.
✗ Branch 437 not taken.
✗ Branch 439 not taken.
✗ Branch 440 not taken.
✗ Branch 442 not taken.
✗ Branch 443 not taken.
✗ Branch 447 not taken.
✗ Branch 448 not taken.
✗ Branch 450 not taken.
✗ Branch 451 not taken.
✗ Branch 453 not taken.
✗ Branch 454 not taken.
✗ Branch 456 not taken.
✗ Branch 457 not taken.
✗ Branch 461 not taken.
✗ Branch 462 not taken.
✗ Branch 464 not taken.
✗ Branch 465 not taken.
✗ Branch 467 not taken.
✗ Branch 468 not taken.
✗ Branch 470 not taken.
✗ Branch 471 not taken.
✗ Branch 475 not taken.
✗ Branch 476 not taken.
✗ Branch 478 not taken.
✗ Branch 479 not taken.
✗ Branch 481 not taken.
✗ Branch 482 not taken.
✗ Branch 484 not taken.
✗ Branch 485 not taken.
✗ Branch 489 not taken.
✗ Branch 490 not taken.
✗ Branch 492 not taken.
✗ Branch 493 not taken.
✗ Branch 495 not taken.
✗ Branch 496 not taken.
✗ Branch 498 not taken.
✗ Branch 499 not taken.
✗ Branch 503 not taken.
✗ Branch 504 not taken.
✗ Branch 506 not taken.
✗ Branch 507 not taken.
✗ Branch 509 not taken.
✗ Branch 510 not taken.
✗ Branch 512 not taken.
✗ Branch 513 not taken.
✗ Branch 517 not taken.
✗ Branch 518 not taken.
✗ Branch 520 not taken.
✗ Branch 521 not taken.
✗ Branch 523 not taken.
✗ Branch 524 not taken.
✗ Branch 526 not taken.
✗ Branch 527 not taken.
25104954 const GridGeometry& gridGeometry() const { return gridVariables_.gridGeometry(); }
386 const SolutionVector& sol() const { return sol_; }
387
388
2/8
✗ Branch 0 not taken.
✓ Branch 1 taken 206 times.
✓ Branch 2 taken 206 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
412 const std::vector<VolVarScalarDataInfo>& volVarScalarDataInfo() const { return volVarScalarDataInfo_; }
389
2/8
✗ Branch 0 not taken.
✓ Branch 1 taken 206 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 206 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
412 const std::vector<VolVarVectorDataInfo>& volVarVectorDataInfo() const { return volVarVectorDataInfo_; }
390
391 using VelocityOutput = VelocityOutputType;
392
8/80
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✓ Branch 7 taken 206 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 206 times.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✓ Branch 19 taken 327064 times.
✗ Branch 20 not taken.
✓ Branch 22 taken 327064 times.
✗ Branch 23 not taken.
✓ Branch 25 taken 327064 times.
✗ Branch 26 not taken.
✓ Branch 28 taken 327064 times.
✗ Branch 29 not taken.
✗ Branch 31 not taken.
✗ Branch 32 not taken.
✗ Branch 34 not taken.
✗ Branch 35 not taken.
✗ Branch 37 not taken.
✗ Branch 38 not taken.
✗ Branch 40 not taken.
✗ Branch 41 not taken.
✓ Branch 43 taken 206 times.
✗ Branch 44 not taken.
✓ Branch 46 taken 206 times.
✗ Branch 47 not taken.
✗ Branch 49 not taken.
✗ Branch 50 not taken.
✗ Branch 52 not taken.
✗ Branch 53 not taken.
✗ Branch 55 not taken.
✗ Branch 56 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 67 not taken.
✗ Branch 68 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 79 not taken.
✗ Branch 80 not taken.
✗ Branch 82 not taken.
✗ Branch 83 not taken.
✗ Branch 85 not taken.
✗ Branch 86 not taken.
✗ Branch 88 not taken.
✗ Branch 89 not taken.
✗ Branch 91 not taken.
✗ Branch 92 not taken.
✗ Branch 94 not taken.
✗ Branch 95 not taken.
✗ Branch 97 not taken.
✗ Branch 98 not taken.
✗ Branch 100 not taken.
✗ Branch 101 not taken.
✗ Branch 103 not taken.
✗ Branch 104 not taken.
✗ Branch 106 not taken.
✗ Branch 107 not taken.
✗ Branch 109 not taken.
✗ Branch 110 not taken.
✗ Branch 112 not taken.
✗ Branch 113 not taken.
✗ Branch 115 not taken.
✗ Branch 116 not taken.
✗ Branch 118 not taken.
✗ Branch 119 not taken.
1309080 const VelocityOutput& velocityOutput() const { return *velocityOutput_; }
393
394 private:
395
396 //! Assembles the fields and adds them to the writer (conforming output)
397 7752 void writeConforming_(double time, Dune::VTK::OutputType type) override
398 {
399 7752 const Dune::VTK::DataMode dm = Dune::VTK::conforming;
400 //////////////////////////////////////////////////////////////
401 //! (1) Assemble all variable fields and add to writer
402 //////////////////////////////////////////////////////////////
403
404 // instantiate the velocity output
405 using VelocityVector = typename VelocityOutput::VelocityVector;
406
4/8
✓ Branch 1 taken 6556 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 6556 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 6556 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 6556 times.
✗ Branch 11 not taken.
23256 std::vector<VelocityVector> velocity(velocityOutput_->numFluidPhases());
407
408 // process rank
409
2/4
✓ Branch 0 taken 10 times.
✓ Branch 1 taken 6546 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
15504 std::vector<double> rank;
410
411 // volume variable data
412
4/4
✓ Branch 0 taken 10 times.
✓ Branch 1 taken 6546 times.
✓ Branch 3 taken 6516 times.
✓ Branch 4 taken 40 times.
15504 std::vector<std::vector<Scalar>> volVarScalarData;
413
2/2
✓ Branch 0 taken 10 times.
✓ Branch 1 taken 6546 times.
15504 std::vector<std::vector<VolVarsVector>> volVarVectorData;
414
415 //! Abort if no data was registered
416
2/2
✓ Branch 0 taken 10 times.
✓ Branch 1 taken 6546 times.
7752 if (!volVarScalarDataInfo_.empty()
417
4/4
✓ Branch 0 taken 4 times.
✓ Branch 1 taken 6 times.
✓ Branch 2 taken 4 times.
✓ Branch 3 taken 6 times.
20 || !volVarVectorDataInfo_.empty()
418
2/4
✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 4 times.
8 || !this->fields().empty()
419 || velocityOutput_->enableOutput()
420
2/4
✓ Branch 0 taken 10 times.
✓ Branch 1 taken 6546 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
7752 || addProcessRank_)
421 {
422
5/8
✓ Branch 0 taken 11 times.
✓ Branch 1 taken 5263 times.
✓ Branch 2 taken 11 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 5274 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 5263 times.
✗ Branch 8 not taken.
23256 const auto numCells = gridGeometry().gridView().size(0);
423 15504 const auto numDofs = numDofs_();
424
425 // get fields for all volume variables
426
4/4
✓ Branch 0 taken 6546 times.
✓ Branch 1 taken 10 times.
✓ Branch 2 taken 5251 times.
✓ Branch 3 taken 10 times.
13929 if (!volVarScalarDataInfo_.empty())
427
5/12
✓ Branch 1 taken 6546 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 6546 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 6546 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 6546 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 6546 times.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
30968 volVarScalarData.resize(volVarScalarDataInfo_.size(), std::vector<Scalar>(numDofs));
428
4/4
✓ Branch 0 taken 1110 times.
✓ Branch 1 taken 5446 times.
✓ Branch 2 taken 1110 times.
✓ Branch 3 taken 5446 times.
15504 if (!volVarVectorDataInfo_.empty())
429
5/12
✓ Branch 1 taken 1110 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1110 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 1110 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 1110 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 1110 times.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
4536 volVarVectorData.resize(volVarVectorDataInfo_.size(), std::vector<VolVarsVector>(numDofs));
430
431
4/6
✓ Branch 1 taken 6556 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 6556 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 3036 times.
✓ Branch 7 taken 3520 times.
15504 if (velocityOutput_->enableOutput())
432 {
433
4/6
✓ Branch 1 taken 6603 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 6603 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 3567 times.
✓ Branch 7 taken 3036 times.
10996 for (int phaseIdx = 0; phaseIdx < velocityOutput_->numFluidPhases(); ++phaseIdx)
434 {
435
4/6
✓ Branch 1 taken 3567 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 3567 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 262 times.
✓ Branch 7 taken 3305 times.
8072 if (velocityOutput_->fieldType() == VelocityOutput::FieldType::element)
436
2/4
✓ Branch 1 taken 262 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 262 times.
✗ Branch 5 not taken.
584 velocity[phaseIdx].resize(numCells);
437
3/6
✓ Branch 1 taken 3305 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 3305 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 3305 times.
7488 else if (velocityOutput_->fieldType() == VelocityOutput::FieldType::vertex)
438 velocity[phaseIdx].resize(numDofs);
439 else
440 {
441 if(isBox && dim == 1)
442
2/4
✓ Branch 1 taken 660 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 660 times.
✗ Branch 5 not taken.
1328 velocity[phaseIdx].resize(numCells);
443 else
444
2/4
✓ Branch 1 taken 2645 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 2645 times.
✗ Branch 5 not taken.
6160 velocity[phaseIdx].resize(numDofs);
445 }
446 }
447 }
448
449 // maybe allocate space for the process rank
450
3/4
✓ Branch 0 taken 6516 times.
✓ Branch 1 taken 40 times.
✓ Branch 3 taken 6516 times.
✗ Branch 4 not taken.
7752 if (addProcessRank_) rank.resize(numCells);
451
452
3/6
✓ Branch 1 taken 5755 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 5755 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 98 times.
✗ Branch 7 not taken.
18193 auto fvGeometry = localView(gridGeometry());
453
5/8
✓ Branch 1 taken 5759 times.
✓ Branch 2 taken 548 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 5759 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 1277 times.
✓ Branch 7 taken 151 times.
✗ Branch 8 not taken.
24285 auto elemVolVars = localView(gridVariables_.curGridVolVars());
454
19/22
✓ Branch 1 taken 5759 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 443532 times.
✓ Branch 4 taken 6545 times.
✓ Branch 5 taken 443521 times.
✓ Branch 6 taken 797 times.
✓ Branch 7 taken 5759 times.
✓ Branch 8 taken 179267 times.
✓ Branch 9 taken 4702768 times.
✓ Branch 10 taken 1007 times.
✓ Branch 11 taken 364938 times.
✓ Branch 12 taken 442 times.
✓ Branch 13 taken 52317 times.
✓ Branch 14 taken 364938 times.
✓ Branch 15 taken 1375366 times.
✓ Branch 16 taken 565 times.
✓ Branch 17 taken 1740304 times.
✓ Branch 18 taken 565 times.
✓ Branch 20 taken 1375366 times.
✗ Branch 21 not taken.
✓ Branch 23 taken 1375366 times.
✗ Branch 24 not taken.
15580297 for (const auto& element : elements(gridGeometry().gridView(), Dune::Partitions::interior))
455 {
456
3/6
✓ Branch 1 taken 1971323 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1971323 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 1971323 times.
✗ Branch 8 not taken.
27181470 const auto eIdxGlobal = gridGeometry().elementMapper().index(element);
457 // If velocity output is enabled we need to bind to the whole stencil
458 // otherwise element-local data is sufficient
459
4/6
✓ Branch 1 taken 6516903 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 6516903 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 2648942 times.
✓ Branch 7 taken 3867961 times.
18120980 if (velocityOutput_->enableOutput())
460 {
461
1/3
✗ Branch 0 not taken.
✓ Branch 1 taken 990524 times.
✗ Branch 2 not taken.
3639678 fvGeometry.bind(element);
462
1/2
✓ Branch 1 taken 2538942 times.
✗ Branch 2 not taken.
3639678 elemVolVars.bind(element, fvGeometry, sol_);
463 }
464 else
465 {
466
2/3
✓ Branch 0 taken 175134 times.
✓ Branch 1 taken 2323971 times.
✗ Branch 2 not taken.
5420812 fvGeometry.bindElement(element);
467
1/2
✓ Branch 1 taken 1938206 times.
✗ Branch 2 not taken.
4923376 elemVolVars.bindElement(element, fvGeometry, sol_);
468 }
469
470
8/8
✓ Branch 0 taken 54488 times.
✓ Branch 1 taken 6462415 times.
✓ Branch 2 taken 54488 times.
✓ Branch 3 taken 6462415 times.
✓ Branch 4 taken 42000 times.
✓ Branch 5 taken 12488 times.
✓ Branch 6 taken 42000 times.
✓ Branch 7 taken 12488 times.
18120980 if (!volVarScalarDataInfo_.empty() || !volVarVectorDataInfo_.empty())
471 {
472
4/4
✓ Branch 0 taken 10600539 times.
✓ Branch 1 taken 6504415 times.
✓ Branch 2 taken 8734051 times.
✓ Branch 3 taken 4751167 times.
29092822 for (const auto& scv : scvs(fvGeometry))
473 {
474 13602972 const auto dofIdxGlobal = scv.dofIndex();
475 13602972 const auto& volVars = elemVolVars[scv];
476
477 // get the scalar-valued data
478
5/5
✓ Branch 0 taken 82514042 times.
✓ Branch 1 taken 31246754 times.
✓ Branch 2 taken 85866585 times.
✓ Branch 3 taken 31246754 times.
✓ Branch 4 taken 3352543 times.
250346584 for (std::size_t i = 0; i < volVarScalarDataInfo_.size(); ++i)
479
2/4
✗ Branch 0 not taken.
✓ Branch 1 taken 106512800 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 106512800 times.
591859030 volVarScalarData[i][dofIdxGlobal] = volVarScalarDataInfo_[i].get(volVars);
480
481 // get the vector-valued data
482
4/4
✓ Branch 0 taken 709200 times.
✓ Branch 1 taken 10600539 times.
✓ Branch 2 taken 709200 times.
✓ Branch 3 taken 10600539 times.
28648472 for (std::size_t i = 0; i < volVarVectorDataInfo_.size(); ++i)
483
2/4
✗ Branch 0 not taken.
✓ Branch 1 taken 709200 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 709200 times.
3606320 volVarVectorData[i][dofIdxGlobal] = volVarVectorDataInfo_[i].get(volVars);
484 }
485 }
486
487 // velocity output
488
4/6
✓ Branch 1 taken 6516903 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 6516903 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 2648942 times.
✓ Branch 7 taken 3867961 times.
18120980 if (velocityOutput_->enableOutput())
489 {
490
4/10
✓ Branch 1 taken 919634 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 888282 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 888282 times.
✗ Branch 8 not taken.
✓ Branch 9 taken 20294 times.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
12297886 const auto elemFluxVarsCache = localView(gridVariables_.gridFluxVarsCache()).bind(element, fvGeometry, elemVolVars);
491
492
4/6
✓ Branch 1 taken 5370536 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 5370536 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 2721594 times.
✓ Branch 7 taken 2648942 times.
7362008 for (int phaseIdx = 0; phaseIdx < velocityOutput_->numFluidPhases(); ++phaseIdx)
493
3/6
✓ Branch 1 taken 2721594 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 2721594 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 2721594 times.
✗ Branch 8 not taken.
11166990 velocityOutput_->calculateVelocity(velocity[phaseIdx], element, fvGeometry, elemVolVars, elemFluxVarsCache, phaseIdx);
494 }
495
496 //! the rank
497
2/2
✓ Branch 0 taken 6201903 times.
✓ Branch 1 taken 315000 times.
9060490 if (addProcessRank_)
498
3/6
✗ Branch 0 not taken.
✓ Branch 1 taken 4746437 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 4746437 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 4746437 times.
26476770 rank[eIdxGlobal] = static_cast<double>(gridGeometry().gridView().comm().rank());
499 }
500
501 //////////////////////////////////////////////////////////////
502 //! (2) Register data fields with the vtk writer
503 //////////////////////////////////////////////////////////////
504
505 // volume variables if any
506 if constexpr (isBox || isPQ1Bubble)
507 {
508
4/4
✓ Branch 0 taken 28438 times.
✓ Branch 1 taken 2683 times.
✓ Branch 2 taken 28438 times.
✓ Branch 3 taken 2683 times.
60357 for (std::size_t i = 0; i < volVarScalarDataInfo_.size(); ++i)
509
9/22
✓ Branch 1 taken 28438 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 28438 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 28438 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 28438 times.
✗ Branch 11 not taken.
✓ Branch 13 taken 28438 times.
✗ Branch 14 not taken.
✓ Branch 16 taken 28438 times.
✗ Branch 17 not taken.
✓ Branch 20 taken 28438 times.
✗ Branch 21 not taken.
✓ Branch 22 taken 28438 times.
✗ Branch 23 not taken.
✓ Branch 24 taken 28438 times.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
✗ Branch 27 not taken.
✗ Branch 28 not taken.
✗ Branch 29 not taken.
230304 this->sequenceWriter().addVertexData( Field(gridGeometry().gridView(), gridGeometry().dofMapper(), volVarScalarData[i],
510
2/4
✓ Branch 1 taken 28438 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 28438 times.
✗ Branch 5 not taken.
57576 volVarScalarDataInfo_[i].name, /*numComp*/1, /*codim*/dim, dm, this->precision()).get() );
511
4/4
✓ Branch 0 taken 32 times.
✓ Branch 1 taken 2683 times.
✓ Branch 2 taken 32 times.
✓ Branch 3 taken 2683 times.
5674 for (std::size_t i = 0; i < volVarVectorDataInfo_.size(); ++i)
512
9/22
✓ 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 10 taken 32 times.
✗ Branch 11 not taken.
✓ Branch 13 taken 32 times.
✗ Branch 14 not taken.
✓ Branch 16 taken 32 times.
✗ Branch 17 not taken.
✓ Branch 20 taken 32 times.
✗ Branch 21 not taken.
✓ Branch 22 taken 32 times.
✗ Branch 23 not taken.
✓ Branch 24 taken 32 times.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
✗ Branch 27 not taken.
✗ Branch 28 not taken.
✗ Branch 29 not taken.
448 this->sequenceWriter().addVertexData( Field(gridGeometry().gridView(), gridGeometry().dofMapper(), volVarVectorData[i],
513
2/4
✓ Branch 1 taken 32 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 32 times.
✗ Branch 5 not taken.
112 volVarVectorDataInfo_[i].name, /*numComp*/dimWorld, /*codim*/dim, dm, this->precision()).get() );
514
515 if constexpr (isPQ1Bubble)
516 {
517
4/4
✓ Branch 0 taken 4 times.
✓ Branch 1 taken 10 times.
✓ Branch 2 taken 4 times.
✓ Branch 3 taken 10 times.
28 for (std::size_t i = 0; i < volVarScalarDataInfo_.size(); ++i)
518
9/22
✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 4 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 4 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 4 times.
✗ Branch 11 not taken.
✓ Branch 13 taken 4 times.
✗ Branch 14 not taken.
✓ Branch 16 taken 4 times.
✗ Branch 17 not taken.
✓ Branch 20 taken 4 times.
✗ Branch 21 not taken.
✓ Branch 22 taken 4 times.
✗ Branch 23 not taken.
✓ Branch 24 taken 4 times.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
✗ Branch 27 not taken.
✗ Branch 28 not taken.
✗ Branch 29 not taken.
32 this->sequenceWriter().addCellData( Field(gridGeometry().gridView(), gridGeometry().dofMapper(), volVarScalarData[i],
519
2/4
✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 4 times.
✗ Branch 5 not taken.
8 volVarScalarDataInfo_[i].name, /*numComp*/1, /*codim*/0,dm, this->precision()).get() );
520
4/4
✓ Branch 0 taken 6 times.
✓ Branch 1 taken 10 times.
✓ Branch 2 taken 6 times.
✓ Branch 3 taken 10 times.
32 for (std::size_t i = 0; i < volVarVectorDataInfo_.size(); ++i)
521
9/22
✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 6 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 6 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 6 times.
✗ Branch 11 not taken.
✓ Branch 13 taken 6 times.
✗ Branch 14 not taken.
✓ Branch 16 taken 6 times.
✗ Branch 17 not taken.
✓ Branch 20 taken 6 times.
✗ Branch 21 not taken.
✓ Branch 22 taken 6 times.
✗ Branch 23 not taken.
✓ Branch 24 taken 6 times.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
✗ Branch 27 not taken.
✗ Branch 28 not taken.
✗ Branch 29 not taken.
48 this->sequenceWriter().addCellData( Field(gridGeometry().gridView(), gridGeometry().dofMapper(), volVarVectorData[i],
522
2/4
✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 6 times.
✗ Branch 5 not taken.
12 volVarVectorDataInfo_[i].name, /*numComp*/dimWorld, /*codim*/0,dm, this->precision()).get() );
523 }
524
525 }
526 else
527 {
528
4/4
✓ Branch 0 taken 44027 times.
✓ Branch 1 taken 3873 times.
✓ Branch 2 taken 44027 times.
✓ Branch 3 taken 3873 times.
107647 for (std::size_t i = 0; i < volVarScalarDataInfo_.size(); ++i)
529
9/22
✓ Branch 1 taken 44027 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 44027 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 44027 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 44027 times.
✗ Branch 11 not taken.
✓ Branch 13 taken 44027 times.
✗ Branch 14 not taken.
✓ Branch 16 taken 44027 times.
✗ Branch 17 not taken.
✓ Branch 20 taken 44027 times.
✗ Branch 21 not taken.
✓ Branch 22 taken 44027 times.
✗ Branch 23 not taken.
✓ Branch 24 taken 44027 times.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
✗ Branch 27 not taken.
✗ Branch 28 not taken.
✗ Branch 29 not taken.
410704 this->sequenceWriter().addCellData( Field(gridGeometry().gridView(), gridGeometry().elementMapper(), volVarScalarData[i],
530
2/4
✓ Branch 1 taken 44027 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 44027 times.
✗ Branch 5 not taken.
102676 volVarScalarDataInfo_[i].name, /*numComp*/1, /*codim*/0,dm, this->precision()).get() );
531
4/4
✓ Branch 0 taken 2156 times.
✓ Branch 1 taken 3873 times.
✓ Branch 2 taken 2156 times.
✓ Branch 3 taken 3873 times.
14254 for (std::size_t i = 0; i < volVarVectorDataInfo_.size(); ++i)
532
9/22
✓ Branch 1 taken 2156 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 2156 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 2156 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 2156 times.
✗ Branch 11 not taken.
✓ Branch 13 taken 2156 times.
✗ Branch 14 not taken.
✓ Branch 16 taken 2156 times.
✗ Branch 17 not taken.
✓ Branch 20 taken 2156 times.
✗ Branch 21 not taken.
✓ Branch 22 taken 2156 times.
✗ Branch 23 not taken.
✓ Branch 24 taken 2156 times.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
✗ Branch 27 not taken.
✗ Branch 28 not taken.
✗ Branch 29 not taken.
17248 this->sequenceWriter().addCellData( Field(gridGeometry().gridView(), gridGeometry().elementMapper(), volVarVectorData[i],
533
2/4
✓ Branch 1 taken 2156 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 2156 times.
✗ Branch 5 not taken.
4312 volVarVectorDataInfo_[i].name, /*numComp*/dimWorld, /*codim*/0,dm, this->precision()).get() );
534 }
535
536 // the velocity field
537
4/6
✓ Branch 1 taken 6556 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 6556 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 3036 times.
✓ Branch 7 taken 3520 times.
15504 if (velocityOutput_->enableOutput())
538 {
539
2/4
✓ Branch 1 taken 3036 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 3036 times.
✗ Branch 5 not taken.
6960 if (velocityOutput_->fieldType() == VelocityOutput::FieldType::vertex
540
5/8
✓ Branch 0 taken 3036 times.
✗ Branch 1 not taken.
✓ Branch 3 taken 3036 times.
✗ Branch 4 not taken.
✓ Branch 6 taken 3036 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 506 times.
✓ Branch 9 taken 7 times.
3480 || ( (velocityOutput_->fieldType() == VelocityOutput::FieldType::automatic) && dim > 1 && isBox ))
541 {
542
4/6
✓ Branch 1 taken 1143 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1143 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 637 times.
✓ Branch 7 taken 506 times.
2286 for (int phaseIdx = 0; phaseIdx < velocityOutput_->numFluidPhases(); ++phaseIdx)
543
15/40
✓ Branch 1 taken 637 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 637 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 637 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 637 times.
✗ Branch 11 not taken.
✓ Branch 13 taken 637 times.
✗ Branch 14 not taken.
✓ Branch 16 taken 637 times.
✗ Branch 17 not taken.
✓ Branch 19 taken 637 times.
✗ Branch 20 not taken.
✓ Branch 22 taken 637 times.
✗ Branch 23 not taken.
✓ Branch 25 taken 637 times.
✗ Branch 26 not taken.
✓ Branch 29 taken 637 times.
✗ Branch 30 not taken.
✓ Branch 31 taken 637 times.
✗ Branch 32 not taken.
✓ Branch 33 taken 637 times.
✗ Branch 34 not taken.
✓ Branch 35 taken 637 times.
✗ Branch 36 not taken.
✗ Branch 37 not taken.
✓ Branch 38 taken 637 times.
✗ Branch 39 not taken.
✓ Branch 40 taken 637 times.
✗ Branch 41 not taken.
✗ Branch 42 not taken.
✗ Branch 43 not taken.
✗ Branch 44 not taken.
✗ Branch 45 not taken.
✗ Branch 46 not taken.
✗ Branch 47 not taken.
✗ Branch 48 not taken.
✗ Branch 49 not taken.
✗ Branch 50 not taken.
2548 this->sequenceWriter().addVertexData( Field(gridGeometry().gridView(), gridGeometry().vertexMapper(), velocity[phaseIdx],
544
2/4
✓ Branch 1 taken 637 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 637 times.
✗ Branch 5 not taken.
1274 "velocity_" + velocityOutput_->phaseName(phaseIdx) + " (m/s)",
545 /*numComp*/dimWorld, /*codim*/dim, dm, this->precision()).get() );
546 }
547 // cell-centered models
548 else
549 {
550
4/6
✓ Branch 1 taken 5460 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 5460 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 2930 times.
✓ Branch 7 taken 2530 times.
12746 for (int phaseIdx = 0; phaseIdx < velocityOutput_->numFluidPhases(); ++phaseIdx)
551
15/40
✓ Branch 1 taken 2930 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 2930 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 2930 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 2930 times.
✗ Branch 11 not taken.
✓ Branch 13 taken 2930 times.
✗ Branch 14 not taken.
✓ Branch 16 taken 2930 times.
✗ Branch 17 not taken.
✓ Branch 19 taken 2930 times.
✗ Branch 20 not taken.
✓ Branch 22 taken 2930 times.
✗ Branch 23 not taken.
✓ Branch 25 taken 2930 times.
✗ Branch 26 not taken.
✓ Branch 29 taken 2930 times.
✗ Branch 30 not taken.
✓ Branch 31 taken 2930 times.
✗ Branch 32 not taken.
✓ Branch 33 taken 2930 times.
✗ Branch 34 not taken.
✓ Branch 35 taken 2930 times.
✗ Branch 36 not taken.
✗ Branch 37 not taken.
✓ Branch 38 taken 2930 times.
✗ Branch 39 not taken.
✓ Branch 40 taken 2930 times.
✗ Branch 41 not taken.
✗ Branch 42 not taken.
✗ Branch 43 not taken.
✗ Branch 44 not taken.
✗ Branch 45 not taken.
✗ Branch 46 not taken.
✗ Branch 47 not taken.
✗ Branch 48 not taken.
✗ Branch 49 not taken.
✗ Branch 50 not taken.
13596 this->sequenceWriter().addCellData( Field(gridGeometry().gridView(), gridGeometry().elementMapper(), velocity[phaseIdx],
552
2/4
✓ Branch 1 taken 2930 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 2930 times.
✗ Branch 5 not taken.
6798 "velocity_" + velocityOutput_->phaseName(phaseIdx) + " (m/s)",
553 /*numComp*/dimWorld, /*codim*/0, dm, this->precision()).get() );
554 }
555 }
556
557 // the process rank
558
2/2
✓ Branch 0 taken 6516 times.
✓ Branch 1 taken 40 times.
7752 if (addProcessRank_)
559
12/30
✓ Branch 1 taken 6516 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 6516 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 6516 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 6516 times.
✗ Branch 11 not taken.
✓ Branch 13 taken 6516 times.
✗ Branch 14 not taken.
✓ Branch 16 taken 6516 times.
✗ Branch 17 not taken.
✓ Branch 19 taken 6516 times.
✗ Branch 20 not taken.
✓ Branch 22 taken 6516 times.
✗ Branch 23 not taken.
✓ Branch 26 taken 6516 times.
✗ Branch 27 not taken.
✓ Branch 28 taken 6516 times.
✗ Branch 29 not taken.
✓ Branch 30 taken 6516 times.
✗ Branch 31 not taken.
✗ Branch 32 not taken.
✓ Branch 33 taken 6516 times.
✗ Branch 34 not taken.
✗ Branch 35 not taken.
✗ Branch 36 not taken.
✗ Branch 37 not taken.
✗ Branch 38 not taken.
✗ Branch 39 not taken.
38560 this->sequenceWriter().addCellData(Field(gridGeometry().gridView(), gridGeometry().elementMapper(), rank, "process rank", 1, 0).get());
560
561 // also register additional (non-standardized) user fields if any
562
4/4
✓ Branch 0 taken 8111 times.
✓ Branch 1 taken 6556 times.
✓ Branch 2 taken 8111 times.
✓ Branch 3 taken 6556 times.
31958 for (auto&& field : this->fields())
563 {
564
2/2
✓ Branch 0 taken 5831 times.
✓ Branch 1 taken 2280 times.
8702 if (field.codim() == 0)
565
2/6
✓ Branch 3 taken 5831 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 5831 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
19122 this->sequenceWriter().addCellData(field.get());
566
1/2
✓ Branch 0 taken 2280 times.
✗ Branch 1 not taken.
2328 else if (field.codim() == dim)
567
2/8
✓ Branch 3 taken 2280 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 2280 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
6984 this->sequenceWriter().addVertexData(field.get());
568 else
569 DUNE_THROW(Dune::RangeError, "Cannot add wrongly sized vtk scalar field!");
570 }
571 }
572
573 //////////////////////////////////////////////////////////////
574 //! (2) The writer writes the output for us
575 //////////////////////////////////////////////////////////////
576
2/4
✓ Branch 1 taken 6556 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 6556 times.
✗ Branch 5 not taken.
15504 this->sequenceWriter().write(time, type);
577
578 //////////////////////////////////////////////////////////////
579 //! (3) Clear the writer
580 //////////////////////////////////////////////////////////////
581 15504 this->writer().clear();
582 7752 }
583
584 //! Assembles the fields and adds them to the writer (nonconforming output)
585 72 void writeNonConforming_(double time, Dune::VTK::OutputType type) override
586 {
587 72 const Dune::VTK::DataMode dm = Dune::VTK::nonconforming;
588
589 // only supports finite-element-like discretization schemes
590 if(!isBox && !isDiamond)
591 DUNE_THROW(Dune::NotImplemented,
592 "Non-conforming output for discretization scheme " << GridGeometry::discMethod
593 );
594
595 //////////////////////////////////////////////////////////////
596 //! (1) Assemble all variable fields and add to writer
597 //////////////////////////////////////////////////////////////
598
599 // check the velocity output
600
1/4
✗ Branch 0 not taken.
✓ Branch 1 taken 52 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
72 if (enableVelocityOutput_ && !velocityOutput_->enableOutput())
601 std::cerr << "Warning! Velocity output was enabled in the input file"
602 << " but no velocity output policy was set for the VTK output module:"
603 << " There will be no velocity output."
604 << " Use the addVelocityOutput member function of the VTK output module." << std::endl;
605 using VelocityVector = typename VelocityOutput::VelocityVector;
606
4/8
✓ Branch 1 taken 52 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 52 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 52 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 52 times.
✗ Branch 11 not taken.
216 std::vector<VelocityVector> velocity(velocityOutput_->numFluidPhases());
607
608 // process rank
609
2/4
✓ Branch 0 taken 6 times.
✓ Branch 1 taken 46 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
144 std::vector<double> rank;
610
611 // volume variable data (indexing: volvardata/element/localindex)
612 using ScalarDataContainer = std::vector< std::vector<Scalar> >;
613 using VectorDataContainer = std::vector< std::vector<VolVarsVector> >;
614
3/4
✓ Branch 0 taken 6 times.
✓ Branch 1 taken 46 times.
✓ Branch 3 taken 52 times.
✗ Branch 4 not taken.
144 std::vector< ScalarDataContainer > volVarScalarData;
615
2/2
✓ Branch 0 taken 6 times.
✓ Branch 1 taken 46 times.
144 std::vector< VectorDataContainer > volVarVectorData;
616
617 //! Abort if no data was registered
618
2/2
✓ Branch 0 taken 6 times.
✓ Branch 1 taken 46 times.
72 if (!volVarScalarDataInfo_.empty()
619
2/4
✗ Branch 0 not taken.
✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 6 times.
12 || !volVarVectorDataInfo_.empty()
620 || !this->fields().empty()
621 || velocityOutput_->enableOutput()
622
2/4
✓ Branch 0 taken 6 times.
✓ Branch 1 taken 46 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
72 || addProcessRank_)
623 {
624
3/8
✗ Branch 0 not taken.
✓ Branch 1 taken 46 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 46 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 46 times.
✗ Branch 8 not taken.
216 const auto numCells = gridGeometry().gridView().size(0);
625 144 const auto outputSize = numDofs_();
626
627 // get fields for all volume variables
628
3/4
✓ Branch 0 taken 46 times.
✓ Branch 1 taken 6 times.
✓ Branch 2 taken 18 times.
✗ Branch 3 not taken.
90 if (!volVarScalarDataInfo_.empty())
629
4/8
✓ Branch 1 taken 46 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 46 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 46 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 46 times.
✗ Branch 11 not taken.
132 volVarScalarData.resize(volVarScalarDataInfo_.size(), ScalarDataContainer(numCells));
630
4/4
✓ Branch 0 taken 6 times.
✓ Branch 1 taken 46 times.
✓ Branch 2 taken 6 times.
✓ Branch 3 taken 46 times.
144 if (!volVarVectorDataInfo_.empty())
631
4/8
✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 6 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 6 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 6 times.
✗ Branch 11 not taken.
12 volVarVectorData.resize(volVarVectorDataInfo_.size(), VectorDataContainer(numCells));
632
633
4/6
✓ Branch 1 taken 52 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 52 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 4 times.
✓ Branch 7 taken 48 times.
144 if (velocityOutput_->enableOutput())
634 {
635
4/6
✓ Branch 1 taken 8 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 8 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 4 times.
✓ Branch 7 taken 4 times.
12 for (int phaseIdx = 0; phaseIdx < velocityOutput_->numFluidPhases(); ++phaseIdx)
636 {
637 if((isBox && dim == 1) || isDiamond)
638
2/4
✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 4 times.
✗ Branch 5 not taken.
8 velocity[phaseIdx].resize(numCells);
639 else
640 velocity[phaseIdx].resize(outputSize);
641 }
642 }
643
644 // maybe allocate space for the process rank
645
2/4
✓ Branch 0 taken 52 times.
✗ Branch 1 not taken.
✓ Branch 3 taken 52 times.
✗ Branch 4 not taken.
72 if (addProcessRank_) rank.resize(numCells);
646
647 // now we go element-local to extract values at local dof locations
648
2/6
✓ Branch 1 taken 52 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 52 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
144 auto fvGeometry = localView(gridGeometry());
649
3/7
✓ Branch 1 taken 52 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 52 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 48 times.
✗ Branch 7 not taken.
280 auto elemVolVars = localView(gridVariables_.curGridVolVars());
650
15/22
✓ Branch 1 taken 52 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 52 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 52 times.
✗ Branch 8 not taken.
✓ Branch 9 taken 125378 times.
✓ Branch 10 taken 26 times.
✓ Branch 11 taken 55504 times.
✓ Branch 12 taken 6 times.
✓ Branch 13 taken 20 times.
✓ Branch 14 taken 55504 times.
✓ Branch 15 taken 36000 times.
✓ Branch 16 taken 20 times.
✓ Branch 17 taken 91504 times.
✓ Branch 18 taken 20 times.
✓ Branch 20 taken 36000 times.
✗ Branch 21 not taken.
✓ Branch 23 taken 36000 times.
✗ Branch 24 not taken.
267416 for (const auto& element : elements(gridGeometry().gridView(), Dune::Partitions::interior))
651 {
652
3/6
✓ Branch 1 taken 91504 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 91504 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 91504 times.
✗ Branch 8 not taken.
592056 const auto eIdxGlobal = gridGeometry().elementMapper().index(element);
653 // If velocity output is enabled we need to bind to the whole stencil
654 // otherwise element-local data is sufficient
655
4/6
✓ Branch 1 taken 161352 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 161352 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 55304 times.
✓ Branch 7 taken 106048 times.
394704 if (velocityOutput_->enableOutput())
656 {
657
1/2
✓ Branch 1 taken 55304 times.
✗ Branch 2 not taken.
55304 fvGeometry.bind(element);
658
1/2
✓ Branch 1 taken 55304 times.
✗ Branch 2 not taken.
55304 elemVolVars.bind(element, fvGeometry, sol_);
659 }
660 else
661 {
662
1/2
✓ Branch 1 taken 63848 times.
✗ Branch 2 not taken.
142048 fvGeometry.bindElement(element);
663
1/2
✓ Branch 1 taken 106048 times.
✗ Branch 2 not taken.
142048 elemVolVars.bindElement(element, fvGeometry, sol_);
664 }
665
666 197352 const auto numLocalDofs = fvGeometry.numScv();
667 // resize element-local data containers
668
4/4
✓ Branch 0 taken 465904 times.
✓ Branch 1 taken 161352 times.
✓ Branch 2 taken 465904 times.
✓ Branch 3 taken 161352 times.
741672 for (std::size_t i = 0; i < volVarScalarDataInfo_.size(); ++i)
669
3/6
✓ Branch 1 taken 465904 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 465904 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 465904 times.
✗ Branch 8 not taken.
1632960 volVarScalarData[i][eIdxGlobal].resize(numLocalDofs);
670
4/4
✓ Branch 0 taken 42000 times.
✓ Branch 1 taken 161352 times.
✓ Branch 2 taken 42000 times.
✓ Branch 3 taken 161352 times.
436704 for (std::size_t i = 0; i < volVarVectorDataInfo_.size(); ++i)
671
3/6
✓ Branch 1 taken 42000 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 42000 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 42000 times.
✗ Branch 8 not taken.
126000 volVarVectorData[i][eIdxGlobal].resize(numLocalDofs);
672
673
6/8
✓ Branch 0 taken 42000 times.
✓ Branch 1 taken 119352 times.
✓ Branch 2 taken 42000 times.
✓ Branch 3 taken 119352 times.
✓ Branch 4 taken 42000 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 42000 times.
✗ Branch 7 not taken.
394704 if (!volVarScalarDataInfo_.empty() || !volVarVectorDataInfo_.empty())
674 {
675
4/4
✓ Branch 0 taken 609408 times.
✓ Branch 1 taken 161352 times.
✓ Branch 2 taken 609408 times.
✓ Branch 3 taken 161352 times.
1112112 for (const auto& scv : scvs(fvGeometry))
676 {
677 717408 const auto& volVars = elemVolVars[scv];
678
679 // get the scalar-valued data
680
4/4
✓ Branch 0 taken 1785200 times.
✓ Branch 1 taken 609408 times.
✓ Branch 2 taken 1785200 times.
✓ Branch 3 taken 609408 times.
4758304 for (std::size_t i = 0; i < volVarScalarDataInfo_.size(); ++i)
681
2/4
✗ Branch 0 not taken.
✓ Branch 1 taken 1785200 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 1785200 times.
12122688 volVarScalarData[i][eIdxGlobal][scv.localDofIndex()] = volVarScalarDataInfo_[i].get(volVars);
682
683 // get the vector-valued data
684
4/4
✓ Branch 0 taken 168000 times.
✓ Branch 1 taken 609408 times.
✓ Branch 2 taken 168000 times.
✓ Branch 3 taken 609408 times.
1770816 for (std::size_t i = 0; i < volVarVectorDataInfo_.size(); ++i)
685
2/4
✗ Branch 0 not taken.
✓ Branch 1 taken 168000 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 168000 times.
1008000 volVarVectorData[i][eIdxGlobal][scv.localDofIndex()] = volVarVectorDataInfo_[i].get(volVars);
686 }
687 }
688
689 // velocity output
690
4/6
✓ Branch 1 taken 161352 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 161352 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 55304 times.
✓ Branch 7 taken 106048 times.
394704 if (velocityOutput_->enableOutput())
691 {
692
3/10
✓ Branch 1 taken 55304 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 55304 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 55304 times.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
165912 const auto elemFluxVarsCache = localView(gridVariables_.gridFluxVarsCache()).bind(element, fvGeometry, elemVolVars);
693
4/6
✓ Branch 1 taken 110608 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 110608 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 55304 times.
✓ Branch 7 taken 55304 times.
110608 for (int phaseIdx = 0; phaseIdx < velocityOutput_->numFluidPhases(); ++phaseIdx)
694
3/6
✓ Branch 1 taken 55304 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 55304 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 55304 times.
✗ Branch 8 not taken.
165912 velocityOutput_->calculateVelocity(velocity[phaseIdx], element, fvGeometry, elemVolVars, elemFluxVarsCache, phaseIdx);
695 }
696
697 //! the rank
698
1/2
✓ Branch 0 taken 161352 times.
✗ Branch 1 not taken.
197352 if (addProcessRank_)
699
3/6
✗ Branch 0 not taken.
✓ Branch 1 taken 125352 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 125352 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 125352 times.
592056 rank[eIdxGlobal] = static_cast<double>(gridGeometry().gridView().comm().rank());
700 }
701
702 //////////////////////////////////////////////////////////////
703 //! Register data fields with the vtk writer
704 //////////////////////////////////////////////////////////////
705
706 // volume variables if any
707 static constexpr int dofLocCodim = isDiamond ? 1 : dim;
708
4/4
✓ Branch 0 taken 234 times.
✓ Branch 1 taken 52 times.
✓ Branch 2 taken 234 times.
✓ Branch 3 taken 52 times.
624 for (std::size_t i = 0; i < volVarScalarDataInfo_.size(); ++i)
709
7/18
✓ Branch 1 taken 234 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 234 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 234 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 234 times.
✗ Branch 11 not taken.
✓ Branch 14 taken 234 times.
✗ Branch 15 not taken.
✓ Branch 16 taken 234 times.
✗ Branch 17 not taken.
✓ Branch 18 taken 234 times.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
1656 this->sequenceWriter().addVertexData(Field(
710
1/2
✓ Branch 1 taken 234 times.
✗ Branch 2 not taken.
276 gridGeometry().gridView(), gridGeometry().elementMapper(),
711
3/6
✓ Branch 1 taken 234 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 234 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 234 times.
✗ Branch 8 not taken.
828 volVarScalarData[i], volVarScalarDataInfo_[i].name,
712 /*numComp*/1, /*codim*/dofLocCodim, /*nonconforming*/dm, this->precision()
713 ).get());
714
715
4/4
✓ Branch 0 taken 6 times.
✓ Branch 1 taken 52 times.
✓ Branch 2 taken 6 times.
✓ Branch 3 taken 52 times.
156 for (std::size_t i = 0; i < volVarVectorDataInfo_.size(); ++i)
716
7/18
✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 6 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 6 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 6 times.
✗ Branch 11 not taken.
✓ Branch 14 taken 6 times.
✗ Branch 15 not taken.
✓ Branch 16 taken 6 times.
✗ Branch 17 not taken.
✓ Branch 18 taken 6 times.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
36 this->sequenceWriter().addVertexData(Field(
717
1/2
✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
6 gridGeometry().gridView(), gridGeometry().elementMapper(),
718
3/6
✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 6 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 6 times.
✗ Branch 8 not taken.
18 volVarVectorData[i], volVarVectorDataInfo_[i].name,
719 /*numComp*/dimWorld, /*codim*/dofLocCodim, /*nonconforming*/dm, this->precision()
720 ).get());
721
722 // the velocity field
723
4/6
✓ Branch 1 taken 52 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 52 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 4 times.
✓ Branch 7 taken 48 times.
144 if (velocityOutput_->enableOutput())
724 {
725 // node-wise velocities
726 if (dim > 1 && !isDiamond)
727 for (int phaseIdx = 0; phaseIdx < velocityOutput_->numFluidPhases(); ++phaseIdx)
728 this->sequenceWriter().addVertexData(Field(
729 gridGeometry().gridView(), gridGeometry().vertexMapper(), velocity[phaseIdx],
730 "velocity_" + velocityOutput_->phaseName(phaseIdx) + " (m/s)",
731 /*numComp*/dimWorld, /*codim*/dofLocCodim, dm, this->precision()
732 ).get());
733
734 // cell-wise velocities
735 else
736
4/6
✓ Branch 1 taken 8 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 8 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 4 times.
✓ Branch 7 taken 4 times.
16 for (int phaseIdx = 0; phaseIdx < velocityOutput_->numFluidPhases(); ++phaseIdx)
737
12/36
✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 4 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 4 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 4 times.
✗ Branch 11 not taken.
✓ Branch 13 taken 4 times.
✗ Branch 14 not taken.
✓ Branch 16 taken 4 times.
✗ Branch 17 not taken.
✓ Branch 20 taken 4 times.
✗ Branch 21 not taken.
✓ Branch 22 taken 4 times.
✗ Branch 23 not taken.
✓ Branch 24 taken 4 times.
✗ Branch 25 not taken.
✓ Branch 26 taken 4 times.
✗ Branch 27 not taken.
✗ Branch 28 not taken.
✓ Branch 29 taken 4 times.
✗ Branch 30 not taken.
✓ Branch 31 taken 4 times.
✗ Branch 32 not taken.
✗ Branch 33 not taken.
✗ Branch 34 not taken.
✗ Branch 35 not taken.
✗ 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 not taken.
✗ Branch 43 not taken.
16 this->sequenceWriter().addCellData(Field(
738
3/6
✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 4 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 4 times.
✗ Branch 8 not taken.
12 gridGeometry().gridView(), gridGeometry().elementMapper(), velocity[phaseIdx],
739
2/4
✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 4 times.
✗ Branch 5 not taken.
8 "velocity_" + velocityOutput_->phaseName(phaseIdx) + " (m/s)",
740 /*numComp*/dimWorld, /*codim*/0, dm, this->precision()
741 ).get());
742 }
743 }
744
745 // the process rank
746
1/2
✓ Branch 0 taken 52 times.
✗ Branch 1 not taken.
72 if (addProcessRank_)
747
10/26
✓ Branch 1 taken 52 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 52 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 52 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 52 times.
✗ Branch 11 not taken.
✓ Branch 13 taken 52 times.
✗ Branch 14 not taken.
✓ Branch 16 taken 52 times.
✗ Branch 17 not taken.
✓ Branch 20 taken 52 times.
✗ Branch 21 not taken.
✓ Branch 22 taken 52 times.
✗ Branch 23 not taken.
✓ Branch 24 taken 52 times.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
✓ Branch 27 taken 52 times.
✗ Branch 28 not taken.
✗ Branch 29 not taken.
✗ Branch 30 not taken.
✗ Branch 31 not taken.
✗ Branch 32 not taken.
✗ Branch 33 not taken.
360 this->sequenceWriter().addCellData(Field(
748
2/4
✓ Branch 1 taken 52 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 52 times.
✗ Branch 5 not taken.
144 gridGeometry().gridView(), gridGeometry().elementMapper(),
749 rank, "process rank", /*numComp*/1, /*codim*/0
750 ).get());
751
752 // also register additional (non-standardized) user fields if any
753
4/4
✓ Branch 0 taken 6 times.
✓ Branch 1 taken 52 times.
✓ Branch 2 taken 6 times.
✓ Branch 3 taken 52 times.
222 for (const auto& field : this->fields())
754 {
755
1/2
✓ Branch 0 taken 6 times.
✗ Branch 1 not taken.
6 if (field.codim() == 0)
756
2/6
✓ Branch 3 taken 6 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 6 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
18 this->sequenceWriter().addCellData(field.get());
757 else if (field.codim() == dim || field.codim() == 1)
758 this->sequenceWriter().addVertexData(field.get());
759 else
760 DUNE_THROW(Dune::RangeError, "Cannot add wrongly sized vtk scalar field!");
761 }
762
763 //////////////////////////////////////////////////////////////
764 //! (2) The writer writes the output for us
765 //////////////////////////////////////////////////////////////
766
2/4
✓ Branch 1 taken 52 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 52 times.
✗ Branch 5 not taken.
144 this->sequenceWriter().write(time, type);
767
768 //////////////////////////////////////////////////////////////
769 //! (3) Clear the writer
770 //////////////////////////////////////////////////////////////
771 144 this->writer().clear();
772 72 }
773
774 //! return the number of dofs, we only support vertex and cell data
775 std::size_t numDofs_() const
776 {
777 // TODO this should actually always be dofMapper.size()
778 // maybe some discretizations needs special treatment (?)
779 if constexpr (isBox || isDiamond || isPQ1Bubble)
780
29/52
✓ Branch 0 taken 39 times.
✓ Branch 1 taken 12 times.
✓ Branch 2 taken 39 times.
✓ Branch 3 taken 12 times.
✓ Branch 4 taken 39 times.
✓ Branch 5 taken 12 times.
✓ Branch 6 taken 2612 times.
✓ Branch 7 taken 16 times.
✓ Branch 8 taken 2618 times.
✓ Branch 9 taken 4 times.
✓ Branch 10 taken 2630 times.
✓ Branch 11 taken 4 times.
✓ Branch 12 taken 509 times.
✓ Branch 13 taken 12 times.
✓ Branch 14 taken 6 times.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✓ Branch 18 taken 23 times.
✗ Branch 19 not taken.
✓ Branch 20 taken 26 times.
✗ Branch 21 not taken.
✓ Branch 22 taken 26 times.
✗ Branch 23 not taken.
✓ Branch 24 taken 24 times.
✗ Branch 25 not taken.
✓ Branch 26 taken 14 times.
✗ Branch 27 not taken.
✓ Branch 28 taken 11 times.
✗ Branch 29 not taken.
✓ Branch 30 taken 13 times.
✗ Branch 31 not taken.
✓ Branch 32 taken 2 times.
✗ Branch 33 not taken.
✓ Branch 34 taken 2 times.
✗ Branch 35 not taken.
✓ Branch 36 taken 2 times.
✗ Branch 37 not taken.
✗ Branch 38 not taken.
✗ Branch 39 not taken.
✗ Branch 40 not taken.
✗ Branch 41 not taken.
✗ Branch 42 not taken.
✗ Branch 43 not taken.
✓ Branch 44 taken 11 times.
✗ Branch 45 not taken.
✓ Branch 46 taken 11 times.
✗ Branch 47 not taken.
✓ Branch 48 taken 11 times.
✗ Branch 49 not taken.
✓ Branch 50 taken 11 times.
✗ Branch 51 not taken.
8751 return gridGeometry().dofMapper().size();
781 else
782
20/144
✓ Branch 0 taken 3221 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 3209 times.
✓ Branch 3 taken 12 times.
✓ Branch 4 taken 3209 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 454 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 404 times.
✓ Branch 9 taken 101 times.
✓ Branch 10 taken 404 times.
✓ Branch 11 taken 101 times.
✓ Branch 12 taken 89 times.
✓ Branch 13 taken 101 times.
✓ Branch 14 taken 44 times.
✓ Branch 15 taken 101 times.
✓ Branch 16 taken 24 times.
✗ Branch 17 not taken.
✓ Branch 18 taken 125 times.
✗ Branch 19 not taken.
✓ Branch 20 taken 24 times.
✓ Branch 21 taken 101 times.
✓ Branch 22 taken 22 times.
✗ Branch 23 not taken.
✓ Branch 24 taken 22 times.
✗ Branch 25 not taken.
✓ Branch 26 taken 22 times.
✗ 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 not taken.
✗ Branch 35 not taken.
✗ 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 not taken.
✗ Branch 43 not taken.
✗ Branch 44 not taken.
✗ Branch 45 not taken.
✗ Branch 46 not taken.
✗ Branch 47 not taken.
✗ Branch 48 not taken.
✗ Branch 49 not taken.
✗ Branch 50 not taken.
✗ Branch 51 not taken.
✗ Branch 52 not taken.
✗ Branch 53 not taken.
✗ Branch 54 not taken.
✗ Branch 55 not taken.
✗ Branch 56 not taken.
✗ Branch 57 not taken.
✗ Branch 58 not taken.
✗ Branch 59 not taken.
✗ Branch 60 not taken.
✗ Branch 61 not taken.
✗ Branch 62 not taken.
✗ Branch 63 not taken.
✗ Branch 64 not taken.
✗ Branch 65 not taken.
✗ Branch 66 not taken.
✗ Branch 67 not taken.
✗ Branch 68 not taken.
✗ Branch 69 not taken.
✗ Branch 70 not taken.
✗ Branch 71 not taken.
✗ Branch 72 not taken.
✗ Branch 73 not taken.
✗ Branch 74 not taken.
✗ Branch 75 not taken.
✗ Branch 76 not taken.
✗ Branch 77 not taken.
✗ Branch 78 not taken.
✗ Branch 79 not taken.
✗ Branch 80 not taken.
✗ Branch 81 not taken.
✗ Branch 82 not taken.
✗ Branch 83 not taken.
✗ Branch 84 not taken.
✗ Branch 85 not taken.
✗ Branch 86 not taken.
✗ Branch 87 not taken.
✗ Branch 88 not taken.
✗ Branch 89 not taken.
✗ Branch 90 not taken.
✗ Branch 91 not taken.
✗ Branch 92 not taken.
✗ Branch 93 not taken.
✗ Branch 94 not taken.
✗ Branch 95 not taken.
✗ Branch 96 not taken.
✗ Branch 97 not taken.
✗ Branch 98 not taken.
✗ Branch 99 not taken.
✗ Branch 100 not taken.
✗ Branch 101 not taken.
✗ Branch 102 not taken.
✗ Branch 103 not taken.
✗ Branch 104 not taken.
✗ Branch 105 not taken.
✗ Branch 106 not taken.
✗ Branch 107 not taken.
✗ Branch 108 not taken.
✗ Branch 109 not taken.
✗ Branch 110 not taken.
✗ Branch 111 not taken.
✗ Branch 112 not taken.
✗ Branch 113 not taken.
✗ Branch 114 not taken.
✗ Branch 115 not taken.
✗ Branch 116 not taken.
✗ Branch 117 not taken.
✗ Branch 118 not taken.
✗ Branch 119 not taken.
✗ Branch 120 not taken.
✗ Branch 121 not taken.
✗ Branch 122 not taken.
✗ Branch 123 not taken.
✗ Branch 124 not taken.
✗ Branch 125 not taken.
✗ Branch 126 not taken.
✗ Branch 127 not taken.
✗ Branch 128 not taken.
✗ Branch 129 not taken.
✗ Branch 130 not taken.
✗ Branch 131 not taken.
✗ Branch 132 not taken.
✗ Branch 133 not taken.
✗ Branch 134 not taken.
✗ Branch 135 not taken.
✗ Branch 136 not taken.
✗ Branch 137 not taken.
✗ Branch 138 not taken.
✗ Branch 139 not taken.
✗ Branch 140 not taken.
✗ Branch 141 not taken.
✗ Branch 142 not taken.
✗ Branch 143 not taken.
11790 return gridGeometry().elementMapper().size();
783 }
784
785 const GridVariables& gridVariables_;
786 const SolutionVector& sol_;
787
788 std::vector<VolVarScalarDataInfo> volVarScalarDataInfo_; //!< Registered volume variables (scalar)
789 std::vector<VolVarVectorDataInfo> volVarVectorDataInfo_; //!< Registered volume variables (vector)
790
791 std::shared_ptr<VelocityOutput> velocityOutput_; //!< The velocity output policy
792 bool enableVelocityOutput_ = false;
793 bool addProcessRank_ = true;
794 };
795
796 } // end namespace Dumux
797
798 #endif
799