15#ifndef dealii_base_bounding_box_h
16#define dealii_base_bounding_box_h
134template <
int spacedim,
typename Number =
double>
181 template <
class Container>
215 const double tolerance = std::numeric_limits<Number>::epsilon())
const;
223 const double tolerance = std::numeric_limits<Number>::epsilon())
const;
242 const double tolerance = std::numeric_limits<Number>::epsilon())
const;
314 bounds(
const unsigned int direction)
const;
321 vertex(
const unsigned int index)
const;
328 child(
const unsigned int index)
const;
370 const unsigned int direction)
const;
385 template <
class Archive>
398template <
typename Number>
415 template <
class Container>
425template <
int dim,
typename Number =
double>
467 const int coordinate_in_dim)
471 return (locked_coordinate + coordinate_in_dim + 1) % (dim + 1);
481template <
int spacedim,
typename Number>
489template <
int spacedim,
typename Number>
495 for (
unsigned int i = 0; i < spacedim; ++i)
496 Assert(boundary_points.first[i] <= boundary_points.second[i],
497 ExcMessage(
"Bounding Box can't be created: the points' "
498 "order should be bottom left, top right!"));
500 this->boundary_points = boundary_points;
505template <
int spacedim,
typename Number>
506template <
class Container>
511 if (points.size() > 0)
513 auto &
min = boundary_points.first;
514 auto &
max = boundary_points.second;
515 for (
unsigned int d = 0;
d < spacedim; ++
d)
517 min[
d] = std::numeric_limits<Number>::infinity();
518 max[
d] = -std::numeric_limits<Number>::infinity();
522 for (
unsigned int d = 0;
d < spacedim; ++
d)
532template <
int spacedim,
typename Number>
536 return this->boundary_points;
541template <
int spacedim,
typename Number>
545 return this->boundary_points;
550template <
int spacedim,
typename Number>
560template <
int spacedim,
typename Number>
570template <
int spacedim,
typename Number>
574 for (
unsigned int d = 0;
d < spacedim; ++
d)
576 boundary_points.first[
d] -= amount;
577 boundary_points.second[
d] += amount;
578 Assert(boundary_points.first[d] <= boundary_points.second[d],
579 ExcMessage(
"Bounding Box can't be shrunk this much: the points' "
580 "order should remain bottom left, top right."));
586template <
int spacedim,
typename Number>
599template <
int spacedim,
typename Number>
602 const Number relative_amount)
const
607 for (
unsigned int d = 0;
d < spacedim; ++
d)
609 bb.boundary_points.first[
d] -= relative_amount * side_length(d);
610 bb.boundary_points.second[
d] += relative_amount * side_length(d);
611 Assert(bb.boundary_points.first[d] <= bb.boundary_points.second[d],
612 ExcMessage(
"Bounding Box can't be shrunk this much: the points' "
613 "order should remain bottom left, top right."));
621template <
int spacedim,
typename Number>
622template <
class Archive>
629 ar &boundary_points.first;
630 ar &boundary_points.second;
635template <
typename Number>
643template <
typename Number>
652template <
typename Number>
653template <
class Container>
BoundingBox< dim, Number > create_unit_bounding_box()
BoundingBox(const std::pair< Point< 0, Number >, Point< 0, Number > > &)
BoundingBox(const Container &)
int coordinate_to_one_dim_higher(const int locked_coordinate, const int coordinate_in_dim)
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(const std::pair< Point< spacedim, Number >, Point< spacedim, Number > > &boundary_points)
Point< spacedim, Number > center() const
Number lower_bound(const unsigned int direction) const
Number signed_distance(const Point< spacedim, Number > &point, const unsigned int direction) const
bool operator==(const BoundingBox< spacedim, Number > &box) const
void serialize(Archive &ar, const unsigned int version)
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
void extend(const Number amount)
BoundingBox< spacedim, Number > create_extended_relative(const Number relative_amount) const
BoundingBox(const Container &points)
Point< spacedim, Number > real_to_unit(const Point< spacedim, Number > &point) const
const std::pair< Point< spacedim, Number >, Point< spacedim, Number > > & get_boundary_points() const
static constexpr unsigned int dimension
Number side_length(const unsigned int direction) const
BoundingBox< spacedim, Number > child(const unsigned int index) const
bool operator!=(const BoundingBox< spacedim, Number > &box) const
BoundingBox< spacedim, Number > & operator=(const BoundingBox< spacedim, Number > &t)=default
NeighborType get_neighbor_type(const BoundingBox< spacedim, Number > &other_bbox, const double tolerance=std::numeric_limits< Number >::epsilon()) const
BoundingBox< spacedim, Number > create_extended(const Number amount) const
Point< spacedim, Number > vertex(const unsigned int index) const
BoundingBox(const Point< spacedim, Number > &point)
BoundingBox< spacedim - 1, Number > cross_section(const unsigned int direction) const
BoundingBox(const BoundingBox< spacedim, Number > &box)=default
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 Assert(cond, exc)
static ::ExceptionBase & ExcImpossibleInDim(int arg1)
#define AssertIndexRange(index, range)
static ::ExceptionBase & ExcMessage(std::string arg1)
#define AssertThrow(cond, exc)
SymmetricTensor< 2, dim, Number > d(const Tensor< 2, dim, Number > &F, const Tensor< 2, dim, Number > &dF_dt)
::VectorizedArray< Number, width > min(const ::VectorizedArray< Number, width > &, const ::VectorizedArray< Number, width > &)
::VectorizedArray< Number, width > max(const ::VectorizedArray< Number, width > &, const ::VectorizedArray< Number, width > &)