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. Specialization for staggered grids with dofs on faces. | ||
11 | */ | ||
12 | #ifndef DUMUX_STAGGERED_VTK_OUTPUT_MODULE_HH | ||
13 | #define DUMUX_STAGGERED_VTK_OUTPUT_MODULE_HH | ||
14 | |||
15 | #include <dune/common/fvector.hh> | ||
16 | |||
17 | #include <dumux/io/vtkoutputmodule.hh> | ||
18 | #include <dumux/io/pointcloudvtkwriter.hh> | ||
19 | #include <dumux/io/vtksequencewriter.hh> | ||
20 | #include <dumux/discretization/staggered/freeflow/velocityoutput.hh> | ||
21 | |||
22 | namespace Dumux { | ||
23 | |||
24 | template<class Scalar, class GlobalPosition> | ||
25 | class PointCloudVtkWriter; | ||
26 | |||
27 | /*! | ||
28 | * \ingroup InputOutput | ||
29 | * \brief A VTK output module to simplify writing dumux simulation data to VTK format | ||
30 | * Specialization for staggered grids with dofs on faces. | ||
31 | * | ||
32 | * \tparam GridVariables The grid variables | ||
33 | * \tparam SolutionVector The solution vector | ||
34 | */ | ||
35 | template<class GridVariables, class SolutionVector> | ||
36 | class StaggeredVtkOutputModule | ||
37 | : public VtkOutputModule<GridVariables, SolutionVector> | ||
38 | { | ||
39 | using ParentType = VtkOutputModule<GridVariables, SolutionVector>; | ||
40 | using GridGeometry = typename GridVariables::GridGeometry; | ||
41 | using GridView = typename GridGeometry::GridView; | ||
42 | using Scalar = typename GridVariables::Scalar; | ||
43 | using FaceVariables = typename GridVariables::GridFaceVariables::FaceVariables; | ||
44 | using FVElementGeometry = typename GridGeometry::LocalView; | ||
45 | using SubControlVolumeFace = typename FVElementGeometry::SubControlVolumeFace; | ||
46 | |||
47 | using Element = typename GridView::template Codim<0>::Entity; | ||
48 | using GlobalPosition = typename Element::Geometry::GlobalCoordinate; | ||
49 | |||
50 | struct FaceVarScalarDataInfo { std::function<Scalar(const FaceVariables&)> get; std::string name; }; | ||
51 | struct FaceVarVectorDataInfo { std::function<GlobalPosition(const SubControlVolumeFace& scvf, const FaceVariables&)> get; std::string name; }; | ||
52 | |||
53 | ✗ | struct FaceFieldScalarDataInfo | |
54 | { | ||
55 | FaceFieldScalarDataInfo(const std::vector<Scalar>& f, const std::string& n) : data(f), name(n) {} | ||
56 | const std::vector<Scalar>& data; | ||
57 | const std::string name; | ||
58 | }; | ||
59 | |||
60 |
1/96✗ Branch 0 not taken.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ 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.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✓ Branch 17 taken 9 times.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ 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.
✗ 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.
|
18 | struct FaceFieldVectorDataInfo |
61 | { | ||
62 |
2/6✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 4 taken 9 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 9 times.
✗ Branch 8 not taken.
|
9 | FaceFieldVectorDataInfo(const std::vector<GlobalPosition>& f, const std::string& n) : data(f), name(n) {} |
63 | const std::vector<GlobalPosition>& data; | ||
64 | const std::string name; | ||
65 | }; | ||
66 | |||
67 | public: | ||
68 | |||
69 | template<class Sol> | ||
70 | 50 | StaggeredVtkOutputModule(const GridVariables& gridVariables, | |
71 | const Sol& sol, | ||
72 | const std::string& name, | ||
73 | const std::string& paramGroup = "", | ||
74 | Dune::VTK::DataMode dm = Dune::VTK::conforming, | ||
75 | bool verbose = true) | ||
76 | : ParentType(gridVariables, sol, name, paramGroup, dm, verbose) | ||
77 | 50 | , faceWriter_(std::make_shared<PointCloudVtkWriter<Scalar, GlobalPosition>>(coordinates_)) | |
78 | 50 | , sequenceWriter_(faceWriter_, name + "-face", "","", | |
79 |
4/8✓ Branch 1 taken 50 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 50 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 50 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 47 times.
✗ Branch 11 not taken.
|
197 | gridVariables.curGridVolVars().problem().gridGeometry().gridView().comm().rank(), |
80 |
30/65✓ Branch 2 taken 50 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 50 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 50 times.
✗ Branch 8 not taken.
✓ Branch 9 taken 50 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 50 times.
✓ Branch 13 taken 50 times.
✗ Branch 14 not taken.
✓ Branch 16 taken 50 times.
✗ Branch 17 not taken.
✓ Branch 19 taken 50 times.
✗ Branch 20 not taken.
✓ Branch 22 taken 50 times.
✗ Branch 23 not taken.
✓ Branch 25 taken 50 times.
✗ Branch 26 not taken.
✓ Branch 28 taken 50 times.
✗ Branch 29 not taken.
✓ Branch 31 taken 47 times.
✓ Branch 32 taken 3 times.
✗ Branch 33 not taken.
✓ Branch 34 taken 3 times.
✓ Branch 35 taken 47 times.
✓ Branch 36 taken 3 times.
✓ Branch 37 taken 47 times.
✗ Branch 38 not taken.
✓ Branch 39 taken 50 times.
✗ Branch 40 not taken.
✓ Branch 41 taken 3 times.
✓ Branch 42 taken 47 times.
✓ Branch 43 taken 3 times.
✓ Branch 44 taken 47 times.
✓ Branch 45 taken 3 times.
✓ Branch 46 taken 47 times.
✓ Branch 48 taken 50 times.
✗ Branch 49 not taken.
✓ Branch 51 taken 50 times.
✗ Branch 52 not taken.
✓ Branch 54 taken 50 times.
✗ Branch 55 not taken.
✓ Branch 57 taken 50 times.
✗ Branch 58 not taken.
✓ Branch 60 taken 50 times.
✗ Branch 61 not taken.
✗ Branch 62 not taken.
✓ Branch 63 taken 47 times.
✗ 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 76 not taken.
✗ Branch 77 not taken.
✗ Branch 79 not taken.
✗ Branch 80 not taken.
|
150 | gridVariables.curGridVolVars().problem().gridGeometry().gridView().comm().size() ) |
81 | |||
82 | { | ||
83 | static_assert(std::is_same<Sol, SolutionVector>::value, "Make sure that sol has the same type as SolutionVector." | ||
84 | "Use StaggeredVtkOutputModule<GridVariables, decltype(sol)> when calling the constructor."); | ||
85 | |||
86 | // enable velocity output per default | ||
87 |
3/6✓ Branch 1 taken 50 times.
✗ Branch 2 not taken.
✓ Branch 5 taken 50 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✓ Branch 8 taken 50 times.
|
100 | this->addVelocityOutput(std::make_shared<StaggeredFreeFlowVelocityOutput<GridVariables, SolutionVector>>(gridVariables, sol)); |
88 |
1/2✓ Branch 1 taken 50 times.
✗ Branch 2 not taken.
|
50 | writeFaceVars_ = getParamFromGroup<bool>(paramGroup, "Vtk.WriteFaceData", false); |
89 | 50 | coordinatesInitialized_ = false; | |
90 | 50 | } | |
91 | |||
92 | ////////////////////////////////////////////////////////////////////////////////////////////// | ||
93 | //! Methods to conveniently add face variables | ||
94 | //! Do not call these methods after initialization | ||
95 | ////////////////////////////////////////////////////////////////////////////////////////////// | ||
96 | |||
97 | //! Add a scalar valued field | ||
98 | //! \param v The field to be added | ||
99 | //! \param name The name of the vtk field | ||
100 | void addFaceField(const std::vector<Scalar>& v, const std::string& name) | ||
101 | { | ||
102 | if (v.size() == this->gridGeometry().gridView().size(1)) | ||
103 | faceFieldScalarDataInfo_.emplace_back(v, name); | ||
104 | else | ||
105 | DUNE_THROW(Dune::RangeError, "Size mismatch of added field!"); | ||
106 | } | ||
107 | |||
108 | //! Add a vector valued field | ||
109 | //! \param v The field to be added | ||
110 | //! \param name The name of the vtk field | ||
111 | 9 | void addFaceField(const std::vector<GlobalPosition>& v, const std::string& name) | |
112 | { | ||
113 |
1/2✓ Branch 4 taken 9 times.
✗ Branch 5 not taken.
|
36 | if (v.size() == this->gridGeometry().gridView().size(1)) |
114 | 9 | faceFieldVectorDataInfo_.emplace_back(v, name); | |
115 | else | ||
116 | ✗ | DUNE_THROW(Dune::RangeError, "Size mismatch of added field!"); | |
117 | 9 | } | |
118 | |||
119 | //! Add a scalar-valued faceVarible | ||
120 | //! \param f A function taking a FaceVariables object and returning the desired scalar | ||
121 | //! \param name The name of the vtk field | ||
122 | 2 | void addFaceVariable(std::function<Scalar(const FaceVariables&)>&& f, const std::string& name) | |
123 | { | ||
124 |
1/2✓ Branch 3 taken 2 times.
✗ Branch 4 not taken.
|
2 | faceVarScalarDataInfo_.push_back(FaceVarScalarDataInfo{f, name}); |
125 | 2 | } | |
126 | |||
127 | //! Add a vector-valued faceVarible | ||
128 | //! \param f A function taking a SubControlVolumeFace and FaceVariables object and returning the desired vector | ||
129 | //! \param name The name of the vtk field | ||
130 | 2 | void addFaceVariable(std::function<GlobalPosition(const SubControlVolumeFace& scvf, const FaceVariables&)>&& f, const std::string& name) | |
131 | { | ||
132 |
1/2✓ Branch 3 taken 2 times.
✗ Branch 4 not taken.
|
2 | faceVarVectorDataInfo_.push_back(FaceVarVectorDataInfo{f, name}); |
133 | 2 | } | |
134 | |||
135 | //! Write the values to vtp files | ||
136 | //! \param time The current time | ||
137 | //! \param type The output type | ||
138 | 1322 | void write(double time, Dune::VTK::OutputType type = Dune::VTK::ascii) | |
139 | { | ||
140 | 1322 | ParentType::write(time, type); | |
141 |
2/2✓ Branch 0 taken 63 times.
✓ Branch 1 taken 1259 times.
|
1322 | if(writeFaceVars_) |
142 | 63 | getFaceDataAndWrite_(time); | |
143 | 1322 | } | |
144 | |||
145 | |||
146 | private: | ||
147 | |||
148 | //! Update the coordinates (the face centers) | ||
149 | 63 | void updateCoordinates_() | |
150 | { | ||
151 | 126 | coordinates_.resize(this->gridGeometry().numFaceDofs()); | |
152 |
3/4✓ Branch 3 taken 24423 times.
✓ Branch 4 taken 24255 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 48615 times.
|
73164 | for(auto&& facet : facets(this->gridGeometry().gridView())) |
153 | { | ||
154 |
3/6✗ Branch 0 not taken.
✓ Branch 1 taken 48615 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 48615 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 48615 times.
|
145845 | const int dofIdxGlobal = this->gridGeometry().gridView().indexSet().index(facet); |
155 | 48615 | coordinates_[dofIdxGlobal] = facet.geometry().center(); | |
156 | } | ||
157 | 63 | coordinatesInitialized_ = true; | |
158 | 63 | } | |
159 | |||
160 | //! Gathers all face-related data and invokes the face vtk-writer using these data. | ||
161 | //! \param time The current time | ||
162 | 63 | void getFaceDataAndWrite_(const Scalar time) | |
163 | { | ||
164 | 126 | const auto numPoints = this->gridGeometry().numFaceDofs(); | |
165 | |||
166 | // make sure not to iterate over the same dofs twice | ||
167 |
1/2✓ Branch 2 taken 63 times.
✗ Branch 3 not taken.
|
126 | std::vector<bool> dofVisited(numPoints, false); |
168 | |||
169 | // get fields for all primary coordinates and variables | ||
170 |
1/2✓ Branch 0 taken 63 times.
✗ Branch 1 not taken.
|
63 | if(!coordinatesInitialized_) |
171 |
1/2✓ Branch 1 taken 63 times.
✗ Branch 2 not taken.
|
63 | updateCoordinates_(); |
172 | |||
173 | // prepare some containers to store the relevant data | ||
174 |
1/2✓ Branch 0 taken 63 times.
✗ Branch 1 not taken.
|
126 | std::vector<std::vector<Scalar>> faceVarScalarData; |
175 |
1/2✓ Branch 0 taken 63 times.
✗ Branch 1 not taken.
|
63 | std::vector<std::vector<GlobalPosition>> faceVarVectorData; |
176 | |||
177 |
2/4✓ Branch 0 taken 63 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 63 times.
✗ Branch 3 not taken.
|
126 | if(!faceVarScalarDataInfo_.empty()) |
178 |
5/12✓ Branch 1 taken 63 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 63 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 63 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 63 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 63 times.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
|
252 | faceVarScalarData.resize(faceVarScalarDataInfo_.size(), std::vector<Scalar>(numPoints)); |
179 | |||
180 |
2/4✓ Branch 0 taken 63 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 63 times.
✗ Branch 3 not taken.
|
126 | if(!faceVarVectorDataInfo_.empty()) |
181 |
5/12✓ Branch 1 taken 63 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 63 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 63 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 63 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 63 times.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
|
252 | faceVarVectorData.resize(faceVarVectorDataInfo_.size(), std::vector<GlobalPosition>(numPoints)); |
182 | |||
183 |
2/4✓ Branch 1 taken 63 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 63 times.
✗ Branch 5 not taken.
|
126 | auto fvGeometry = localView(this->gridGeometry()); |
184 |
2/4✓ Branch 1 taken 63 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 63 times.
✗ Branch 5 not taken.
|
126 | auto elemFaceVars = localView(this->gridVariables().curGridFaceVars()); |
185 |
5/12✓ Branch 1 taken 63 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 63 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 63 times.
✗ Branch 8 not taken.
✓ Branch 9 taken 23163 times.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✓ Branch 12 taken 23100 times.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
|
46389 | for (const auto& element : elements(this->gridGeometry().gridView(), Dune::Partitions::interior)) |
186 | { | ||
187 |
2/8✗ Branch 0 not taken.
✓ Branch 1 taken 23100 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 23100 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
|
46200 | if (!faceVarScalarDataInfo_.empty() || !faceVarVectorDataInfo_.empty()) |
188 | { | ||
189 |
0/2✗ Branch 1 not taken.
✗ Branch 2 not taken.
|
23100 | fvGeometry.bind(element); |
190 | 23100 | elemFaceVars.bindElement(element, fvGeometry, this->sol()); | |
191 | |||
192 |
6/6✓ Branch 0 taken 92400 times.
✓ Branch 1 taken 23100 times.
✓ Branch 2 taken 92400 times.
✓ Branch 3 taken 23100 times.
✓ Branch 4 taken 48615 times.
✓ Branch 5 taken 43785 times.
|
138600 | for (auto&& scvf : scvfs(fvGeometry)) |
193 | { | ||
194 |
2/2✓ Branch 0 taken 48615 times.
✓ Branch 1 taken 43785 times.
|
92400 | const auto dofIdxGlobal = scvf.dofIndex(); |
195 |
6/6✓ Branch 0 taken 48615 times.
✓ Branch 1 taken 43785 times.
✓ Branch 2 taken 48615 times.
✓ Branch 3 taken 43785 times.
✓ Branch 4 taken 48615 times.
✓ Branch 5 taken 43785 times.
|
277200 | if(dofVisited[dofIdxGlobal]) |
196 | continue; | ||
197 | |||
198 | 97230 | dofVisited[dofIdxGlobal] = true; | |
199 | |||
200 | 48615 | const auto& faceVars = elemFaceVars[scvf]; | |
201 | |||
202 | // get the scalar-valued data | ||
203 |
4/4✓ Branch 0 taken 48615 times.
✓ Branch 1 taken 48615 times.
✓ Branch 2 taken 48615 times.
✓ Branch 3 taken 48615 times.
|
145845 | for (std::size_t i = 0; i < faceVarScalarDataInfo_.size(); ++i) |
204 |
2/4✗ Branch 0 not taken.
✓ Branch 1 taken 48615 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 48615 times.
|
243075 | faceVarScalarData[i][dofIdxGlobal] = faceVarScalarDataInfo_[i].get(faceVars); |
205 | |||
206 | // get the vector-valued data | ||
207 |
4/4✓ Branch 0 taken 48615 times.
✓ Branch 1 taken 48615 times.
✓ Branch 2 taken 48615 times.
✓ Branch 3 taken 48615 times.
|
194460 | for (std::size_t i = 0; i < faceVarVectorDataInfo_.size(); ++i) |
208 |
2/4✗ Branch 0 not taken.
✓ Branch 1 taken 48615 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 48615 times.
|
243075 | faceVarVectorData[i][dofIdxGlobal] = faceVarVectorDataInfo_[i].get(scvf, faceVars); |
209 | } | ||
210 | } | ||
211 | } | ||
212 | |||
213 | // transfer the data to the point writer | ||
214 |
2/4✓ Branch 0 taken 63 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 63 times.
✗ Branch 3 not taken.
|
126 | if(!faceVarScalarDataInfo_.empty()) |
215 |
4/4✓ Branch 0 taken 63 times.
✓ Branch 1 taken 63 times.
✓ Branch 2 taken 63 times.
✓ Branch 3 taken 63 times.
|
189 | for (std::size_t i = 0; i < faceVarScalarDataInfo_.size(); ++i) |
216 |
4/8✓ Branch 1 taken 63 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 63 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 63 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 63 times.
✗ Branch 11 not taken.
|
252 | faceWriter_->addPointData(faceVarScalarData[i], faceVarScalarDataInfo_[i].name); |
217 | |||
218 |
2/4✓ Branch 0 taken 63 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 63 times.
✗ Branch 3 not taken.
|
126 | if(!faceVarVectorDataInfo_.empty()) |
219 |
4/4✓ Branch 0 taken 63 times.
✓ Branch 1 taken 63 times.
✓ Branch 2 taken 63 times.
✓ Branch 3 taken 63 times.
|
189 | for (std::size_t i = 0; i < faceVarVectorDataInfo_.size(); ++i) |
220 |
4/8✓ Branch 1 taken 63 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 63 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 63 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 63 times.
✗ Branch 11 not taken.
|
252 | faceWriter_->addPointData(faceVarVectorData[i], faceVarVectorDataInfo_[i].name); |
221 | |||
222 | // account for the custom fields | ||
223 |
2/4✗ Branch 0 not taken.
✓ Branch 1 taken 63 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 63 times.
|
189 | for(const auto& field: faceFieldScalarDataInfo_) |
224 | ✗ | faceWriter_->addPointData(field.data, field.name); | |
225 | |||
226 |
2/4✗ Branch 0 not taken.
✓ Branch 1 taken 63 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 63 times.
|
189 | for(const auto& field: faceFieldVectorDataInfo_) |
227 | ✗ | faceWriter_->addPointData(field.data, field.name); | |
228 | |||
229 | // write for the current time step | ||
230 |
1/2✓ Branch 1 taken 63 times.
✗ Branch 2 not taken.
|
63 | sequenceWriter_.write(time); |
231 | |||
232 | // clear coordinates to save some memory | ||
233 |
1/2✓ Branch 0 taken 63 times.
✗ Branch 1 not taken.
|
63 | coordinates_.clear(); |
234 |
1/2✓ Branch 0 taken 63 times.
✗ Branch 1 not taken.
|
63 | coordinates_.shrink_to_fit(); |
235 | 63 | coordinatesInitialized_ = false; | |
236 | 63 | } | |
237 | |||
238 | |||
239 | std::shared_ptr<PointCloudVtkWriter<Scalar, GlobalPosition>> faceWriter_; | ||
240 | |||
241 | VTKSequenceWriter<PointCloudVtkWriter<Scalar, GlobalPosition>> sequenceWriter_; | ||
242 | |||
243 | bool writeFaceVars_; | ||
244 | |||
245 | std::vector<GlobalPosition> coordinates_; | ||
246 | bool coordinatesInitialized_; | ||
247 | |||
248 | std::vector<FaceVarScalarDataInfo> faceVarScalarDataInfo_; | ||
249 | std::vector<FaceVarVectorDataInfo> faceVarVectorDataInfo_; | ||
250 | |||
251 | std::vector<FaceFieldScalarDataInfo> faceFieldScalarDataInfo_; | ||
252 | std::vector<FaceFieldVectorDataInfo> faceFieldVectorDataInfo_; | ||
253 | |||
254 | }; | ||
255 | |||
256 | } // end namespace Dumux | ||
257 | |||
258 | #endif | ||
259 |