Directory: | ./ |
---|---|
File: | Geometry/Tools/boundingBox.hpp |
Date: | 2024-04-14 07:32:34 |
Exec | Total | Coverage | |
---|---|---|---|
Lines: | 5 | 5 | 100.0% |
Branches: | 8 | 8 | 100.0% |
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 | #ifndef FEL_BBOX_HPP | ||
16 | #define FEL_BBOX_HPP | ||
17 | |||
18 | // System includes | ||
19 | |||
20 | // External includes | ||
21 | |||
22 | // Project includes | ||
23 | #include "Core/shared_pointers.hpp" | ||
24 | #include "Geometry/geometricMeshRegion.hpp" | ||
25 | |||
26 | namespace felisce | ||
27 | { | ||
28 | ///@name felisce Globals | ||
29 | ///@{ | ||
30 | |||
31 | ///@} | ||
32 | ///@name Type Definitions | ||
33 | ///@{ | ||
34 | |||
35 | ///@} | ||
36 | ///@name Enum's | ||
37 | ///@{ | ||
38 | |||
39 | ///@} | ||
40 | ///@name Functions | ||
41 | ///@{ | ||
42 | |||
43 | ///@} | ||
44 | ///@name felisce Classes | ||
45 | ///@{ | ||
46 | |||
47 | class BoundingBox | ||
48 | { | ||
49 | public: | ||
50 | ///@name Type Definitions | ||
51 | ///@{ | ||
52 | |||
53 | /// Pointer definition of BoundingBox | ||
54 | FELISCE_CLASS_POINTER_DEFINITION(BoundingBox); | ||
55 | |||
56 | ///@} | ||
57 | ///@name Life Cycle | ||
58 | ///@{ | ||
59 | |||
60 | BoundingBox() = delete; | ||
61 | |||
62 | BoundingBox(const GeometricMeshRegion& mesh); | ||
63 | |||
64 | template<class T> | ||
65 | BoundingBox(const int dim, const T& list); | ||
66 | |||
67 | BoundingBox(const BoundingBox& ) = delete; | ||
68 | |||
69 | BoundingBox(BoundingBox&& ) = delete; | ||
70 | |||
71 | BoundingBox& operator=(const BoundingBox& ) = delete; | ||
72 | |||
73 | BoundingBox& operator=(BoundingBox&& ) = delete; | ||
74 | |||
75 | ~BoundingBox() = default; | ||
76 | |||
77 | ///@} | ||
78 | ///@name Variables | ||
79 | ///@{ | ||
80 | |||
81 | ///@} | ||
82 | ///@name Operators | ||
83 | ///@{ | ||
84 | |||
85 | ///@} | ||
86 | ///@name Operations | ||
87 | ///@{ | ||
88 | |||
89 | void computeDelta(const int dim); | ||
90 | |||
91 | template<class P> | ||
92 | bool isInBBox(const int dim, P& point, const double tol=0.); | ||
93 | |||
94 | ///@} | ||
95 | ///@name Access | ||
96 | ///@{ | ||
97 | |||
98 | ///@} | ||
99 | ///@name Inquiry | ||
100 | ///@{ | ||
101 | |||
102 | 1805 | inline Point delta() const { return m_delta; }; | |
103 | 3595 | inline Point max() const { return m_max; }; | |
104 | 5417 | inline Point min() const { return m_min; }; | |
105 | |||
106 | ///@} | ||
107 | ///@name Input and output | ||
108 | ///@{ | ||
109 | |||
110 | ///@} | ||
111 | ///@name Friends | ||
112 | ///@{ | ||
113 | |||
114 | ///@} | ||
115 | protected: | ||
116 | ///@name Protected static Member Variables | ||
117 | ///@{ | ||
118 | |||
119 | ///@} | ||
120 | ///@name Protected member Variables | ||
121 | ///@{ | ||
122 | |||
123 | ///@} | ||
124 | ///@name Protected Operators | ||
125 | ///@{ | ||
126 | |||
127 | ///@} | ||
128 | ///@name Protected Operations | ||
129 | ///@{ | ||
130 | |||
131 | ///@} | ||
132 | ///@name Protected Access | ||
133 | ///@{ | ||
134 | |||
135 | ///@} | ||
136 | ///@name Protected Inquiry | ||
137 | ///@{ | ||
138 | |||
139 | ///@} | ||
140 | ///@name Protected LifeCycle | ||
141 | ///@{ | ||
142 | |||
143 | ///@} | ||
144 | private: | ||
145 | ///@name Private static Member Variables | ||
146 | ///@{ | ||
147 | |||
148 | ///@} | ||
149 | ///@name Private member Variables | ||
150 | ///@{ | ||
151 | |||
152 | Point m_delta; | ||
153 | Point m_max; | ||
154 | Point m_min; | ||
155 | |||
156 | ///@} | ||
157 | ///@name Private Operators | ||
158 | ///@{ | ||
159 | |||
160 | ///@} | ||
161 | ///@name Private Operations | ||
162 | ///@{ | ||
163 | |||
164 | template<class T> | ||
165 |
4/4✓ Branch 2 taken 367 times.
✓ Branch 3 taken 8205 times.
✓ Branch 6 taken 8572 times.
✓ Branch 7 taken 4258 times.
|
25660 | inline void setMax(T& pnt, int dim) { for (int i = 0; i < dim; ++i) if ( pnt[i] > m_max.coor(i) ) m_max.coor(i) = pnt[i]; }; |
166 | |||
167 | template<class T> | ||
168 |
4/4✓ Branch 2 taken 41 times.
✓ Branch 3 taken 8531 times.
✓ Branch 6 taken 8572 times.
✓ Branch 7 taken 4258 times.
|
25660 | inline void setMin(T& pnt, int dim) { for (int i = 0; i < dim; ++i) if ( pnt[i] < m_min.coor(i) ) m_min.coor(i) = pnt[i]; }; |
169 | |||
170 | ///@} | ||
171 | ///@name Private Access | ||
172 | ///@{ | ||
173 | |||
174 | ///@} | ||
175 | ///@name Private Inquiry | ||
176 | ///@{ | ||
177 | |||
178 | ///@} | ||
179 | ///@name Private LifeCycle | ||
180 | ///@{ | ||
181 | |||
182 | ///@} | ||
183 | }; | ||
184 | ///@} | ||
185 | ///@name Type Definitions | ||
186 | ///@{ | ||
187 | |||
188 | ///@} | ||
189 | } /* namespace felisce.*/ | ||
190 | |||
191 | #include "boundingBox.hxx" | ||
192 | |||
193 | #endif /* FEL_BBOX_HPP defined */ | ||
194 |