https://mooseframework.inl.gov
DiscreteLineSegmentInterface.h
Go to the documentation of this file.
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 #include "MooseTypes.h"
13 #include "InputParameters.h"
14 #include "libmesh/vector_value.h"
15 #include "libmesh/tensor_value.h"
16 
17 class MooseObject;
18 
23 {
24 public:
25  DiscreteLineSegmentInterface(const MooseObject * moose_object);
26 
27  virtual Point getPosition() const { return getStartPoint(); }
28  Point getStartPoint() const { return _position; }
29  Point getEndPoint() const { return _end_point; }
30  virtual RealVectorValue getDirection() const { return _dir; }
31  virtual Real getRotation() const { return _rotation; }
32 
33  virtual Real getNumElems() const { return _n_elem; }
34  virtual Real getLength() const { return _length; }
35 
37  Real getMinimumElemSize() const { return _dx_min; }
38 
39  /*
40  * Computes the axial coordinate for a given point in 3-D space.
41  *
42  * @param[in] p Point in 3-D space
43  */
44  Real computeAxialCoordinate(const Point & p) const;
45 
46  /*
47  * Computes the radial coordinate from the line axis for a given point in 3-D space.
48  *
49  * @param[in] p Point in 3-D space
50  */
51  Real computeRadialCoordinate(const Point & p) const;
52 
53  /*
54  * Gets the axial section index for a given point in 3-D space.
55  *
56  * @param[in] p Point in 3-D space
57  */
58  unsigned int getAxialSectionIndex(const Point & p) const;
59 
60  /*
61  * Gets the axial element index for a given element center point in 3-D space.
62  *
63  * @param[in] p_center Element center point in 3-D space
64  */
65  unsigned int getAxialElementIndex(const Point & p_center) const;
66 
72  Point computeRealPointFromReferencePoint(const Point & p) const;
73 
79  Point computeReferencePointFromRealPoint(const Point & p) const;
80 
88 
92  std::vector<Real> getElementBoundaryCoordinates() const;
93 
94 protected:
96  const Point & _position;
102  const Real & _rotation;
103 
105  std::vector<Real> _lengths;
108 
110  const Point _end_point;
111 
113  std::vector<unsigned int> _n_elems;
115  unsigned int _n_elem;
116 
118  const unsigned int _n_sections;
120  std::vector<Real> _section_end;
121 
123  std::vector<Real> _x_centers;
124 
129 
134 
136  const std::string _moose_object_name_dlsi;
137 
138 private:
144  static RealVectorValue initializeDirectionVector(const RealVectorValue & dir_unnormalized);
145 
146 public:
147  static InputParameters validParams();
148 
155 
161  static RealTensorValue computeXRotationTransformationTensor(const Real & rotation);
162 
168  static Point computeRealPointFromReferencePoint(const Point & p,
169  const RealVectorValue & position,
170  const RealTensorValue & R,
171  const RealTensorValue & Rx);
172 
178  static Point computeReferencePointFromRealPoint(const Point & p,
179  const RealVectorValue & position,
180  const RealTensorValue & R_inv,
181  const RealTensorValue & Rx_inv);
182 
189  static MooseEnum getAlignmentAxis(const RealVectorValue & dir);
190 
200  static std::vector<Real> getElementBoundaryCoordinates(const RealVectorValue & position,
201  const RealVectorValue & orientation,
202  const Real & rotation,
203  const std::vector<Real> & lengths,
204  const std::vector<unsigned int> & n_elems);
205 
208 };
Defines a discretized line segment in 3D space.
Real computeAxialCoordinate(const Point &p) const
unsigned int getAxialSectionIndex(const Point &p) const
static RealTensorValue computeXRotationTransformationTensor(const Real &rotation)
Computes the rotation transformation tensor.
virtual RealVectorValue getDirection() const
const RealTensorValue _Rx_inv
Inverse rotational transformation tensor about x-axis.
std::vector< Real > _lengths
Length of each axial section.
static RealTensorValue computeDirectionTransformationTensor(const RealVectorValue &dir)
Computes the direction transformation tensor.
const Point _end_point
End point of line segment.
const double R
const Real & _rotation
Angle of rotation about the x-axis.
const RealVectorValue & _dir_unnormalized
Unnormalized direction of axis from start position to end position.
const RealVectorValue _dir
Normalized direction of axis from start position to end position.
TensorValue< Real > RealTensorValue
std::vector< Real > _section_end
Axial coordinate of the end of each axial section using the line &#39;position&#39; as the origin...
unsigned int _n_elem
Total number of axial elements.
const unsigned int _n_sections
Number of axial sections.
const Point & _position
Start position of axis in 3-D space.
Real computeRadialCoordinate(const Point &p) const
Point computeReferencePointFromRealPoint(const Point &p) const
Computes point in reference space from a point in 3-D space.
const RealTensorValue _R_inv
Inverse direction transformation tensor.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
const RealTensorValue _Rx
Rotational transformation tensor about x-axis.
const RealTensorValue _R
Direction transformation tensor.
MooseEnum getAlignmentAxis() const
Gets an axis MooseEnum for the axis the component is aligned with.
const Real p
unsigned int getAxialElementIndex(const Point &p_center) const
std::vector< unsigned int > _n_elems
Number of elements in each axial section.
const std::string _moose_object_name_dlsi
Name of the MOOSE object.
DiscreteLineSegmentInterface(const MooseObject *moose_object)
static RealVectorValue initializeDirectionVector(const RealVectorValue &dir_unnormalized)
Computes a normalized direction vector or reports an error if the zero vector is provided.
std::vector< Real > getElementBoundaryCoordinates() const
Gets the element boundary coordinates for the aligned axis.
Point computeRealPointFromReferencePoint(const Point &p) const
Computes point in 3-D space from a point in reference space.
std::vector< Real > _x_centers
Center axial coordinate of each axial element.
Real getMinimumElemSize() const
Gets the minimum element size.