GCC Code Coverage Report


Directory: ../../../builds/dumux-repositories/
File: /builds/dumux-repositories/dumux/dumux/geometry/diameter.hh
Date: 2024-05-04 19:09:25
Exec Total Coverage
Lines: 6 6 100.0%
Functions: 9 9 100.0%
Branches: 15 18 83.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 Geometry
10 * \brief A function to compute a geometry's diameter, i.e.
11 * the longest distance between points of a geometry
12 */
13 #ifndef DUMUX_GEOMETRY_DIAMETER_HH
14 #define DUMUX_GEOMETRY_DIAMETER_HH
15
16 #include <algorithm>
17
18 namespace Dumux {
19
20 /*!
21 * \ingroup Geometry
22 * \brief Computes the longest distance between points of a geometry
23 * \note Useful e.g. to compute the maximum cell diameter of a grid
24 */
25 template<class Geometry>
26 2900382 typename Geometry::ctype diameter(const Geometry& geo)
27 {
28 using std::max;
29 2900382 typename Geometry::ctype h = 0.0;
30
4/4
✓ Branch 0 taken 6875216 times.
✓ Branch 1 taken 1783017 times.
✓ Branch 2 taken 6875216 times.
✓ Branch 3 taken 1783017 times.
33151222 for (std::size_t i = 0; i < geo.corners(); ++i)
31
4/4
✓ Branch 0 taken 6875216 times.
✓ Branch 1 taken 9988493 times.
✓ Branch 2 taken 6875216 times.
✓ Branch 3 taken 9988493 times.
90132714 for (std::size_t j = i + 1; j < geo.corners(); ++j)
32
7/10
✓ Branch 0 taken 3536168 times.
✓ Branch 1 taken 5271898 times.
✓ Branch 2 taken 669611 times.
✓ Branch 3 taken 511008 times.
✓ Branch 4 taken 192 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 192 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 192 times.
✗ Branch 9 not taken.
166750477 h = max(h, (geo.corner(i)-geo.corner(j)).two_norm());
33
34 2900382 return h;
35 }
36
37 } // end namespace Dumux
38
39 #endif
40