13 #include "libmesh/vector_value.h" 14 #include "libmesh/tensor_value.h" 22 template <
bool is_ad = false>
29 vec /=
sqrt(vec * vec);
38 if ((w(2) >= w(1) && w(1) >= w(0)) || (w(1) >= w(2) && w(2) >= w(0)))
41 else if ((w(2) >= w(0) && w(0) >= w(1)) || (w(0) >= w(2) && w(2) >= w(1)))
48 v1 -= (v1 * vec) * vec;
53 v0(0) = v1(1) * vec(2) - v1(2) * vec(1);
54 v0(1) = v1(2) * vec(0) - v1(0) * vec(2);
55 v0(2) = v1(0) * vec(1) - v1(1) * vec(0);
59 v0(0), v0(1), v0(2), v1(0), v1(1), v1(2), vec(0), vec(1), vec(2));
64 template <
bool is_ad = false>
71 return rot2_to_z.transpose() * rot1_to_z;
75 template <
bool is_ad = false>
94 template <
bool is_ad = false>
114 mooseError(
"Rotation matrix cannot be generated for opposite-facing vectors at this time!");
118 k_vec /= k_vec.norm();
119 Real cos_theta = u * v;
120 Real theta = std::acos(cos_theta);
124 0, -k_vec(2), k_vec(1), k_vec(2), 0, -k_vec(0), -k_vec(1), k_vec(0), 0);
129 rot_matrix = I + sin_theta * K_matrix + (1 - cos_theta) * K_matrix * K_matrix;
MetaPhysicL::DualNumber< V, D, asd > abs(const MetaPhysicL::DualNumber< V, D, asd > &a)
Moose::GenericType< Real, is_ad > GenericReal
CTSub CT_OPERATOR_BINARY CTMul CTCompareLess CTCompareGreater CTCompareEqual _arg template * sin(_arg) *_arg.template D< dtag >()) CT_SIMPLE_UNARY_FUNCTION(tan
GenericRealTensorValue< is_ad > rotVec2DToX(const GenericRealVectorValue< is_ad > &vec)
provides a rotation matrix that will rotate the vector vec1 to the [1,0,0], assuming vec1[2]==0 ...
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
static constexpr Real TOLERANCE
Utility functions to return rotations matrics.
GenericRealTensorValue< is_ad > rodriguesRotationMatrix(GenericRealVectorValue< is_ad > vec1, GenericRealVectorValue< is_ad > vec2)
Provides rotatiom matrix for rotating from vec1 to vec2 using Rodrigues' rotation forumula...
Moose::GenericType< RealTensorValue, is_ad > GenericRealTensorValue
CTSub CT_OPERATOR_BINARY CTMul CTCompareLess CTCompareGreater CTCompareEqual _arg template cos(_arg) *_arg.template D< dtag >()) CT_SIMPLE_UNARY_FUNCTION(cos
Moose::GenericType< RealVectorValue, is_ad > GenericRealVectorValue
GenericRealTensorValue< is_ad > rotVecToZ(GenericRealVectorValue< is_ad > vec)
provides a rotation matrix that will rotate the vector vec to the z axis (the "2" direction) ...
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
GenericRealTensorValue< is_ad > rotVec1ToVec2(GenericRealVectorValue< is_ad > vec1, GenericRealVectorValue< is_ad > vec2)
provides a rotation matrix that will rotate the vector vec1 to vec2
CTSub CT_OPERATOR_BINARY CTMul CTCompareLess CTCompareGreater CTCompareEqual _arg template * sqrt(_arg)) *_arg.template D< dtag >()) CT_SIMPLE_UNARY_FUNCTION(tanh