Move Bounds and Matrix operators to vtkm namespace

This helps with ADL lookup.
This commit is contained in:
Kenneth Moreland 2019-06-06 12:48:30 -06:00
parent 0bf3c7ffcb
commit a3783ef514
2 changed files with 27 additions and 4 deletions

@ -170,8 +170,6 @@ struct Bounds
} }
}; };
} // namespace vtkm
/// Helper function for printing bounds during testing /// Helper function for printing bounds during testing
/// ///
static inline VTKM_CONT std::ostream& operator<<(std::ostream& stream, const vtkm::Bounds& bounds) static inline VTKM_CONT std::ostream& operator<<(std::ostream& stream, const vtkm::Bounds& bounds)
@ -179,4 +177,6 @@ static inline VTKM_CONT std::ostream& operator<<(std::ostream& stream, const vtk
return stream << "{ X:" << bounds.X << ", Y:" << bounds.Y << ", Z:" << bounds.Z << " }"; return stream << "{ X:" << bounds.X << ", Y:" << bounds.Y << ", Z:" << bounds.Z << " }";
} }
} // namespace vtkm
#endif //vtk_m_Bounds_h #endif //vtk_m_Bounds_h

@ -523,6 +523,12 @@ struct TypeTraits<vtkm::Matrix<T, NumRow, NumCol>>
{ {
using NumericTag = typename TypeTraits<T>::NumericTag; using NumericTag = typename TypeTraits<T>::NumericTag;
using DimensionalityTag = vtkm::TypeTraitsMatrixTag; using DimensionalityTag = vtkm::TypeTraitsMatrixTag;
VTKM_EXEC_CONT
static vtkm::Matrix<T, NumRow, NumCol> ZeroInitialization()
{
return vtkm::Matrix<T, NumRow, NumCol>(vtkm::TypeTraits<T>::ZeroInitialization());
}
}; };
/// A matrix has vector traits to implement component-wise operations. /// A matrix has vector traits to implement component-wise operations.
@ -563,8 +569,6 @@ public:
} }
}; };
} // namespace vtkm
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
// Basic comparison operators. // Basic comparison operators.
@ -589,4 +593,23 @@ VTKM_EXEC_CONT bool operator!=(const vtkm::Matrix<T, NumRow, NumCol>& a,
return !(a == b); return !(a == b);
} }
/// Helper function for printing out matricies during testing
///
template <typename T, vtkm::IdComponent NumRow, vtkm::IdComponent NumCol>
VTKM_CONT std::ostream& operator<<(std::ostream& stream, const vtkm::Matrix<T, NumRow, NumCol>& mat)
{
stream << std::endl;
for (vtkm::IdComponent row = 0; row < NumRow; ++row)
{
stream << "| ";
for (vtkm::IdComponent col = 0; col < NumCol; ++col)
{
stream << mat(row, col) << "\t";
}
stream << "|" << std::endl;
}
return stream;
}
} // namespace vtkm
#endif //vtk_m_Matrix_h #endif //vtk_m_Matrix_h