10 #ifndef INCLUDED_ATOMSMATHSHEAR_H
11 #define INCLUDED_ATOMSMATHSHEAR_H
13 #include <AtomsMath/ImathMath.h>
14 #include <AtomsMath/ImathNamespace.h>
15 #include <AtomsMath/ImathVec.h>
18 ATOMSMATH_INTERNAL_NAMESPACE_HEADER_ENTER
120 T xy, xz, yz, yx, zx, zy;
125 ATOMSMATH_HOSTDEVICE ATOMSMATH_CONSTEXPR14 T&
operator[] (
int i);
128 ATOMSMATH_HOSTDEVICE constexpr
const T&
operator[] (
int i)
const;
134 ATOMSMATH_HOSTDEVICE ATOMSMATH_CONSTEXPR14
Shear6();
137 ATOMSMATH_HOSTDEVICE ATOMSMATH_CONSTEXPR14
Shear6 (T XY, T XZ, T YZ);
140 ATOMSMATH_HOSTDEVICE ATOMSMATH_CONSTEXPR14
Shear6 (
const Vec3<T>& v);
147 ATOMSMATH_HOSTDEVICE ATOMSMATH_CONSTEXPR14
Shear6 (T XY,
155 ATOMSMATH_HOSTDEVICE ATOMSMATH_CONSTEXPR14
Shear6 (
const Shear6& h);
158 template <
class S> ATOMSMATH_HOSTDEVICE ATOMSMATH_CONSTEXPR14
Shear6 (
const Shear6<S>& h);
176 template <
class S> ATOMSMATH_HOSTDEVICE
void setValue (S XY, S XZ, S YZ, S YX, S ZX, S ZY);
183 ATOMSMATH_HOSTDEVICE
void getValue (S& XY, S& XZ, S& YZ, S& YX, S& ZX, S& ZY)
const;
192 ATOMSMATH_HOSTDEVICE
const T*
getValue()
const;
233 ATOMSMATH_HOSTDEVICE ATOMSMATH_CONSTEXPR14
const Shear6&
negate();
264 ATOMSMATH_HOSTDEVICE constexpr
static T
baseTypeLowest() noexcept {
return std::numeric_limits<T>::lowest(); }
267 ATOMSMATH_HOSTDEVICE constexpr
static T
baseTypeMax() noexcept {
return std::numeric_limits<T>::max(); }
270 ATOMSMATH_HOSTDEVICE constexpr
static T
baseTypeSmallest() noexcept {
return std::numeric_limits<T>::min(); }
273 ATOMSMATH_HOSTDEVICE constexpr
static T
baseTypeEpsilon() noexcept {
return std::numeric_limits<T>::epsilon(); }
278 ATOMSMATH_HOSTDEVICE constexpr
static unsigned int dimensions() {
return 6; }
286 template <
class T> std::ostream& operator<< (std::ostream& s,
const Shear6<T>& h);
289 template <
class S,
class T>
309 ATOMSMATH_CONSTEXPR14
inline T&
316 constexpr
inline const T&
324 xy = xz = yz = yx = zx = zy = 0;
357 template <
class T> ATOMSMATH_CONSTEXPR14
inline Shear6<T>::Shear6 (T XY, T XZ, T YZ, T YX, T ZX, T ZY)
390 ATOMSMATH_CONSTEXPR14
inline const Shear6<T>&
404 ATOMSMATH_CONSTEXPR14
inline const Shear6<T>&
479 return (
const T*) &xy;
484 constexpr
inline bool
487 return xy == h.xy && xz == h.xz && yz == h.yz && yx == h.yx && zx == h.zx && zy == h.zy;
492 constexpr
inline bool
495 return xy != h.xy || xz != h.xz || yz != h.yz || yx != h.yx || zx != h.zx || zy != h.zy;
499 ATOMSMATH_CONSTEXPR14
inline bool
502 for (
int i = 0; i < 6; i++)
503 if (!ATOMSMATH_INTERNAL_NAMESPACE::equalWithAbsError ((*
this)[i], h[i], e))
510 ATOMSMATH_CONSTEXPR14
inline bool
513 for (
int i = 0; i < 6; i++)
514 if (!ATOMSMATH_INTERNAL_NAMESPACE::equalWithRelError ((*
this)[i], h[i], e))
521 ATOMSMATH_CONSTEXPR14
inline const Shear6<T>&
537 return Shear6 (xy + h.xy, xz + h.xz, yz + h.yz, yx + h.yx, zx + h.zx, zy + h.zy);
541 ATOMSMATH_CONSTEXPR14
inline const Shear6<T>&
557 return Shear6 (xy - h.xy, xz - h.xz, yz - h.yz, yx - h.yx, zx - h.zx, zy - h.zy);
564 return Shear6 (-xy, -xz, -yz, -yx, -zx, -zy);
568 ATOMSMATH_CONSTEXPR14
inline const Shear6<T>&
581 ATOMSMATH_CONSTEXPR14
inline const Shear6<T>&
594 ATOMSMATH_CONSTEXPR14
inline const Shear6<T>&
610 return Shear6 (xy * h.xy, xz * h.xz, yz * h.yz, yx * h.yx, zx * h.zx, zy * h.zy);
617 return Shear6 (xy * a, xz * a, yz * a, yx * a, zx * a, zy * a);
621 ATOMSMATH_CONSTEXPR14
inline const Shear6<T>&
634 ATOMSMATH_CONSTEXPR14
inline const Shear6<T>&
650 return Shear6 (xy / h.xy, xz / h.xz, yz / h.yz, yx / h.yx, zx / h.zx, zy / h.zy);
657 return Shear6 (xy / a, xz / a, yz / a, yx / a, zx / a, zy / a);
666 operator<< (std::ostream& s,
const Shear6<T>& h)
668 return s <<
'(' << h.xy <<
' ' << h.xz <<
' ' << h.yz << h.yx <<
' ' << h.zx <<
' ' << h.zy
676 template <
class S,
class T>
680 return Shear6<T> (a * h.xy, a * h.xz, a * h.yz, a * h.yx, a * h.zx, a * h.zy);
683 ATOMSMATH_INTERNAL_NAMESPACE_HEADER_EXIT
Definition: ImathShear.h:114
constexpr static ATOMSMATH_HOSTDEVICE T baseTypeLowest() noexcept
Largest possible negative value.
Definition: ImathShear.h:264
ATOMSMATH_HOSTDEVICE ATOMSMATH_CONSTEXPR14 bool equalWithAbsError(const Shear6< T > &h, T e) const
Definition: ImathShear.h:500
constexpr static ATOMSMATH_HOSTDEVICE T baseTypeSmallest() noexcept
Smallest possible positive value.
Definition: ImathShear.h:270
ATOMSMATH_HOSTDEVICE ATOMSMATH_CONSTEXPR14 Shear6(const Vec3< S > &v)
Initialize to the given XY, XZ, YZ values held in (v.x, v.y, v.z)
constexpr static ATOMSMATH_HOSTDEVICE unsigned int dimensions()
Return the number of dimensions, i.e. 6.
Definition: ImathShear.h:278
~Shear6()=default
Destructor.
ATOMSMATH_HOSTDEVICE ATOMSMATH_CONSTEXPR14 const Shear6 & operator-=(const Shear6 &h)
Component-wise subtraction.
Definition: ImathShear.h:542
constexpr ATOMSMATH_HOSTDEVICE Shear6 operator*(const Shear6 &h) const
Component-wise multiplication.
Definition: ImathShear.h:608
ATOMSMATH_HOSTDEVICE ATOMSMATH_CONSTEXPR14 const Shear6 & operator=(const Shear6 &h)
Assignment.
Definition: ImathShear.h:391
ATOMSMATH_HOSTDEVICE ATOMSMATH_CONSTEXPR14 const Shear6 & operator*=(const Shear6 &h)
Component-wise multiplication.
Definition: ImathShear.h:582
constexpr ATOMSMATH_HOSTDEVICE Shear6 operator/(const Shear6 &h) const
Component-wise division.
Definition: ImathShear.h:648
constexpr ATOMSMATH_HOSTDEVICE bool operator!=(const Shear6< S > &h) const
Inequality.
ATOMSMATH_HOSTDEVICE ATOMSMATH_CONSTEXPR14 T & operator[](int i)
Element access.
Definition: ImathShear.h:310
constexpr ATOMSMATH_HOSTDEVICE Shear6 operator+(const Shear6 &h) const
Component-wise addition.
Definition: ImathShear.h:535
ATOMSMATH_HOSTDEVICE T * getValue()
Return a raw pointer to the array of values.
Definition: ImathShear.h:470
ATOMSMATH_HOSTDEVICE ATOMSMATH_CONSTEXPR14 Shear6()
Initialize to 0.
Definition: ImathShear.h:322
ATOMSMATH_HOSTDEVICE ATOMSMATH_CONSTEXPR14 const Shear6 & operator/=(const Shear6 &h)
Component-wise division.
Definition: ImathShear.h:622
constexpr static ATOMSMATH_HOSTDEVICE T baseTypeMax() noexcept
Largest possible positive value.
Definition: ImathShear.h:267
ATOMSMATH_HOSTDEVICE void setValue(S XY, S XZ, S YZ, S YX, S ZX, S ZY)
Set the value.
ATOMSMATH_HOSTDEVICE ATOMSMATH_CONSTEXPR14 const Shear6 & negate()
Component-wise multiplication by -1.
Definition: ImathShear.h:569
ATOMSMATH_HOSTDEVICE void getValue(Shear6< S > &h) const
Return the value in h
constexpr ATOMSMATH_HOSTDEVICE bool operator==(const Shear6< S > &h) const
Equality.
constexpr static ATOMSMATH_HOSTDEVICE T baseTypeEpsilon() noexcept
Smallest possible e for which 1+e != 1.
Definition: ImathShear.h:273
T BaseType
Definition: ImathShear.h:282
ATOMSMATH_HOSTDEVICE ATOMSMATH_CONSTEXPR14 Shear6(const Shear6< S > &h)
Construct from a Shear6 object of another base type.
ATOMSMATH_HOSTDEVICE void getValue(S &XY, S &XZ, S &YZ, S &YX, S &ZX, S &ZY) const
Return the values.
constexpr ATOMSMATH_HOSTDEVICE Shear6 operator-() const
Component-wise multiplication by -1.
Definition: ImathShear.h:562
ATOMSMATH_HOSTDEVICE ATOMSMATH_CONSTEXPR14 bool equalWithRelError(const Shear6< T > &h, T e) const
Definition: ImathShear.h:511
ATOMSMATH_HOSTDEVICE void setValue(const Shear6< S > &h)
Set the value.
ATOMSMATH_HOSTDEVICE ATOMSMATH_CONSTEXPR14 const Shear6 & operator+=(const Shear6 &h)
Component-wise addition.
Definition: ImathShear.h:522
Definition: ImathVec.h:260