15#ifndef dealii_vector_relations_h
16#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);
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;
129 const Number det = axis * cross_product_3d(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 > &)
inline ::VectorizedArray< Number, width > acos(const ::VectorizedArray< Number, width > &x)