16#ifndef dealii_vector_relations_h
17#define dealii_vector_relations_h
34 namespace VectorRelations
45 template <
int spacedim,
typename Number>
77 template <
int spacedim,
typename Number>
91template <
int spacedim,
typename Number>
96 const Number a_norm = a.
norm();
97 const Number b_norm = b.norm();
98 Assert(a_norm > 1.e-12 * b_norm && a_norm > 1.e-12 * b_norm,
99 ExcMessage(
"Both vectors need to be non-zero!"));
101 Number argument = (a * b) / a_norm / b_norm;
106 if ((1. -
std::abs(argument)) < 8. * std::numeric_limits<Number>::epsilon())
107 argument = std::copysign(1., argument);
109 return std::acos(argument);
114template <
int spacedim,
typename Number>
121 ExcMessage(
"This function can only be used with spacedim==3!"));
124 ExcMessage(
"The axial vector is not a unit vector."));
127 ExcMessage(
"The vectors are not perpendicular to the axial vector."));
129 const Number dot = a *
b;
130 const Number det = axis * cross_product_3d(a, b);
132 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 > &)