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 44 of file OrientedBoxInterface.h.

Constructor & Destructor Documentation

◆ OrientedBoxInterface()

OrientedBoxInterface::OrientedBoxInterface ( const InputParameters parameters)

Class constructor.

Definition at line 36 of file OrientedBoxInterface.C.

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

◆ ~OrientedBoxInterface()

virtual OrientedBoxInterface::~OrientedBoxInterface ( )
virtualdefault

Class destructor.

Member Function Documentation

◆ containsPoint()

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 81 of file OrientedBoxInterface.C.

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

82 {
83  // Translate the point to the origin, and then rotate
84  return _bounding_box->contains_point((*_rot_matrix) * (point - _center));
85 }
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

◆ _bounding_box

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

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

Definition at line 73 of file OrientedBoxInterface.h.

Referenced by containsPoint(), and OrientedBoxInterface().

◆ _center

Point OrientedBoxInterface::_center
private

Center of the defined bounding box.

Definition at line 67 of file OrientedBoxInterface.h.

Referenced by containsPoint().

◆ _rot_matrix

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

Rotation matrix for transforming the bounding box.

Definition at line 70 of file OrientedBoxInterface.h.

Referenced by containsPoint(), and OrientedBoxInterface().


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