20 #ifndef LIBMESH_TENSOR_VALUE_H
21 #define LIBMESH_TENSOR_VALUE_H
24 #include "libmesh/type_tensor.h"
25 #include "libmesh/libmesh.h"
27 #ifdef LIBMESH_HAVE_METAPHYSICL
28 #include "metaphysicl/raw_type.h"
42 class TensorValue :
public TypeTensor<T>
47 template <
typename T2>
93 template <
typename Scalar>
103 boostcopy::enable_if_c<ScalarTraits<Scalar>::value,
104 const Scalar>::type & zz=0);
110 template <
typename T2>
118 template <
typename T2>
128 template <
typename T2>
137 template <
typename T2>
144 template <
typename T2>
147 #ifdef LIBMESH_USE_COMPLEX_NUMBERS
162 template <
typename Scalar>
163 typename boostcopy::enable_if_c<
164 ScalarTraits<Scalar>::value,
167 { libmesh_assert_equal_to (p, Scalar(0)); this->
zero();
return *
this; }
229 template <
typename T>
238 template <
typename T>
254 template <
typename T>
255 template <
typename Scalar>
266 boostcopy::enable_if_c<ScalarTraits<Scalar>::value,
267 const Scalar>::type & zz) :
274 template <
typename T>
275 template <
typename T2>
284 template <
typename T>
285 template <
typename T2>
294 template <
typename T>
295 template <
typename T2>
305 template <
typename T>
306 template <
typename T2>
317 template <
typename T>
318 template <
typename T2>
326 #ifdef LIBMESH_USE_COMPLEX_NUMBERS
327 template <
typename T>
332 Complex (p_re(0,1), p_im(0,1)),
333 Complex (p_re(0,2), p_im(0,2)),
334 Complex (p_re(1,0), p_im(1,0)),
335 Complex (p_re(1,1), p_im(1,1)),
336 Complex (p_re(1,2), p_im(1,2)),
337 Complex (p_re(2,0), p_im(2,0)),
338 Complex (p_re(2,1), p_im(2,1)),
339 Complex (p_re(2,2), p_im(2,2)))
344 template <
typename T>
353 const Real p = -phi / 180. *
pi;
354 const Real t = -theta / 180. *
pi;
355 const Real s = -psi / 180. *
pi;
356 const Real sp = std::sin(p), cp = std::cos(p);
357 const Real st = std::sin(t), ct = std::cos(t);
358 const Real ss = std::sin(s), cs = std::cos(s);
361 sp * cs + cp * ct * ss,
363 -cp * ss - sp * ct * cs,
364 -sp * ss + cp * ct * cs,
371 libmesh_error_msg(
"TensorValue<T>::intrinsic_rotation_matrix() requires libMesh to be compiled "
372 "with LIBMESH_DIM==3");
378 template <
typename T>
386 template <
typename T>
389 const Real angle2_deg,
390 const Real angle3_deg)
393 const auto angle1 = angle1_deg / 180. *
pi;
394 const auto angle2 = angle2_deg / 180. *
pi;
395 const auto angle3 = angle3_deg / 180. *
pi;
396 const auto s1 = std::sin(angle1), c1 = std::cos(angle1);
397 const auto s2 = std::sin(angle2), c2 = std::cos(angle2);
398 const auto s3 = std::sin(angle3), c3 = std::cos(angle3);
401 -c1 * s3 - c2 * c3 * s1,
403 c3 * s1 + c1 * c2 * s3,
404 c1 * c2 * c3 - s1 * s3,
411 libmesh_error_msg(
"TensorValue<T>::extrinsic_rotation_matrix() requires libMesh to be compiled "
412 "with LIBMESH_DIM==3");
418 template <
typename T>
421 const Real angle2_deg,
422 const Real angle3_deg)
430 #ifdef LIBMESH_HAVE_METAPHYSICL
431 namespace MetaPhysicL
433 template <
typename T>
434 struct RawType<libMesh::TensorValue<T>>
441 for (
unsigned int i = 0; i < LIBMESH_DIM; ++i)
442 for (
unsigned int j = 0; j < LIBMESH_DIM; ++j)
443 ret(i,j) = raw_value(in(i,j));
449 template <
typename T,
typename U>
450 struct ReplaceAlgebraicType<libMesh::TensorValue<T>, U>
457 #endif // LIBMESH_TENSOR_VALUE_H
static TensorValue< Real > extrinsic_rotation_matrix(Real angle1_deg, Real angle2_deg, Real angle3_deg)
生成与提供的欧拉角关联的外禀旋转矩阵。外禀旋转旋转域中的物体,并保持坐标轴不变。 我们遵循https://en.wikipedia.org/wiki/Euler_angles#Rotation_matr...
static TensorValue< Real > inverse_extrinsic_rotation_matrix(Real angle1_deg, Real angle2_deg, Real angle3_deg)
反转与提供给extrinsic_rotation_matrix的相同角度的旋转,即返回到原始起始点。
void zero()
将 Tensor 的所有元素设置为零。
static TensorValue< Real > inverse_intrinsic_rotation_matrix(Real phi, Real theta, Real psi)
反转与提供给intrinsic_rotation_matrix的相同角度的旋转,即返回到原始起始点。 所有角度应以度为单位提供。
RealTensorValue RealTensor
boostcopy::enable_if_c< ScalarTraits< Scalar >::value, TensorValue & >::type operator=(const Scalar &libmesh_dbg_var(p))
赋值给标量的运算符。仅用于将张量清零。
This class defines a tensor in LIBMESH_DIM dimensional space of type T.
TensorValue()
无参构造函数。 在LIBMESH_DIM维度的T空间中创建零张量。
void libmesh_ignore(const Args &...)
static TensorValue< Real > intrinsic_rotation_matrix(Real phi, Real theta, Real psi)
生成与提供的欧拉角关联的内禀旋转矩阵。内禀旋转会保持域中的物体不动,同时旋转坐标轴。 我们遵循http://mathworld.wolfram.com/EulerAngles.html中描述的约定 (方程6-14给出了复合变换矩阵的条目)。旋转在z、x'和z''轴上按顺序执行。旋 转序列的每个步骤中的正角度给出了在旋转轴周围以逆时针方向旋转实体的外观,尽管事实上 旋转的是坐标轴本身。为了给出物体逆时针旋转的外观,我们实际上将角度传递到方法中的负角度。 所有角度应以度为单位提供。
该类定义了一个在 LIBMESH_DIM 维度空间中类型为 T 的向量。
std::complex< Real > Complex
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
TensorValue< Number > NumberTensorValue
TensorValue< Real > RealTensorValue
用于允许在实数和复数数据类型之间无缝切换的有用typedef。
此类定义了LIBMESH_DIM维度的实数或复数空间中的张量。typedef RealTensorValue总是定义为实数值的张量, 而NumberTensorValue则根据库的配置定义为实数或复数值...