Merge branch 'icc-fix'

This commit is contained in:
Kenneth Moreland 2014-07-10 10:58:04 -06:00
commit b66a5c706a
2 changed files with 19 additions and 4 deletions

@ -29,6 +29,7 @@
#include <sstream>
#include <string>
#include <typeinfo>
namespace {
@ -110,6 +111,7 @@ struct CheckFunctor
template<typename T, typename Storage>
void operator()(vtkm::cont::ArrayHandle<T, Storage> array) const {
CheckCalled = true;
std::cout << " Checking for type: " << typeid(T).name() << std::endl;
VTKM_TEST_ASSERT(array.GetNumberOfValues() == ARRAY_SIZE,
"Unexpected array size.");
@ -118,7 +120,7 @@ struct CheckFunctor
array.GetPortalConstControl();
for (vtkm::Id index = 0; index < ARRAY_SIZE; index++)
{
VTKM_TEST_ASSERT(portal.Get(index) == TestValue(index, T()),
VTKM_TEST_ASSERT(test_equal(portal.Get(index), TestValue(index, T())),
"Got bad value in array. Perhaps a bad cast?");
}
}
@ -270,8 +272,11 @@ void TryUnusualTypeAndStorage()
void TestDynamicArrayHandle()
{
std::cout << "Try common types with default type lists." << std::endl;
std::cout << "*** vtkm::Id ***************" << std::endl;
TryDefaultType(vtkm::Id());
std::cout << "*** vtkm::Scalar ***********" << std::endl;
TryDefaultType(vtkm::Scalar());
std::cout << "*** vtkm::Vector3 **********" << std::endl;
TryDefaultType(vtkm::Vector3());
std::cout << "Try all VTK-m types." << std::endl;

@ -298,9 +298,10 @@ public:
/// variance due to floating point numerical inaccuracies.
///
template<typename VectorType>
VTKM_EXEC_CONT_EXPORT bool test_equal(VectorType vector1,
VectorType vector2,
vtkm::Scalar tolerance = 0.0001)
VTKM_EXEC_CONT_EXPORT
bool test_equal(VectorType vector1,
VectorType vector2,
vtkm::Scalar tolerance = 0.0001)
{
typedef typename vtkm::VectorTraits<VectorType> Traits;
for (int component = 0; component < Traits::NUM_COMPONENTS; component++)
@ -328,6 +329,15 @@ VTKM_EXEC_CONT_EXPORT bool test_equal(VectorType vector1,
return true;
}
/// Special implementation of test_equal for strings, which don't fit a model
/// of fixed length vectors of numbers.
///
VTKM_EXEC_CONT_EXPORT
bool test_equal(const std::string &string1, const std::string &string2)
{
return string1 == string2;
}
/// Helper function for printing out vectors during testing.
///
template<typename T, int Size>