GCC Code Coverage Report


Directory: ../../../builds/dumux-repositories/
File: /builds/dumux-repositories/dumux/test/discretization/facecentered/staggered/drawgrid.hh
Date: 2024-09-21 20:52:54
Exec Total Coverage
Lines: 108 117 92.3%
Functions: 4 5 80.0%
Branches: 186 368 50.5%

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 * \brief Draw Grid function for face-centered staggered. Modified from Dune-Grid's printgrid method
10 */
11
12 #ifndef DUMUX_DISCRETIZATION_FACECENTERED_STAGGERED_DRAWGRID_HH
13 #define DUMUX_DISCRETIZATION_FACECENTERED_STAGGERED_DRAWGRID_HH
14
15 #include <iostream>
16 #include <fstream>
17 #include <string>
18 #include <array>
19 #include <utility>
20
21 #include <dune/common/exceptions.hh>
22
23 #include <dumux/discretization/facecentered/staggered/normalaxis.hh>
24
25 namespace Dumux {
26
27 namespace {
28
29 // Shift a point closer to basegeo's center by factor scale (used for drawing relative to the element)
30 template<class GlobalPosition>
31 GlobalPosition shift(const GlobalPosition& centerCoords, const GlobalPosition& coords, const double shiftScale, const int direction)
32 {
33
2/2
✓ Branch 5 taken 60 times.
✓ Branch 6 taken 260 times.
920 double shift = (coords[direction] - centerCoords[direction]) * shiftScale;
34 920 GlobalPosition ret = coords;
35
2/2
✓ Branch 5 taken 60 times.
✓ Branch 6 taken 260 times.
920 ret[direction] += shift;
36 920 return ret;
37 }
38
39 // Scale a point closer to basegeo's center by factor scale (used for drawing relative to the element)
40 template<class GlobalPosition>
41 GlobalPosition centrify(const GlobalPosition& centerCoords, const GlobalPosition& coords, const double scale)
42 {
43 GlobalPosition ret = coords;
44 ret -= centerCoords;
45 ret *= scale;
46 ret += centerCoords;
47 return ret;
48 }
49
50 // Add a line to the plotfile from p1 to p2
51 template<class GlobalPosition>
52 620 void drawLine (std::ofstream &plotfile, const GlobalPosition &p1, const GlobalPosition &p2, const std::string& options) {
53 620 plotfile << "set object poly from ";
54 2480 plotfile << p1[0] << "," << p1[1] << " to ";
55 2480 plotfile << p2[0] << "," << p2[1] << " to ";
56 2480 plotfile << p1[0] << "," << p1[1];
57 1240 plotfile << " " << options << std::endl;
58 620 }
59
60 template<class GlobalPosition>
61 100 void drawCircle(std::ofstream& plotfile, const GlobalPosition& center, const double size, std::string options = "fc rgb \"navy\"")
62 {
63 100 plotfile << "set object circle at ";
64 400 plotfile << center[0] << "," << center[1];
65 200 plotfile << " size " << size;
66 200 plotfile << " " << options << std::endl;
67 100 }
68
69 template<class GlobalPosition>
70 100 void drawArrow(std::ofstream& plotfile, const GlobalPosition& center, const double elementRadius, const double scale, const int direction)
71 {
72 100 const double size = elementRadius * scale;
73 100 GlobalPosition start = center;
74
2/2
✓ Branch 0 taken 50 times.
✓ Branch 1 taken 50 times.
100 if (direction == 0)
75 100 start[0] -= size/2;
76 else
77 100 start[1] -= size/2;
78
79
8/14
✓ Branch 0 taken 50 times.
✓ Branch 1 taken 50 times.
✓ Branch 3 taken 50 times.
✗ Branch 4 not taken.
✓ Branch 6 taken 50 times.
✗ Branch 7 not taken.
✓ Branch 9 taken 50 times.
✗ Branch 10 not taken.
✓ Branch 12 taken 50 times.
✗ Branch 13 not taken.
✓ Branch 14 taken 50 times.
✓ Branch 15 taken 50 times.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
150 const std::string shift = direction ? " 0.0," + std::to_string(size) : std::to_string(size) + ",0.0";
80
6/12
✓ Branch 0 taken 50 times.
✓ Branch 1 taken 50 times.
✓ Branch 2 taken 50 times.
✓ Branch 3 taken 50 times.
✓ Branch 5 taken 100 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✓ Branch 8 taken 100 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
350 const std::string options = direction ? "lw 1 lc rgb \"red\"" : "lw 1 lc rgb \"blue\"";
81
82
1/2
✓ Branch 1 taken 100 times.
✗ Branch 2 not taken.
100 plotfile << "set arrow from ";
83
4/8
✓ Branch 1 taken 100 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 100 times.
✗ Branch 5 not taken.
✓ Branch 8 taken 100 times.
✗ Branch 9 not taken.
✓ Branch 11 taken 100 times.
✗ Branch 12 not taken.
400 plotfile << start[0] << "," << start[1];
84
1/2
✓ Branch 2 taken 100 times.
✗ Branch 3 not taken.
200 plotfile << " rto " << shift;
85
3/6
✓ Branch 2 taken 100 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 100 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 100 times.
✗ Branch 8 not taken.
200 plotfile << " " << options << std::endl;
86 100 }
87
88 } // end anonymous namespace
89
90 /** \brief Print a grid geometry as a gnuplot for testing and development
91 * \tparam GridGeometry the grid geometry used
92 * \param gridGeometry the grid geometry to print
93 * \param outputFileName the base of the output filename
94 * \param size size of the plot in pixels; increase if plot is too cramped
95 * \param executePlot whether to execute gnuplot automatically
96 * \param png whether to use PNG or SVG as the output format
97 * Creates a gnuplot (one per process if parallel) showing the grid structure with indices, intersection types etc.
98 */
99 template<class GridGeometry>
100 1 void drawGridGeometry(const GridGeometry& gridGeometry,
101 const std::string& outputFileName = "printgrid",
102 int size = 2000,
103 bool executePlot = true,
104 bool png = true)
105 {
106 static_assert(GridGeometry::Grid::dimension == 2, "drawGridGeometry only works for 2D grids");
107
108 // Create output file
109
0/2
✗ Branch 1 not taken.
✗ Branch 2 not taken.
2 std::string plotFileName = outputFileName + ".gnuplot";
110
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
2 std::ofstream plotFile (plotFileName, std::ios::out | std::ios::trunc);
111
112
2/4
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 1 times.
2 if (!plotFile.is_open())
113 {
114 DUNE_THROW(Dune::IOError, "Could not create plot file " << outputFileName << "!");
115 return;
116 }
117
118 // Basic plot output settings
119
1/2
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
2 plotFile << "set size ratio -1" << std::endl;
120
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
1 if (png)
121 {
122 plotFile << "set terminal png size " << size << "," << size << std::endl;
123 plotFile << "set output '" << outputFileName << ".png'" << std::endl;
124 }
125 else
126 {
127
3/6
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 6 taken 1 times.
✗ Branch 7 not taken.
✓ Branch 10 taken 1 times.
✗ Branch 11 not taken.
4 plotFile << "set terminal svg size " << size << "," << size << " enhanced background rgb 'white'" << std::endl;
128
2/4
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 6 taken 1 times.
✗ Branch 7 not taken.
3 plotFile << "set output '" << outputFileName << ".svg'" << std::endl;
129 }
130
131
1/2
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
2 plotFile << "set style textbox opaque noborder" << std::endl;
132
133 // Get GridView
134
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
2 const auto gridView = gridGeometry.gridView();
135
136 // Will contain min/max coordinates. Needed for scaling of the plot
137 using Element = typename GridGeometry::GridView::template Codim<0>::Entity;
138 using GlobalPosition = typename Element::Geometry::GlobalCoordinate;
139 1 GlobalPosition maxCoord;
140 1 GlobalPosition minCoord;
141
142 // Iterate over elements
143
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 auto fvGeometry = localView(gridGeometry);
144
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 26 times.
✗ Branch 4 not taken.
51 for (const auto& element : elements(gridView))
145 {
146 50 auto eIdx = gridGeometry.elementMapper().index(element);
147 25 fvGeometry.bind(element);
148
149 // Plot element index at element center
150 25 const GlobalPosition elementCenter = element.geometry().center();
151
6/12
✓ Branch 2 taken 25 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 25 times.
✗ Branch 6 not taken.
✓ Branch 9 taken 25 times.
✗ Branch 10 not taken.
✓ Branch 12 taken 25 times.
✗ Branch 13 not taken.
✓ Branch 16 taken 25 times.
✗ Branch 17 not taken.
✓ Branch 20 taken 25 times.
✗ Branch 21 not taken.
175 plotFile << "set label at " << elementCenter[0] << "," << elementCenter[1] << " '" << eIdx << "' center" << std::endl;
152
153 // draw element boundaries
154
2/2
✓ Branch 1 taken 25 times.
✓ Branch 2 taken 100 times.
125 for (const auto& intersection : intersections(gridView, element))
155 {
156 // draw grid intersections
157 100 auto intersectionGeometry = intersection.geometry();
158 300 auto elementRadius = (elementCenter - intersectionGeometry.center()).two_norm();
159
4/10
✓ Branch 1 taken 100 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 100 times.
✗ Branch 5 not taken.
✓ Branch 9 taken 100 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 100 times.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
300 drawLine(plotFile, intersectionGeometry.corner(0), intersectionGeometry.corner(1), "fs empty border 1");
160
161 // draw arrows at dofs
162 100 GlobalPosition shiftedIntersectionCenter = intersectionGeometry.center();
163
2/2
✓ Branch 1 taken 50 times.
✓ Branch 2 taken 50 times.
200 if (Dumux::normalAxis(intersection.centerUnitOuterNormal()) == 0)
164 100 shiftedIntersectionCenter[1] -= 0.05;
165 else
166 100 shiftedIntersectionCenter[0] -= 0.05;
167
1/2
✓ Branch 2 taken 100 times.
✗ Branch 3 not taken.
200 drawArrow(plotFile, shiftedIntersectionCenter, elementRadius, 0.15, Dumux::normalAxis(intersection.centerUnitOuterNormal()));
168
169 // draw an element Box around element index
170 // Thin line with color according to neighbor()
171 100 auto innerCorner1 = centrify(elementCenter, intersectionGeometry.corner(0), 0.1);
172 100 auto innerCorner2 = centrify(elementCenter, intersectionGeometry.corner(1), 0.1);
173
174
2/2
✓ Branch 0 taken 90 times.
✓ Branch 1 taken 10 times.
100 if (intersection.neighbor())
175
4/10
✓ Branch 1 taken 80 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 80 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 80 times.
✗ Branch 8 not taken.
✓ Branch 9 taken 80 times.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
320 drawLine(plotFile, innerCorner1, innerCorner2, "fs empty border 2");
176 else
177
4/10
✓ Branch 1 taken 20 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 20 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 20 times.
✗ Branch 8 not taken.
✓ Branch 9 taken 20 times.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
80 drawLine(plotFile, innerCorner1, innerCorner2, "fs empty border 1");
178
179 // Thick line in case of boundary()
180
1/2
✓ Branch 0 taken 100 times.
✗ Branch 1 not taken.
100 if (intersection.boundary())
181
4/10
✓ Branch 1 taken 20 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 20 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 20 times.
✗ Branch 8 not taken.
✓ Branch 9 taken 20 times.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
80 drawLine(plotFile, innerCorner1, innerCorner2, "fs empty border 3 lw 4");
182
183 // set max and min grid coordinates
184
4/4
✓ Branch 0 taken 200 times.
✓ Branch 1 taken 100 times.
✓ Branch 2 taken 200 times.
✓ Branch 3 taken 100 times.
400 for (int i = 0; i < intersectionGeometry.corners(); ++i)
185 {
186 // Adapt min / max coordinates
187
2/2
✓ Branch 0 taken 400 times.
✓ Branch 1 taken 200 times.
600 for (int dim = 0; dim < 2; ++dim)
188 {
189
3/6
✗ Branch 1 not taken.
✓ Branch 2 taken 400 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 400 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 400 times.
400 if (intersectionGeometry.corner(i)[dim] < minCoord[dim])
190 minCoord[dim] = intersectionGeometry.corner(i)[dim];
191
6/6
✓ Branch 1 taken 10 times.
✓ Branch 2 taken 390 times.
✓ Branch 3 taken 10 times.
✓ Branch 4 taken 390 times.
✓ Branch 5 taken 10 times.
✓ Branch 6 taken 390 times.
400 else if (intersectionGeometry.corner(i)[dim] > maxCoord[dim])
192 10 maxCoord[dim] = intersectionGeometry.corner(i)[dim];
193 }
194 }
195
196 // draw shifted frontal scv boundaries
197 200 int dirIdx = Dumux::normalAxis(intersection.centerUnitOuterNormal());
198 100 std::array<GlobalPosition, 4> pseudoScvCorners;
199 100 pseudoScvCorners[0] = shift(elementCenter,
200 100 centrify(elementCenter, intersectionGeometry.corner(0), 0.45),
201 0.15, dirIdx);
202 100 pseudoScvCorners[1] = shift(elementCenter,
203 100 centrify(elementCenter, intersectionGeometry.corner(1), 0.45),
204 0.15, dirIdx);
205 100 pseudoScvCorners[2] = shift(elementCenter,
206 100 centrify(elementCenter, intersectionGeometry.corner(1), 0.45),
207 1.20, dirIdx);
208 100 pseudoScvCorners[3] = shift(elementCenter,
209 100 centrify(elementCenter, intersectionGeometry.corner(0), 0.45),
210 1.20, dirIdx);
211
212
2/2
✓ Branch 0 taken 400 times.
✓ Branch 1 taken 100 times.
500 for (int i = 0; i < pseudoScvCorners.size(); i++)
213 {
214
2/2
✓ Branch 0 taken 200 times.
✓ Branch 1 taken 200 times.
400 if (dirIdx == 0)
215 {
216
2/2
✓ Branch 0 taken 50 times.
✓ Branch 1 taken 150 times.
200 if(i == 3)
217
6/14
✓ 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 50 times.
✗ Branch 11 not taken.
✓ Branch 13 taken 50 times.
✗ Branch 14 not taken.
✓ Branch 15 taken 50 times.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
200 drawLine(plotFile, pseudoScvCorners[3], pseudoScvCorners[0], "fs empty border 6");
218 else
219
6/14
✓ Branch 1 taken 150 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 150 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 150 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 150 times.
✗ Branch 11 not taken.
✓ Branch 13 taken 150 times.
✗ Branch 14 not taken.
✓ Branch 15 taken 150 times.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
600 drawLine(plotFile, pseudoScvCorners[i], pseudoScvCorners[i+1], "fs empty border 6");
220 }
221 else
222 {
223
2/2
✓ Branch 0 taken 50 times.
✓ Branch 1 taken 150 times.
200 if(i == 3)
224
6/14
✓ 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 50 times.
✗ Branch 11 not taken.
✓ Branch 13 taken 50 times.
✗ Branch 14 not taken.
✓ Branch 15 taken 50 times.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
200 drawLine(plotFile, pseudoScvCorners[3], pseudoScvCorners[0], "fs empty border 7");
225 else
226
6/14
✓ Branch 1 taken 150 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 150 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 150 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 150 times.
✗ Branch 11 not taken.
✓ Branch 13 taken 150 times.
✗ Branch 14 not taken.
✓ Branch 15 taken 150 times.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
600 drawLine(plotFile, pseudoScvCorners[i], pseudoScvCorners[i+1], "fs empty border 7");
227 }
228 }
229 }
230
231 // Iterate through the scvs (SCVs and SCVFs only have center positions stored?)
232
4/4
✓ Branch 1 taken 100 times.
✓ Branch 2 taken 25 times.
✓ Branch 3 taken 100 times.
✓ Branch 4 taken 25 times.
225 for (auto&& scv : scvs(fvGeometry))
233 {
234 // Plot scv index at the scv center
235 // shift scv center in it's direction
236 200 GlobalPosition shiftedScvCenter = shift(elementCenter, scv.center(), 0.5, scv.dofAxis());
237
6/12
✓ Branch 2 taken 100 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 100 times.
✗ Branch 6 not taken.
✓ Branch 9 taken 100 times.
✗ Branch 10 not taken.
✓ Branch 12 taken 100 times.
✗ Branch 13 not taken.
✓ Branch 16 taken 100 times.
✗ Branch 17 not taken.
✓ Branch 20 taken 100 times.
✗ Branch 21 not taken.
700 plotFile << "set label at " << shiftedScvCenter[0] << "," << shiftedScvCenter[1] << " '" << scv.index() << "' center" << std::endl;
238
6/12
✓ Branch 1 taken 100 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 100 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 100 times.
✗ Branch 8 not taken.
✓ Branch 9 taken 100 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 50 times.
✓ Branch 12 taken 50 times.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
300 drawCircle(plotFile, shiftedScvCenter, 0.05, "fs empty border 0");
239
240 // Plot the Dof index adjacent to the scv center
241
7/10
✓ Branch 0 taken 50 times.
✓ Branch 1 taken 50 times.
✓ Branch 2 taken 50 times.
✓ Branch 3 taken 50 times.
✓ Branch 5 taken 100 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 50 times.
✓ Branch 8 taken 50 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
400 const std::string suffix = scv.dofAxis() == 0 ? "' boxed center" : "' boxed center rotate by 90";
242
2/2
✓ Branch 0 taken 80 times.
✓ Branch 1 taken 20 times.
100 const double shiftFactor = scv.boundary() ? 1.2 : 1.0;
243 200 const GlobalPosition shiftedDofLocation = shift(elementCenter, scv.center(), shiftFactor, scv.dofAxis());
244
7/14
✓ Branch 2 taken 100 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 100 times.
✗ Branch 6 not taken.
✓ Branch 9 taken 100 times.
✗ Branch 10 not taken.
✓ Branch 12 taken 100 times.
✗ Branch 13 not taken.
✓ Branch 16 taken 100 times.
✗ Branch 17 not taken.
✓ Branch 19 taken 100 times.
✗ Branch 20 not taken.
✓ Branch 22 taken 100 times.
✗ Branch 23 not taken.
600 plotFile << "set label at " << shiftedDofLocation[0] << "," << shiftedDofLocation[1] << " 'dof " << int(scv.dofIndex()) << suffix << std::endl;
245
246 // Iterate through each scvf in each scv
247
4/4
✓ Branch 1 taken 320 times.
✓ Branch 2 taken 100 times.
✓ Branch 3 taken 320 times.
✓ Branch 4 taken 100 times.
420 for (auto&& scvf : scvfs(fvGeometry, scv))
248 {
249 //scale the scvf centers
250 960 auto shiftedScvfCenter = centrify(scv.center(), scvf.center(), 0.25);
251
2/2
✓ Branch 0 taken 60 times.
✓ Branch 1 taken 260 times.
320 shiftedScvfCenter = shift(elementCenter, shiftedScvfCenter, 0.5, scv.dofAxis());
252
253 // Plot scvf index at the scvf center, (offset)
254
2/2
✓ Branch 0 taken 60 times.
✓ Branch 1 taken 260 times.
320 if (scvf.boundary())
255
6/12
✓ Branch 2 taken 60 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 60 times.
✗ Branch 6 not taken.
✓ Branch 9 taken 60 times.
✗ Branch 10 not taken.
✓ Branch 12 taken 60 times.
✗ Branch 13 not taken.
✓ Branch 16 taken 60 times.
✗ Branch 17 not taken.
✓ Branch 20 taken 60 times.
✗ Branch 21 not taken.
420 plotFile << "set label at " << shiftedScvfCenter[0] << "," << shiftedScvfCenter[1] << " '" << scvf.index() << "(b)' center" << std::endl;
256 else
257
6/12
✓ Branch 2 taken 260 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 260 times.
✗ Branch 6 not taken.
✓ Branch 9 taken 260 times.
✗ Branch 10 not taken.
✓ Branch 12 taken 260 times.
✗ Branch 13 not taken.
✓ Branch 16 taken 260 times.
✗ Branch 17 not taken.
✓ Branch 20 taken 260 times.
✗ Branch 21 not taken.
1820 plotFile << "set label at " << shiftedScvfCenter[0] << "," << shiftedScvfCenter[1] << " '" << scvf.index() << "' center" << std::endl;
258 }
259 }
260 }
261
262 // Finish plot, pass extend of the grid
263 1 GlobalPosition extend(maxCoord - minCoord);
264
265 1 extend *= 0.075;
266 minCoord -= extend;
267 1 maxCoord += extend;
268
6/12
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✓ Branch 9 taken 1 times.
✗ Branch 10 not taken.
✓ Branch 12 taken 1 times.
✗ Branch 13 not taken.
✓ Branch 16 taken 1 times.
✗ Branch 17 not taken.
✓ Branch 19 taken 1 times.
✗ Branch 20 not taken.
7 plotFile << "plot [" << minCoord[0] << ":" << maxCoord[0] << "] [" << minCoord[1]
269
3/6
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✓ Branch 9 taken 1 times.
✗ Branch 10 not taken.
4 << ":" << maxCoord[1] << "] NaN notitle" << std::endl;
270
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 plotFile.close();
271
272 #if DUMUX_HAVE_GNUPLOT
273 if (executePlot)
274 {
275 std::string cmd = "gnuplot -p '" + plotFileName + "'";
276 if (std::system (cmd.c_str()) != 0)
277 DUNE_THROW(Dune::Exception, "Error running GNUPlot: " << cmd);
278 }
279 #else
280
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 std::cout << "No gnuplot found. Cannot visualize result. \n";
281 #endif
282
283 }
284
285 } // end namespace Dumux
286
287 #endif
288