GCC Code Coverage Report


Directory: ../../../builds/dumux-repositories/
File: /builds/dumux-repositories/dumux/dumux/porousmediumflow/boxdfm/vtkoutputmodule.hh
Date: 2024-09-21 20:52:54
Exec Total Coverage
Lines: 137 250 54.8%
Functions: 20 40 50.0%
Branches: 306 1256 24.4%

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 BoxDFMModel
10 * \brief A VTK output module to simplify writing dumux simulation data to VTK format.
11 */
12
13 #ifndef POROUSMEDIUMFLOW_BOXDFM_VTK_OUTPUT_MODULE_HH
14 #define POROUSMEDIUMFLOW_BOXDFM_VTK_OUTPUT_MODULE_HH
15
16 #include <set>
17
18 #include <dune/grid/common/gridfactory.hh>
19 #include <dune/grid/common/mcmgmapper.hh>
20
21 #include <dumux/io/vtkoutputmodule.hh>
22
23 namespace Dumux {
24
25 /*!
26 * \ingroup BoxDFMModel
27 * \brief A VTK output module to simplify writing dumux simulation data to VTK format.
28 *
29 * This output module is specialized for writing out data obtained by the box-dfm
30 * scheme. It writes out separate vtk files for the solution on the fracture. For
31 * this, a grid type to be used the fracture-conforming lower-dimensional grid has
32 * to be provided.
33 *
34 * \tparam TypeTag The TypeTag of the problem implementation
35 * \tparam FractureGrid The Type used for the lower-dimensional grid
36 *
37 * Handles the output of scalar and vector fields to VTK formatted file for multiple
38 * variables and time steps. Certain predefined fields can be registered on
39 * initialization and/or be turned on/off using the designated properties. Additionally
40 * non-standardized scalar and vector fields can be added to the writer manually.
41 */
42 template<class GridVariables, class SolutionVector, class FractureGrid>
43 class BoxDfmVtkOutputModule : public VtkOutputModule<GridVariables, SolutionVector>
44 {
45 using ParentType = VtkOutputModule<GridVariables, SolutionVector>;
46 using GridGeometry = typename GridVariables::GridGeometry;
47 using VV = typename GridVariables::VolumeVariables;
48 using FluidSystem = typename VV::FluidSystem;
49 using Scalar = typename GridVariables::Scalar;
50
51 using GridView = typename GridGeometry::GridView;
52 using FractureGridView = typename FractureGrid::LeafGridView;
53 using FractureMapper = Dune::MultipleCodimMultipleGeomTypeMapper<FractureGridView>;
54
55 enum
56 {
57 dim = GridView::dimension,
58 dimWorld = GridView::dimensionworld
59 };
60
61 using GridIndexType = typename GridView::IndexSet::IndexType;
62 using Element = typename GridView::template Codim<0>::Entity;
63 using GlobalPosition = typename Element::Geometry::GlobalCoordinate;
64
65 using Field = Vtk::template Field<GridView>;
66 using FractureField = Vtk::template Field<FractureGridView>;
67
68 static_assert(dim > 1, "Box-Dfm output only works for dim > 1");
69 static_assert(FractureGrid::dimension == int(dim-1), "Fracture grid must be of codimension one!");
70 static_assert(FractureGrid::dimensionworld == int(dimWorld), "Fracture grid has to has the same coordinate dimension!");
71 static_assert(GridGeometry::discMethod == DiscretizationMethods::box, "Box-Dfm output module can only be used with the box scheme!");
72 public:
73
74 //! The constructor
75 template< class FractureGridAdapter >
76 6 BoxDfmVtkOutputModule(const GridVariables& gridVariables,
77 const SolutionVector& sol,
78 const std::string& name,
79 const FractureGridAdapter& fractureGridAdapter,
80 const std::string& paramGroup = "",
81 Dune::VTK::DataMode dm = Dune::VTK::conforming,
82 bool verbose = true)
83
7/26
✓ Branch 2 taken 6 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 6 times.
✗ Branch 6 not taken.
✓ Branch 8 taken 6 times.
✗ Branch 9 not taken.
✓ Branch 11 taken 6 times.
✗ Branch 12 not taken.
✓ Branch 14 taken 6 times.
✗ Branch 15 not taken.
✓ Branch 17 taken 6 times.
✗ Branch 18 not taken.
✓ Branch 20 taken 6 times.
✗ Branch 21 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.
6 : ParentType(gridVariables, sol, name, paramGroup, dm, verbose)
84 {
85 // create the fracture grid and all objects needed on it
86
1/2
✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
6 initializeFracture_(fractureGridAdapter);
87 6 }
88
89 //////////////////////////////////////////////////////////////////////////////////////////////
90 //! Writing data
91 //////////////////////////////////////////////////////////////////////////////////////////////
92
93 //! Write the data for this timestep to file in four steps
94 //! (1) We assemble all registered variable fields
95 //! (2) We register them with the vtk writer
96 //! (3) The writer writes the output for us
97 //! (4) Clear the writer for the next time step
98 206 void write(double time, Dune::VTK::OutputType type = Dune::VTK::ascii)
99 {
100 206 Dune::Timer timer;
101
102 // write to file depending on data mode
103 206 const auto dm = this->dataMode();
104
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 206 times.
206 if (dm == Dune::VTK::conforming)
105 writeConforming_(time, type);
106
1/2
✓ Branch 0 taken 206 times.
✗ Branch 1 not taken.
206 else if (dm == Dune::VTK::nonconforming)
107 206 writeNonConforming_(time, type);
108 else
109 DUNE_THROW(Dune::NotImplemented, "Output for provided vtk data mode");
110
111 //! output
112 206 timer.stop();
113
1/2
✓ Branch 0 taken 206 times.
✗ Branch 1 not taken.
206 if (this->verbose())
114 1030 std::cout << "Writing output for problem \"" << this->name() << "\". Took " << timer.elapsed() << " seconds." << std::endl;
115 206 }
116
117 private:
118 //! Assembles the fields and adds them to the writer (conforming output)
119 void writeConforming_(double time, Dune::VTK::OutputType type)
120 {
121 //////////////////////////////////////////////////////////////
122 //! (1) Assemble all variable fields and add to writer
123 //////////////////////////////////////////////////////////////
124
125 // instantiate the velocity output
126 std::vector<typename ParentType::VelocityOutput::VelocityVector> velocity;
127
128 // process rank
129 static bool addProcessRank = getParamFromGroup<bool>(this->paramGroup(), "Vtk.AddProcessRank");
130 std::vector<double> rank;
131
132 // volume variable data
133 std::vector<std::vector<Scalar>> volVarScalarData;
134 std::vector<std::vector<Scalar>> volVarScalarDataFracture;
135 std::vector<std::vector<GlobalPosition>> volVarVectorData;
136 std::vector<std::vector<GlobalPosition>> volVarVectorDataFracture;
137
138 // some references for convenience
139 const auto& gridView = this->gridGeometry().gridView();
140 const auto& fractureGridView = fractureGrid_->leafGridView();
141 const auto& volVarScalarDataInfo = this->volVarScalarDataInfo();
142 const auto& volVarVectorDataInfo = this->volVarVectorDataInfo();
143
144 //! Abort if no data was registered
145 if (!volVarScalarDataInfo.empty()
146 || !volVarVectorDataInfo.empty()
147 || !this->fields().empty()
148 || this->velocityOutput().enableOutput()
149 || addProcessRank)
150 {
151 const auto numCells = gridView.size(0);
152 const auto numDofs = gridView.size(dim);
153 const auto numFractureVert = fractureGridView.size(FractureGridView::dimension);
154
155 // get fields for all volume variables
156 if (!this->volVarScalarDataInfo().empty())
157 {
158 volVarScalarData.resize(volVarScalarDataInfo.size(), std::vector<Scalar>(numDofs));
159 volVarScalarDataFracture.resize(volVarScalarDataInfo.size(), std::vector<Scalar>(numFractureVert));
160 }
161 if (!this->volVarVectorDataInfo().empty())
162 {
163 volVarVectorData.resize(volVarVectorDataInfo.size(), std::vector<GlobalPosition>(numDofs));
164 volVarVectorDataFracture.resize(volVarVectorDataInfo.size(), std::vector<GlobalPosition>(numFractureVert));
165 }
166
167 if (this->velocityOutput().enableOutput())
168 for (int phaseIdx = 0; phaseIdx < this->velocityOutput().numFluidPhases(); ++phaseIdx)
169 velocity[phaseIdx].resize(numDofs);
170
171 // maybe allocate space for the process rank
172 if (addProcessRank) rank.resize(numCells);
173
174 auto fvGeometry = localView(this->gridGeometry());
175 auto elemVolVars = localView(this->gridVariables().curGridVolVars());
176 auto elemFluxVarsCache = localView(this->gridVariables().gridFluxVarsCache());
177 for (const auto& element : elements(gridView, Dune::Partitions::interior))
178 {
179 const auto eIdxGlobal = this->gridGeometry().elementMapper().index(element);
180
181 // If velocity output is enabled we need to bind to the whole stencil
182 // otherwise element-local data is sufficient
183 if (this->velocityOutput().enableOutput())
184 {
185 fvGeometry.bind(element);
186 elemVolVars.bind(element, fvGeometry, this->sol());
187 }
188 else
189 {
190 fvGeometry.bindElement(element);
191 elemVolVars.bindElement(element, fvGeometry, this->sol());
192 }
193
194 if (!volVarScalarDataInfo.empty() || !volVarVectorDataInfo.empty())
195 {
196 for (auto&& scv : scvs(fvGeometry))
197 {
198 const auto dofIdxGlobal = scv.dofIndex();
199 const auto& volVars = elemVolVars[scv];
200
201 if (!scv.isOnFracture())
202 {
203 for (std::size_t i = 0; i < volVarScalarDataInfo.size(); ++i)
204 volVarScalarData[i][dofIdxGlobal] = volVarScalarDataInfo[i].get(volVars);
205 for (std::size_t i = 0; i < volVarVectorDataInfo.size(); ++i)
206 volVarVectorData[i][dofIdxGlobal] = volVarVectorDataInfo[i].get(volVars);
207 }
208 else
209 {
210 for (std::size_t i = 0; i < volVarScalarDataInfo.size(); ++i)
211 volVarScalarDataFracture[i][vertexToFractureVertexIdx_[dofIdxGlobal]] = volVarScalarDataInfo[i].get(volVars);
212 for (std::size_t i = 0; i < volVarVectorDataInfo.size(); ++i)
213 volVarVectorDataFracture[i][vertexToFractureVertexIdx_[dofIdxGlobal]] = volVarVectorDataInfo[i].get(volVars);
214 }
215 }
216 }
217
218 // velocity output
219 if (this->velocityOutput().enableOutput())
220 {
221 elemFluxVarsCache.bind(element, fvGeometry, elemVolVars);
222
223 for (int phaseIdx = 0; phaseIdx < this->velocityOutput().numFluidPhases(); ++phaseIdx)
224 this->velocityOutput().calculateVelocity(velocity[phaseIdx], element, fvGeometry, elemVolVars, elemFluxVarsCache, phaseIdx);
225 }
226
227 //! the rank
228 if (addProcessRank)
229 rank[eIdxGlobal] = static_cast<double>(gridView.comm().rank());
230 }
231
232 //////////////////////////////////////////////////////////////
233 //! (2) Register data fields with the vtk writer
234 //////////////////////////////////////////////////////////////
235
236 // volume variables if any
237 for (std::size_t i = 0; i < volVarScalarDataInfo.size(); ++i)
238 {
239 this->sequenceWriter().addVertexData(volVarScalarData[i], volVarScalarDataInfo[i].name);
240 fractureSequenceWriter_->addVertexData(volVarScalarDataFracture[i], volVarScalarDataInfo[i].name);
241 }
242
243 for (std::size_t i = 0; i < volVarVectorDataInfo.size(); ++i)
244 {
245 this->sequenceWriter().addVertexData( Field(gridView, this->gridGeometry().vertexMapper(), volVarVectorData[i],
246 volVarVectorDataInfo[i].name, /*numComp*/dimWorld, /*codim*/dim).get() );
247 fractureSequenceWriter_->addVertexData( FractureField(fractureGridView, *fractureVertexMapper_, volVarVectorDataFracture[i],
248 volVarVectorDataInfo[i].name, /*numComp*/dimWorld, /*codim*/dim-1).get() );
249 }
250
251 // the velocity field
252 if (this->velocityOutput().enableOutput())
253 {
254 for (int phaseIdx = 0; phaseIdx < this->velocityOutput().numFluidPhases(); ++phaseIdx)
255 this->sequenceWriter().addVertexData( Field(gridView, this->gridGeometry().vertexMapper(), velocity[phaseIdx],
256 "velocity_" + std::string(this->velocityOutput().phaseName(phaseIdx)) + " (m/s)",
257 /*numComp*/dimWorld, /*codim*/dim).get() );
258 }
259
260 // the process rank
261 if (addProcessRank)
262 this->sequenceWriter().addCellData( Field(gridView, this->gridGeometry().elementMapper(), rank,
263 "process rank", /*numComp*/1, /*codim*/0).get() );
264
265 // also register additional (non-standardized) user fields if any (only on matrix grid)
266 for (auto&& field : this->fields())
267 {
268 if (field.codim() == 0)
269 this->sequenceWriter().addCellData(field.get());
270 else if (field.codim() == dim)
271 this->sequenceWriter().addVertexData(field.get());
272 else
273 DUNE_THROW(Dune::RangeError, "Cannot add wrongly sized vtk scalar field!");
274 }
275 }
276
277 //////////////////////////////////////////////////////////////
278 //! (2) The writer writes the output for us
279 //////////////////////////////////////////////////////////////
280 this->sequenceWriter().write(time, type);
281 fractureSequenceWriter_->write(time, type);
282
283 //////////////////////////////////////////////////////////////
284 //! (3) Clear the writer
285 //////////////////////////////////////////////////////////////
286 this->writer().clear();
287 fractureWriter_->clear();
288 }
289
290 //! Assembles the fields and adds them to the writer (conforming output)
291 206 void writeNonConforming_(double time, Dune::VTK::OutputType type)
292 {
293 //////////////////////////////////////////////////////////////
294 //! (1) Assemble all variable fields and add to writer
295 //////////////////////////////////////////////////////////////
296
297 // instantiate the velocity output
298
2/2
✓ Branch 0 taken 6 times.
✓ Branch 1 taken 200 times.
206 std::vector<typename ParentType::VelocityOutput::VelocityVector> velocity;
299
300 // process rank
301
5/8
✓ Branch 0 taken 6 times.
✓ Branch 1 taken 200 times.
✓ Branch 3 taken 6 times.
✗ Branch 4 not taken.
✓ Branch 6 taken 6 times.
✗ Branch 7 not taken.
✓ Branch 9 taken 6 times.
✗ Branch 10 not taken.
206 static bool addProcessRank = getParamFromGroup<bool>(this->paramGroup(), "Vtk.AddProcessRank");
302
1/4
✗ Branch 0 not taken.
✓ Branch 1 taken 206 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
412 std::vector<double> rank;
303
304 // volume variable data (indexing: volvardata/element/localcorner)
305 using ScalarDataContainer = std::vector< std::vector<Scalar> >;
306 using VectorDataContainer = std::vector< std::vector<GlobalPosition> >;
307
2/4
✗ Branch 0 not taken.
✓ Branch 1 taken 206 times.
✓ Branch 3 taken 206 times.
✗ Branch 4 not taken.
412 std::vector< ScalarDataContainer > volVarScalarData;
308
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 206 times.
412 std::vector< ScalarDataContainer > volVarScalarDataFracture;
309
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 206 times.
412 std::vector< VectorDataContainer > volVarVectorData;
310
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 206 times.
412 std::vector< VectorDataContainer > volVarVectorDataFracture;
311
312 // some references for convenience
313
2/4
✗ Branch 0 not taken.
✓ Branch 1 taken 206 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 206 times.
412 const auto& gridView = this->gridGeometry().gridView();
314
2/4
✗ Branch 0 not taken.
✓ Branch 1 taken 206 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 206 times.
412 const auto& fractureGridView = fractureGrid_->leafGridView();
315
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 206 times.
206 const auto& volVarScalarDataInfo = this->volVarScalarDataInfo();
316
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 206 times.
206 const auto& volVarVectorDataInfo = this->volVarVectorDataInfo();
317
318 //! Abort if no data was registered
319
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 206 times.
206 if (!volVarScalarDataInfo.empty()
320 || !volVarVectorDataInfo.empty()
321 || !this->fields().empty()
322 || this->velocityOutput().enableOutput()
323
1/4
✗ Branch 0 not taken.
✓ Branch 1 taken 206 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
206 || addProcessRank)
324 {
325
1/2
✓ Branch 1 taken 103 times.
✗ Branch 2 not taken.
206 const auto numCells = gridView.size(0);
326
1/2
✓ Branch 1 taken 103 times.
✗ Branch 2 not taken.
206 const auto numDofs = gridView.size(dim);
327 206 const auto numFractureCells = fractureGridView.size(0);
328
329 // get fields for all volume variables
330
3/6
✓ Branch 0 taken 206 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 206 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 206 times.
✗ Branch 5 not taken.
618 if (!this->volVarScalarDataInfo().empty())
331 {
332
5/10
✓ Branch 1 taken 206 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 206 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 206 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 206 times.
✗ Branch 11 not taken.
✓ Branch 14 taken 206 times.
✗ Branch 15 not taken.
412 volVarScalarData.resize(volVarScalarDataInfo.size(), ScalarDataContainer(numCells));
333
4/8
✓ Branch 1 taken 206 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 206 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 206 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 206 times.
✗ Branch 11 not taken.
412 volVarScalarDataFracture.resize(volVarScalarDataInfo.size(), ScalarDataContainer(numFractureCells));
334 }
335
3/6
✗ 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 206 times.
618 if (!this->volVarVectorDataInfo().empty())
336 {
337 volVarVectorData.resize(volVarVectorDataInfo.size(), VectorDataContainer(numCells));
338 volVarVectorDataFracture.resize(volVarVectorDataInfo.size(), VectorDataContainer(numFractureCells));
339 }
340
341
3/6
✓ Branch 1 taken 206 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 206 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 206 times.
412 if (this->velocityOutput().enableOutput())
342 for (int phaseIdx = 0; phaseIdx < this->velocityOutput().numFluidPhases(); ++phaseIdx)
343 velocity[phaseIdx].resize(numDofs);
344
345 // maybe allocate space for the process rank
346
2/4
✓ Branch 0 taken 206 times.
✗ Branch 1 not taken.
✓ Branch 3 taken 206 times.
✗ Branch 4 not taken.
206 if (addProcessRank) rank.resize(numCells);
347
348
13/16
✓ Branch 1 taken 206 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 163532 times.
✓ Branch 4 taken 206 times.
✓ Branch 5 taken 163532 times.
✓ Branch 6 taken 103 times.
✓ Branch 7 taken 103 times.
✓ Branch 8 taken 163532 times.
✓ Branch 9 taken 163532 times.
✓ Branch 10 taken 103 times.
✓ Branch 11 taken 327064 times.
✓ Branch 12 taken 103 times.
✓ Branch 14 taken 163532 times.
✗ Branch 15 not taken.
✓ Branch 17 taken 163532 times.
✗ Branch 18 not taken.
327270 for (const auto& element : elements(gridView, Dune::Partitions::interior))
349 {
350
3/6
✓ Branch 1 taken 327064 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 327064 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 327064 times.
✗ Branch 8 not taken.
981192 const auto eIdxGlobal = this->gridGeometry().elementMapper().index(element);
351
1/2
✓ Branch 1 taken 327064 times.
✗ Branch 2 not taken.
327064 const auto numCorners = element.subEntities(dim);
352
353 654128 auto fvGeometry = localView(this->gridGeometry());
354
1/2
✓ Branch 0 taken 327064 times.
✗ Branch 1 not taken.
1308256 auto elemVolVars = localView(this->gridVariables().curGridVolVars());
355
356 // resize element-local data containers (for bulk grid)
357
4/4
✓ Branch 0 taken 3270640 times.
✓ Branch 1 taken 327064 times.
✓ Branch 2 taken 3270640 times.
✓ Branch 3 taken 327064 times.
3597704 for (std::size_t i = 0; i < volVarScalarDataInfo.size(); ++i)
358
3/6
✓ Branch 1 taken 3270640 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 3270640 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 3270640 times.
✗ Branch 8 not taken.
9811920 volVarScalarData[i][eIdxGlobal].resize(numCorners);
359
2/4
✗ Branch 0 not taken.
✓ Branch 1 taken 327064 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 327064 times.
654128 for (std::size_t i = 0; i < volVarVectorDataInfo.size(); ++i)
360 volVarVectorData[i][eIdxGlobal].resize(numCorners);
361
362 // If velocity output is enabled we need to bind to the whole stencil
363 // otherwise element-local data is sufficient
364
3/6
✓ Branch 1 taken 327064 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 327064 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 327064 times.
654128 if (this->velocityOutput().enableOutput())
365 {
366 fvGeometry.bind(element);
367 elemVolVars.bind(element, fvGeometry, this->sol());
368 }
369 else
370 {
371
1/2
✓ Branch 1 taken 327064 times.
✗ Branch 2 not taken.
327064 fvGeometry.bindElement(element);
372
1/2
✓ Branch 1 taken 327064 times.
✗ Branch 2 not taken.
327064 elemVolVars.bindElement(element, fvGeometry, this->sol());
373 }
374
375
2/8
✗ Branch 0 not taken.
✓ Branch 1 taken 327064 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 327064 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
654128 if (!volVarScalarDataInfo.empty() || !volVarVectorDataInfo.empty())
376 {
377
4/4
✓ Branch 0 taken 1129824 times.
✓ Branch 1 taken 327064 times.
✓ Branch 2 taken 1129824 times.
✓ Branch 3 taken 327064 times.
1783952 for (auto&& scv : scvs(fvGeometry))
378 {
379
2/2
✓ Branch 0 taken 1057616 times.
✓ Branch 1 taken 72208 times.
1129824 const auto& volVars = elemVolVars[scv];
380
381
2/2
✓ Branch 0 taken 1057616 times.
✓ Branch 1 taken 72208 times.
1129824 if (!scv.isOnFracture())
382 {
383
4/4
✓ Branch 0 taken 10576160 times.
✓ Branch 1 taken 1057616 times.
✓ Branch 2 taken 10576160 times.
✓ Branch 3 taken 1057616 times.
23267552 for (std::size_t i = 0; i < volVarScalarDataInfo.size(); ++i)
384
2/4
✗ Branch 0 not taken.
✓ Branch 1 taken 10576160 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 10576160 times.
63456960 volVarScalarData[i][eIdxGlobal][scv.localDofIndex()] = volVarScalarDataInfo[i].get(volVars);
385
2/4
✗ Branch 0 not taken.
✓ Branch 1 taken 1057616 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 1057616 times.
2115232 for (std::size_t i = 0; i < volVarVectorDataInfo.size(); ++i)
386 volVarVectorData[i][eIdxGlobal][scv.localDofIndex()] = volVarVectorDataInfo[i].get(volVars);
387 }
388 else
389 {
390 72208 const auto fIdx = scv.facetIndexInElement();
391 72208 const auto& localMap = fractureElementMap_[eIdxGlobal];
392 216624 const auto fracEIdx = std::find_if(localMap.begin(), localMap.end(), [fIdx] (const auto& p) { return p.first == fIdx; })->second;
393
4/4
✓ Branch 0 taken 722080 times.
✓ Branch 1 taken 72208 times.
✓ Branch 2 taken 722080 times.
✓ Branch 3 taken 72208 times.
1516368 for (std::size_t i = 0; i < volVarScalarDataInfo.size(); ++i)
394
5/10
✗ Branch 0 not taken.
✓ Branch 1 taken 722080 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 722080 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 722080 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 722080 times.
✓ Branch 9 taken 722080 times.
✗ Branch 10 not taken.
3610400 volVarScalarDataFracture[i][fracEIdx].push_back(volVarScalarDataInfo[i].get(volVars));
395
2/4
✗ Branch 0 not taken.
✓ Branch 1 taken 72208 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 72208 times.
144416 for (std::size_t i = 0; i < volVarVectorDataInfo.size(); ++i)
396 volVarVectorDataFracture[i][fracEIdx].push_back(volVarVectorDataInfo[i].get(volVars));
397 }
398 }
399 }
400
401 // velocity output
402
3/6
✓ Branch 1 taken 327064 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 327064 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 327064 times.
654128 if (this->velocityOutput().enableOutput())
403 {
404 const auto elemFluxVarsCache = localView(this->gridVariables().gridFluxVarsCache()).bind(element, fvGeometry, elemVolVars);
405
406 for (int phaseIdx = 0; phaseIdx < this->velocityOutput().numFluidPhases(); ++phaseIdx)
407 this->velocityOutput().calculateVelocity(velocity[phaseIdx], element, fvGeometry, elemVolVars, elemFluxVarsCache, phaseIdx);
408 }
409
410 //! the rank
411
1/2
✓ Branch 0 taken 327064 times.
✗ Branch 1 not taken.
327064 if (addProcessRank)
412
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 163532 times.
327064 rank[eIdxGlobal] = static_cast<double>(gridView.comm().rank());
413 }
414
415 //////////////////////////////////////////////////////////////
416 //! (2) Register data fields with the vtk writer
417 //////////////////////////////////////////////////////////////
418
419 // volume variables if any
420
4/4
✓ Branch 0 taken 2060 times.
✓ Branch 1 taken 206 times.
✓ Branch 2 taken 2060 times.
✓ Branch 3 taken 206 times.
4326 for (std::size_t i = 0; i < volVarScalarDataInfo.size(); ++i)
421 {
422
7/18
✓ Branch 1 taken 2060 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 2060 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 2060 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 2060 times.
✗ Branch 11 not taken.
✓ Branch 14 taken 2060 times.
✗ Branch 15 not taken.
✓ Branch 16 taken 2060 times.
✗ Branch 17 not taken.
✓ Branch 18 taken 2060 times.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
10300 this->sequenceWriter().addVertexData( Field(gridView, this->gridGeometry().elementMapper(), volVarScalarData[i],
423
2/4
✓ Branch 1 taken 2060 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 2060 times.
✗ Branch 5 not taken.
4120 volVarScalarDataInfo[i].name, /*numComp*/1, /*codim*/dim,
424 /*nonconforming*/this->dataMode()).get() );
425
6/16
✓ Branch 1 taken 2060 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 2060 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 2060 times.
✗ Branch 8 not taken.
✓ Branch 11 taken 2060 times.
✗ Branch 12 not taken.
✓ Branch 13 taken 2060 times.
✗ Branch 14 not taken.
✓ Branch 15 taken 2060 times.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
10300 fractureSequenceWriter_->addVertexData( FractureField(fractureGridView, *fractureElementMapper_, volVarScalarDataFracture[i],
426
2/4
✓ Branch 1 taken 2060 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 2060 times.
✗ Branch 5 not taken.
4120 volVarScalarDataInfo[i].name, /*numComp*/1, /*codim*/dim-1,
427 /*nonconforming*/this->dataMode()).get() );
428 }
429
430
2/4
✗ Branch 0 not taken.
✓ Branch 1 taken 206 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 206 times.
412 for (std::size_t i = 0; i < volVarVectorDataInfo.size(); ++i)
431 {
432 this->sequenceWriter().addVertexData( Field(gridView, this->gridGeometry().elementMapper(), volVarVectorData[i],
433 volVarVectorDataInfo[i].name, /*numComp*/dimWorld, /*codim*/dim,
434 /*nonconforming*/this->dataMode()).get() );
435 fractureSequenceWriter_->addVertexData( FractureField(fractureGridView, *fractureElementMapper_, volVarVectorDataFracture[i],
436 volVarVectorDataInfo[i].name, /*numComp*/dimWorld, /*codim*/dim-1,
437 /*nonconforming*/this->dataMode()).get() );
438 }
439
440 // the velocity field
441
3/6
✓ Branch 1 taken 206 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 206 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 206 times.
412 if (this->velocityOutput().enableOutput())
442 {
443 for (int phaseIdx = 0; phaseIdx < this->velocityOutput().numFluidPhases(); ++phaseIdx)
444 this->sequenceWriter().addVertexData( Field(gridView, this->gridGeometry().vertexMapper(), velocity[phaseIdx],
445 "velocity_" + std::string(this->velocityOutput().phaseName(phaseIdx)) + " (m/s)",
446 /*numComp*/dimWorld, /*codim*/dim).get() );
447 }
448
449 // the process rank
450
1/2
✓ Branch 0 taken 206 times.
✗ Branch 1 not taken.
206 if (addProcessRank)
451
10/26
✓ Branch 1 taken 206 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 206 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 206 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 206 times.
✗ Branch 11 not taken.
✓ Branch 13 taken 206 times.
✗ Branch 14 not taken.
✓ Branch 16 taken 206 times.
✗ Branch 17 not taken.
✓ Branch 20 taken 206 times.
✗ Branch 21 not taken.
✓ Branch 22 taken 206 times.
✗ Branch 23 not taken.
✓ Branch 24 taken 206 times.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
✓ Branch 27 taken 206 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.
1030 this->sequenceWriter().addCellData( Field(gridView, this->gridGeometry().elementMapper(), rank,
452 "process rank", /*numComp*/1, /*codim*/0).get() );
453
454 // also register additional (non-standardized) user fields if any (only on matrix grid)
455
2/4
✗ Branch 0 not taken.
✓ Branch 1 taken 206 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 206 times.
824 for (auto&& field : this->fields())
456 {
457 if (field.codim() == 0)
458 this->sequenceWriter().addCellData(field.get());
459 else if (field.codim() == dim)
460 this->sequenceWriter().addVertexData(field.get());
461 else
462 DUNE_THROW(Dune::RangeError, "Cannot add wrongly sized vtk scalar field!");
463 }
464 }
465
466 //////////////////////////////////////////////////////////////
467 //! (2) The writer writes the output for us
468 //////////////////////////////////////////////////////////////
469
2/4
✓ Branch 1 taken 206 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 206 times.
✗ Branch 5 not taken.
412 this->sequenceWriter().write(time, type);
470
2/4
✓ Branch 1 taken 206 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 206 times.
✗ Branch 5 not taken.
412 fractureSequenceWriter_->write(time, type);
471
472 //////////////////////////////////////////////////////////////
473 //! (3) Clear the writer
474 //////////////////////////////////////////////////////////////
475 412 this->writer().clear();
476 412 fractureWriter_->clear();
477 206 }
478
479 //! Creates the lower-dimensional fracture grid, index maps and writers
480 template< class FractureGridAdapter >
481 6 void initializeFracture_(const FractureGridAdapter& fractureGridAdapter)
482 {
483 6 const auto& gridGeometry = this->gridGeometry();
484 6 const auto& gridView = gridGeometry.gridView();
485 6 Dune::GridFactory<FractureGrid> gridFactory;
486
487 // insert fracture vertices
488 6 std::size_t fracVertexCount = 0;
489
3/5
✓ Branch 1 taken 3 times.
✓ Branch 2 taken 3 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 3 times.
✗ Branch 5 not taken.
6 vertexToFractureVertexIdx_.resize(gridView.size(dim));
490
11/14
✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 1940 times.
✓ Branch 4 taken 6 times.
✓ Branch 5 taken 1940 times.
✓ Branch 6 taken 3 times.
✓ Branch 7 taken 3 times.
✓ Branch 8 taken 1940 times.
✓ Branch 9 taken 3 times.
✓ Branch 10 taken 1940 times.
✓ Branch 11 taken 1940 times.
✗ Branch 12 not taken.
✓ Branch 16 taken 1940 times.
✗ Branch 17 not taken.
3889 for (const auto& v : vertices(gridView))
491 {
492
3/4
✓ Branch 1 taken 3880 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 360 times.
✓ Branch 4 taken 3520 times.
3880 if (fractureGridAdapter.isOnFacetGrid(v))
493 {
494
4/7
✓ Branch 1 taken 180 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 180 times.
✓ Branch 4 taken 180 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 180 times.
✗ Branch 8 not taken.
540 gridFactory.insertVertex(v.geometry().center());
495
2/4
✓ Branch 1 taken 180 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 180 times.
✗ Branch 5 not taken.
720 vertexToFractureVertexIdx_[gridGeometry.vertexMapper().index(v)] = fracVertexCount++;
496 }
497 }
498
499 // insert fracture elements
500 6 std::size_t fractureElementCount = 0;
501
3/5
✓ Branch 1 taken 3 times.
✓ Branch 2 taken 3 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 3 times.
✗ Branch 5 not taken.
6 fractureElementMap_.resize(gridView.size(0));
502
1/2
✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
12 std::set< std::pair<GridIndexType, unsigned int> > handledFacets;
503
12/14
✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 4426 times.
✓ Branch 4 taken 6 times.
✓ Branch 5 taken 4426 times.
✓ Branch 6 taken 3 times.
✓ Branch 7 taken 3 times.
✓ Branch 8 taken 4426 times.
✓ Branch 9 taken 4426 times.
✓ Branch 10 taken 3 times.
✓ Branch 11 taken 4426 times.
✓ Branch 12 taken 3 times.
✓ Branch 14 taken 4426 times.
✗ Branch 15 not taken.
17710 for (const auto& element : elements(gridView))
504 {
505
2/4
✓ Branch 1 taken 8852 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 8852 times.
✗ Branch 5 not taken.
17704 const auto eIdxGlobal = gridGeometry.elementMapper().index(element);
506
1/2
✓ Branch 1 taken 8852 times.
✗ Branch 2 not taken.
8852 const auto refElement = referenceElement(element);
507
508
9/15
✓ Branch 1 taken 8852 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 4426 times.
✓ Branch 5 taken 20202 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 4426 times.
✗ Branch 8 not taken.
✓ Branch 9 taken 20202 times.
✓ Branch 10 taken 15776 times.
✗ Branch 11 not taken.
✓ Branch 15 taken 4426 times.
✓ Branch 16 taken 4426 times.
✗ Branch 17 not taken.
✓ Branch 18 taken 15776 times.
✗ Branch 19 not taken.
89660 for (const auto& is : intersections(gridView, element))
509 {
510 // obtain all vertex indices on this intersection
511
2/4
✓ Branch 1 taken 31552 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 31552 times.
✗ Branch 5 not taken.
63104 const auto& isGeometry = is.geometry();
512
2/3
✓ Branch 0 taken 1296 times.
✓ Branch 1 taken 30256 times.
✗ Branch 2 not taken.
31552 const auto numCorners = isGeometry.corners();
513
2/3
✓ Branch 0 taken 1296 times.
✓ Branch 1 taken 30256 times.
✗ Branch 2 not taken.
31552 const auto indexInInside = is.indexInInside();
514
515
4/10
✓ Branch 1 taken 31552 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 31552 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 31552 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 15776 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
126208 std::vector<GridIndexType> isVertexIndices(numCorners);
516
2/2
✓ Branch 0 taken 80496 times.
✓ Branch 1 taken 31552 times.
112048 for (unsigned int i = 0; i < numCorners; ++i)
517
1/2
✓ Branch 3 taken 80496 times.
✗ Branch 4 not taken.
160992 isVertexIndices[i] = gridGeometry.vertexMapper().subIndex(element,
518 refElement.subEntity(indexInInside, 1, i, dim),
519 dim);
520
521 // determine if this is a fracture facet & if it has to be inserted
522 31552 bool insertFacet = false;
523
3/4
✓ Branch 1 taken 31552 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 876 times.
✓ Branch 4 taken 30676 times.
31552 if (fractureGridAdapter.composeFacetElement(isVertexIndices))
524 {
525 876 insertFacet = true;
526
2/3
✓ Branch 0 taken 43 times.
✓ Branch 1 taken 833 times.
✗ Branch 2 not taken.
876 if (!is.boundary())
527 {
528 // only proceed if facet has not been handled yet
529
3/6
✓ Branch 1 taken 876 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 876 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 876 times.
✗ Branch 8 not taken.
1752 const auto outsideEIdx = gridGeometry.elementMapper().index(is.outside());
530
1/2
✓ Branch 1 taken 876 times.
✗ Branch 2 not taken.
876 const auto idxInOutside = is.indexInOutside();
531 1314 const auto pair = std::make_pair(outsideEIdx, idxInOutside);
532 2190 if (handledFacets.count( pair ) != 0)
533 {
534 438 insertFacet = false;
535
536 // obtain the fracture grid elem idx from outside map and insert to map
537 438 const auto& outsideMap = fractureElementMap_[outsideEIdx];
538
3/8
✗ Branch 0 not taken.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 3 times.
✓ Branch 5 taken 2 times.
✓ Branch 6 taken 435 times.
✗ Branch 7 not taken.
1754 auto it = std::find_if(outsideMap.begin(), outsideMap.end(), [idxInOutside] (const auto& p) { return p.first == idxInOutside; });
539
4/8
✓ Branch 1 taken 438 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 438 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 438 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 438 times.
✗ Branch 11 not taken.
1752 fractureElementMap_[eIdxGlobal].push_back( std::make_pair(indexInInside, it->second) );
540 }
541 }
542 }
543
544 if (insertFacet)
545 {
546 // transform intersection vertex indices to frac grid indices
547 1314 std::for_each( isVertexIndices.begin(),
548 isVertexIndices.end(),
549 2192 [&] (auto& idx) { idx = this->vertexToFractureVertexIdx_[idx]; } );
550
551 // insert the element
552
3/5
✓ Branch 1 taken 219 times.
✓ Branch 2 taken 219 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 219 times.
✗ Branch 5 not taken.
657 gridFactory.insertElement(isGeometry.type(), isVertexIndices);
553
554 // insert to set of handled facets
555
2/4
✓ Branch 1 taken 438 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 438 times.
✗ Branch 5 not taken.
876 handledFacets.insert( std::make_pair(eIdxGlobal, indexInInside) );
556
4/10
✓ Branch 1 taken 438 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 438 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 438 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 438 times.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
1752 fractureElementMap_[eIdxGlobal].push_back( std::make_pair(indexInInside, fractureElementCount) );
557 438 fractureElementCount++;
558 }
559 }
560 }
561
562 // make grid and get grid view
563
5/12
✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 6 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 6 times.
✗ Branch 8 not taken.
✓ Branch 9 taken 6 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 6 times.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
6 fractureGrid_ = std::shared_ptr<FractureGrid>(gridFactory.createGrid());
564
565 // update fracture mappers
566
2/4
✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 6 times.
✗ Branch 5 not taken.
12 const auto& fractureGridView = fractureGrid_->leafGridView();
567
5/12
✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 6 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 6 times.
✗ Branch 8 not taken.
✓ Branch 9 taken 6 times.
✓ Branch 10 taken 6 times.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
12 fractureVertexMapper_ = std::make_unique<FractureMapper>(fractureGridView, Dune::mcmgVertexLayout());
568
5/12
✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 6 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 6 times.
✗ Branch 8 not taken.
✓ Branch 9 taken 6 times.
✓ Branch 10 taken 6 times.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
12 fractureElementMapper_ = std::make_unique<FractureMapper>(fractureGridView, Dune::mcmgElementLayout());
569
570 // obtain map fracture insertion indices -> fracture grid indices
571
1/2
✓ Branch 3 taken 6 times.
✗ Branch 4 not taken.
18 std::vector<GridIndexType> insToVertexIdx(fractureGridView.size(FractureGridView::dimension));
572
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 std::vector<GridIndexType> insToElemIdx(fractureGridView.size(0));
573
4/4
✓ Branch 1 taken 360 times.
✓ Branch 2 taken 6 times.
✓ Branch 3 taken 360 times.
✓ Branch 4 taken 6 times.
366 for (const auto& v : vertices(fractureGridView)) insToVertexIdx[ gridFactory.insertionIndex(v) ] = fractureVertexMapper_->index(v);
574
4/4
✓ Branch 1 taken 438 times.
✓ Branch 2 taken 6 times.
✓ Branch 3 taken 438 times.
✓ Branch 4 taken 6 times.
444 for (const auto& e : elements(fractureGridView)) insToElemIdx[ gridFactory.insertionIndex(e) ] = fractureElementMapper_->index(e);
575
576 // update vertex index map
577
4/4
✓ Branch 1 taken 3883 times.
✓ Branch 2 taken 3 times.
✓ Branch 3 taken 1940 times.
✓ Branch 4 taken 3 times.
3886 for (GridIndexType dofIdx = 0; dofIdx < gridView.size(GridView::dimension); ++dofIdx)
578
4/4
✓ Branch 0 taken 360 times.
✓ Branch 1 taken 3520 times.
✓ Branch 2 taken 360 times.
✓ Branch 3 taken 3520 times.
7760 if (gridGeometry.dofOnFracture(dofIdx))
579 1080 vertexToFractureVertexIdx_[dofIdx] = insToVertexIdx[ vertexToFractureVertexIdx_[dofIdx] ];
580
581 // update fracture element map
582
4/4
✓ Branch 0 taken 8852 times.
✓ Branch 1 taken 6 times.
✓ Branch 2 taken 8852 times.
✓ Branch 3 taken 6 times.
8870 for (auto& elemLocalMap : fractureElementMap_)
583
4/4
✓ Branch 0 taken 876 times.
✓ Branch 1 taken 8852 times.
✓ Branch 2 taken 876 times.
✓ Branch 3 taken 8852 times.
28308 for (auto& dataPair : elemLocalMap)
584 1752 dataPair.second = insToElemIdx[ dataPair.second ];
585
586 // instantiate writers for the fracture
587
3/6
✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 6 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 6 times.
6 fractureWriter_ = std::make_shared< Dune::VTKWriter<FractureGridView> >(fractureGridView, this->dataMode());
588
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 9 not taken.
✓ Branch 10 taken 6 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 6 times.
✓ Branch 13 taken 6 times.
✗ Branch 14 not taken.
✓ Branch 15 taken 6 times.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
18 fractureSequenceWriter_ = std::make_unique< Dune::VTKSequenceWriter<FractureGridView> >(fractureWriter_, this->name() + "_fracture");
589 6 }
590
591 std::shared_ptr<FractureGrid> fractureGrid_;
592
593 std::unique_ptr<FractureMapper> fractureVertexMapper_;
594 std::unique_ptr<FractureMapper> fractureElementMapper_;
595
596 std::shared_ptr<Dune::VTKWriter<FractureGridView>> fractureWriter_;
597 std::unique_ptr< Dune::VTKSequenceWriter<FractureGridView> > fractureSequenceWriter_;
598
599 // maps to a bulk grid vertex the vertex index within the fracture grid
600 std::vector<GridIndexType> vertexToFractureVertexIdx_;
601
602 // maps to the local facet indices of an element the corresponding fracture element indices
603 std::vector< std::vector<std::pair<GridIndexType, unsigned int>> > fractureElementMap_;
604 };
605
606 } // end namespace Dumux
607
608 #endif
609