libMesh::MeshTools::BoundingBox Class Reference

#include <mesh_tools.h>

Inheritance diagram for libMesh::MeshTools::BoundingBox:

Public Member Functions

 BoundingBox (const Point &new_min, const Point &new_max)
 
 BoundingBox (const std::pair< Point, Point > &bbox)
 
 BoundingBox ()
 
void invalidate ()
 
const Pointmin () const
 
Pointmin ()
 
const Pointmax () const
 
Pointmax ()
 
bool intersects (const BoundingBox &) const
 
bool intersect (const BoundingBox &b) const
 
bool contains_point (const Point &) const
 
void intersect_with (const BoundingBox &)
 
void union_with (const Point &p)
 
void union_with (const BoundingBox &)
 

Detailed Description

Backwards compatibility with forward declarations.

Deprecated:
Use libMesh::BoundingBox instead.

Definition at line 59 of file mesh_tools.h.

Constructor & Destructor Documentation

libMesh::MeshTools::BoundingBox::BoundingBox ( const Point new_min,
const Point new_max 
)
inline

Definition at line 62 of file mesh_tools.h.

63  :
64  libMesh::BoundingBox(new_min, new_max) {
65  libmesh_deprecated(); // Switch to libMesh::BoundingBox
66  }
libMesh::MeshTools::BoundingBox::BoundingBox ( const std::pair< Point, Point > &  bbox)
inline

Definition at line 68 of file mesh_tools.h.

68  :
69  libMesh::BoundingBox(bbox) {
70  libmesh_deprecated(); // Switch to libMesh::BoundingBox
71  }
libMesh::MeshTools::BoundingBox::BoundingBox ( )
inline

Definition at line 73 of file mesh_tools.h.

References mesh, libMesh::MeshTools::total_weight(), and libMesh::MeshTools::weight().

73  {
74  libmesh_deprecated(); // Switch to libMesh::BoundingBox
75  }

Member Function Documentation

bool libMesh::BoundingBox::contains_point ( const Point p) const
inherited

Definition at line 73 of file bounding_box.C.

References libMesh::is_between(), and libMesh::Real.

Referenced by libMesh::BoundingBox::intersect().

74 {
75  // Make local variables first to make things more clear in a moment
76  Real my_min_x = this->first(0);
77  Real my_max_x = this->second(0);
78  bool x_int = is_between(my_min_x, p(0), my_max_x);
79 
80  bool intersection_true = x_int;
81 
82 #if LIBMESH_DIM > 1
83  Real my_min_y = this->first(1);
84  Real my_max_y = this->second(1);
85  bool y_int = is_between(my_min_y, p(1), my_max_y);
86 
87  intersection_true = intersection_true && y_int;
88 #endif
89 
90 
91 #if LIBMESH_DIM > 2
92  Real my_min_z = this->first(2);
93  Real my_max_z = this->second(2);
94  bool z_int = is_between(my_min_z, p(2), my_max_z);
95 
96  intersection_true = intersection_true && z_int;
97 #endif
98 
99  return intersection_true;
100 }
bool is_between(Real min, Real check, Real max)
Definition: bounding_box.C:28
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
bool libMesh::BoundingBox::intersect ( const BoundingBox b) const
inlineinherited
Returns
true if the other bounding box has a non-empty intersection with this bounding box.
Deprecated:
Use the BoundingBox::intersects() function instead.

Definition at line 103 of file bounding_box.h.

References libMesh::BoundingBox::contains_point(), libMesh::BoundingBox::intersect_with(), libMesh::BoundingBox::intersects(), and libMesh::BoundingBox::union_with().

104  { libmesh_deprecated(); return this->intersects(b); }
bool intersects(const BoundingBox &) const
Definition: bounding_box.C:33
void libMesh::BoundingBox::intersect_with ( const BoundingBox other_box)
inherited

Definition at line 103 of file bounding_box.C.

References std::max(), and std::min().

Referenced by libMesh::BoundingBox::intersect().

104 {
105  this->first(0) = std::max(this->first(0), other_box.first(0));
106  this->second(0) = std::min(this->second(0), other_box.second(0));
107 
108 #if LIBMESH_DIM > 1
109  this->first(1) = std::max(this->first(1), other_box.first(1));
110  this->second(1) = std::min(this->second(1), other_box.second(1));
111 #endif
112 
113 #if LIBMESH_DIM > 2
114  this->first(2) = std::max(this->first(2), other_box.first(2));
115  this->second(2) = std::min(this->second(2), other_box.second(2));
116 #endif
117 }
long double max(long double a, double b)
long double min(long double a, double b)
bool libMesh::BoundingBox::intersects ( const BoundingBox other_box) const
inherited

Definition at line 33 of file bounding_box.C.

References libMesh::is_between(), and libMesh::Real.

Referenced by libMesh::TreeNode< N >::insert(), libMesh::BoundingBox::intersect(), and libMesh::BoundingBox::max().

34 {
35  // Make local variables first to make things more clear in a moment
36  const Real & my_min_x = this->first(0);
37  const Real & my_max_x = this->second(0);
38  const Real & other_min_x = other_box.first(0);
39  const Real & other_max_x = other_box.second(0);
40 
41  const bool x_int = is_between(my_min_x, other_min_x, my_max_x) || is_between(my_min_x, other_max_x, my_max_x) ||
42  is_between(other_min_x, my_min_x, other_max_x) || is_between(other_min_x, my_max_x, other_max_x);
43 
44  bool intersection_true = x_int;
45 
46 #if LIBMESH_DIM > 1
47  const Real & my_min_y = this->first(1);
48  const Real & my_max_y = this->second(1);
49  const Real & other_min_y = other_box.first(1);
50  const Real & other_max_y = other_box.second(1);
51 
52  const bool y_int = is_between(my_min_y, other_min_y, my_max_y) || is_between(my_min_y, other_max_y, my_max_y) ||
53  is_between(other_min_y, my_min_y, other_max_y) || is_between(other_min_y, my_max_y, other_max_y);
54 
55  intersection_true = intersection_true && y_int;
56 #endif
57 
58 #if LIBMESH_DIM > 2
59  const Real & my_min_z = this->first(2);
60  const Real & my_max_z = this->second(2);
61  const Real & other_min_z = other_box.first(2);
62  const Real & other_max_z = other_box.second(2);
63 
64  const bool z_int = is_between(my_min_z, other_min_z, my_max_z) || is_between(my_min_z, other_max_z, my_max_z) ||
65  is_between(other_min_z, my_min_z, other_max_z) || is_between(other_min_z, my_max_z, other_max_z);
66 
67  intersection_true = intersection_true && z_int;
68 #endif
69 
70  return intersection_true;
71 }
bool is_between(Real min, Real check, Real max)
Definition: bounding_box.C:28
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
void libMesh::BoundingBox::invalidate ( )
inlineinherited

Definition at line 64 of file bounding_box.h.

References std::max().

Referenced by libMesh::BoundingBox::BoundingBox().

65  {
66  for (unsigned int i=0; i<LIBMESH_DIM; i++)
67  {
68  this->first(i) = std::numeric_limits<Real>::max();
69  this->second(i) = -std::numeric_limits<Real>::max();
70  }
71  }
long double max(long double a, double b)
const Point& libMesh::BoundingBox::max ( ) const
inlineinherited

Definition at line 85 of file bounding_box.h.

Referenced by libMesh::BoundingBox::union_with().

86  { return this->second; }
Point& libMesh::BoundingBox::max ( )
inlineinherited

Definition at line 88 of file bounding_box.h.

References libMesh::BoundingBox::intersects().

89  { return this->second; }
const Point& libMesh::BoundingBox::min ( ) const
inlineinherited

Definition at line 76 of file bounding_box.h.

Referenced by libMesh::BoundingBox::union_with().

77  { return this->first; }
Point& libMesh::BoundingBox::min ( )
inlineinherited

Definition at line 79 of file bounding_box.h.

80  { return this->first; }
void libMesh::BoundingBox::union_with ( const Point p)
inlineinherited

Definition at line 138 of file bounding_box.h.

References std::max(), libMesh::BoundingBox::max(), std::min(), and libMesh::BoundingBox::min().

Referenced by libMesh::BoundingBox::intersect(), and libMesh::Cell::loose_bounding_box().

139 {
140  for (unsigned int i=0; i<LIBMESH_DIM; i++)
141  {
142  min()(i) = std::min(min()(i), p(i));
143  max()(i) = std::max(max()(i), p(i));
144  }
145 }
const Point & max() const
Definition: bounding_box.h:85
long double max(long double a, double b)
const Point & min() const
Definition: bounding_box.h:76
long double min(long double a, double b)
void libMesh::BoundingBox::union_with ( const BoundingBox other_box)
inherited

Definition at line 120 of file bounding_box.C.

References std::max(), and std::min().

121 {
122  this->first(0) = std::min(this->first(0), other_box.first(0));
123  this->second(0) = std::max(this->second(0), other_box.second(0));
124 
125 #if LIBMESH_DIM > 1
126  this->first(1) = std::min(this->first(1), other_box.first(1));
127  this->second(1) = std::max(this->second(1), other_box.second(1));
128 #endif
129 
130 #if LIBMESH_DIM > 2
131  this->first(2) = std::min(this->first(2), other_box.first(2));
132  this->second(2) = std::max(this->second(2), other_box.second(2));
133 #endif
134 }
long double max(long double a, double b)
long double min(long double a, double b)

The documentation for this class was generated from the following file: