Commit 00c7905a authored by David Thompson's avatar David Thompson

Rename `vtkm::dot()` to `vtkm::Dot()`.

This keeps the old name around but prepares it for removal
in the next release.
parent dd7c17f7
# Dot product function name changed.
The free function `vtkm::dot()` has been renamed to `vtkm::Dot()`
to be consistent with other vtk-m function names.
Aliases are provided for backwards compatibility but will
be removed in the next release.
......@@ -388,8 +388,8 @@ public:
VTKM_EXEC_CONT Scalar Value(const Vector& point) const override
{
Vector x2c = point - this->Center;
FloatDefault proj = vtkm::dot(this->Axis, x2c);
return vtkm::dot(x2c, x2c) - (proj * proj) - (this->Radius * this->Radius);
FloatDefault proj = vtkm::Dot(this->Axis, x2c);
return vtkm::Dot(x2c, x2c) - (proj * proj) - (this->Radius * this->Radius);
}
VTKM_EXEC_CONT Vector Gradient(const Vector& point) const override
......@@ -487,7 +487,7 @@ public:
{
const Vector& p = this->Points[index];
const Vector& n = this->Normals[index];
const Scalar val = vtkm::dot(point - p, n);
const Scalar val = vtkm::Dot(point - p, n);
maxVal = vtkm::Max(maxVal, val);
}
return maxVal;
......@@ -501,7 +501,7 @@ public:
{
const Vector& p = this->Points[index];
const Vector& n = this->Normals[index];
Scalar val = vtkm::dot(point - p, n);
Scalar val = vtkm::Dot(point - p, n);
if (val > maxVal)
{
maxVal = val;
......@@ -556,7 +556,7 @@ public:
VTKM_EXEC_CONT Scalar Value(const Vector& point) const override
{
return vtkm::dot(point - this->Origin, this->Normal);
return vtkm::Dot(point - this->Origin, this->Normal);
}
VTKM_EXEC_CONT Vector Gradient(const Vector&) const override { return this->Normal; }
......
......@@ -195,7 +195,7 @@ VTKM_EXEC_CONT vtkm::Vec<T, NumRow> MatrixMultiply(
vtkm::Vec<T, NumRow> product;
for (vtkm::IdComponent rowIndex = 0; rowIndex < NumRow; rowIndex++)
{
product[rowIndex] = vtkm::dot(vtkm::MatrixGetRow(leftFactor, rowIndex), rightFactor);
product[rowIndex] = vtkm::Dot(vtkm::MatrixGetRow(leftFactor, rowIndex), rightFactor);
}
return product;
}
......@@ -210,7 +210,7 @@ VTKM_EXEC_CONT vtkm::Vec<T, NumCol> MatrixMultiply(
vtkm::Vec<T, NumCol> product;
for (vtkm::IdComponent colIndex = 0; colIndex < NumCol; colIndex++)
{
product[colIndex] = vtkm::dot(leftFactor, vtkm::MatrixGetColumn(rightFactor, colIndex));
product[colIndex] = vtkm::Dot(leftFactor, vtkm::MatrixGetColumn(rightFactor, colIndex));
}
return product;
}
......
......@@ -47,9 +47,9 @@ VTKM_EXEC_CONT vtkm::Vec<T, 3> Transform3DPoint(const vtkm::Matrix<T, 4, 4>& mat
const vtkm::Vec<T, 3>& point)
{
vtkm::Vec<T, 4> homogeneousPoint(point[0], point[1], point[2], T(1));
return vtkm::Vec<T, 3>(vtkm::dot(vtkm::MatrixGetRow(matrix, 0), homogeneousPoint),
vtkm::dot(vtkm::MatrixGetRow(matrix, 1), homogeneousPoint),
vtkm::dot(vtkm::MatrixGetRow(matrix, 2), homogeneousPoint));
return vtkm::Vec<T, 3>(vtkm::Dot(vtkm::MatrixGetRow(matrix, 0), homogeneousPoint),
vtkm::Dot(vtkm::MatrixGetRow(matrix, 1), homogeneousPoint),
vtkm::Dot(vtkm::MatrixGetRow(matrix, 2), homogeneousPoint));
}
/// \brief Transform a 3D point by a transformation matrix with perspective.
......@@ -66,10 +66,10 @@ VTKM_EXEC_CONT vtkm::Vec<T, 3> Transform3DPointPerspective(const vtkm::Matrix<T,
const vtkm::Vec<T, 3>& point)
{
vtkm::Vec<T, 4> homogeneousPoint(point[0], point[1], point[2], T(1));
T inverseW = 1 / vtkm::dot(vtkm::MatrixGetRow(matrix, 3), homogeneousPoint);
return vtkm::Vec<T, 3>(vtkm::dot(vtkm::MatrixGetRow(matrix, 0), homogeneousPoint) * inverseW,
vtkm::dot(vtkm::MatrixGetRow(matrix, 1), homogeneousPoint) * inverseW,
vtkm::dot(vtkm::MatrixGetRow(matrix, 2), homogeneousPoint) * inverseW);
T inverseW = 1 / vtkm::Dot(vtkm::MatrixGetRow(matrix, 3), homogeneousPoint);
return vtkm::Vec<T, 3>(vtkm::Dot(vtkm::MatrixGetRow(matrix, 0), homogeneousPoint) * inverseW,
vtkm::Dot(vtkm::MatrixGetRow(matrix, 1), homogeneousPoint) * inverseW,
vtkm::Dot(vtkm::MatrixGetRow(matrix, 2), homogeneousPoint) * inverseW);
}
/// \brief Transform a 3D vector by a transformation matrix.
......
......@@ -1226,24 +1226,24 @@ static inline VTKM_EXEC_CONT typename DotType<T>::type vec_dot(const vtkm::Vec<T
}
template <typename T>
static inline VTKM_EXEC_CONT auto dot(const T& a, const T& b) -> decltype(detail::vec_dot(a, b))
static inline VTKM_EXEC_CONT auto Dot(const T& a, const T& b) -> decltype(detail::vec_dot(a, b))
{
return detail::vec_dot(a, b);
}
template <typename T>
static inline VTKM_EXEC_CONT typename detail::DotType<T>::type dot(const vtkm::Vec<T, 2>& a,
static inline VTKM_EXEC_CONT typename detail::DotType<T>::type Dot(const vtkm::Vec<T, 2>& a,
const vtkm::Vec<T, 2>& b)
{
return (a[0] * b[0]) + (a[1] * b[1]);
}
template <typename T>
static inline VTKM_EXEC_CONT typename detail::DotType<T>::type dot(const vtkm::Vec<T, 3>& a,
static inline VTKM_EXEC_CONT typename detail::DotType<T>::type Dot(const vtkm::Vec<T, 3>& a,
const vtkm::Vec<T, 3>& b)
{
return (a[0] * b[0]) + (a[1] * b[1]) + (a[2] * b[2]);
}
template <typename T>
static inline VTKM_EXEC_CONT typename detail::DotType<T>::type dot(const vtkm::Vec<T, 4>& a,
static inline VTKM_EXEC_CONT typename detail::DotType<T>::type Dot(const vtkm::Vec<T, 4>& a,
const vtkm::Vec<T, 4>& b)
{
return (a[0] * b[0]) + (a[1] * b[1]) + (a[2] * b[2]) + (a[3] * b[3]);
......@@ -1251,7 +1251,11 @@ static inline VTKM_EXEC_CONT typename detail::DotType<T>::type dot(const vtkm::V
// Integer types of a width less than an integer get implicitly casted to
// an integer when doing a multiplication.
#define VTK_M_SCALAR_DOT(stype) \
static inline VTKM_EXEC_CONT detail::DotType<stype>::type dot(stype a, stype b) { return a * b; }
static inline VTKM_EXEC_CONT detail::DotType<stype>::type dot(stype a, stype b) \
{ \
return a * b; \
} /* LEGACY */ \
static inline VTKM_EXEC_CONT detail::DotType<stype>::type Dot(stype a, stype b) { return a * b; }
VTK_M_SCALAR_DOT(vtkm::Int8)
VTK_M_SCALAR_DOT(vtkm::UInt8)
VTK_M_SCALAR_DOT(vtkm::Int16)
......@@ -1263,6 +1267,32 @@ VTK_M_SCALAR_DOT(vtkm::UInt64)
VTK_M_SCALAR_DOT(vtkm::Float32)
VTK_M_SCALAR_DOT(vtkm::Float64)
// v============ LEGACY =============v
template <typename T>
static inline VTKM_EXEC_CONT auto dot(const T& a, const T& b) -> decltype(detail::vec_dot(a, b))
{
return vtkm::Dot(a, b);
}
template <typename T>
static inline VTKM_EXEC_CONT typename detail::DotType<T>::type dot(const vtkm::Vec<T, 2>& a,
const vtkm::Vec<T, 2>& b)
{
return vtkm::Dot(a, b);
}
template <typename T>
static inline VTKM_EXEC_CONT typename detail::DotType<T>::type dot(const vtkm::Vec<T, 3>& a,
const vtkm::Vec<T, 3>& b)
{
return vtkm::Dot(a, b);
}
template <typename T>
static inline VTKM_EXEC_CONT typename detail::DotType<T>::type dot(const vtkm::Vec<T, 4>& a,
const vtkm::Vec<T, 4>& b)
{
return vtkm::Dot(a, b);
}
// ^============ LEGACY =============^
template <typename T, vtkm::IdComponent Size>
inline VTKM_EXEC_CONT T ReduceSum(const vtkm::Vec<T, Size>& a)
{
......
......@@ -76,7 +76,7 @@ template <typename T>
VTKM_EXEC_CONT typename detail::FloatingPointReturnType<T>::Type MagnitudeSquared(const T& x)
{
using U = typename detail::FloatingPointReturnType<T>::Type;
return static_cast<U>(vtkm::dot(x, x));
return static_cast<U>(vtkm::Dot(x, x));
}
// ----------------------------------------------------------------------------
......
......@@ -65,7 +65,7 @@ struct ValueSquared
template <typename U>
VTKM_EXEC_CONT ValueType operator()(U u) const
{
return vtkm::dot(u, u);
return vtkm::Dot(u, u);
}
};
......
......@@ -40,9 +40,9 @@ const vtkm::Id ARRAY_SIZE = 10;
struct MySquare
{
template <typename U>
VTKM_EXEC auto operator()(U u) const -> decltype(vtkm::dot(u, u))
VTKM_EXEC auto operator()(U u) const -> decltype(vtkm::Dot(u, u))
{
return vtkm::dot(u, u);
return vtkm::Dot(u, u);
}
};
......
......@@ -635,19 +635,19 @@ VTKM_EXEC vtkm::Vec<ValueType, 3> TriangleDerivative(const vtkm::Vec<ValueType,
// gradient g and scalar value s_origin, can be found with this set of 4
// equations and 4 unknowns.
//
// dot(p0, g) + s_origin = s0
// dot(p1, g) + s_origin = s1
// dot(p2, g) + s_origin = s2
// dot(n, g) = 0
// Dot(p0, g) + s_origin = s0
// Dot(p1, g) + s_origin = s1
// Dot(p2, g) + s_origin = s2
// Dot(n, g) = 0
//
// Where the p's are point coordinates and n is the normal vector. But we
// don't really care about s_origin. We just want to find the gradient g.
// With some simple elimination we, we can get rid of s_origin and be left
// with 3 equations and 3 unknowns.
//
// dot(p1-p0, g) = s1 - s0
// dot(p2-p0, g) = s2 - s0
// dot(n, g) = 0
// Dot(p1-p0, g) = s1 - s0
// Dot(p2-p0, g) = s2 - s0
// Dot(n, g) = 0
//
// We'll solve this by putting this in matrix form Ax = b where the rows of A
// are the differences in points and normal, b has the scalar differences,
......@@ -937,19 +937,19 @@ VTKM_EXEC vtkm::Vec<ValueType, 3> TetraDerivative(const vtkm::Vec<ValueType, 4>&
// gradient g and scalar value s_origin, can be found with this set of 4
// equations and 4 unknowns.
//
// dot(p0, g) + s_origin = s0
// dot(p1, g) + s_origin = s1
// dot(p2, g) + s_origin = s2
// dot(p3, g) + s_origin = s3
// Dot(p0, g) + s_origin = s0
// Dot(p1, g) + s_origin = s1
// Dot(p2, g) + s_origin = s2
// Dot(p3, g) + s_origin = s3
//
// Where the p's are point coordinates. But we don't really care about
// s_origin. We just want to find the gradient g. With some simple
// elimination we, we can get rid of s_origin and be left with 3 equations
// and 3 unknowns.
//
// dot(p1-p0, g) = s1 - s0
// dot(p2-p0, g) = s2 - s0
// dot(p3-p0, g) = s3 - s0
// Dot(p1-p0, g) = s1 - s0
// Dot(p2-p0, g) = s2 - s0
// Dot(p3-p0, g) = s3 - s0
//
// We'll solve this by putting this in matrix form Ax = b where the rows of A
// are the differences in points and normal, b has the scalar differences,
......
......@@ -86,7 +86,7 @@ VTKM_EXEC typename WorldCoordVector::ComponentType ReverseInterpolateTriangle(
//
// First, we define an implicit plane as:
//
// dot((p - wcoords), planeNormal) = 0
// Dot((p - wcoords), planeNormal) = 0
//
// where planeNormal is the normal to the plane (easily computed from the
// triangle), and p is any point in the plane. Next, we define the parametric
......@@ -103,7 +103,7 @@ VTKM_EXEC typename WorldCoordVector::ComponentType ReverseInterpolateTriangle(
// definition of p(d) into p for the plane equation. With some basic algebra
// you get:
//
// d = dot((wcoords - p0), planeNormal)/dot((p1-p0), planeNormal)
// d = Dot((wcoords - p0), planeNormal)/Dot((p1-p0), planeNormal)
//
// From here, the u coordinate is simply d. The v coordinate follows
// similarly.
......@@ -122,7 +122,7 @@ VTKM_EXEC typename WorldCoordVector::ComponentType ReverseInterpolateTriangle(
Vector3 p2 = pointWCoords[2 - dimension];
Vector3 planeNormal = vtkm::Cross(triangleNormal, p2 - p0);
T d = vtkm::dot(wcoords - p0, planeNormal) / vtkm::dot(p1 - p0, planeNormal);
T d = vtkm::Dot(wcoords - p0, planeNormal) / vtkm::Dot(p1 - p0, planeNormal);
pcoords[dimension] = d;
}
......
......@@ -123,8 +123,8 @@ VTKM_EXEC OutType CellMeasure(const vtkm::IdComponent& numPts,
Normalize(unitCenterNormal);
OutType area =
(dot(unitCenterNormal, cornerNormals[0]) + dot(unitCenterNormal, cornerNormals[1]) +
dot(unitCenterNormal, cornerNormals[2]) + dot(unitCenterNormal, cornerNormals[3])) *
(Dot(unitCenterNormal, cornerNormals[0]) + Dot(unitCenterNormal, cornerNormals[1]) +
Dot(unitCenterNormal, cornerNormals[2]) + Dot(unitCenterNormal, cornerNormals[3])) *
OutType(0.25);
return area;
}
......@@ -157,7 +157,7 @@ VTKM_EXEC OutType CellMeasure(const vtkm::IdComponent& numPts,
typename PointCoordVecType::ComponentType v1 = pts[1] - pts[0];
typename PointCoordVecType::ComponentType v2 = pts[2] - pts[0];
typename PointCoordVecType::ComponentType v3 = pts[3] - pts[0];
OutType volume = dot(Cross(v1, v2), v3) / OutType(6.0);
OutType volume = Dot(Cross(v1, v2), v3) / OutType(6.0);
return volume;
}
......@@ -201,7 +201,7 @@ VTKM_EXEC OutType CellMeasure(const vtkm::IdComponent& numPts,
efg3 -= pts[2];
efg3 -= pts[3];
OutType volume = dot(Cross(efg2, efg3), efg1) / OutType(64.0);
OutType volume = Dot(Cross(efg2, efg3), efg1) / OutType(64.0);
return volume;
}
......@@ -221,17 +221,17 @@ VTKM_EXEC OutType CellMeasure(const vtkm::IdComponent& numPts,
typename PointCoordVecType::ComponentType v0 = pts[1] - pts[0];
typename PointCoordVecType::ComponentType v1 = pts[2] - pts[0];
typename PointCoordVecType::ComponentType v2 = pts[3] - pts[0];
OutType volume = dot(Cross(v0, v1), v2) / OutType(6.0);
OutType volume = Dot(Cross(v0, v1), v2) / OutType(6.0);
typename PointCoordVecType::ComponentType v3 = pts[4] - pts[1];
typename PointCoordVecType::ComponentType v4 = pts[5] - pts[1];
typename PointCoordVecType::ComponentType v5 = pts[3] - pts[1];
volume += dot(Cross(v3, v4), v5) / OutType(6.0);
volume += Dot(Cross(v3, v4), v5) / OutType(6.0);
typename PointCoordVecType::ComponentType v6 = pts[5] - pts[1];
typename PointCoordVecType::ComponentType v7 = pts[2] - pts[1];
typename PointCoordVecType::ComponentType v8 = pts[3] - pts[1];
volume += dot(Cross(v6, v7), v8) / OutType(6.0);
volume += Dot(Cross(v6, v7), v8) / OutType(6.0);
return volume;
}
......@@ -252,12 +252,12 @@ VTKM_EXEC OutType CellMeasure(const vtkm::IdComponent& numPts,
typename PointCoordVecType::ComponentType v1 = pts[1] - pts[0];
typename PointCoordVecType::ComponentType v2 = pts[3] - pts[0];
typename PointCoordVecType::ComponentType v3 = pts[4] - pts[0];
OutType volume = dot(Cross(v1, v2), v3) / OutType(6.0);
OutType volume = Dot(Cross(v1, v2), v3) / OutType(6.0);
typename PointCoordVecType::ComponentType v4 = pts[1] - pts[2];
typename PointCoordVecType::ComponentType v5 = pts[3] - pts[2];
typename PointCoordVecType::ComponentType v6 = pts[4] - pts[2];
volume += dot(Cross(v5, v4), v6) / OutType(6.0);
volume += Dot(Cross(v5, v4), v6) / OutType(6.0);
return volume;
}
......
......@@ -58,7 +58,7 @@ struct Space2D
Vec2 ConvertCoordToSpace(const Vec3 coord) const
{
Vec3 vec = coord - this->Origin;
return Vec2(vtkm::dot(vec, this->Basis0), vtkm::dot(vec, this->Basis1));
return Vec2(vtkm::Dot(vec, this->Basis0), vtkm::Dot(vec, this->Basis1));
}
template <typename U>
......
......@@ -628,17 +628,17 @@ WorldCoordinatesToParametricCoordinates(const WorldCoordVector& pointWCoords,
// Because this is a line, there is only one valid parametric coordinate. Let
// vec be the vector from the first point to the second point
// (pointWCoords[1] - pointWCoords[0]), which is the direction of the line.
// dot(vec,wcoords-pointWCoords[0])/mag(vec) is the orthoginal projection of
// Dot(vec,wcoords-pointWCoords[0])/mag(vec) is the orthoginal projection of
// wcoords on the line and represents the distance between the orthoginal
// projection and pointWCoords[0]. The parametric coordinate is the fraction
// of this over the length of the segment, which is mag(vec). Thus, the
// parametric coordinate is dot(vec,wcoords-pointWCoords[0])/mag(vec)^2.
// parametric coordinate is Dot(vec,wcoords-pointWCoords[0])/mag(vec)^2.
using Vector3 = typename WorldCoordVector::ComponentType;
using T = typename Vector3::ComponentType;
Vector3 vec = pointWCoords[1] - pointWCoords[0];
T numerator = vtkm::dot(vec, wcoords - pointWCoords[0]);
T numerator = vtkm::Dot(vec, wcoords - pointWCoords[0]);
T denominator = vtkm::MagnitudeSquared(vec);
return Vector3(numerator / denominator, 0, 0);
......@@ -848,8 +848,8 @@ WorldCoordinatesToParametricCoordinates(const WorldCoordVector& pointWCoords,
{
WCoordType vecInPlane = pointWCoords[firstPointIndex] - wcoordCenter;
WCoordType planeNormal = vtkm::Cross(polygonNormal, vecInPlane);
typename WCoordType::ComponentType planeOffset = vtkm::dot(planeNormal, wcoordCenter);
if (vtkm::dot(planeNormal, wcoords) < planeOffset)
typename WCoordType::ComponentType planeOffset = vtkm::Dot(planeNormal, wcoordCenter);
if (vtkm::Dot(planeNormal, wcoords) < planeOffset)
{
// wcoords on wrong side of plane, thus outside of triangle
continue;
......@@ -858,8 +858,8 @@ WorldCoordinatesToParametricCoordinates(const WorldCoordVector& pointWCoords,
secondPointIndex = firstPointIndex + 1;
vecInPlane = pointWCoords[secondPointIndex] - wcoordCenter;
planeNormal = vtkm::Cross(polygonNormal, vecInPlane);
planeOffset = vtkm::dot(planeNormal, wcoordCenter);
if (vtkm::dot(planeNormal, wcoords) > planeOffset)
planeOffset = vtkm::Dot(planeNormal, wcoordCenter);
if (vtkm::Dot(planeNormal, wcoords) > planeOffset)
{
// wcoords on wrong side of plane, thus outside of triangle
continue;
......@@ -931,7 +931,7 @@ WorldCoordinatesToParametricCoordinatesTetra(
// from p0 to the adjacent point (which is itself the parametric coordinate
// we are after), we get the following definition for the intersection.
//
// d = dot((wcoords - p0), planeNormal)/dot((p1-p0), planeNormal)
// d = Dot((wcoords - p0), planeNormal)/Dot((p1-p0), planeNormal)
//
const auto vec0 = pointWCoords[1] - pointWCoords[0];
......@@ -941,13 +941,13 @@ WorldCoordinatesToParametricCoordinatesTetra(
typename WorldCoordVector::ComponentType pcoords;
auto planeNormal = vtkm::Cross(vec1, vec2);
pcoords[0] = vtkm::dot(coordVec, planeNormal) / vtkm::dot(vec0, planeNormal);
pcoords[0] = vtkm::Dot(coordVec, planeNormal) / vtkm::Dot(vec0, planeNormal);
planeNormal = vtkm::Cross(vec0, vec2);
pcoords[1] = vtkm::dot(coordVec, planeNormal) / vtkm::dot(vec1, planeNormal);
pcoords[1] = vtkm::Dot(coordVec, planeNormal) / vtkm::Dot(vec1, planeNormal);
planeNormal = vtkm::Cross(vec0, vec1);
pcoords[2] = vtkm::dot(coordVec, planeNormal) / vtkm::dot(vec2, planeNormal);
pcoords[2] = vtkm::Dot(coordVec, planeNormal) / vtkm::Dot(vec2, planeNormal);
return pcoords;
}
......
......@@ -225,7 +225,7 @@ struct TestWorkletProxy : vtkm::exec::FunctorBase
const InputDomainType&,
const G& globalThreadIndexOffset) const
{
const vtkm::Id index = vtkm::dot(threadIndex, vtkm::Id3(1, 8, 64));
const vtkm::Id index = vtkm::Dot(threadIndex, vtkm::Id3(1, 8, 64));
return vtkm::exec::arg::ThreadIndicesBasic(
index, outToIn.Get(index), visit.Get(index), globalThreadIndexOffset);
}
......@@ -265,7 +265,7 @@ struct TestWorkletErrorProxy : vtkm::exec::FunctorBase
const InputDomainType&,
const G& globalThreadIndexOffset) const
{
const vtkm::Id index = vtkm::dot(threadIndex, vtkm::Id3(1, 8, 64));
const vtkm::Id index = vtkm::Dot(threadIndex, vtkm::Id3(1, 8, 64));
return vtkm::exec::arg::ThreadIndicesBasic(
index, outToIn.Get(index), visit.Get(index), globalThreadIndexOffset);
}
......
......@@ -212,7 +212,7 @@ struct TestPCoordsFunctor
numPoints, pointIndex, pcoords, CellShapeTag(), workletProxy);
VTKM_TEST_ASSERT(!errorMessage.IsErrorRaised(), messageBuffer);
Vector3 wCoords = Vector3(pcoords[0], pcoords[1], pcoords[2] + vtkm::dot(pcoords, sheerVec));
Vector3 wCoords = Vector3(pcoords[0], pcoords[1], pcoords[2] + vtkm::Dot(pcoords, sheerVec));
pointWCoords.Append(wCoords);
}
......
......@@ -111,14 +111,14 @@ void CheckResult(const vtkm::cont::ArrayHandle<vtkm::Vec<vtkm::FloatDefault, 3>>
//Make sure result is orthogonal each input vector. Need to normalize to compare with zero.
vtkm::Vec<vtkm::FloatDefault, 3> v1N(vtkm::Normal(v1)), v2N(vtkm::Normal(v1)),
resN(vtkm::Normal(res));
VTKM_TEST_ASSERT(test_equal(vtkm::dot(resN, v1N), vtkm::FloatDefault(0.0)),
VTKM_TEST_ASSERT(test_equal(vtkm::Dot(resN, v1N), vtkm::FloatDefault(0.0)),
"Wrong result for cross product");
VTKM_TEST_ASSERT(test_equal(vtkm::dot(resN, v2N), vtkm::FloatDefault(0.0)),
VTKM_TEST_ASSERT(test_equal(vtkm::Dot(resN, v2N), vtkm::FloatDefault(0.0)),
"Wrong result for cross product");
vtkm::FloatDefault sinAngle =
vtkm::Magnitude(res) * vtkm::RMagnitude(v1) * vtkm::RMagnitude(v2);
vtkm::FloatDefault cosAngle = vtkm::dot(v1, v2) * vtkm::RMagnitude(v1) * vtkm::RMagnitude(v2);
vtkm::FloatDefault cosAngle = vtkm::Dot(v1, v2) * vtkm::RMagnitude(v1) * vtkm::RMagnitude(v2);
VTKM_TEST_ASSERT(test_equal(sinAngle * sinAngle + cosAngle * cosAngle, vtkm::FloatDefault(1.0)),
"Bad cross product length.");
}
......
......@@ -108,7 +108,7 @@ void CheckResult(const vtkm::cont::ArrayHandle<vtkm::Vec<vtkm::FloatDefault, 3>>
vtkm::Vec<vtkm::FloatDefault, 3> v2 = v2Portal.Get(j);
vtkm::FloatDefault res = outPortal.Get(j);
VTKM_TEST_ASSERT(test_equal(vtkm::dot(v1, v2), res), "Wrong result for dot product");
VTKM_TEST_ASSERT(test_equal(vtkm::Dot(v1, v2), res), "Wrong result for dot product");
}
}
......
......@@ -294,7 +294,7 @@ private:
// vtkm::FloatDefault magnitudeValue = GLReturneMags[pointIndex];
// vtkm::FloatDefault magnitudeExpected =
// sqrt(vtkm::dot(pointCoordinateExpected, pointCoordinateExpected));
// sqrt(vtkm::Dot(pointCoordinateExpected, pointCoordinateExpected));
// VTKM_TEST_ASSERT(test_equal(magnitudeValue, magnitudeExpected),
// "Got bad magnitude from OpenGL buffer.");
// }
......
......@@ -77,9 +77,9 @@ struct MatrixHelpers
matrix(2, 1) = viewDir[1];
matrix(2, 2) = viewDir[2];
matrix(0, 3) = -vtkm::dot(right, position);
matrix(1, 3) = -vtkm::dot(ru, position);
matrix(2, 3) = -vtkm::dot(viewDir, position);
matrix(0, 3) = -vtkm::Dot(right, position);
matrix(1, 3) = -vtkm::Dot(ru, position);
matrix(2, 3) = -vtkm::Dot(viewDir, position);
return matrix;
}
......
......@@ -121,7 +121,7 @@ public:
ray_dir = nlook + delta_x * ((2.f * vtkm::Float32(i) - vtkm::Float32(w)) / 2.0f) +
delta_y * ((2.f * vtkm::Float32(j) - vtkm::Float32(h)) / 2.0f);
vtkm::Float32 dot = vtkm::dot(ray_dir, ray_dir);
vtkm::Float32 dot = vtkm::Dot(ray_dir, ray_dir);
vtkm::Float32 sq_mag = vtkm::Sqrt(dot);
ray_dir[0] = ray_dir[0] / sq_mag;
......@@ -338,7 +338,7 @@ public:
if (ray_dir[d] == 0.f)
ray_dir[d] += 0.0000001f;
}
Precision dot = vtkm::dot(ray_dir, ray_dir);
Precision dot = vtkm::Dot(ray_dir, ray_dir);
Precision sq_mag = vtkm::Sqrt(dot);
rayDirX = ray_dir[0] / sq_mag;
......@@ -1064,7 +1064,7 @@ void Camera::CreateDebugRayImp(vtkm::Vec<vtkm::Int32, 2> pixel, Ray<Precision>&
ray_dir = nlook + delta_x * ((2.f * Precision(i) - Precision(this->Width)) / 2.0f) +
delta_y * ((2.f * Precision(j) - Precision(this->Height)) / 2.0f);
Precision dot = vtkm::dot(ray_dir, ray_dir);
Precision dot = vtkm::Dot(ray_dir, ray_dir);
Precision sq_mag = vtkm::Sqrt(dot);
ray_dir[0] = ray_dir[0] / sq_mag;
......
......@@ -279,7 +279,7 @@ public:
vtkm::UInt32& mortonCode) const
{
vtkm::Vec<vtkm::Float32, 3> direction(xmax - xmin, ymax - ymin, zmax - zmin);
vtkm::Float32 halfDistance = sqrtf(vtkm::dot(direction, direction)) * 0.5f;
vtkm::Float32 halfDistance = sqrtf(vtkm::Dot(direction, direction)) * 0.5f;
vtkm::Normalize(direction);
vtkm::Float32 centroidx = xmin + halfDistance * direction[0] - MinCoordinate[0];
vtkm::Float32 centroidy = ymin + halfDistance * direction[1] - MinCoordinate[1];
......
......@@ -122,7 +122,7 @@ public:
vtkm::Normalize(normal);
//flip the normal if its pointing the wrong way
if (vtkm::dot(normal, rayDir) > 0.f)
if (vtkm::Dot(normal, rayDir) > 0.f)
normal = -normal;
normalX = normal[0];
normalY = normal[1];
......@@ -338,15 +338,15 @@ public:
vtkm::Normalize(lightDir);
vtkm::Normalize(viewDir);
//Diffuse lighting
Precision cosTheta = vtkm::dot(normal, lightDir);
Precision cosTheta = vtkm::Dot(normal, lightDir);
//clamp tp [0,1]
const Precision zero = 0.f;
const Precision one = 1.f;
cosTheta = vtkm::Min(vtkm::Max(cosTheta, zero), one);
//Specular lighting
vtkm::Vec<Precision, 3> reflect = 2.f * vtkm::dot(lightDir, normal) * normal - lightDir;
vtkm::Vec<Precision, 3> reflect = 2.f * vtkm::Dot(lightDir, normal) * normal - lightDir;
vtkm::Normalize(reflect);
Precision cosPhi = vtkm::dot(reflect, viewDir);
Precision cosPhi = vtkm::Dot(reflect, viewDir);
Precision specularConstant =
Precision(pow(vtkm::Max(cosPhi, zero), (Precision)SpecularExponent));
vtkm::Int32 colorIdx = vtkm::Int32(scalar * Precision(ColorMapSize - 1));
......
......@@ -145,7 +145,7 @@ struct MatrixTest
{
vtkm::Vec<T, NUM_COLS> leftVector = vtkm::MatrixGetRow(leftFactor, row);
vtkm::Vec<T, NUM_COLS> rightVector = vtkm::MatrixGetColumn(rightFactor, col);
VTKM_TEST_ASSERT(test_equal(product(row, col), vtkm::dot(leftVector, rightVector)),
VTKM_TEST_ASSERT(test_equal(product(row, col), vtkm::Dot(leftVector, rightVector)),
"Matrix multiple wrong.");
}
......
......@@ -189,13 +189,13 @@ void GeneralVecCTypeTest(const vtkm::Vec<ComponentType, Size>&)
div = aSrc / b;
VTKM_TEST_ASSERT(test_equal(div, correct_div), "Tuples not divided correctly.");
ComponentType d = static_cast<ComponentType>(vtkm::dot(a, b));
ComponentType d = static_cast<ComponentType>(vtkm::Dot(a, b));
ComponentType correct_d = 0;
for (vtkm::IdComponent i = 0; i < Size; ++i)
{
correct_d = ComponentType(correct_d + a[i] * b[i]);
}
VTKM_TEST_ASSERT(test_equal(d, correct_d), "dot(Tuple) wrong");
VTKM_TEST_ASSERT(test_equal(d, correct_d), "Dot(Tuple) wrong");
VTKM_TEST_ASSERT(!(a < b), "operator< wrong");
VTKM_TEST_ASSERT((b < a), "operator< wrong");
......@@ -286,13 +286,13 @@ void GeneralVecCConstTypeTest(const vtkm::Vec<ComponentType, Size>&)
div = aSrc / b;
VTKM_TEST_ASSERT(test_equal(div, correct_div), "Tuples not divided correctly.");
ComponentType d = static_cast<ComponentType>(vtkm::dot(a, b));
ComponentType d = static_cast<ComponentType>(vtkm::Dot(a, b));
ComponentType correct_d = 0;
for (vtkm::IdComponent i = 0; i < Size; ++i)
{
correct_d = ComponentType(correct_d + a[i] * b[i]);
}
VTKM_TEST_ASSERT(test_equal(d, correct_d), "dot(Tuple) wrong");
VTKM_TEST_ASSERT(test_equal(d, correct_d), "Dot(Tuple) wrong");
VTKM_TEST_ASSERT(!(a < b), "operator< wrong");
VTKM_TEST_ASSERT((b < a), "operator< wrong");
......@@ -403,13 +403,13 @@ void GeneralVecTypeTest(const vtkm::Vec<ComponentType, Size>&)
div = a / ComponentType(2);
VTKM_TEST_ASSERT(test_equal(div, b), "Tuple does not divide by Scalar correctly.");
ComponentType d = static_cast<ComponentType>(vtkm::dot(a, b));
ComponentType d = static_cast<ComponentType>(vtkm::Dot(a, b));
ComponentType correct_d = 0;
for (vtkm::IdComponent i = 0; i < T::NUM_COMPONENTS; ++i)
{
correct_d = ComponentType(correct_d + a[i] * b[i]);
}
VTKM_TEST_ASSERT(test_equal(d, correct_d), "dot(Tuple) wrong");
VTKM_TEST_ASSERT(test_equal(d, correct_d), "Dot(Tuple) wrong");
VTKM_TEST_ASSERT(!(a < b), "operator< wrong");
VTKM_TEST_ASSERT((b < a), "operator< wrong");
......@@ -477,8 +477,8 @@ void TypeTest(const vtkm::Vec<Scalar, 2>&)
VTKM_TEST_ASSERT(test_equal(div, vtkm::make_Vec(1, 2)),
"Vector does not divide by Scalar correctly.");
Scalar d = static_cast<Scalar>(vtkm::dot(a, b));
VTKM_TEST_ASSERT(test_equal(d, Scalar(10)), "dot(Vector2) wrong");
Scalar d = static_cast<Scalar>(vtkm::Dot(a, b));
VTKM_TEST_ASSERT(test_equal(d, Scalar(10)), "Dot(Vector2) wrong");
VTKM_TEST_ASSERT(!(a < b), "operator< wrong");
VTKM_TEST_ASSERT((b < a), "operator< wrong");
......@@ -539,8 +539,8 @@ void TypeTest(const vtkm::Vec<Scalar, 3>&)
div = a / Scalar(2);
VTKM_TEST_ASSERT(test_equal(div, b), "Vector does not divide by Scalar correctly.");
Scalar d = static_cast<Scalar>(vtkm::dot(a, b));
VTKM_TEST_ASSERT(test_equal(d, Scalar(28)), "dot(Vector3) wrong");
Scalar d = static_cast<Scalar>(vtkm::Dot(a, b));
VTKM_TEST_ASSERT(test_equal(d, Scalar(28)), "Dot(Vector3) wrong");
VTKM_TEST_ASSERT(!(a < b), "operator< wrong");
VTKM_TEST_ASSERT((b < a), "operator< wrong");
......@@ -601,8 +601,8 @@ void TypeTest(const vtkm::Vec<Scalar, 4>&)
div = a / Scalar(2);
VTKM_TEST_ASSERT(test_equal(div, b), "Vector does not divide by Scalar correctly.");
Scalar d = static_cast<Scalar>(vtkm::dot(a, b));
VTKM_TEST_ASSERT(test_equal(d, Scalar(60)), "dot(Vector4) wrong");
Scalar d = static_cast<Scalar>(vtkm::Dot(a, b));
VTKM_TEST_ASSERT(test_equal(d, Scalar(60)), "Dot(Vector4) wrong");
VTKM_TEST_ASSERT(!(a < b), "operator< wrong");
VTKM_TEST_ASSERT((b < a), "operator< wrong");
......@@ -668,20 +668,20 @@ void TypeTest(Scalar)
VTKM_TEST_FAIL("operator!= wrong");
}
if (vtkm::dot(a, b) != 8)
if (vtkm::Dot(a, b) != 8)
{
VTKM_TEST_FAIL("dot(Scalar) wrong");
VTKM_TEST_FAIL("Dot(Scalar) wrong");
}
//verify we don't roll over
Scalar c = 128;
Scalar d = 32;
auto r = vtkm::dot(c, d);
auto r = vtkm::Dot(c, d);
VTKM_TEST_ASSERT((sizeof(r) >= sizeof(int)),
"dot(Scalar) didn't promote smaller than 32bit types");
"Dot(Scalar) didn't promote smaller than 32bit types");
if (r != 4096)
{
VTKM_TEST_FAIL("dot(Scalar) wrong");