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
/// Represents an ID.
typedef internal::Int32Type Id __attribute__ ((aligned(VTKM_SIZE_ID)));
typedef internal::Int32Type Id;
#elif VTKM_SIZE_ID == 8
/// Represents an ID.
typedef internal::Int64Type Id __attribute__ ((aligned(VTKM_SIZE_ID)));
typedef internal::Int64Type Id;
#else
#error Unknown Id Size
@ -263,12 +263,12 @@ typedef internal::Int64Type Id __attribute__ ((aligned(VTKM_SIZE_ID)));
#ifdef VTKM_USE_DOUBLE_PRECISION
/// Scalar corresponds to a floating point number.
typedef double Scalar __attribute__ ((aligned(VTKM_SIZE_SCALAR)));
typedef double Scalar;
#else //VTKM_USE_DOUBLE_PRECISION
/// Scalar corresponds to a floating point number.
typedef float Scalar __attribute__ ((aligned(VTKM_SIZE_SCALAR)));
typedef float Scalar;
#endif //VTKM_USE_DOUBLE_PRECISION
@ -431,12 +431,11 @@ protected:
};
/// Vector2 corresponds to a 2-tuple
typedef vtkm::Tuple<vtkm::Scalar,2>
Vector2 __attribute__ ((aligned(VTKM_ALIGNMENT_TWO_SCALAR)));
typedef vtkm::Tuple<vtkm::Scalar,2> Vector2;
/// 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>
class Tuple<T,3>
@ -511,8 +510,11 @@ protected:
};
/// Vector3 corresponds to a 3-tuple
typedef vtkm::Tuple<vtkm::Scalar,3>
Vector3 __attribute__ ((aligned(VTKM_SIZE_SCALAR)));
typedef vtkm::Tuple<vtkm::Scalar,3> Vector3;
/// 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>
class Tuple<T,4>
@ -592,14 +594,9 @@ protected:
};
/// Vector4 corresponds to a 4-tuple
typedef vtkm::Tuple<vtkm::Scalar,4>
Vector4 __attribute__ ((aligned(VTKM_ALIGNMENT_FOUR_SCALAR)));
typedef vtkm::Tuple<vtkm::Scalar,4> Vector4;
/// 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.
VTKM_EXEC_CONT_EXPORT vtkm::Vector2 make_Vector2(vtkm::Scalar x,
vtkm::Scalar y)

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

@ -101,7 +101,7 @@ public:
/// 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)
{
this->Internals->UserPortal = userData;

@ -36,6 +36,14 @@ class Error
public:
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:
Error() { }
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
/// 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
/// the given data to that array. The allocated array can later be accessed
@ -212,7 +212,7 @@ public:
}
VTKM_CONT_EXPORT
void LoadDataForInput(PortalConstControl portal)
void LoadDataForInput(const PortalConstControl& portal)
{
this->Transfer.LoadDataForInput(portal);
}

@ -83,7 +83,7 @@ public:
/// GetPortalConst method.
///
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
/// 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.
///
VTKM_CONT_EXPORT void LoadDataForInput(PortalConstType portal)
VTKM_CONT_EXPORT void LoadDataForInput(const PortalConstType& portal)
{
this->ConstPortal = portal;
this->ConstPortalValid = true;

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

@ -77,7 +77,7 @@ public:
}
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 < this->GetNumberOfValues());

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

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

@ -40,7 +40,7 @@ struct TemplatedTests
typedef vtkm::cont::internal::ArrayContainerControl<
T, vtkm::cont::ArrayContainerControlTagBasic> ArrayContainerType;
void SetContainer(ArrayContainerType &array, ValueType value)
void SetContainer(ArrayContainerType &array, const ValueType& value)
{
std::fill(array.GetPortal().GetIteratorBegin(),
array.GetPortal().GetIteratorEnd(),
@ -48,7 +48,7 @@ struct TemplatedTests
}
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++)
{
@ -57,7 +57,7 @@ struct TemplatedTests
return true;
}
bool CheckContainer(ArrayContainerType &array, ValueType value)
bool CheckContainer(ArrayContainerType &array, const ValueType& value)
{
return CheckArray(array.GetPortalConst().GetIteratorBegin(),
array.GetPortalConst().GetIteratorEnd(),

@ -38,7 +38,7 @@ struct TemplatedTests
typedef typename ArrayContainerType::PortalType PortalType;
typedef typename PortalType::IteratorType IteratorType;
void SetContainer(ArrayContainerType &array, ValueType value)
void SetContainer(ArrayContainerType &array, const ValueType& value)
{
for (IteratorType iter = array.GetPortal().GetIteratorBegin();
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();
iter != array.GetPortal().GetIteratorEnd();

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