21template <
int spacedim,
typename Number>
24 const double tolerance)
const
26 for (
unsigned int i = 0; i < spacedim; ++i)
31 if ((p[i] < this->boundary_points.first[i] -
32 tolerance *
std::abs(this->boundary_points.second[i] -
33 this->boundary_points.first[i])) ||
34 (p[i] > this->boundary_points.second[i] +
35 tolerance *
std::abs(this->boundary_points.second[i] -
36 this->boundary_points.first[i])))
42template <
int spacedim,
typename Number>
47 for (
unsigned int i = 0; i < spacedim; ++i)
49 this->boundary_points.first[i] =
50 std::min(this->boundary_points.first[i],
52 this->boundary_points.second[i] =
53 std::max(this->boundary_points.second[i],
58template <
int spacedim,
typename Number>
74 const std::array<Point<spacedim, Number>, 2> bbox1 = {
75 {this->get_boundary_points().first,
76 this->get_boundary_points().second}};
77 const std::array<Point<spacedim, Number>, 2> bbox2 = {
82 for (
unsigned int d = 0;
d < spacedim; ++
d)
91 std::array<double, spacedim> intersect_bbox_min;
92 std::array<double, spacedim> intersect_bbox_max;
93 for (
unsigned int d = 0;
d < spacedim; ++
d)
95 intersect_bbox_min[
d] =
std::max(bbox1[0][
d], bbox2[0][
d]);
96 intersect_bbox_max[
d] =
std::min(bbox1[1][
d], bbox2[1][
d]);
100 int intersect_dim = spacedim;
101 for (
unsigned int d = 0;
d < spacedim; ++
d)
102 if (
std::abs(intersect_bbox_min[
d] - intersect_bbox_max[
d]) <=
108 if (intersect_dim == 0 || intersect_dim == spacedim - 2)
113 unsigned int not_align_1 = 0, not_align_2 = 0;
114 bool same_direction =
true;
115 for (
unsigned int d = 0;
d < spacedim; ++
d)
125 if (not_align_1 != not_align_2)
127 same_direction =
false;
132 if (not_align_1 <= 1 && not_align_2 <= 1 && same_direction)
136 if ((this->point_inside(bbox2[0]) && this->point_inside(bbox2[1])) ||
148template <
int spacedim,
typename Number>
153 for (
unsigned int i = 0; i < spacedim; ++i)
154 vol *= (this->boundary_points.second[i] - this->boundary_points.first[i]);
160template <
int spacedim,
typename Number>
166 return boundary_points.first[direction];
171template <
int spacedim,
typename Number>
177 return boundary_points.second[direction];
182template <
int spacedim,
typename Number>
187 for (
unsigned int i = 0; i < spacedim; ++i)
188 point[i] = .5 * (boundary_points.first[i] + boundary_points.second[i]);
195template <
int spacedim,
typename Number>
202 lower_upper_bounds.first[0] =
lower_bound(direction);
203 lower_upper_bounds.second[0] = upper_bound(direction);
210template <
int spacedim,
typename Number>
216 return boundary_points.second[direction] - boundary_points.first[direction];
221template <
int spacedim,
typename Number>
231 for (
unsigned int i = 0; i < spacedim; ++i)
232 point[i] = boundary_points.first[i] + side_length(i) * unit_cell_vertex[i];
239template <
int spacedim,
typename Number>
257 child_lower_upper_corner;
258 for (
unsigned int i = 0; i < spacedim; ++i)
260 const double child_side_length = side_length(i) / 2;
262 const double child_center = (parent_center[i] + parent_vertex[i]) / 2;
264 child_lower_upper_corner.first[i] =
265 child_center + child_side_length * (lower_corner_unit_cell[i] - .5);
266 child_lower_upper_corner.second[i] =
267 child_center + child_side_length * (upper_corner_unit_cell[i] - .5);
275template <
int spacedim,
typename Number>
281 std::pair<
Point<spacedim - 1, Number>,
Point<spacedim - 1, Number>>
282 cross_section_lower_upper_corner;
283 for (
unsigned int d = 0;
d < spacedim - 1; ++
d)
285 const int index_to_write_from =
286 internal::coordinate_to_one_dim_higher<spacedim - 1>(direction,
d);
288 cross_section_lower_upper_corner.first[
d] =
289 boundary_points.first[index_to_write_from];
291 cross_section_lower_upper_corner.second[
d] =
292 boundary_points.second[index_to_write_from];
295 return BoundingBox<spacedim - 1, Number>(cross_section_lower_upper_corner);
300template <
int spacedim,
typename Number>
306 const auto diag = boundary_points.second - boundary_points.first;
307 unit -= boundary_points.first;
308 for (
unsigned int d = 0;
d < spacedim; ++
d)
315template <
int spacedim,
typename Number>
320 auto real = boundary_points.first;
321 const auto diag = boundary_points.second - boundary_points.first;
322 for (
unsigned int d = 0;
d < spacedim; ++
d)
329template <
int dim,
typename Number>
334 for (
unsigned int i = 0; i < dim; ++i)
336 lower_upper_corner.second[i] = 1;
342#include "bounding_box.inst"
std::pair< Point< spacedim, Number >, Point< spacedim, Number > > boundary_points
BoundingBox< 1, Number > bounds(const unsigned int direction) const
BoundingBox< dim, Number > create_unit_bounding_box()
NeighborType get_neighbor_type(const BoundingBox< spacedim, Number > &other_bbox) const
Point< spacedim, Number > center() const
Number lower_bound(const unsigned int direction) const
void merge_with(const BoundingBox< spacedim, Number > &other_bbox)
std::pair< Point< spacedim, Number >, Point< spacedim, Number > > & get_boundary_points()
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
Point< spacedim, Number > vertex(const unsigned int index) const
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)
SymmetricTensor< 2, dim, Number > epsilon(const Tensor< 2, dim, Number > &Grad_u)
Iterator lower_bound(Iterator first, Iterator last, const T &val)
::VectorizedArray< Number, width > min(const ::VectorizedArray< Number, width > &, const ::VectorizedArray< Number, width > &)
::VectorizedArray< Number, width > max(const ::VectorizedArray< Number, width > &, const ::VectorizedArray< Number, width > &)
::VectorizedArray< Number, width > abs(const ::VectorizedArray< Number, width > &)
static Point< dim > unit_cell_vertex(const unsigned int vertex)