Merge branch 'WindowsSupport'

This commit is contained in:
Robert Maynard 2014-05-19 14:40:19 -04:00
commit 085524f7ea
14 changed files with 41 additions and 32 deletions

@ -249,12 +249,12 @@ struct copy_vector<3>
#if VTKM_SIZE_ID == 4 #if VTKM_SIZE_ID == 4
/// Represents an ID. /// Represents an ID.
typedef internal::Int32Type Id __attribute__ ((aligned(VTKM_SIZE_ID))); typedef internal::Int32Type Id;
#elif VTKM_SIZE_ID == 8 #elif VTKM_SIZE_ID == 8
/// Represents an ID. /// Represents an ID.
typedef internal::Int64Type Id __attribute__ ((aligned(VTKM_SIZE_ID))); typedef internal::Int64Type Id;
#else #else
#error Unknown Id Size #error Unknown Id Size
@ -263,12 +263,12 @@ typedef internal::Int64Type Id __attribute__ ((aligned(VTKM_SIZE_ID)));
#ifdef VTKM_USE_DOUBLE_PRECISION #ifdef VTKM_USE_DOUBLE_PRECISION
/// Scalar corresponds to a floating point number. /// Scalar corresponds to a floating point number.
typedef double Scalar __attribute__ ((aligned(VTKM_SIZE_SCALAR))); typedef double Scalar;
#else //VTKM_USE_DOUBLE_PRECISION #else //VTKM_USE_DOUBLE_PRECISION
/// Scalar corresponds to a floating point number. /// Scalar corresponds to a floating point number.
typedef float Scalar __attribute__ ((aligned(VTKM_SIZE_SCALAR))); typedef float Scalar;
#endif //VTKM_USE_DOUBLE_PRECISION #endif //VTKM_USE_DOUBLE_PRECISION
@ -431,12 +431,11 @@ protected:
}; };
/// Vector2 corresponds to a 2-tuple /// Vector2 corresponds to a 2-tuple
typedef vtkm::Tuple<vtkm::Scalar,2> typedef vtkm::Tuple<vtkm::Scalar,2> Vector2;
Vector2 __attribute__ ((aligned(VTKM_ALIGNMENT_TWO_SCALAR)));
/// Id2 corresponds to a 2-dimensional index /// Id2 corresponds to a 2-dimensional index
typedef vtkm::Tuple<vtkm::Id,2> Id2 __attribute__ ((aligned(VTKM_SIZE_ID))); typedef vtkm::Tuple<vtkm::Id,2> Id2;
template<typename T> template<typename T>
class Tuple<T,3> class Tuple<T,3>
@ -511,8 +510,11 @@ protected:
}; };
/// Vector3 corresponds to a 3-tuple /// Vector3 corresponds to a 3-tuple
typedef vtkm::Tuple<vtkm::Scalar,3> typedef vtkm::Tuple<vtkm::Scalar,3> Vector3;
Vector3 __attribute__ ((aligned(VTKM_SIZE_SCALAR)));
/// Id3 corresponds to a 3-dimensional index for 3d arrays. Note that
/// the precision of each index may be less than vtkm::Id.
typedef vtkm::Tuple<vtkm::Id,3> Id3;
template<typename T> template<typename T>
class Tuple<T,4> class Tuple<T,4>
@ -592,14 +594,9 @@ protected:
}; };
/// Vector4 corresponds to a 4-tuple /// Vector4 corresponds to a 4-tuple
typedef vtkm::Tuple<vtkm::Scalar,4> typedef vtkm::Tuple<vtkm::Scalar,4> Vector4;
Vector4 __attribute__ ((aligned(VTKM_ALIGNMENT_FOUR_SCALAR)));
/// Id3 corresponds to a 3-dimensional index for 3d arrays. Note that
/// the precision of each index may be less than vtkm::Id.
typedef vtkm::Tuple<vtkm::Id,3> Id3 __attribute__ ((aligned(VTKM_SIZE_ID)));
/// Initializes and returns a Vector2. /// Initializes and returns a Vector2.
VTKM_EXEC_CONT_EXPORT vtkm::Vector2 make_Vector2(vtkm::Scalar x, VTKM_EXEC_CONT_EXPORT vtkm::Vector2 make_Vector2(vtkm::Scalar x,
vtkm::Scalar y) vtkm::Scalar y)

@ -131,7 +131,7 @@ public:
return this->Portal.GetNumberOfValues(); return this->Portal.GetNumberOfValues();
} }
VTKM_CONT_EXPORT void LoadDataForInput(PortalConstControl portal) VTKM_CONT_EXPORT void LoadDataForInput(const PortalConstControl& portal)
{ {
this->Portal = portal; this->Portal = portal;
this->PortalValid = true; this->PortalValid = true;

@ -101,7 +101,7 @@ public:
/// Constructs an ArrayHandle pointing to the data in the given array portal. /// Constructs an ArrayHandle pointing to the data in the given array portal.
/// ///
VTKM_CONT_EXPORT ArrayHandle(PortalConstControl userData) VTKM_CONT_EXPORT ArrayHandle(const PortalConstControl& userData)
: Internals(new InternalStruct) : Internals(new InternalStruct)
{ {
this->Internals->UserPortal = userData; this->Internals->UserPortal = userData;

@ -36,6 +36,14 @@ class Error
public: public:
const std::string &GetMessage() const { return this->Message; } const std::string &GetMessage() const { return this->Message; }
//GetMessage is a macro defined by <windows.h> to redirrect to
//GetMessageA or W depending on if you are using ansi or unicode.
//To get around this we make our own A/W variants on windows.
#ifdef _WIN32
const std::string &GetMessageA() const { return this->Message; }
const std::string &GetMessageW() const { return this->Message; }
#endif
protected: protected:
Error() { } Error() { }
Error(const std::string message) : Message(message) { } Error(const std::string message) : Message(message) { }

@ -73,7 +73,7 @@ public:
/// arrays, then this method may save the iterators to be returned in the \c /// arrays, then this method may save the iterators to be returned in the \c
/// GetPortalConst methods. /// GetPortalConst methods.
/// ///
virtual void LoadDataForInput(PortalConstControl portal) = 0; virtual void LoadDataForInput(const PortalConstControl& portal) = 0;
/// Allocates a large enough array in the execution environment and copies /// Allocates a large enough array in the execution environment and copies
/// the given data to that array. The allocated array can later be accessed /// the given data to that array. The allocated array can later be accessed
@ -212,7 +212,7 @@ public:
} }
VTKM_CONT_EXPORT VTKM_CONT_EXPORT
void LoadDataForInput(PortalConstControl portal) void LoadDataForInput(const PortalConstControl& portal)
{ {
this->Transfer.LoadDataForInput(portal); this->Transfer.LoadDataForInput(portal);
} }

@ -83,7 +83,7 @@ public:
/// GetPortalConst method. /// GetPortalConst method.
/// ///
VTKM_CONT_EXPORT void LoadDataForInput( VTKM_CONT_EXPORT void LoadDataForInput(
typename ContainerType::PortalConstType portal); const typename ContainerType::PortalConstType& portal);
/// Allocates a large enough array in the execution environment and copies /// Allocates a large enough array in the execution environment and copies
/// the given data to that array. The allocated array can later be accessed /// the given data to that array. The allocated array can later be accessed

@ -64,7 +64,7 @@ public:
/// Saves the given iterators to be returned later. /// Saves the given iterators to be returned later.
/// ///
VTKM_CONT_EXPORT void LoadDataForInput(PortalConstType portal) VTKM_CONT_EXPORT void LoadDataForInput(const PortalConstType& portal)
{ {
this->ConstPortal = portal; this->ConstPortal = portal;
this->ConstPortalValid = true; this->ConstPortalValid = true;

@ -73,7 +73,7 @@ public:
} }
VTKM_CONT_EXPORT VTKM_CONT_EXPORT
void Set(vtkm::Id index, ValueType value) const void Set(vtkm::Id index, const ValueType& value) const
{ {
*this->IteratorAt(index) = value; *this->IteratorAt(index) = value;
} }

@ -77,7 +77,7 @@ public:
} }
VTKM_CONT_EXPORT VTKM_CONT_EXPORT
void Set(vtkm::Id index, ValueType value) const void Set(vtkm::Id index, const ValueType& value) const
{ {
VTKM_ASSERT_CONT(index >= 0); VTKM_ASSERT_CONT(index >= 0);
VTKM_ASSERT_CONT(index < this->GetNumberOfValues()); VTKM_ASSERT_CONT(index < this->GetNumberOfValues());

@ -82,7 +82,7 @@ public:
/// arrays, then this method may save the iterators to be returned in the \c /// arrays, then this method may save the iterators to be returned in the \c
/// GetPortalConst methods. /// GetPortalConst methods.
/// ///
VTKM_CONT_EXPORT void LoadDataForInput(PortalConstControl portal) VTKM_CONT_EXPORT void LoadDataForInput(const PortalConstControl& portal)
{ {
this->ArrayManager.LoadDataForInput(portal); this->ArrayManager.LoadDataForInput(portal);
} }

@ -60,7 +60,7 @@ struct IteratorFromArrayPortalValue
} }
VTKM_CONT_EXPORT VTKM_CONT_EXPORT
ValueType operator=(ValueType value) ValueType operator=(const ValueType& value)
{ {
this->Portal.Set(this->Index, value); this->Portal.Set(this->Index, value);
return value; return value;

@ -40,7 +40,7 @@ struct TemplatedTests
typedef vtkm::cont::internal::ArrayContainerControl< typedef vtkm::cont::internal::ArrayContainerControl<
T, vtkm::cont::ArrayContainerControlTagBasic> ArrayContainerType; T, vtkm::cont::ArrayContainerControlTagBasic> ArrayContainerType;
void SetContainer(ArrayContainerType &array, ValueType value) void SetContainer(ArrayContainerType &array, const ValueType& value)
{ {
std::fill(array.GetPortal().GetIteratorBegin(), std::fill(array.GetPortal().GetIteratorBegin(),
array.GetPortal().GetIteratorEnd(), array.GetPortal().GetIteratorEnd(),
@ -48,7 +48,7 @@ struct TemplatedTests
} }
template <class IteratorType> template <class IteratorType>
bool CheckArray(IteratorType begin, IteratorType end, ValueType value) bool CheckArray(IteratorType begin, IteratorType end, const ValueType& value)
{ {
for (IteratorType iter = begin; iter != end; iter++) for (IteratorType iter = begin; iter != end; iter++)
{ {
@ -57,7 +57,7 @@ struct TemplatedTests
return true; return true;
} }
bool CheckContainer(ArrayContainerType &array, ValueType value) bool CheckContainer(ArrayContainerType &array, const ValueType& value)
{ {
return CheckArray(array.GetPortalConst().GetIteratorBegin(), return CheckArray(array.GetPortalConst().GetIteratorBegin(),
array.GetPortalConst().GetIteratorEnd(), array.GetPortalConst().GetIteratorEnd(),

@ -38,7 +38,7 @@ struct TemplatedTests
typedef typename ArrayContainerType::PortalType PortalType; typedef typename ArrayContainerType::PortalType PortalType;
typedef typename PortalType::IteratorType IteratorType; typedef typename PortalType::IteratorType IteratorType;
void SetContainer(ArrayContainerType &array, ValueType value) void SetContainer(ArrayContainerType &array, const ValueType& value)
{ {
for (IteratorType iter = array.GetPortal().GetIteratorBegin(); for (IteratorType iter = array.GetPortal().GetIteratorBegin();
iter != array.GetPortal().GetIteratorEnd(); iter != array.GetPortal().GetIteratorEnd();
@ -48,7 +48,7 @@ struct TemplatedTests
} }
} }
bool CheckContainer(ArrayContainerType &array, ValueType value) bool CheckContainer(ArrayContainerType &array, const ValueType& value)
{ {
for (IteratorType iter = array.GetPortal().GetIteratorBegin(); for (IteratorType iter = array.GetPortal().GetIteratorBegin();
iter != array.GetPortal().GetIteratorEnd(); iter != array.GetPortal().GetIteratorEnd();

@ -211,8 +211,12 @@
* *
*/ */
#ifndef OPTIONPARSER_H_ #ifdef _MSC_VER
#define OPTIONPARSER_H_ #include <intrin.h>
#endif
#ifndef vtk_m_testing_OPTIONPARSER_H_
#define vtk_m_testing_OPTIONPARSER_H_
namespace vtkm { namespace vtkm {
namespace testing { namespace testing {