Skip to content
Snippets Groups Projects
Commit 9db8483b authored by Kenneth Moreland's avatar Kenneth Moreland
Browse files

Merge branch 'msvc-warnings'

parents b2e39ad8 dd897c05
No related branches found
No related tags found
No related merge requests found
......@@ -77,7 +77,7 @@ public:
VTKM_EXEC_CONT_EXPORT
ValueType Get(vtkm::Id index) const {
return StartingValue + ValueType(ComponentType(index));
return StartingValue + ValueType(static_cast<ComponentType>(index));
}
private:
......
......@@ -37,7 +37,6 @@
namespace fancy_array_detail
{
template<typename T>
class IncrementBy2
{
public:
......@@ -48,10 +47,10 @@ public:
}
VTKM_EXEC_CONT_EXPORT
explicit IncrementBy2(T value): Value(2*value) { }
explicit IncrementBy2(vtkm::Id value): Value(2*value) { }
VTKM_EXEC_CONT_EXPORT
operator T() const { return this->Value; }
operator vtkm::Id() const { return this->Value; }
VTKM_EXEC_CONT_EXPORT
IncrementBy2 operator+(const IncrementBy2 &rhs) const
......@@ -82,13 +81,12 @@ public:
{ os << v.Value; return os; }
T Value;
vtkm::Id Value;
};
template<typename T>
IncrementBy2<T> TestValue(vtkm::Id index, IncrementBy2<T>)
IncrementBy2 TestValue(vtkm::Id index, IncrementBy2)
{
return IncrementBy2<T>(::TestValue(index, T()));
return IncrementBy2(::TestValue(index, vtkm::Id()));
}
template<typename ValueType>
......@@ -110,32 +108,22 @@ struct ValueSquared
ValueType operator()(U u) const
{ return vtkm::dot(u, u); }
template<typename U>
VTKM_EXEC_CONT_EXPORT
ValueType operator()( ::fancy_array_detail::IncrementBy2<U> u) const
ValueType operator()( ::fancy_array_detail::IncrementBy2 u) const
{ return ValueType( vtkm::dot(u.Value, u.Value) ); }
};
}
namespace vtkm {
// Allows us to use vec traits with IncrementBy2, will make look like
// a vector of a single component
template< typename T >
struct VecTraits< ::fancy_array_detail::IncrementBy2<T> > :
public vtkm::internal::VecTraitsBasic< ::fancy_array_detail::IncrementBy2<T> >
{ };
}
VTKM_BASIC_TYPE_VECTOR(::fancy_array_detail::IncrementBy2)
namespace vtkm { namespace testing {
template<typename T>
struct TypeName< ::fancy_array_detail::IncrementBy2<T> >
template<>
struct TypeName< ::fancy_array_detail::IncrementBy2 >
{
static std::string Name()
static std::string Name()
{
std::stringstream stream;
stream << "fancy_array_detail::IncrementBy2< " << TypeName<T>::Name() << " >";
return stream.str();
return std::string("fancy_array_detail::IncrementBy2");
}
};
......@@ -505,8 +493,7 @@ private:
vtkm::Float64,
vtkm::Vec<vtkm::Float64,3>,
vtkm::Vec<vtkm::Float32,4>,
::fancy_array_detail::IncrementBy2 < vtkm::Int32 >,
::fancy_array_detail::IncrementBy2 < vtkm::Float32 >
::fancy_array_detail::IncrementBy2
>
{ };
......
......@@ -24,6 +24,8 @@
#include <vtkm/cont/ArrayHandleImplicit.h>
#include <vtkm/cont/DeviceAdapterSerial.h>
#include <vtkm/VecTraits.h>
#include <vtkm/cont/testing/Testing.h>
namespace {
......@@ -35,7 +37,10 @@ struct IndexSquared
{
VTKM_EXEC_CONT_EXPORT
ValueType operator()(vtkm::Id i) const
{ return ValueType(i*i); }
{
typedef typename vtkm::VecTraits<ValueType>::ComponentType ComponentType;
return ValueType(static_cast<ComponentType>(i*i));
}
};
......
......@@ -166,7 +166,7 @@ struct TransformTests
Portal portal = input.GetPortalControl();
for(vtkm::Id index=0; index < ARRAY_SIZE; ++index)
{
portal.Set(index, InputValueType(index+2) );
portal.Set(index, TestValue(index, InputValueType()) );
}
CheckControlPortals(input, thandle);
......@@ -180,7 +180,7 @@ struct TransformTests
<< std::endl;
for(vtkm::Id index=0; index < ARRAY_SIZE; ++index)
{
portal.Set(index, InputValueType(index*index));
portal.Set(index, TestValue(index*index, InputValueType()));
}
CheckControlPortals(input, thandle);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment