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"
49 template <
typename T2>
79 template <
typename Scalar>
90 const Scalar>::type & zz=0);
95 template <
typename T2>
101 template <
typename T2>
108 template <
typename T2>
117 template <
typename T2>
123 template <
typename T2>
127#ifdef LIBMESH_USE_COMPLEX_NUMBERS
141 template <
typename Scalar>
142 typename std::enable_if<
146 { libmesh_assert_equal_to (p, Scalar(0)); this->
zero();
return *
this; }
239template <
typename Scalar>
251 const Scalar>::type & zz) :
259template <
typename T2>
269template <
typename T2>
279template <
typename T2>
290template <
typename T2>
302template <
typename T2>
310#ifdef LIBMESH_USE_COMPLEX_NUMBERS
316 Complex (p_re(0,1), p_im(0,1)),
317 Complex (p_re(0,2), p_im(0,2)),
318 Complex (p_re(1,0), p_im(1,0)),
319 Complex (p_re(1,1), p_im(1,1)),
320 Complex (p_re(1,2), p_im(1,2)),
321 Complex (p_re(2,0), p_im(2,0)),
322 Complex (p_re(2,1), p_im(2,1)),
323 Complex (p_re(2,2), p_im(2,2)))
337 const Real p = -phi / 180. *
pi;
338 const Real t = -theta / 180. *
pi;
339 const Real s = -psi / 180. *
pi;
340 const Real sp = std::sin(p), cp = std::cos(p);
341 const Real st = std::sin(t), ct = std::cos(t);
342 const Real ss = std::sin(s), cs = std::cos(s);
345 sp * cs + cp * ct * ss,
347 -cp * ss - sp * ct * cs,
348 -sp * ss + cp * ct * cs,
355 libmesh_error_msg(
"TensorValue<T>::intrinsic_rotation_matrix() requires libMesh to be compiled "
356 "with LIBMESH_DIM==3");
373 const Real angle2_deg,
374 const Real angle3_deg)
377 const auto angle1 = angle1_deg / 180. *
pi;
378 const auto angle2 = angle2_deg / 180. *
pi;
379 const auto angle3 = angle3_deg / 180. *
pi;
380 const auto s1 = std::sin(angle1), c1 = std::cos(angle1);
381 const auto s2 = std::sin(angle2), c2 = std::cos(angle2);
382 const auto s3 = std::sin(angle3), c3 = std::cos(angle3);
385 -c1 * s3 - c2 * c3 * s1,
387 c3 * s1 + c1 * c2 * s3,
388 c1 * c2 * c3 - s1 * s3,
395 libmesh_error_msg(
"TensorValue<T>::extrinsic_rotation_matrix() requires libMesh to be compiled "
396 "with LIBMESH_DIM==3");
405 const Real angle2_deg,
406 const Real angle3_deg)
414#ifdef LIBMESH_HAVE_METAPHYSICL
425 for (
unsigned int i = 0; i < LIBMESH_DIM; ++i)
426 for (
unsigned int j = 0; j < LIBMESH_DIM; ++j)
427 ret(i,j) = raw_value(in(i,j));
433template <
typename T,
typename U>
434struct ReplaceAlgebraicType<
libMesh::TensorValue<T>, U>
This class defines a tensor in LIBMESH_DIM dimensional Real or Complex space.
static TensorValue< Real > extrinsic_rotation_matrix(Real angle1_deg, Real angle2_deg, Real angle3_deg)
Generate the extrinsic rotation matrix associated with the provided Euler angles.
static TensorValue< Real > inverse_extrinsic_rotation_matrix(Real angle1_deg, Real angle2_deg, Real angle3_deg)
Invert the rotation that would occur if the same angles were provided to extrinsic_rotation_matrix,...
std::enable_if< ScalarTraits< Scalar >::value, TensorValue & >::type operator=(const Scalar &libmesh_dbg_var(p))
Assignment-from-scalar operator.
TensorValue()
Empty constructor.
static TensorValue< Real > inverse_intrinsic_rotation_matrix(Real phi, Real theta, Real psi)
Invert the rotation that would occur if the same angles were provided to intrinsic_rotation_matrix,...
static TensorValue< Real > intrinsic_rotation_matrix(Real phi, Real theta, Real psi)
Generate the intrinsic rotation matrix associated with the provided Euler angles.
This class defines a tensor in LIBMESH_DIM dimensional space of type T.
void zero()
Set all entries of the tensor to 0.
TypeTensor< T > transpose() const
This class defines a vector in LIBMESH_DIM dimensional space of type T.
The libMesh namespace provides an interface to certain functionality in the library.
TensorValue< Number > NumberTensorValue
std::complex< Real > Complex
void libmesh_ignore(const Args &...)
TensorValue< Real > RealTensorValue
Useful typedefs to allow transparent switching between Real and Complex data types.
RealTensorValue RealTensor
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real