20 template <
int spacedim,
typename Number>
25 for (
unsigned int i = 0; i < spacedim; ++i)
31 (std::abs(this->boundary_points.first[i] + p[i])) <
32 this->boundary_points.first[i] - p[i] ||
34 (std::abs(this->boundary_points.second[i] + p[i])) <
35 p[i] - this->boundary_points.second[i])
41 template <
int spacedim,
typename Number>
46 for (
unsigned int i = 0; i < spacedim; ++i)
48 this->boundary_points.first[i] =
49 std::min(this->boundary_points.first[i],
51 this->boundary_points.second[i] =
52 std::max(this->boundary_points.second[i],
57 template <
int spacedim,
typename Number>
73 std::vector<Point<spacedim, Number>> bbox1;
74 bbox1.push_back(this->get_boundary_points().
first);
75 bbox1.push_back(this->get_boundary_points().
second);
76 std::vector<Point<spacedim, Number>> bbox2;
81 for (
unsigned int d = 0;
d < spacedim; ++
d)
90 std::vector<double> intersect_bbox_min;
91 std::vector<double> intersect_bbox_max;
92 for (
unsigned int d = 0; d < spacedim; ++
d)
94 intersect_bbox_min.push_back(
std::max(bbox1[0][d], bbox2[0][d]));
95 intersect_bbox_max.push_back(
std::min(bbox1[1][d], bbox2[1][d]));
100 unsigned 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]) <=
104 (std::abs(intersect_bbox_min[d]) +
105 std::abs(intersect_bbox_max[d])))
108 if (intersect_dim == 0 || intersect_dim + 2 == spacedim)
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)
117 if (std::abs(bbox2[0][d] - bbox1[0][d]) >
119 (std::abs(bbox2[0][d]) + std::abs(bbox1[0][d])))
121 if (std::abs(bbox1[1][d] - bbox2[1][d]) >
123 (std::abs(bbox1[1][d]) + std::abs(bbox2[1][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])) ||
148 template <
int spacedim,
typename Number>
152 return this->boundary_points;
157 template <
int spacedim,
typename Number>
161 return this->boundary_points;
166 template <
int spacedim,
typename Number>
171 for (
unsigned int i = 0; i < spacedim; ++i)
172 vol *= (this->boundary_points.second[i] - this->boundary_points.first[i]);
178 template <
int spacedim,
typename Number>
184 return boundary_points.first[direction];
189 template <
int spacedim,
typename Number>
195 return boundary_points.second[direction];
200 template <
int spacedim,
typename Number>
205 for (
unsigned int i = 0; i < spacedim; ++i)
206 point[i] = .5 * (boundary_points.first[i] + boundary_points.second[i]);
213 template <
int spacedim,
typename Number>
220 lower_upper_bounds.first[0] =
lower_bound(direction);
221 lower_upper_bounds.second[0] = upper_bound(direction);
228 template <
int spacedim,
typename Number>
234 return boundary_points.second[direction] - boundary_points.first[direction];
239 template <
int spacedim,
typename Number>
249 for (
unsigned int i = 0; i < spacedim; ++i)
250 point[i] = boundary_points.first[i] + side_length(i) * unit_cell_vertex[i];
257 template <
int spacedim,
typename Number>
275 child_lower_upper_corner;
276 for (
unsigned int i = 0; i < spacedim; ++i)
278 const double child_side_length = side_length(i) / 2;
280 const double child_center = (parent_center[i] + parent_vertex[i]) / 2;
282 child_lower_upper_corner.first[i] =
283 child_center + child_side_length * (lower_corner_unit_cell[i] - .5);
284 child_lower_upper_corner.second[i] =
285 child_center + child_side_length * (upper_corner_unit_cell[i] - .5);
293 template <
int spacedim,
typename Number>
299 std::pair<
Point<spacedim - 1, Number>,
Point<spacedim - 1, Number>>
300 cross_section_lower_upper_corner;
301 for (
unsigned int d = 0;
d < spacedim - 1; ++
d)
303 const int index_to_write_from =
304 internal::coordinate_to_one_dim_higher<spacedim - 1>(direction,
d);
306 cross_section_lower_upper_corner.first[
d] =
307 boundary_points.first[index_to_write_from];
309 cross_section_lower_upper_corner.second[
d] =
310 boundary_points.second[index_to_write_from];
313 return BoundingBox<spacedim - 1, Number>(cross_section_lower_upper_corner);
318 template <
int dim,
typename Number>
323 for (
unsigned int i = 0; i < dim; ++i)
325 lower_upper_corner.second[i] = 1;
331 #include "bounding_box.inst" Point< spacedim, Number > vertex(const unsigned int index) const
Iterator lower_bound(Iterator first, Iterator last, const T &val)
#define AssertIndexRange(index, range)
static Point< dim > unit_cell_vertex(const unsigned int vertex)
void merge_with(const BoundingBox< spacedim, Number > &other_bbox)
Number lower_bound(const unsigned int direction) const
SymmetricTensor< 2, dim, Number > epsilon(const Tensor< 2, dim, Number > &Grad_u)
Number upper_bound(const unsigned int direction) const
BoundingBox< spacedim, Number > child(const unsigned int index) const
Point< spacedim, Number > center() const
#define DEAL_II_NAMESPACE_CLOSE
std::pair< Point< spacedim, Number >, Point< spacedim, Number > > boundary_points
BoundingBox< spacedim - 1, Number > cross_section(const unsigned int direction) const
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)
NeighborType get_neighbor_type(const BoundingBox< spacedim, Number > &other_bbox) const
bool point_inside(const Point< spacedim, Number > &p) const
Number side_length(const unsigned int direction) const
#define DEAL_II_NAMESPACE_OPEN
T min(const T &t, const MPI_Comm &mpi_communicator)
std::pair< Point< spacedim, Number >, Point< spacedim, Number > > & get_boundary_points()
BoundingBox< 1, Number > bounds(const unsigned int direction) const
BoundingBox< dim, Number > create_unit_bounding_box()
T max(const T &t, const MPI_Comm &mpi_communicator)