Directory: | ./ |
---|---|
File: | Geometry/Tools/boundingBox.hxx |
Date: | 2024-04-14 07:32:34 |
Exec | Total | Coverage | |
---|---|---|---|
Lines: | 14 | 16 | 87.5% |
Branches: | 13 | 16 | 81.2% |
Line | Branch | Exec | Source |
---|---|---|---|
1 | // ______ ______ _ _ _____ ______ | ||
2 | // | ____| ____| | (_)/ ____| | ____| | ||
3 | // | |__ | |__ | | _| (___ ___| |__ | ||
4 | // | __| | __| | | | |\___ \ / __| __| | ||
5 | // | | | |____| |____| |____) | (__| |____ | ||
6 | // |_| |______|______|_|_____/ \___|______| | ||
7 | // Finite Elements for Life Sciences and Engineering | ||
8 | // | ||
9 | // License: LGL2.1 License | ||
10 | // FELiScE default license: LICENSE in root folder | ||
11 | // | ||
12 | // Main authors: | ||
13 | // | ||
14 | |||
15 | // System includes | ||
16 | |||
17 | // External includes | ||
18 | |||
19 | // Project includes | ||
20 | |||
21 | namespace felisce | ||
22 | { | ||
23 | |||
24 | template<class T> | ||
25 | 34 | BoundingBox::BoundingBox(const int dim, const T& list): | |
26 | 34 | m_delta(0.), m_max(-1.e30), m_min(1.e30) | |
27 | { | ||
28 |
2/4✓ Branch 0 taken 17 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 17 times.
|
34 | FEL_ASSERT(dim >= 0 && dim <= 3); |
29 | |||
30 |
2/2✓ Branch 1 taken 4258 times.
✓ Branch 2 taken 17 times.
|
8550 | for (std::size_t k = 0; k < list.size(); ++k) { |
31 | |||
32 | if constexpr ( !std::is_pointer<typename T::value_type>::value ) { | ||
33 | |||
34 | // Update maximum | ||
35 | 8516 | setMax( list[k], dim ); | |
36 | |||
37 | // Update minimum | ||
38 | 8516 | setMin( list[k], dim ); | |
39 | } | ||
40 | else { | ||
41 | |||
42 | // Update maximum | ||
43 | ✗ | setMax( *list[k], dim ); | |
44 | |||
45 | // Update minimum | ||
46 | ✗ | setMin( *list[k], dim ); | |
47 | } | ||
48 | } | ||
49 | |||
50 |
2/2✓ Branch 0 taken 10 times.
✓ Branch 1 taken 17 times.
|
54 | for (int i = dim; i < 3; ++i) { |
51 | 20 | m_max.coor(i) = 0.; | |
52 | 20 | m_min.coor(i) = 0.; | |
53 | } | ||
54 | } | ||
55 | |||
56 | /***********************************************************************************/ | ||
57 | /***********************************************************************************/ | ||
58 | |||
59 | template<class T> | ||
60 | 1805 | bool BoundingBox::isInBBox(const int dim, T& point, const double tol) | |
61 | { | ||
62 |
2/2✓ Branch 0 taken 3612 times.
✓ Branch 1 taken 1788 times.
|
5400 | for (int icoor = 0; icoor < dim; ++icoor){ |
63 |
5/6✓ Branch 3 taken 3595 times.
✓ Branch 4 taken 17 times.
✗ Branch 8 not taken.
✓ Branch 9 taken 3595 times.
✓ Branch 10 taken 17 times.
✓ Branch 11 taken 3595 times.
|
3612 | if ( point[icoor] < min()[icoor] - tol || point[icoor] > max()[icoor] + tol ) |
64 | 17 | return false; | |
65 | } | ||
66 | |||
67 | 1788 | return true; | |
68 | } | ||
69 | |||
70 | } | ||
71 |