$extrastylesheet
libMesh::MeshTools::BoundingBox Class Reference

#include <mesh_tools.h>

List of all members.

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 ()
BoundingBoxexpand ()
bool intersect (const BoundingBox &) const
bool contains_point (const Point &) const

Detailed Description

Defines a Cartesian bounding box by the two corner extremum.

Definition at line 66 of file mesh_tools.h.


Constructor & Destructor Documentation

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

Definition at line 70 of file mesh_tools.h.

                                                           :
    std::pair<Point, Point>(new_min, new_max)
  {}
libMesh::MeshTools::BoundingBox::BoundingBox ( const std::pair< Point, Point > &  bbox) [inline]

Definition at line 74 of file mesh_tools.h.

                                                  :
    std::pair<Point, Point> (bbox)
  {}

Default constructor sets invalid bounds.

Definition at line 81 of file mesh_tools.h.

References invalidate().

  {
    this->invalidate();
  }

Member Function Documentation

Definition at line 283 of file mesh_tools.C.

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

{
  // Make local variables first to make thiings more clear in a moment
  Real my_min_x = this->first(0);
  Real my_max_x = this->second(0);
  bool x_int = is_between(my_min_x, p(0), my_max_x);

  bool intersection_true = x_int;

#if LIBMESH_DIM > 1
  Real my_min_y = this->first(1);
  Real my_max_y = this->second(1);
  bool y_int = is_between(my_min_y, p(1), my_max_y);

  intersection_true = intersection_true && y_int;
#endif


#if LIBMESH_DIM > 2
  Real my_min_z = this->first(2);
  Real my_max_z = this->second(2);
  bool z_int = is_between(my_min_z, p(2), my_max_z);

  intersection_true = intersection_true && z_int;
#endif

  return intersection_true;
}

Definition at line 107 of file mesh_tools.h.

  { return *this; }
bool libMesh::MeshTools::BoundingBox::intersect ( const BoundingBox other_box) const

Definition at line 243 of file mesh_tools.C.

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

{
  // Make local variables first to make thiings more clear in a moment
  const Real& my_min_x = this->first(0);
  const Real& my_max_x = this->second(0);
  const Real& other_min_x = other_box.first(0);
  const Real& other_max_x = other_box.second(0);

  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) ||
    is_between(other_min_x, my_min_x, other_max_x) || is_between(other_min_x, my_max_x, other_max_x);

  bool intersection_true = x_int;

#if LIBMESH_DIM > 1
  const Real& my_min_y = this->first(1);
  const Real& my_max_y = this->second(1);
  const Real& other_min_y = other_box.first(1);
  const Real& other_max_y = other_box.second(1);

  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) ||
    is_between(other_min_y, my_min_y, other_max_y) || is_between(other_min_y, my_max_y, other_max_y);

  intersection_true = intersection_true && y_int;
#endif

#if LIBMESH_DIM > 2
  const Real& my_min_z = this->first(2);
  const Real& my_max_z = this->second(2);
  const Real& other_min_z = other_box.first(2);
  const Real& other_max_z = other_box.second(2);

  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) ||
    is_between(other_min_z, my_min_z, other_max_z) || is_between(other_min_z, my_max_z, other_max_z);

  intersection_true = intersection_true && z_int;
#endif

  return intersection_true;
}

Definition at line 86 of file mesh_tools.h.

References max().

Referenced by BoundingBox().

  {
    for (unsigned int i=0; i<LIBMESH_DIM; i++)
      {
        this->first(i)  =  std::numeric_limits<Real>::max();
        this->second(i) = -std::numeric_limits<Real>::max();
      }
  }
const Point& libMesh::MeshTools::BoundingBox::max ( ) const [inline]

Definition at line 101 of file mesh_tools.h.

Referenced by invalidate().

  { return this->second; }

Definition at line 104 of file mesh_tools.h.

  { return this->second; }
const Point& libMesh::MeshTools::BoundingBox::min ( ) const [inline]

Definition at line 95 of file mesh_tools.h.

  { return this->first; }

Definition at line 98 of file mesh_tools.h.

  { return this->first; }

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