23 template <
int spacedim,
typename Number>
26 const double tolerance)
const
28 for (
unsigned int i = 0; i < spacedim; ++i)
34 this->boundary_points.first[i] - tolerance * side_length(i)) ||
35 (p[i] > this->boundary_points.second[i] + tolerance * side_length(i)))
43 template <
int spacedim,
typename Number>
48 for (
unsigned int i = 0; i < spacedim; ++i)
50 this->boundary_points.first[i] =
51 std::min(this->boundary_points.first[i],
53 this->boundary_points.second[i] =
54 std::max(this->boundary_points.second[i],
59 template <
int spacedim,
typename Number>
63 const double tolerance)
const
65 for (
unsigned int i = 0; i < spacedim; ++i)
69 this->boundary_points.first[i] - tolerance * side_length(i)) ||
71 this->boundary_points.second[i] + tolerance * side_length(i)))
77 template <
int spacedim,
typename Number>
81 const double tolerance)
const
83 if (!has_overlap_with(other_bbox, tolerance))
94 const std::array<Point<spacedim, Number>, 2> bbox1 = {
95 {this->get_boundary_points().first,
96 this->get_boundary_points().second}};
97 const std::array<Point<spacedim, Number>, 2> bbox2 = {
103 std::array<double, spacedim> intersect_bbox_min;
104 std::array<double, spacedim> intersect_bbox_max;
105 for (
unsigned int d = 0;
d < spacedim; ++
d)
107 intersect_bbox_min[
d] =
std::max(bbox1[0][
d], bbox2[0][
d]);
108 intersect_bbox_max[
d] =
std::min(bbox1[1][
d], bbox2[1][
d]);
112 int intersect_dim = spacedim;
113 for (
unsigned int d = 0;
d < spacedim; ++
d)
114 if (std::abs(intersect_bbox_min[
d] - intersect_bbox_max[
d]) <=
115 tolerance * (std::abs(intersect_bbox_min[
d]) +
116 std::abs(intersect_bbox_max[
d])))
119 if (intersect_dim == 0 || intersect_dim == spacedim - 2)
124 unsigned int not_align_1 = 0, not_align_2 = 0;
125 bool same_direction =
true;
126 for (
unsigned int d = 0;
d < spacedim; ++
d)
128 if (std::abs(bbox2[0][
d] - bbox1[0][
d]) >
129 tolerance * (std::abs(bbox2[0][
d]) + std::abs(bbox1[0][
d])))
131 if (std::abs(bbox1[1][
d] - bbox2[1][
d]) >
132 tolerance * (std::abs(bbox1[1][
d]) + std::abs(bbox2[1][
d])))
134 if (not_align_1 != not_align_2)
136 same_direction =
false;
141 if (not_align_1 <= 1 && not_align_2 <= 1 && same_direction)
145 if ((this->point_inside(bbox2[0]) && this->point_inside(bbox2[1])) ||
157 template <
int spacedim,
typename Number>
162 for (
unsigned int i = 0; i < spacedim; ++i)
163 vol *= (this->boundary_points.second[i] - this->boundary_points.first[i]);
169 template <
int spacedim,
typename Number>
175 return boundary_points.first[direction];
180 template <
int spacedim,
typename Number>
186 return boundary_points.second[direction];
191 template <
int spacedim,
typename Number>
196 for (
unsigned int i = 0; i < spacedim; ++i)
197 point[i] = .5 * (boundary_points.first[i] + boundary_points.second[i]);
204 template <
int spacedim,
typename Number>
211 lower_upper_bounds.first[0] =
lower_bound(direction);
212 lower_upper_bounds.second[0] = upper_bound(direction);
219 template <
int spacedim,
typename Number>
225 return boundary_points.second[direction] - boundary_points.first[direction];
230 template <
int spacedim,
typename Number>
240 for (
unsigned int i = 0; i < spacedim; ++i)
241 point[i] = boundary_points.first[i] + side_length(i) * unit_cell_vertex[i];
248 template <
int spacedim,
typename Number>
266 child_lower_upper_corner;
267 for (
unsigned int i = 0; i < spacedim; ++i)
269 const double child_side_length = side_length(i) / 2;
271 const double child_center = (parent_center[i] + parent_vertex[i]) / 2;
273 child_lower_upper_corner.first[i] =
274 child_center + child_side_length * (lower_corner_unit_cell[i] - .5);
275 child_lower_upper_corner.second[i] =
276 child_center + child_side_length * (upper_corner_unit_cell[i] - .5);
284 template <
int spacedim,
typename Number>
290 std::pair<
Point<spacedim - 1, Number>,
Point<spacedim - 1, Number>>
291 cross_section_lower_upper_corner;
292 for (
unsigned int d = 0;
d < spacedim - 1; ++
d)
294 const int index_to_write_from =
295 internal::coordinate_to_one_dim_higher<spacedim - 1>(direction,
d);
297 cross_section_lower_upper_corner.first[
d] =
298 boundary_points.first[index_to_write_from];
300 cross_section_lower_upper_corner.second[
d] =
301 boundary_points.second[index_to_write_from];
304 return BoundingBox<spacedim - 1, Number>(cross_section_lower_upper_corner);
309 template <
int spacedim,
typename Number>
315 const auto diag = boundary_points.second - boundary_points.first;
316 unit -= boundary_points.first;
317 for (
unsigned int d = 0;
d < spacedim; ++
d)
324 template <
int spacedim,
typename Number>
329 auto real = boundary_points.first;
330 const auto diag = boundary_points.second - boundary_points.first;
331 for (
unsigned int d = 0;
d < spacedim; ++
d)
338 template <
int dim,
typename Number>
343 for (
unsigned int i = 0; i < dim; ++i)
345 lower_upper_corner.second[i] = 1;
351 #include "bounding_box.inst"
std::pair< Point< spacedim, Number >, Point< spacedim, Number > > boundary_points
BoundingBox< 1, Number > bounds(const unsigned int direction) const
bool has_overlap_with(const BoundingBox< spacedim, Number > &other_bbox, const double tolerance=std::numeric_limits< Number >::epsilon()) const
BoundingBox< dim, Number > create_unit_bounding_box()
Point< spacedim, Number > center() const
Number lower_bound(const unsigned int direction) const
void merge_with(const BoundingBox< spacedim, Number > &other_bbox)
bool point_inside(const Point< spacedim, Number > &p, const double tolerance=std::numeric_limits< Number >::epsilon()) const
Point< spacedim, Number > real_to_unit(const Point< spacedim, Number > &point) const
Number side_length(const unsigned int direction) const
BoundingBox< spacedim, Number > child(const unsigned int index) const
NeighborType get_neighbor_type(const BoundingBox< spacedim, Number > &other_bbox, const double tolerance=std::numeric_limits< Number >::epsilon()) const
Point< spacedim, Number > vertex(const unsigned int index) const
std::pair< Point< spacedim, Number >, Point< spacedim, Number > > & get_boundary_points()
BoundingBox< spacedim - 1, Number > cross_section(const unsigned int direction) const
Number upper_bound(const unsigned int direction) const
Point< spacedim, Number > unit_to_real(const Point< spacedim, Number > &point) const
#define DEAL_II_NAMESPACE_OPEN
#define DEAL_II_NAMESPACE_CLOSE
#define AssertIndexRange(index, range)
Point< spacedim > point(const gp_Pnt &p, const double tolerance=1e-10)
SymmetricTensor< 2, dim, Number > d(const Tensor< 2, dim, Number > &F, const Tensor< 2, dim, Number > &dF_dt)
Iterator lower_bound(Iterator first, Iterator last, const T &val)
static Point< dim > unit_cell_vertex(const unsigned int vertex)