18 class Vec_3D :
public std::array<T, 3>
24 template<
typename ...U>
Vec_3D(U...init):
25 std::array<
T, 3>{init...} {}
28 std::array<
T, 3>({
T(std::get<0>(vec)),
T(std::get<1>(vec)),
T(std::get<2>(vec))}) {}
34 for (
T val : *
this) tmp += val*val;
38 auto norm() const -> decltype(
sqrt(norm2())) {
return sqrt(norm2()); }
44 for(
size_t i = 0; i < 3; ++i) (*
this)[i] += rhs[i];
51 for(
size_t i = 0; i < 3; ++i) (*
this)[i] -= rhs[i];
58 for(
T& val : *
this) val *= rhs;
65 for(
T& val : *
this) val /= rhs;
71 template <
typename T,
typename U>
78 template <
typename T,
typename U>
85 template <
typename T,
typename U>
92 template <
typename T,
typename U>
96 for(
size_t i = 0; i < 3; ++i) tmp[i] = lhs*rhs[i];
100 template <
typename T,
typename U>
103 for(
T& val : lhs) val /= rhs;
Vec_3D< T > operator*(Vec_3D< T > lhs, U rhs)
Vec_3D< T > operator-(Vec_3D< T > lhs, const Vec_3D< U > &rhs)
Vec_3D< T > operator+(Vec_3D< T > lhs, const Vec_3D< U > &rhs)
Grid< NDIM, T > sqrt(Grid< NDIM, T > lhs)
Vec_3D< T > operator/(Vec_3D< T > lhs, U rhs)
auto operator+=(std::string &lhs, StringRef const &sr) -> std::string &
: class handling basic 3D-vector functions, definitions