16#ifndef dealii_vector_relations_h
17#define dealii_vector_relations_h
33 namespace VectorRelations
44 template <
int spacedim,
typename Number>
76 template <
int spacedim,
typename Number>
90template <
int spacedim,
typename Number>
95 const Number a_norm = a.
norm();
96 const Number b_norm = b.norm();
97 Assert(a_norm > 1.e-12 * b_norm && a_norm > 1.e-12 * b_norm,
98 ExcMessage(
"Both vectors need to be non-zero!"));
100 Number argument = (a * b) / a_norm / b_norm;
105 if ((1. -
std::abs(argument)) < 8. * std::numeric_limits<Number>::epsilon())
106 argument = std::copysign(1., argument);
108 return std::acos(argument);
113template <
int spacedim,
typename Number>
120 ExcMessage(
"This function can only be used with spacedim==3!"));
123 ExcMessage(
"The axial vector is not a unit vector."));
126 ExcMessage(
"The vectors are not perpendicular to the axial vector."));
128 const Number dot = a *
b;
131 return std::atan2(det, dot);
numbers::NumberTraits< Number >::real_type norm() const
#define DEAL_II_NAMESPACE_OPEN
#define DEAL_II_NAMESPACE_CLOSE
#define Assert(cond, exc)
static ::ExceptionBase & ExcMessage(std::string arg1)
SymmetricTensor< 2, dim, Number > b(const Tensor< 2, dim, Number > &F)
Number signed_angle(const Tensor< 1, spacedim, Number > &a, const Tensor< 1, spacedim, Number > &b, const Tensor< 1, spacedim, Number > &axis)
Number angle(const Tensor< 1, spacedim, Number > &a, const Tensor< 1, spacedim, Number > &b)
::VectorizedArray< Number, width > abs(const ::VectorizedArray< Number, width > &)
constexpr Tensor< 1, dim, typename ProductType< Number1, Number2 >::type > cross_product_3d(const Tensor< 1, dim, Number1 > &src1, const Tensor< 1, dim, Number2 > &src2)