Line | Branch | Exec | Source |
---|---|---|---|
1 | // | ||
2 | // SPDX-FileCopyrightInfo: Copyright © DuMux Project contributors, see AUTHORS.md in root folder | ||
3 | // SPDX-License-Identifier: GPL-3.0-or-later | ||
4 | // | ||
5 | /*! | ||
6 | * \file | ||
7 | * \ingroup Common | ||
8 | * \brief Intersection test helpers | ||
9 | */ | ||
10 | #ifndef DUMUX_TEST_INTERSECTION_HH | ||
11 | #define DUMUX_TEST_INTERSECTION_HH | ||
12 | |||
13 | #include <dumux/geometry/intersectspointgeometry.hh> | ||
14 | |||
15 | namespace Dumux { | ||
16 | |||
17 | /*! | ||
18 | * \file | ||
19 | * \ingroup Common | ||
20 | * \brief Test intersection overload for point and geometry | ||
21 | */ | ||
22 | template<class Geometry> | ||
23 | 6520 | bool testIntersection(const Geometry& geo, | |
24 | const typename Geometry::GlobalCoordinate& p, | ||
25 | bool foundExpected, bool verbose) | ||
26 | { | ||
27 | 6520 | const bool found = intersectsPointGeometry(p, geo); | |
28 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 3760 times.
|
6520 | if (!found && foundExpected) |
29 | { | ||
30 | ✗ | std::cerr << " Failed detecting intersection of " << geo.type(); | |
31 | ✗ | for (int i = 0; i < geo.corners(); ++i) | |
32 | ✗ | std::cerr << " (" << geo.corner(i) << ")"; | |
33 | ✗ | std::cerr << " with point: " << p << std::endl; | |
34 | } | ||
35 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 3760 times.
|
6520 | else if (found && !foundExpected) |
36 | { | ||
37 | ✗ | std::cerr << " Found false positive: intersection of " << geo.type(); | |
38 | ✗ | for (int i = 0; i < geo.corners(); ++i) | |
39 | ✗ | std::cerr << " (" << geo.corner(i) << ")"; | |
40 | ✗ | std::cerr << " with point: " << p << std::endl; | |
41 | } | ||
42 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 3760 times.
|
6520 | if (verbose) |
43 | { | ||
44 | ✗ | if (found && foundExpected) | |
45 | ✗ | std::cout << " Found intersection with " << p << std::endl; | |
46 | ✗ | else if (!found && !foundExpected) | |
47 | ✗ | std::cout << " No intersection with " << p << std::endl; | |
48 | } | ||
49 | 6520 | return (found == foundExpected); | |
50 | } | ||
51 | |||
52 | } // end namespace Dumux | ||
53 | |||
54 | #endif | ||
55 |