www.mooseframework.org
Public Member Functions | Protected Member Functions | Private Attributes | List of all members
OrientedBoxInterface Class Reference

#include <OrientedBoxInterface.h>

Inheritance diagram for OrientedBoxInterface:
[legend]

Public Member Functions

 OrientedBoxInterface (const InputParameters &parameters)
 Class constructor. More...
 
virtual ~OrientedBoxInterface ()=default
 Class destructor. More...
 

Protected Member Functions

bool containsPoint (const Point &point)
 Test if the supplied point is within the defined oriented bounding box. More...
 

Private Attributes

Point _center
 Center of the defined bounding box. More...
 
std::unique_ptr< RealTensorValue > _rot_matrix
 Rotation matrix for transforming the bounding box. More...
 
std::unique_ptr< BoundingBox > _bounding_box
 The bounding box used to test if the point is contained within. More...
 

Detailed Description

Definition at line 49 of file OrientedBoxInterface.h.

Constructor & Destructor Documentation

OrientedBoxInterface::OrientedBoxInterface ( const InputParameters parameters)

Class constructor.

Definition at line 41 of file OrientedBoxInterface.C.

42  : _center(parameters.get<Point>("center"))
43 {
44  const std::string & name = parameters.get<std::string>("_object_name");
45 
46  // Define the bounding box
47  Real xmax = 0.5 * parameters.get<Real>("width");
48  Real ymax = 0.5 * parameters.get<Real>("length");
49  Real zmax = 0.5 * parameters.get<Real>("height");
50 
51  Point bottom_left(-xmax, -ymax, -zmax);
52  Point top_right(xmax, ymax, zmax);
53 
54  _bounding_box = libmesh_make_unique<BoundingBox>(bottom_left, top_right);
55 
56  /*
57  * now create the rotation matrix that rotates the oriented
58  * box's width direction to "x", its length direction to "y"
59  * and its height direction to "z"
60  */
61  RealVectorValue w = parameters.get<RealVectorValue>("width_direction");
62  RealVectorValue l = parameters.get<RealVectorValue>("length_direction");
63 
64  /*
65  * Normalize the width and length directions in readiness for
66  * insertion into the rotation matrix
67  */
68  Real len = w.norm();
69  if (len == 0.0)
70  mooseError("Length of width_direction vector is zero in ", name);
71  w /= len;
72 
73  len = l.norm();
74  if (len == 0.0)
75  mooseError("Length of length_direction vector is zero in ", name);
76  l /= len;
77 
78  if (w * l > 1E-10)
79  mooseError("width_direction and length_direction are not perpendicular in ", name);
80 
81  // The rotation matrix!
82  _rot_matrix = libmesh_make_unique<RealTensorValue>(w, l, w.cross(l));
83 }
VectorValue< Real > RealVectorValue
Definition: Assembly.h:40
void mooseError(Args &&...args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:182
Point _center
Center of the defined bounding box.
std::unique_ptr< RealTensorValue > _rot_matrix
Rotation matrix for transforming the bounding box.
std::unique_ptr< BoundingBox > _bounding_box
The bounding box used to test if the point is contained within.
virtual OrientedBoxInterface::~OrientedBoxInterface ( )
virtualdefault

Class destructor.

Member Function Documentation

bool OrientedBoxInterface::containsPoint ( const Point &  point)
protected

Test if the supplied point is within the defined oriented bounding box.

Parameters
pointThe point to test
Returns
True if the supplied point is within the bounding box

Definition at line 86 of file OrientedBoxInterface.C.

Referenced by OrientedBoxMarker::computeElementMarker(), and OrientedSubdomainBoundingBox::modify().

87 {
88  // Translate the point to the origin, and then rotate
89  return _bounding_box->contains_point((*_rot_matrix) * (point - _center));
90 }
Point _center
Center of the defined bounding box.
std::unique_ptr< RealTensorValue > _rot_matrix
Rotation matrix for transforming the bounding box.
std::unique_ptr< BoundingBox > _bounding_box
The bounding box used to test if the point is contained within.

Member Data Documentation

std::unique_ptr<BoundingBox> OrientedBoxInterface::_bounding_box
private

The bounding box used to test if the point is contained within.

Definition at line 78 of file OrientedBoxInterface.h.

Referenced by containsPoint(), and OrientedBoxInterface().

Point OrientedBoxInterface::_center
private

Center of the defined bounding box.

Definition at line 72 of file OrientedBoxInterface.h.

Referenced by containsPoint().

std::unique_ptr<RealTensorValue> OrientedBoxInterface::_rot_matrix
private

Rotation matrix for transforming the bounding box.

Definition at line 75 of file OrientedBoxInterface.h.

Referenced by containsPoint(), and OrientedBoxInterface().


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