Line data Source code
1 : //* This file is part of the MOOSE framework 2 : //* https://mooseframework.inl.gov 3 : //* 4 : //* All rights reserved, see COPYRIGHT for full restrictions 5 : //* https://github.com/idaholab/moose/blob/master/COPYRIGHT 6 : //* 7 : //* Licensed under LGPL 2.1, please see LICENSE for details 8 : //* https://www.gnu.org/licenses/lgpl-2.1.html 9 : 10 : #pragma once 11 : 12 : // MOOSE includes 13 : #include "MooseTypes.h" 14 : 15 : #include "libmesh/bounding_box.h" // For destructor 16 : #include "libmesh/vector_value.h" 17 : #include "libmesh/tensor_value.h" 18 : 19 : // Forward declarations 20 : class InputParameters; 21 : template <typename T> 22 : InputParameters validParams(); 23 : 24 : /* 25 : * An interface class for testing if a point is within a bounding box with arbitrary orientation 26 : * 27 : * This constructor does most of the work. 28 : * The overall strategy is to create a box of the required size which is centered at the origin, 29 : * with 30 : * the width along the x axis, the length along the y axis, and the height along the z axis 31 : * 32 : * Then create the transformation from real space into this box, which is: 33 : * a translation from center to the origin, then 34 : * a rotation from the oriented box frame to this frame 35 : * 36 : * see OrientedBoxMarker OrientedSubdomainBoundingBox 37 : */ 38 : class OrientedBoxInterface 39 : { 40 : public: 41 : /** 42 : * Class constructor 43 : */ 44 : static InputParameters validParams(); 45 : 46 : OrientedBoxInterface(const InputParameters & parameters); 47 : 48 : /** 49 : * Class destructor 50 : */ 51 29 : virtual ~OrientedBoxInterface() = default; 52 : 53 : protected: 54 : /** 55 : * Test if the supplied point is within the defined oriented bounding box 56 : * @param point The point to test 57 : * @return True if the supplied point is within the bounding box 58 : */ 59 : bool containsPoint(const Point & point); 60 : 61 : private: 62 : /// Center of the defined bounding box 63 : Point _center; 64 : 65 : /// Rotation matrix for transforming the bounding box 66 : std::unique_ptr<RealTensorValue> _rot_matrix; 67 : 68 : /// The bounding box used to test if the point is contained within 69 : std::unique_ptr<libMesh::BoundingBox> _bounding_box; 70 : };