Make all Vec types consistently mark methods as inline

This commit is contained in:
Robert Maynard 2018-04-25 10:48:28 -04:00
parent e10ee281c7
commit dc6e7d1ac8
2 changed files with 68 additions and 62 deletions

@ -200,7 +200,7 @@ template <vtkm::IdComponent Size>
struct VecComponentWiseUnaryOperation struct VecComponentWiseUnaryOperation
{ {
template <typename T, typename UnaryOpType> template <typename T, typename UnaryOpType>
VTKM_EXEC_CONT T operator()(const T& v, const UnaryOpType& unaryOp) const inline VTKM_EXEC_CONT T operator()(const T& v, const UnaryOpType& unaryOp) const
{ {
T result; T result;
for (vtkm::IdComponent i = 0; i < Size; ++i) for (vtkm::IdComponent i = 0; i < Size; ++i)
@ -215,7 +215,7 @@ template <>
struct VecComponentWiseUnaryOperation<1> struct VecComponentWiseUnaryOperation<1>
{ {
template <typename T, typename UnaryOpType> template <typename T, typename UnaryOpType>
VTKM_EXEC_CONT T operator()(const T& v, const UnaryOpType& unaryOp) const inline VTKM_EXEC_CONT T operator()(const T& v, const UnaryOpType& unaryOp) const
{ {
return T(unaryOp(v[0])); return T(unaryOp(v[0]));
} }
@ -225,7 +225,7 @@ template <>
struct VecComponentWiseUnaryOperation<2> struct VecComponentWiseUnaryOperation<2>
{ {
template <typename T, typename UnaryOpType> template <typename T, typename UnaryOpType>
VTKM_EXEC_CONT T operator()(const T& v, const UnaryOpType& unaryOp) const inline VTKM_EXEC_CONT T operator()(const T& v, const UnaryOpType& unaryOp) const
{ {
return T(unaryOp(v[0]), unaryOp(v[1])); return T(unaryOp(v[0]), unaryOp(v[1]));
} }
@ -235,7 +235,7 @@ template <>
struct VecComponentWiseUnaryOperation<3> struct VecComponentWiseUnaryOperation<3>
{ {
template <typename T, typename UnaryOpType> template <typename T, typename UnaryOpType>
VTKM_EXEC_CONT T operator()(const T& v, const UnaryOpType& unaryOp) const inline VTKM_EXEC_CONT T operator()(const T& v, const UnaryOpType& unaryOp) const
{ {
return T(unaryOp(v[0]), unaryOp(v[1]), unaryOp(v[2])); return T(unaryOp(v[0]), unaryOp(v[1]), unaryOp(v[2]));
} }
@ -245,7 +245,7 @@ template <>
struct VecComponentWiseUnaryOperation<4> struct VecComponentWiseUnaryOperation<4>
{ {
template <typename T, typename UnaryOpType> template <typename T, typename UnaryOpType>
VTKM_EXEC_CONT T operator()(const T& v, const UnaryOpType& unaryOp) const inline VTKM_EXEC_CONT T operator()(const T& v, const UnaryOpType& unaryOp) const
{ {
return T(unaryOp(v[0]), unaryOp(v[1]), unaryOp(v[2]), unaryOp(v[3])); return T(unaryOp(v[0]), unaryOp(v[1]), unaryOp(v[2]), unaryOp(v[3]));
} }
@ -312,7 +312,7 @@ private:
struct Add struct Add
{ {
template <typename T> template <typename T>
VTKM_EXEC_CONT T operator()(const T& a, const T& b) const inline VTKM_EXEC_CONT T operator()(const T& a, const T& b) const
{ {
return T(a + b); return T(a + b);
} }
@ -321,7 +321,7 @@ struct Add
struct Subtract struct Subtract
{ {
template <typename T> template <typename T>
VTKM_EXEC_CONT T operator()(const T& a, const T& b) const inline VTKM_EXEC_CONT T operator()(const T& a, const T& b) const
{ {
return T(a - b); return T(a - b);
} }
@ -330,7 +330,7 @@ struct Subtract
struct Multiply struct Multiply
{ {
template <typename T> template <typename T>
VTKM_EXEC_CONT T operator()(const T& a, const T& b) const inline VTKM_EXEC_CONT T operator()(const T& a, const T& b) const
{ {
return T(a * b); return T(a * b);
} }
@ -339,7 +339,7 @@ struct Multiply
struct Divide struct Divide
{ {
template <typename T> template <typename T>
VTKM_EXEC_CONT T operator()(const T& a, const T& b) const inline VTKM_EXEC_CONT T operator()(const T& a, const T& b) const
{ {
return T(a / b); return T(a / b);
} }
@ -348,7 +348,7 @@ struct Divide
struct Negate struct Negate
{ {
template <typename T> template <typename T>
VTKM_EXEC_CONT T operator()(const T& x) const inline VTKM_EXEC_CONT T operator()(const T& x) const
{ {
return T(-x); return T(-x);
} }
@ -409,15 +409,15 @@ protected:
private: private:
// Only for internal use // Only for internal use
VTKM_EXEC_CONT VTKM_EXEC_CONT
vtkm::IdComponent NumComponents() const { return this->Derived().GetNumberOfComponents(); } inline vtkm::IdComponent NumComponents() const { return this->Derived().GetNumberOfComponents(); }
// Only for internal use // Only for internal use
VTKM_EXEC_CONT VTKM_EXEC_CONT
const T& Component(vtkm::IdComponent index) const { return this->Derived()[index]; } inline const T& Component(vtkm::IdComponent index) const { return this->Derived()[index]; }
// Only for internal use // Only for internal use
VTKM_EXEC_CONT VTKM_EXEC_CONT
T& Component(vtkm::IdComponent index) { return this->Derived()[index]; } inline T& Component(vtkm::IdComponent index) { return this->Derived()[index]; }
public: public:
template <vtkm::IdComponent OtherSize> template <vtkm::IdComponent OtherSize>
@ -484,7 +484,7 @@ public:
#endif // not using cuda < 8 #endif // not using cuda < 8
template <vtkm::IdComponent Size> template <vtkm::IdComponent Size>
VTKM_EXEC_CONT vtkm::Vec<ComponentType, Size> operator+( inline VTKM_EXEC_CONT vtkm::Vec<ComponentType, Size> operator+(
const vtkm::Vec<ComponentType, Size>& other) const const vtkm::Vec<ComponentType, Size>& other) const
{ {
VTKM_ASSERT(Size == this->NumComponents()); VTKM_ASSERT(Size == this->NumComponents());
@ -497,7 +497,8 @@ public:
} }
template <typename OtherClass> template <typename OtherClass>
VTKM_EXEC_CONT DerivedClass& operator+=(const VecBaseCommon<ComponentType, OtherClass>& other) inline VTKM_EXEC_CONT DerivedClass& operator+=(
const VecBaseCommon<ComponentType, OtherClass>& other)
{ {
const OtherClass& other_derived = static_cast<const OtherClass&>(other); const OtherClass& other_derived = static_cast<const OtherClass&>(other);
VTKM_ASSERT(this->NumComponents() == other_derived.GetNumberOfComponents()); VTKM_ASSERT(this->NumComponents() == other_derived.GetNumberOfComponents());
@ -509,7 +510,7 @@ public:
} }
template <vtkm::IdComponent Size> template <vtkm::IdComponent Size>
VTKM_EXEC_CONT vtkm::Vec<ComponentType, Size> operator-( inline VTKM_EXEC_CONT vtkm::Vec<ComponentType, Size> operator-(
const vtkm::Vec<ComponentType, Size>& other) const const vtkm::Vec<ComponentType, Size>& other) const
{ {
VTKM_ASSERT(Size == this->NumComponents()); VTKM_ASSERT(Size == this->NumComponents());
@ -522,7 +523,8 @@ public:
} }
template <typename OtherClass> template <typename OtherClass>
VTKM_EXEC_CONT DerivedClass& operator-=(const VecBaseCommon<ComponentType, OtherClass>& other) inline VTKM_EXEC_CONT DerivedClass& operator-=(
const VecBaseCommon<ComponentType, OtherClass>& other)
{ {
const OtherClass& other_derived = static_cast<const OtherClass&>(other); const OtherClass& other_derived = static_cast<const OtherClass&>(other);
VTKM_ASSERT(this->NumComponents() == other_derived.GetNumberOfComponents()); VTKM_ASSERT(this->NumComponents() == other_derived.GetNumberOfComponents());
@ -534,7 +536,7 @@ public:
} }
template <vtkm::IdComponent Size> template <vtkm::IdComponent Size>
VTKM_EXEC_CONT vtkm::Vec<ComponentType, Size> operator*( inline VTKM_EXEC_CONT vtkm::Vec<ComponentType, Size> operator*(
const vtkm::Vec<ComponentType, Size>& other) const const vtkm::Vec<ComponentType, Size>& other) const
{ {
vtkm::Vec<ComponentType, Size> result; vtkm::Vec<ComponentType, Size> result;
@ -546,7 +548,8 @@ public:
} }
template <typename OtherClass> template <typename OtherClass>
VTKM_EXEC_CONT DerivedClass& operator*=(const VecBaseCommon<ComponentType, OtherClass>& other) inline VTKM_EXEC_CONT DerivedClass& operator*=(
const VecBaseCommon<ComponentType, OtherClass>& other)
{ {
const OtherClass& other_derived = static_cast<const OtherClass&>(other); const OtherClass& other_derived = static_cast<const OtherClass&>(other);
VTKM_ASSERT(this->NumComponents() == other_derived.GetNumberOfComponents()); VTKM_ASSERT(this->NumComponents() == other_derived.GetNumberOfComponents());
@ -558,7 +561,7 @@ public:
} }
template <vtkm::IdComponent Size> template <vtkm::IdComponent Size>
VTKM_EXEC_CONT vtkm::Vec<ComponentType, Size> operator/( inline VTKM_EXEC_CONT vtkm::Vec<ComponentType, Size> operator/(
const vtkm::Vec<ComponentType, Size>& other) const const vtkm::Vec<ComponentType, Size>& other) const
{ {
vtkm::Vec<ComponentType, Size> result; vtkm::Vec<ComponentType, Size> result;
@ -630,20 +633,16 @@ protected:
} }
public: public:
VTKM_EXEC_CONT inline VTKM_EXEC_CONT vtkm::IdComponent GetNumberOfComponents() const { return NUM_COMPONENTS; }
vtkm::IdComponent GetNumberOfComponents() const { return NUM_COMPONENTS; }
VTKM_EXEC_CONT inline VTKM_EXEC_CONT const ComponentType& operator[](vtkm::IdComponent idx) const
//DRP
/* inline */ const ComponentType& operator[](vtkm::IdComponent idx) const
{ {
VTKM_ASSERT(idx >= 0); VTKM_ASSERT(idx >= 0);
VTKM_ASSERT(idx < NUM_COMPONENTS); VTKM_ASSERT(idx < NUM_COMPONENTS);
return this->Components[idx]; return this->Components[idx];
} }
VTKM_EXEC_CONT
//DRP inline VTKM_EXEC_CONT ComponentType& operator[](vtkm::IdComponent idx)
/*inline*/ ComponentType& operator[](vtkm::IdComponent idx)
{ {
VTKM_ASSERT(idx >= 0); VTKM_ASSERT(idx >= 0);
VTKM_ASSERT(idx < NUM_COMPONENTS); VTKM_ASSERT(idx < NUM_COMPONENTS);
@ -658,7 +657,7 @@ public:
#endif // not using cuda < 8 #endif // not using cuda < 8
template <typename OtherComponentType, typename OtherClass> template <typename OtherComponentType, typename OtherClass>
VTKM_EXEC_CONT DerivedClass inline VTKM_EXEC_CONT DerivedClass
operator+(const VecBaseCommon<OtherComponentType, OtherClass>& other) const operator+(const VecBaseCommon<OtherComponentType, OtherClass>& other) const
{ {
const OtherClass& other_derived = static_cast<const OtherClass&>(other); const OtherClass& other_derived = static_cast<const OtherClass&>(other);
@ -673,7 +672,7 @@ public:
} }
template <typename OtherComponentType, typename OtherClass> template <typename OtherComponentType, typename OtherClass>
VTKM_EXEC_CONT DerivedClass inline VTKM_EXEC_CONT DerivedClass
operator-(const VecBaseCommon<OtherComponentType, OtherClass>& other) const operator-(const VecBaseCommon<OtherComponentType, OtherClass>& other) const
{ {
const OtherClass& other_derived = static_cast<const OtherClass&>(other); const OtherClass& other_derived = static_cast<const OtherClass&>(other);
@ -688,7 +687,7 @@ public:
} }
template <typename OtherComponentType, typename OtherClass> template <typename OtherComponentType, typename OtherClass>
VTKM_EXEC_CONT DerivedClass inline VTKM_EXEC_CONT DerivedClass
operator*(const VecBaseCommon<OtherComponentType, OtherClass>& other) const operator*(const VecBaseCommon<OtherComponentType, OtherClass>& other) const
{ {
const OtherClass& other_derived = static_cast<const OtherClass&>(other); const OtherClass& other_derived = static_cast<const OtherClass&>(other);
@ -703,7 +702,7 @@ public:
} }
template <typename OtherComponentType, typename OtherClass> template <typename OtherComponentType, typename OtherClass>
VTKM_EXEC_CONT DerivedClass inline VTKM_EXEC_CONT DerivedClass
operator/(const VecBaseCommon<OtherComponentType, OtherClass>& other) const operator/(const VecBaseCommon<OtherComponentType, OtherClass>& other) const
{ {
const OtherClass& other_derived = static_cast<const OtherClass&>(other); const OtherClass& other_derived = static_cast<const OtherClass&>(other);
@ -1043,24 +1042,24 @@ public:
{ {
} }
VTKM_EXEC_CONT inline VTKM_EXEC_CONT const T& operator[](vtkm::IdComponent index) const
const T& operator[](vtkm::IdComponent index) const
{ {
VTKM_ASSERT(index >= 0); VTKM_ASSERT(index >= 0);
VTKM_ASSERT(index < this->NumberOfComponents); VTKM_ASSERT(index < this->NumberOfComponents);
return this->Components[index]; return this->Components[index];
} }
VTKM_EXEC_CONT inline VTKM_EXEC_CONT T& operator[](vtkm::IdComponent index)
T& operator[](vtkm::IdComponent index)
{ {
VTKM_ASSERT(index >= 0); VTKM_ASSERT(index >= 0);
VTKM_ASSERT(index < this->NumberOfComponents); VTKM_ASSERT(index < this->NumberOfComponents);
return this->Components[index]; return this->Components[index];
} }
VTKM_EXEC_CONT inline VTKM_EXEC_CONT vtkm::IdComponent GetNumberOfComponents() const
vtkm::IdComponent GetNumberOfComponents() const { return this->NumberOfComponents; } {
return this->NumberOfComponents;
}
VTKM_EXEC_CONT VTKM_EXEC_CONT
VecC<T>& operator=(const VecC<T>& src) VecC<T>& operator=(const VecC<T>& src)
@ -1144,16 +1143,17 @@ public:
{ {
} }
VTKM_EXEC_CONT inline VTKM_EXEC_CONT const T& operator[](vtkm::IdComponent index) const
const T& operator[](vtkm::IdComponent index) const
{ {
VTKM_ASSERT(index >= 0); VTKM_ASSERT(index >= 0);
VTKM_ASSERT(index < this->NumberOfComponents); VTKM_ASSERT(index < this->NumberOfComponents);
return this->Components[index]; return this->Components[index];
} }
VTKM_EXEC_CONT inline VTKM_EXEC_CONT vtkm::IdComponent GetNumberOfComponents() const
vtkm::IdComponent GetNumberOfComponents() const { return this->NumberOfComponents; } {
return this->NumberOfComponents;
}
private: private:
const T* const Components; const T* const Components;
@ -1171,7 +1171,7 @@ private:
/// Creates a \c VecC from an input array. /// Creates a \c VecC from an input array.
/// ///
template <typename T> template <typename T>
VTKM_EXEC_CONT static inline vtkm::VecC<T> make_VecC(T* array, vtkm::IdComponent size) static inline VTKM_EXEC_CONT vtkm::VecC<T> make_VecC(T* array, vtkm::IdComponent size)
{ {
return vtkm::VecC<T>(array, size); return vtkm::VecC<T>(array, size);
} }
@ -1179,7 +1179,7 @@ VTKM_EXEC_CONT static inline vtkm::VecC<T> make_VecC(T* array, vtkm::IdComponent
/// Creates a \c VecCConst from a constant input array. /// Creates a \c VecCConst from a constant input array.
/// ///
template <typename T> template <typename T>
VTKM_EXEC_CONT static inline vtkm::VecCConst<T> make_VecC(const T* array, vtkm::IdComponent size) static inline VTKM_EXEC_CONT vtkm::VecCConst<T> make_VecC(const T* array, vtkm::IdComponent size)
{ {
return vtkm::VecCConst<T>(array, size); return vtkm::VecCConst<T>(array, size);
} }
@ -1265,7 +1265,7 @@ VTK_M_SCALAR_DOT(vtkm::Float32)
VTK_M_SCALAR_DOT(vtkm::Float64) VTK_M_SCALAR_DOT(vtkm::Float64)
template <typename T, vtkm::IdComponent Size> template <typename T, vtkm::IdComponent Size>
VTKM_EXEC_CONT T ReduceSum(const vtkm::Vec<T, Size>& a) inline VTKM_EXEC_CONT T ReduceSum(const vtkm::Vec<T, Size>& a)
{ {
T result = a[0]; T result = a[0];
for (vtkm::IdComponent i = 1; i < Size; ++i) for (vtkm::IdComponent i = 1; i < Size; ++i)
@ -1276,25 +1276,25 @@ VTKM_EXEC_CONT T ReduceSum(const vtkm::Vec<T, Size>& a)
} }
template <typename T> template <typename T>
VTKM_EXEC_CONT T ReduceSum(const vtkm::Vec<T, 2>& a) inline VTKM_EXEC_CONT T ReduceSum(const vtkm::Vec<T, 2>& a)
{ {
return a[0] + a[1]; return a[0] + a[1];
} }
template <typename T> template <typename T>
VTKM_EXEC_CONT T ReduceSum(const vtkm::Vec<T, 3>& a) inline VTKM_EXEC_CONT T ReduceSum(const vtkm::Vec<T, 3>& a)
{ {
return a[0] + a[1] + a[2]; return a[0] + a[1] + a[2];
} }
template <typename T> template <typename T>
VTKM_EXEC_CONT T ReduceSum(const vtkm::Vec<T, 4>& a) inline VTKM_EXEC_CONT T ReduceSum(const vtkm::Vec<T, 4>& a)
{ {
return a[0] + a[1] + a[2] + a[3]; return a[0] + a[1] + a[2] + a[3];
} }
template <typename T, vtkm::IdComponent Size> template <typename T, vtkm::IdComponent Size>
VTKM_EXEC_CONT T ReduceProduct(const vtkm::Vec<T, Size>& a) inline VTKM_EXEC_CONT T ReduceProduct(const vtkm::Vec<T, Size>& a)
{ {
T result = a[0]; T result = a[0];
for (vtkm::IdComponent i = 1; i < Size; ++i) for (vtkm::IdComponent i = 1; i < Size; ++i)
@ -1305,19 +1305,19 @@ VTKM_EXEC_CONT T ReduceProduct(const vtkm::Vec<T, Size>& a)
} }
template <typename T> template <typename T>
VTKM_EXEC_CONT T ReduceProduct(const vtkm::Vec<T, 2>& a) inline VTKM_EXEC_CONT T ReduceProduct(const vtkm::Vec<T, 2>& a)
{ {
return a[0] * a[1]; return a[0] * a[1];
} }
template <typename T> template <typename T>
VTKM_EXEC_CONT T ReduceProduct(const vtkm::Vec<T, 3>& a) inline VTKM_EXEC_CONT T ReduceProduct(const vtkm::Vec<T, 3>& a)
{ {
return a[0] * a[1] * a[2]; return a[0] * a[1] * a[2];
} }
template <typename T> template <typename T>
VTKM_EXEC_CONT T ReduceProduct(const vtkm::Vec<T, 4>& a) inline VTKM_EXEC_CONT T ReduceProduct(const vtkm::Vec<T, 4>& a)
{ {
return a[0] * a[1] * a[2] * a[3]; return a[0] * a[1] * a[2] * a[3];
} }
@ -1332,28 +1332,30 @@ struct Pair;
// Declared outside of vtkm namespace so that the operator works with all code. // Declared outside of vtkm namespace so that the operator works with all code.
template <typename T, vtkm::IdComponent Size> template <typename T, vtkm::IdComponent Size>
VTKM_EXEC_CONT vtkm::Vec<T, Size> operator*(T scalar, const vtkm::Vec<T, Size>& vec) VTKM_EXEC_CONT vtkm::Vec<T, Size> inline operator*(T scalar, const vtkm::Vec<T, Size>& vec)
{ {
return vtkm::internal::VecComponentWiseUnaryOperation<Size>()( return vtkm::internal::VecComponentWiseUnaryOperation<Size>()(
vec, vtkm::internal::BindLeftBinaryOp<T, vtkm::Multiply>(scalar)); vec, vtkm::internal::BindLeftBinaryOp<T, vtkm::Multiply>(scalar));
} }
template <typename T, vtkm::IdComponent Size> template <typename T, vtkm::IdComponent Size>
VTKM_EXEC_CONT vtkm::Vec<T, Size> operator*(const vtkm::Vec<T, Size>& vec, T scalar) VTKM_EXEC_CONT vtkm::Vec<T, Size> inline operator*(const vtkm::Vec<T, Size>& vec, T scalar)
{ {
return vtkm::internal::VecComponentWiseUnaryOperation<Size>()( return vtkm::internal::VecComponentWiseUnaryOperation<Size>()(
vec, vtkm::internal::BindRightBinaryOp<T, vtkm::Multiply>(scalar)); vec, vtkm::internal::BindRightBinaryOp<T, vtkm::Multiply>(scalar));
} }
template <typename T, vtkm::IdComponent Size> template <typename T, vtkm::IdComponent Size>
VTKM_EXEC_CONT vtkm::Vec<T, Size> operator*(vtkm::Float64 scalar, const vtkm::Vec<T, Size>& vec) VTKM_EXEC_CONT vtkm::Vec<T, Size> inline operator*(vtkm::Float64 scalar,
const vtkm::Vec<T, Size>& vec)
{ {
return vtkm::Vec<T, Size>(vtkm::internal::VecComponentWiseUnaryOperation<Size>()( return vtkm::Vec<T, Size>(vtkm::internal::VecComponentWiseUnaryOperation<Size>()(
vec, vtkm::internal::BindLeftBinaryOp<vtkm::Float64, vtkm::Multiply, T>(scalar))); vec, vtkm::internal::BindLeftBinaryOp<vtkm::Float64, vtkm::Multiply, T>(scalar)));
} }
template <typename T, vtkm::IdComponent Size> template <typename T, vtkm::IdComponent Size>
VTKM_EXEC_CONT vtkm::Vec<T, Size> operator*(const vtkm::Vec<T, Size>& vec, vtkm::Float64 scalar) VTKM_EXEC_CONT vtkm::Vec<T, Size> inline operator*(const vtkm::Vec<T, Size>& vec,
vtkm::Float64 scalar)
{ {
return vtkm::Vec<T, Size>(vtkm::internal::VecComponentWiseUnaryOperation<Size>()( return vtkm::Vec<T, Size>(vtkm::internal::VecComponentWiseUnaryOperation<Size>()(
vec, vtkm::internal::BindRightBinaryOp<vtkm::Float64, vtkm::Multiply, T>(scalar))); vec, vtkm::internal::BindRightBinaryOp<vtkm::Float64, vtkm::Multiply, T>(scalar)));
@ -1376,14 +1378,15 @@ VTKM_EXEC_CONT vtkm::Vec<vtkm::Float64, Size> operator*(const vtkm::Vec<vtkm::Fl
} }
template <typename T, vtkm::IdComponent Size> template <typename T, vtkm::IdComponent Size>
VTKM_EXEC_CONT vtkm::Vec<T, Size> operator/(const vtkm::Vec<T, Size>& vec, T scalar) VTKM_EXEC_CONT vtkm::Vec<T, Size> inline operator/(const vtkm::Vec<T, Size>& vec, T scalar)
{ {
return vtkm::internal::VecComponentWiseUnaryOperation<Size>()( return vtkm::internal::VecComponentWiseUnaryOperation<Size>()(
vec, vtkm::internal::BindRightBinaryOp<T, vtkm::Divide>(scalar)); vec, vtkm::internal::BindRightBinaryOp<T, vtkm::Divide>(scalar));
} }
template <typename T, vtkm::IdComponent Size> template <typename T, vtkm::IdComponent Size>
VTKM_EXEC_CONT vtkm::Vec<T, Size> operator/(const vtkm::Vec<T, Size>& vec, vtkm::Float64 scalar) VTKM_EXEC_CONT vtkm::Vec<T, Size> inline operator/(const vtkm::Vec<T, Size>& vec,
vtkm::Float64 scalar)
{ {
return vtkm::Vec<T, Size>(vtkm::internal::VecComponentWiseUnaryOperation<Size>()( return vtkm::Vec<T, Size>(vtkm::internal::VecComponentWiseUnaryOperation<Size>()(
vec, vtkm::internal::BindRightBinaryOp<vtkm::Float64, vtkm::Divide, T>(scalar))); vec, vtkm::internal::BindRightBinaryOp<vtkm::Float64, vtkm::Divide, T>(scalar)));

@ -60,10 +60,10 @@ public:
} }
VTKM_EXEC_CONT VTKM_EXEC_CONT
vtkm::IdComponent GetNumberOfComponents() const { return this->NumComponents; } inline vtkm::IdComponent GetNumberOfComponents() const { return this->NumComponents; }
template <vtkm::IdComponent DestSize> template <vtkm::IdComponent DestSize>
VTKM_EXEC_CONT void CopyInto(vtkm::Vec<ComponentType, DestSize>& dest) const VTKM_EXEC_CONT inline void CopyInto(vtkm::Vec<ComponentType, DestSize>& dest) const
{ {
vtkm::IdComponent numComponents = vtkm::Min(DestSize, this->NumComponents); vtkm::IdComponent numComponents = vtkm::Min(DestSize, this->NumComponents);
for (vtkm::IdComponent index = 0; index < numComponents; index++) for (vtkm::IdComponent index = 0; index < numComponents; index++)
@ -73,10 +73,13 @@ public:
} }
VTKM_EXEC_CONT VTKM_EXEC_CONT
const ComponentType& operator[](vtkm::IdComponent index) const { return this->Data[index]; } inline const ComponentType& operator[](vtkm::IdComponent index) const
{
return this->Data[index];
}
VTKM_EXEC_CONT VTKM_EXEC_CONT
ComponentType& operator[](vtkm::IdComponent index) { return this->Data[index]; } inline ComponentType& operator[](vtkm::IdComponent index) { return this->Data[index]; }
VTKM_EXEC_CONT VTKM_EXEC_CONT
void Append(ComponentType value) void Append(ComponentType value)