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 _position; }
28  virtual RealVectorValue getDirection() const { return _dir; }
29  virtual Real getRotation() const { return _rotation; }
30 
31  virtual Real getNumElems() const { return _n_elem; }
32  virtual Real getLength() const { return _length; }
33 
34  /*
35  * Computes the axial coordinate for a given point in 3-D space.
36  *
37  * @param[in] p Point in 3-D space
38  */
39  Real computeAxialCoordinate(const Point & p) const;
40 
41  /*
42  * Computes the radial coordinate from the line axis for a given point in 3-D space.
43  *
44  * @param[in] p Point in 3-D space
45  */
46  Real computeRadialCoordinate(const Point & p) const;
47 
48  /*
49  * Gets the axial section index for a given point in 3-D space.
50  *
51  * @param[in] p Point in 3-D space
52  */
53  unsigned int getAxialSectionIndex(const Point & p) const;
54 
55  /*
56  * Gets the axial element index for a given element center point in 3-D space.
57  *
58  * @param[in] p_center Element center point in 3-D space
59  */
60  unsigned int getAxialElementIndex(const Point & p_center) const;
61 
67  Point computeRealPointFromReferencePoint(const Point & p) const;
68 
74  Point computeReferencePointFromRealPoint(const Point & p) const;
75 
83 
87  std::vector<Real> getElementBoundaryCoordinates() const;
88 
89 protected:
91  const Point & _position;
97  const Real & _rotation;
98 
100  std::vector<Real> _lengths;
103 
105  const std::vector<unsigned int> & _n_elems;
107  const unsigned int _n_elem;
108 
110  const unsigned int _n_sections;
112  std::vector<Real> _section_end;
113 
115  std::vector<Real> _x_centers;
116 
121 
126 
128  const std::string _moose_object_name_dlsi;
129 
130 private:
136  static RealVectorValue initializeDirectionVector(const RealVectorValue & dir_unnormalized);
137 
138 public:
139  static InputParameters validParams();
140 
147 
153  static RealTensorValue computeXRotationTransformationTensor(const Real & rotation);
154 
160  static Point computeRealPointFromReferencePoint(const Point & p,
161  const RealVectorValue & position,
162  const RealTensorValue & R,
163  const RealTensorValue & Rx);
164 
170  static Point computeReferencePointFromRealPoint(const Point & p,
171  const RealVectorValue & position,
172  const RealTensorValue & R_inv,
173  const RealTensorValue & Rx_inv);
174 
181  static MooseEnum getAlignmentAxis(const RealVectorValue & dir);
182 
192  static std::vector<Real> getElementBoundaryCoordinates(const RealVectorValue & position,
193  const RealVectorValue & orientation,
194  const Real & rotation,
195  const std::vector<Real> & lengths,
196  const std::vector<unsigned int> & n_elems);
197 };
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 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...
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.
static const std::string R
Definition: NS.h:162
const std::vector< unsigned int > & _n_elems
Number of elements in each axial section.
const unsigned int _n_elem
Total number of axial elements.
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.
unsigned int getAxialElementIndex(const Point &p_center) const
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.