Merge branch 'windows-fixes'
This commit is contained in:
commit
9f7fcaf579
@ -52,17 +52,17 @@ struct Extent
|
||||
this->Max = rhs.Max;
|
||||
return *this;
|
||||
}
|
||||
} __attribute__ ((aligned(VTKM_SIZE_ID)));
|
||||
};
|
||||
|
||||
/// This is the Extent to use for structured grids with 3 topological
|
||||
/// dimensions.
|
||||
///
|
||||
typedef vtkm::Extent<3> Extent3 __attribute__ ((aligned(VTKM_SIZE_ID)));
|
||||
typedef vtkm::Extent<3> Extent3;
|
||||
|
||||
/// This is the Extent to use for structured grids with 2 topological
|
||||
/// dimensions.
|
||||
///
|
||||
typedef vtkm::Extent<2> Extent2 __attribute__ ((aligned(VTKM_SIZE_ID)));
|
||||
typedef vtkm::Extent<2> Extent2;
|
||||
|
||||
/// Given an extent, returns the array dimensions for the points.
|
||||
///
|
||||
|
97
vtkm/Types.h
97
vtkm/Types.h
@ -470,6 +470,103 @@ protected:
|
||||
ComponentType Components[NUM_COMPONENTS];
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Specializations for small tuples. These are not exactly common but can occur
|
||||
// with generalizations. We implement them a bit special.
|
||||
|
||||
template<typename T>
|
||||
class Tuple<T, 0>
|
||||
{
|
||||
public:
|
||||
typedef T ComponentType;
|
||||
static const int NUM_COMPONENTS = 1;
|
||||
|
||||
VTKM_EXEC_CONT_EXPORT Tuple() {}
|
||||
VTKM_EXEC_CONT_EXPORT explicit Tuple(const ComponentType&) { }
|
||||
VTKM_EXEC_CONT_EXPORT explicit Tuple(const ComponentType*) { }
|
||||
VTKM_EXEC_CONT_EXPORT
|
||||
Tuple(const Tuple<ComponentType, NUM_COMPONENTS> &) { }
|
||||
|
||||
VTKM_EXEC_CONT_EXPORT
|
||||
Tuple<ComponentType, NUM_COMPONENTS> &
|
||||
operator=(const Tuple<ComponentType, NUM_COMPONENTS> &)
|
||||
{
|
||||
return *this;
|
||||
}
|
||||
|
||||
VTKM_EXEC_CONT_EXPORT ComponentType operator[](int vtkmNotUsed(idx)) const
|
||||
{
|
||||
return ComponentType();
|
||||
}
|
||||
|
||||
VTKM_EXEC_CONT_EXPORT
|
||||
bool operator==(const Tuple<T, NUM_COMPONENTS> &vtkmNotUsed(other)) const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
VTKM_EXEC_CONT_EXPORT
|
||||
bool operator!=(const Tuple<T, NUM_COMPONENTS> &vtkmNotUsed(other)) const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
class Tuple<T, 1>
|
||||
{
|
||||
public:
|
||||
typedef T ComponentType;
|
||||
static const int NUM_COMPONENTS = 1;
|
||||
|
||||
VTKM_EXEC_CONT_EXPORT Tuple() {}
|
||||
VTKM_EXEC_CONT_EXPORT explicit Tuple(const ComponentType& value)
|
||||
: Component(value) { }
|
||||
VTKM_EXEC_CONT_EXPORT explicit Tuple(const ComponentType* values)
|
||||
: Component(*values) { }
|
||||
VTKM_EXEC_CONT_EXPORT
|
||||
Tuple(const Tuple<ComponentType, NUM_COMPONENTS> &src)
|
||||
: Component(src.Component) { }
|
||||
|
||||
VTKM_EXEC_CONT_EXPORT
|
||||
Tuple<ComponentType, NUM_COMPONENTS> &
|
||||
operator=(const Tuple<ComponentType, NUM_COMPONENTS> &src)
|
||||
{
|
||||
this->Component = src.Component;
|
||||
return *this;
|
||||
}
|
||||
|
||||
VTKM_EXEC_CONT_EXPORT
|
||||
const ComponentType &operator[](int vtkmNotUsed(idx)) const
|
||||
{
|
||||
return this->Component;
|
||||
}
|
||||
VTKM_EXEC_CONT_EXPORT
|
||||
ComponentType &operator[](int vtkmNotUsed(idx))
|
||||
{
|
||||
return this->Component;
|
||||
}
|
||||
|
||||
VTKM_EXEC_CONT_EXPORT
|
||||
bool operator==(const Tuple<T, NUM_COMPONENTS> &other) const
|
||||
{
|
||||
return this->Component == other.Component;
|
||||
}
|
||||
VTKM_EXEC_CONT_EXPORT
|
||||
bool operator!=(const Tuple<T, NUM_COMPONENTS> &other) const
|
||||
{
|
||||
return !(this->operator==(other));
|
||||
}
|
||||
|
||||
VTKM_EXEC_CONT_EXPORT
|
||||
bool operator<(const Tuple<T, NUM_COMPONENTS> &other) const
|
||||
{
|
||||
return this->Component < other.Component;
|
||||
}
|
||||
|
||||
protected:
|
||||
ComponentType Component;
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Specializations for common tuple sizes (with special names).
|
||||
|
||||
|
@ -25,7 +25,10 @@
|
||||
#include <vtkm/cont/internal/ArrayManagerExecution.h>
|
||||
#include <vtkm/cont/internal/DeviceAdapterTag.h>
|
||||
|
||||
#ifndef _WIN32
|
||||
#ifdef _WIN32
|
||||
#include <sys/timeb.h>
|
||||
#include <sys/types.h>
|
||||
#else //!_WIN32
|
||||
#include <limits.h>
|
||||
#include <sys/time.h>
|
||||
#include <unistd.h>
|
||||
@ -349,9 +352,10 @@ public:
|
||||
TimeStamp currentTime = this->GetCurrentTime();
|
||||
|
||||
vtkm::Scalar elapsedTime;
|
||||
elapsedTime = currentTime.Seconds - this->StartTime.Seconds;
|
||||
elapsedTime += ((currentTime.Microseconds - this->StartTime.Microseconds)
|
||||
/vtkm::Scalar(1000000));
|
||||
elapsedTime = vtkm::Scalar(currentTime.Seconds - this->StartTime.Seconds);
|
||||
elapsedTime +=
|
||||
(vtkm::Scalar(currentTime.Microseconds - this->StartTime.Microseconds)
|
||||
/vtkm::Scalar(1000000));
|
||||
|
||||
return elapsedTime;
|
||||
}
|
||||
|
@ -363,7 +363,7 @@ private:
|
||||
vtkm::Scalar inputArray[ARRAY_SIZE*2];
|
||||
for (vtkm::Id index = 0; index < ARRAY_SIZE*2; index++)
|
||||
{
|
||||
inputArray[index] = index;
|
||||
inputArray[index] = vtkm::Scalar(index);
|
||||
}
|
||||
::vtkm::cont::internal::ArrayPortalFromIterators<vtkm::Scalar *>
|
||||
inputPortal(inputArray, inputArray+ARRAY_SIZE*2);
|
||||
@ -465,7 +465,7 @@ private:
|
||||
|
||||
for (vtkm::Id index = 0; index < 1; index++)
|
||||
{
|
||||
vtkm::Scalar value = container.GetPortalConst().Get(index);
|
||||
vtkm::Id value = container.GetPortalConst().Get(index);
|
||||
VTKM_TEST_ASSERT(value == index + OFFSET,
|
||||
"Got bad value for single value scheduled kernel.");
|
||||
}
|
||||
@ -505,7 +505,7 @@ private:
|
||||
std::cout << "Allocating execution array" << std::endl;
|
||||
IdContainer container;
|
||||
IdArrayManagerExecution manager;
|
||||
vtkm::Id DIM_SIZE = std::pow(ARRAY_SIZE, 1/3.0f);
|
||||
vtkm::Id DIM_SIZE = vtkm::Id(std::pow(ARRAY_SIZE, 1/3.0f));
|
||||
manager.AllocateArrayForOutput(container,
|
||||
DIM_SIZE * DIM_SIZE * DIM_SIZE);
|
||||
vtkm::Id3 maxRange(DIM_SIZE);
|
||||
|
@ -278,9 +278,9 @@ void TestBadArrayLengths() {
|
||||
std::cout << "Checking behavior when size of input arrays do not agree."
|
||||
<< std::endl;
|
||||
|
||||
typedef vtkm::cont::ArrayHandle<vtkm::Id, Container> InArrayType;
|
||||
InArrayType longInArray = MakeInputArray<vtkm::Id>(0);
|
||||
InArrayType shortInArray = MakeInputArray<vtkm::Id>(1);
|
||||
typedef vtkm::cont::ArrayHandle<vtkm::Scalar, Container> InArrayType;
|
||||
InArrayType longInArray = MakeInputArray<vtkm::Scalar>(0);
|
||||
InArrayType shortInArray = MakeInputArray<vtkm::Scalar>(1);
|
||||
shortInArray.Shrink(ARRAY_SIZE/2);
|
||||
|
||||
try
|
||||
|
@ -30,7 +30,7 @@ const vtkm::Id3 POINT_DIMS(16, 18, 5);
|
||||
const vtkm::Id NUM_POINTS = 1440;
|
||||
|
||||
const vtkm::Vector3 ORIGIN(30, -3, -14);
|
||||
const vtkm::Vector3 SPACING(10, 1, 0.1);
|
||||
const vtkm::Vector3 SPACING(10, 1, 0.1f);
|
||||
const vtkm::Vector3 LOWER_LEFT(-20, 5, -10); // MIN_VALUES*SPACING + ORIGIN
|
||||
|
||||
void TestArrayHandleUniformPointCoordinates()
|
||||
|
@ -41,7 +41,9 @@ const vtkm::Id ARRAY_SIZE = DIMENSION[0]*DIMENSION[1]*DIMENSION[2];
|
||||
vtkm::Vector3 TestValue(vtkm::Id index)
|
||||
{
|
||||
vtkm::Id3 index3d = vtkm::ExtentPointFlatIndexToTopologyIndex(index, EXTENT);
|
||||
return vtkm::Vector3(index3d[0], index3d[1], index3d[2]);
|
||||
return vtkm::Vector3(vtkm::Scalar(index3d[0]),
|
||||
vtkm::Scalar(index3d[1]),
|
||||
vtkm::Scalar(index3d[2]));
|
||||
}
|
||||
|
||||
int g_CheckArrayInvocations;
|
||||
|
@ -55,7 +55,9 @@ struct ContainerListTag : vtkm::cont::ContainerListTagBasic { };
|
||||
vtkm::Vector3 TestValue(vtkm::Id index)
|
||||
{
|
||||
vtkm::Id3 index3d = vtkm::ExtentPointFlatIndexToTopologyIndex(index, EXTENT);
|
||||
return vtkm::Vector3(index3d[0], index3d[1], index3d[2]);
|
||||
return vtkm::Vector3(vtkm::Scalar(index3d[0]),
|
||||
vtkm::Scalar(index3d[1]),
|
||||
vtkm::Scalar(index3d[2]));
|
||||
}
|
||||
|
||||
struct CheckArray
|
||||
|
@ -39,7 +39,7 @@ typedef std::string Type3;
|
||||
const Type3 Arg3("Third argument");
|
||||
|
||||
typedef vtkm::Vector3 Type4;
|
||||
const Type4 Arg4(1.2, 3.4, 5.6);
|
||||
const Type4 Arg4(1.2f, 3.4f, 5.6f);
|
||||
|
||||
typedef vtkm::Id3 Type5;
|
||||
const Type5 Arg5(4, 5, 6);
|
||||
|
@ -305,8 +305,8 @@ VTKM_EXEC_CONT_EXPORT bool test_equal(VectorType vector1,
|
||||
typedef typename vtkm::VectorTraits<VectorType> Traits;
|
||||
for (int component = 0; component < Traits::NUM_COMPONENTS; component++)
|
||||
{
|
||||
vtkm::Scalar value1 = Traits::GetComponent(vector1, component);
|
||||
vtkm::Scalar value2 = Traits::GetComponent(vector2, component);
|
||||
vtkm::Scalar value1 = vtkm::Scalar(Traits::GetComponent(vector1, component));
|
||||
vtkm::Scalar value2 = vtkm::Scalar(Traits::GetComponent(vector2, component));
|
||||
if ((fabs(value1) < 2*tolerance) && (fabs(value2) < 2*tolerance))
|
||||
{
|
||||
continue;
|
||||
|
@ -31,12 +31,13 @@ struct TestVectorTypeFunctor
|
||||
template <typename T> void operator()(const T&) const
|
||||
{
|
||||
typedef vtkm::VectorTraits<T> Traits;
|
||||
typedef typename Traits::ComponentType ComponentType;
|
||||
VTKM_TEST_ASSERT(Traits::NUM_COMPONENTS <= MAX_VECTOR_SIZE,
|
||||
"Need to update test for larger vectors.");
|
||||
T vector;
|
||||
for (int index = 0; index < Traits::NUM_COMPONENTS; index++)
|
||||
{
|
||||
Traits::SetComponent(vector, index, VectorInit[index]);
|
||||
Traits::SetComponent(vector, index, ComponentType(VectorInit[index]));
|
||||
}
|
||||
vtkm::testing::TestVectorType(vector);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user