www.mooseframework.org
Public Member Functions | Static 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)
 
virtual ~OrientedBoxInterface ()=default
 Class destructor. More...
 

Static Public Member Functions

static InputParameters validParams ()
 Class constructor. 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 38 of file OrientedBoxInterface.h.

Constructor & Destructor Documentation

◆ OrientedBoxInterface()

OrientedBoxInterface::OrientedBoxInterface ( const InputParameters parameters)

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 = std::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 = std::make_unique<RealTensorValue>(w, l, w.cross(l));
78 }
std::string name(const ElemQuality q)
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:299
std::vector< std::pair< R1, R2 > > get(const std::string &param1, const std::string &param2) const
Combine two vector parameters into a single vector of pairs.
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.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real

◆ ~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(), and OrientedSubdomainBoundingBoxGenerator::generate().

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.

◆ validParams()

InputParameters OrientedBoxInterface::validParams ( )
static

Class constructor.

Definition at line 19 of file OrientedBoxInterface.C.

Referenced by OrientedSubdomainBoundingBoxGenerator::validParams(), and OrientedBoxMarker::validParams().

20 {
21 
23  params.addRequiredParam<Point>("center",
24  "The center (many people spell this 'center') of the box.");
25  params.addRequiredParam<Real>("width", "The width of the box");
26  params.addRequiredParam<Real>("length", "The length of the box");
27  params.addRequiredParam<Real>("height", "The height of the box");
28  params.addRequiredParam<RealVectorValue>("width_direction",
29  "The direction along which the width is oriented.");
30  params.addRequiredParam<RealVectorValue>("length_direction",
31  "The direction along which the length is oriented (must "
32  "be perpendicular to width_direction).");
33  return params;
34 }
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
void addRequiredParam(const std::string &name, const std::string &doc_string)
This method adds a parameter and documentation string to the InputParameters object that will be extr...
InputParameters emptyInputParameters()
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real

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

Referenced by containsPoint(), and OrientedBoxInterface().

◆ _center

Point OrientedBoxInterface::_center
private

Center of the defined bounding box.

Definition at line 63 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 66 of file OrientedBoxInterface.h.

Referenced by containsPoint(), and OrientedBoxInterface().


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