2015-05-05 18:25:48 +00:00
|
|
|
//=============================================================================
|
|
|
|
//
|
|
|
|
// Copyright (c) Kitware, Inc.
|
|
|
|
// All rights reserved.
|
|
|
|
// See LICENSE.txt for details.
|
|
|
|
//
|
|
|
|
// This software is distributed WITHOUT ANY WARRANTY; without even
|
|
|
|
// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
|
|
|
// PURPOSE. See the above copyright notice for more information.
|
|
|
|
//
|
|
|
|
// Copyright 2015 Sandia Corporation.
|
|
|
|
// Copyright 2015 UT-Battelle, LLC.
|
2015-05-21 12:09:22 +00:00
|
|
|
// Copyright 2015 Los Alamos National Security.
|
2015-05-05 18:25:48 +00:00
|
|
|
//
|
|
|
|
// Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
|
|
|
|
// the U.S. Government retains certain rights in this software.
|
|
|
|
// Under the terms of Contract DE-AC52-06NA25396 with Los Alamos National
|
|
|
|
// Laboratory (LANL), the U.S. Government retains certain rights in
|
|
|
|
// this software.
|
|
|
|
//
|
|
|
|
//=============================================================================
|
|
|
|
#ifndef vtk_m_cont_testing_TestingFancyArrayHandles_h
|
|
|
|
#define vtk_m_cont_testing_TestingFancyArrayHandles_h
|
|
|
|
|
2015-07-13 17:01:41 +00:00
|
|
|
#include <vtkm/cont/ArrayHandle.h>
|
2015-09-01 21:42:45 +00:00
|
|
|
#include <vtkm/cont/ArrayHandleCast.h>
|
2015-07-13 17:01:41 +00:00
|
|
|
#include <vtkm/cont/ArrayHandleCompositeVector.h>
|
2015-05-13 20:24:51 +00:00
|
|
|
#include <vtkm/cont/ArrayHandleConstant.h>
|
2015-05-05 18:25:48 +00:00
|
|
|
#include <vtkm/cont/ArrayHandleCounting.h>
|
2015-09-28 23:19:38 +00:00
|
|
|
#include <vtkm/cont/ArrayHandleGroupVec.h>
|
2015-05-05 18:25:48 +00:00
|
|
|
#include <vtkm/cont/ArrayHandleImplicit.h>
|
2015-09-15 04:55:44 +00:00
|
|
|
#include <vtkm/cont/ArrayHandleIndex.h>
|
2015-05-05 18:25:48 +00:00
|
|
|
#include <vtkm/cont/ArrayHandlePermutation.h>
|
|
|
|
#include <vtkm/cont/ArrayHandleTransform.h>
|
|
|
|
#include <vtkm/cont/ArrayHandleZip.h>
|
|
|
|
#include <vtkm/VecTraits.h>
|
|
|
|
|
|
|
|
#include <vtkm/worklet/DispatcherMapField.h>
|
|
|
|
#include <vtkm/worklet/WorkletMapField.h>
|
|
|
|
|
|
|
|
#include <vtkm/cont/testing/Testing.h>
|
|
|
|
|
2015-07-13 17:01:41 +00:00
|
|
|
#include <vector>
|
|
|
|
|
2015-05-05 18:25:48 +00:00
|
|
|
namespace fancy_array_detail
|
|
|
|
{
|
|
|
|
|
|
|
|
template<typename ValueType>
|
|
|
|
struct IndexSquared
|
|
|
|
{
|
|
|
|
VTKM_EXEC_CONT_EXPORT
|
2015-05-07 22:34:06 +00:00
|
|
|
ValueType operator()(vtkm::Id index) const
|
|
|
|
{
|
|
|
|
typedef typename vtkm::VecTraits<ValueType>::ComponentType ComponentType;
|
|
|
|
return ValueType( static_cast<ComponentType>(index*index) );
|
|
|
|
}
|
2015-05-05 18:25:48 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
template<typename ValueType>
|
|
|
|
struct ValueSquared
|
|
|
|
{
|
|
|
|
template<typename U>
|
|
|
|
VTKM_EXEC_CONT_EXPORT
|
|
|
|
ValueType operator()(U u) const
|
|
|
|
{ return vtkm::dot(u, u); }
|
|
|
|
};
|
|
|
|
|
2015-09-29 14:36:11 +00:00
|
|
|
struct ValueScale
|
|
|
|
{
|
|
|
|
ValueScale() : Factor()
|
|
|
|
{ }
|
|
|
|
|
|
|
|
ValueScale(vtkm::Float64 factor) : Factor(factor)
|
|
|
|
{ }
|
|
|
|
|
|
|
|
template<typename ValueType>
|
|
|
|
VTKM_EXEC_CONT_EXPORT
|
|
|
|
ValueType operator()(const ValueType &v) const
|
|
|
|
{
|
|
|
|
typedef vtkm::VecTraits<ValueType> Traits;
|
|
|
|
typedef typename Traits::ComponentType ComponentType;
|
|
|
|
|
|
|
|
ValueType result;
|
|
|
|
for (vtkm::IdComponent i = 0; i < Traits::GetNumberOfComponents(v); ++i)
|
|
|
|
{
|
|
|
|
vtkm::Float64 vi = static_cast<vtkm::Float64>(Traits::GetComponent(v, i));
|
|
|
|
vtkm::Float64 ri = vi * this->Factor;
|
|
|
|
Traits::SetComponent(result, i, static_cast<ComponentType>(ri));
|
|
|
|
}
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
vtkm::Float64 Factor;
|
|
|
|
};
|
|
|
|
|
2015-05-05 18:25:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
namespace vtkm {
|
|
|
|
namespace cont {
|
|
|
|
namespace testing {
|
|
|
|
|
|
|
|
/// This class has a single static member, Run, that tests that all Fancy Array
|
|
|
|
/// Handles work with the given DeviceAdapter
|
|
|
|
///
|
|
|
|
template<class DeviceAdapterTag>
|
|
|
|
struct TestingFancyArrayHandles
|
|
|
|
{
|
|
|
|
|
|
|
|
private:
|
|
|
|
static const int ARRAY_SIZE = 10;
|
|
|
|
|
|
|
|
public:
|
|
|
|
struct PassThrough : public vtkm::worklet::WorkletMapField
|
|
|
|
{
|
|
|
|
typedef void ControlSignature(FieldIn<>, FieldOut<>);
|
|
|
|
typedef _2 ExecutionSignature(_1);
|
|
|
|
|
|
|
|
template<class ValueType>
|
|
|
|
VTKM_EXEC_EXPORT
|
|
|
|
ValueType operator()(const ValueType &inValue) const
|
|
|
|
{ return inValue; }
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
private:
|
2015-07-13 17:01:41 +00:00
|
|
|
|
|
|
|
struct TestCompositeAsInput
|
2015-05-05 18:25:48 +00:00
|
|
|
{
|
2015-07-13 17:01:41 +00:00
|
|
|
template< typename ValueType >
|
|
|
|
VTKM_CONT_EXPORT void operator()(const ValueType vtkmNotUsed(v)) const
|
2015-05-05 18:25:48 +00:00
|
|
|
{
|
2015-07-13 17:01:41 +00:00
|
|
|
//hard-coded to make a vtkm::Vec<ValueType,3> composite vector
|
|
|
|
//for each ValueType.
|
2015-05-05 18:25:48 +00:00
|
|
|
|
2015-07-13 17:01:41 +00:00
|
|
|
typedef typename vtkm::cont::ArrayHandleCompositeVectorType<
|
|
|
|
vtkm::cont::ArrayHandle< ValueType >,
|
|
|
|
vtkm::cont::ArrayHandle< ValueType >,
|
|
|
|
vtkm::cont::ArrayHandle< ValueType > >::type CompositeHandleType;
|
2015-05-05 18:25:48 +00:00
|
|
|
|
2015-07-13 17:01:41 +00:00
|
|
|
const ValueType value = TestValue(13, ValueType());
|
|
|
|
std::vector< ValueType > compositeData( ARRAY_SIZE, value );
|
|
|
|
vtkm::cont::ArrayHandle< ValueType > compositeInput =
|
|
|
|
vtkm::cont::make_ArrayHandle(compositeData);
|
2015-05-05 18:25:48 +00:00
|
|
|
|
2015-07-13 17:01:41 +00:00
|
|
|
CompositeHandleType composite =
|
|
|
|
vtkm::cont::make_ArrayHandleCompositeVector(compositeInput, 0,
|
|
|
|
compositeInput, 1,
|
|
|
|
compositeInput, 2);
|
2015-05-05 18:25:48 +00:00
|
|
|
|
2015-07-13 17:01:41 +00:00
|
|
|
vtkm::cont::ArrayHandle< vtkm::Vec<ValueType, 3> > result;
|
2015-05-05 18:25:48 +00:00
|
|
|
|
2015-07-13 17:01:41 +00:00
|
|
|
vtkm::worklet::DispatcherMapField<PassThrough, DeviceAdapterTag> dispatcher;
|
|
|
|
dispatcher.Invoke(composite, result);
|
2015-05-05 18:25:48 +00:00
|
|
|
|
|
|
|
//verify that the control portal works
|
|
|
|
for(vtkm::Id i=0; i < ARRAY_SIZE; ++i)
|
|
|
|
{
|
2015-07-13 17:01:41 +00:00
|
|
|
const vtkm::Vec<ValueType, 3> result_v =
|
|
|
|
result.GetPortalConstControl().Get(i);
|
|
|
|
VTKM_TEST_ASSERT(test_equal(result_v, vtkm::Vec<ValueType, 3>(value)),
|
|
|
|
"CompositeVector Handle Failed");
|
2015-05-05 18:25:48 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2015-07-13 17:01:41 +00:00
|
|
|
|
2015-05-13 20:24:51 +00:00
|
|
|
struct TestConstantAsInput
|
|
|
|
{
|
|
|
|
template< typename ValueType >
|
|
|
|
VTKM_CONT_EXPORT void operator()(const ValueType vtkmNotUsed(v)) const
|
|
|
|
{
|
|
|
|
const ValueType value = TestValue(43, ValueType());
|
|
|
|
|
|
|
|
vtkm::cont::ArrayHandleConstant<ValueType> constant =
|
|
|
|
vtkm::cont::make_ArrayHandleConstant(value, ARRAY_SIZE);
|
|
|
|
vtkm::cont::ArrayHandle<ValueType> result;
|
|
|
|
|
|
|
|
vtkm::worklet::DispatcherMapField<PassThrough, DeviceAdapterTag> dispatcher;
|
|
|
|
dispatcher.Invoke(constant, result);
|
|
|
|
|
|
|
|
//verify that the control portal works
|
|
|
|
for(vtkm::Id i=0; i < ARRAY_SIZE; ++i)
|
|
|
|
{
|
|
|
|
const ValueType result_v = result.GetPortalConstControl().Get(i);
|
|
|
|
const ValueType control_value = constant.GetPortalConstControl().Get(i);
|
|
|
|
VTKM_TEST_ASSERT(test_equal(result_v, value),
|
|
|
|
"Counting Handle Failed");
|
|
|
|
VTKM_TEST_ASSERT(test_equal(result_v, control_value),
|
|
|
|
"Counting Handle Control Failed");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2015-05-05 18:25:48 +00:00
|
|
|
struct TestCountingAsInput
|
|
|
|
{
|
|
|
|
template< typename ValueType >
|
|
|
|
VTKM_CONT_EXPORT void operator()(const ValueType vtkmNotUsed(v)) const
|
|
|
|
{
|
2015-05-07 22:34:06 +00:00
|
|
|
typedef typename vtkm::VecTraits<ValueType>::ComponentType ComponentType;
|
|
|
|
|
2015-05-05 18:25:48 +00:00
|
|
|
const vtkm::Id length = ARRAY_SIZE;
|
|
|
|
|
|
|
|
//need to initialize the start value or else vectors will have
|
|
|
|
//random values to start
|
2015-05-07 22:34:06 +00:00
|
|
|
ComponentType component_value(0);
|
|
|
|
const ValueType start = ValueType(component_value);
|
2015-05-05 18:25:48 +00:00
|
|
|
|
|
|
|
vtkm::cont::ArrayHandleCounting< ValueType > counting =
|
2015-09-15 04:55:44 +00:00
|
|
|
vtkm::cont::make_ArrayHandleCounting(start, ValueType(1), length);
|
2015-05-05 18:25:48 +00:00
|
|
|
vtkm::cont::ArrayHandle< ValueType > result;
|
|
|
|
|
|
|
|
vtkm::worklet::DispatcherMapField< PassThrough, DeviceAdapterTag > dispatcher;
|
|
|
|
dispatcher.Invoke(counting, result);
|
|
|
|
|
|
|
|
//verify that the control portal works
|
|
|
|
for(vtkm::Id i=0; i < length; ++i)
|
|
|
|
{
|
|
|
|
const ValueType result_v = result.GetPortalConstControl().Get(i);
|
2015-05-07 22:34:06 +00:00
|
|
|
const ValueType correct_value = ValueType(component_value);
|
2015-05-05 18:25:48 +00:00
|
|
|
const ValueType control_value = counting.GetPortalConstControl().Get(i);
|
2015-05-07 22:34:06 +00:00
|
|
|
VTKM_TEST_ASSERT(test_equal(result_v, correct_value),
|
|
|
|
"Counting Handle Failed");
|
|
|
|
VTKM_TEST_ASSERT(test_equal(result_v, control_value),
|
|
|
|
"Counting Handle Control Failed");
|
2015-07-30 22:43:19 +00:00
|
|
|
component_value = ComponentType(component_value + ComponentType(1));
|
2015-05-05 18:25:48 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
struct TestImplicitAsInput
|
|
|
|
{
|
|
|
|
template< typename ValueType>
|
|
|
|
VTKM_CONT_EXPORT void operator()(const ValueType vtkmNotUsed(v)) const
|
|
|
|
{
|
|
|
|
const vtkm::Id length = ARRAY_SIZE;
|
|
|
|
typedef ::fancy_array_detail::IndexSquared<ValueType> FunctorType;
|
|
|
|
FunctorType functor;
|
|
|
|
|
|
|
|
vtkm::cont::ArrayHandleImplicit< ValueType, FunctorType > implicit =
|
|
|
|
vtkm::cont::make_ArrayHandleImplicit<ValueType>(functor, length);
|
|
|
|
|
|
|
|
vtkm::cont::ArrayHandle< ValueType > result;
|
|
|
|
|
|
|
|
vtkm::worklet::DispatcherMapField< PassThrough, DeviceAdapterTag > dispatcher;
|
|
|
|
dispatcher.Invoke(implicit, result);
|
|
|
|
|
|
|
|
//verify that the control portal works
|
|
|
|
for(vtkm::Id i=0; i < length; ++i)
|
|
|
|
{
|
|
|
|
const ValueType result_v = result.GetPortalConstControl().Get(i);
|
|
|
|
const ValueType correct_value = functor( i );
|
|
|
|
const ValueType control_value = implicit.GetPortalConstControl().Get(i);
|
2015-05-07 22:34:06 +00:00
|
|
|
VTKM_TEST_ASSERT(test_equal(result_v, correct_value),
|
|
|
|
"Implicit Handle Failed");
|
|
|
|
VTKM_TEST_ASSERT(test_equal(result_v, control_value)
|
|
|
|
, "Implicit Handle Failed");
|
2015-05-05 18:25:48 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
struct TestPermutationAsInput
|
|
|
|
{
|
|
|
|
template< typename ValueType>
|
|
|
|
VTKM_CONT_EXPORT void operator()(const ValueType vtkmNotUsed(v)) const
|
|
|
|
{
|
|
|
|
const vtkm::Id length = ARRAY_SIZE;
|
|
|
|
|
|
|
|
typedef ::fancy_array_detail::IndexSquared<ValueType> FunctorType;
|
|
|
|
|
|
|
|
typedef vtkm::cont::ArrayHandleCounting< vtkm::Id > KeyHandleType;
|
|
|
|
typedef vtkm::cont::ArrayHandleImplicit< ValueType,
|
|
|
|
FunctorType > ValueHandleType;
|
|
|
|
typedef vtkm::cont::ArrayHandlePermutation< KeyHandleType,
|
|
|
|
ValueHandleType
|
|
|
|
> PermutationHandleType;
|
|
|
|
|
|
|
|
FunctorType functor;
|
|
|
|
for( vtkm::Id start_pos = 0; start_pos < (length-10); start_pos+=10)
|
|
|
|
{
|
|
|
|
const vtkm::Id counting_length = length - start_pos;
|
|
|
|
|
|
|
|
KeyHandleType counting =
|
|
|
|
vtkm::cont::make_ArrayHandleCounting<vtkm::Id>(start_pos,
|
2015-09-15 04:55:44 +00:00
|
|
|
1,
|
2015-05-05 18:25:48 +00:00
|
|
|
counting_length);
|
|
|
|
|
|
|
|
ValueHandleType implicit =
|
|
|
|
vtkm::cont::make_ArrayHandleImplicit<ValueType>(functor,
|
|
|
|
length);
|
|
|
|
|
|
|
|
PermutationHandleType permutation =
|
|
|
|
vtkm::cont::make_ArrayHandlePermutation(counting,
|
|
|
|
implicit);
|
|
|
|
|
|
|
|
vtkm::cont::ArrayHandle< ValueType > result;
|
|
|
|
|
|
|
|
vtkm::worklet::DispatcherMapField< PassThrough, DeviceAdapterTag > dispatcher;
|
|
|
|
dispatcher.Invoke(permutation, result);
|
|
|
|
|
|
|
|
//verify that the control portal works
|
|
|
|
for(vtkm::Id i=0; i <counting_length; ++i)
|
|
|
|
{
|
|
|
|
const vtkm::Id value_index = i;
|
|
|
|
const vtkm::Id key_index = start_pos + i;
|
|
|
|
|
|
|
|
const ValueType result_v = result.GetPortalConstControl().Get( value_index );
|
|
|
|
const ValueType correct_value = implicit.GetPortalConstControl().Get( key_index );
|
|
|
|
const ValueType control_value = permutation.GetPortalConstControl().Get( value_index );
|
2015-05-07 22:34:06 +00:00
|
|
|
VTKM_TEST_ASSERT(test_equal(result_v, correct_value),
|
|
|
|
"Implicit Handle Failed");
|
|
|
|
VTKM_TEST_ASSERT(test_equal(result_v, control_value),
|
|
|
|
"Implicit Handle Failed");
|
2015-05-05 18:25:48 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
struct TestTransformAsInput
|
|
|
|
{
|
|
|
|
template< typename ValueType>
|
|
|
|
VTKM_CONT_EXPORT void operator()(const ValueType vtkmNotUsed(v)) const
|
|
|
|
{
|
2015-09-29 14:36:11 +00:00
|
|
|
typedef fancy_array_detail::ValueScale FunctorType;
|
2015-05-05 18:25:48 +00:00
|
|
|
|
|
|
|
const vtkm::Id length = ARRAY_SIZE;
|
2015-09-29 14:36:11 +00:00
|
|
|
FunctorType functor(2.0);
|
2015-05-05 18:25:48 +00:00
|
|
|
|
|
|
|
vtkm::cont::ArrayHandle<ValueType> input;
|
|
|
|
vtkm::cont::ArrayHandleTransform<
|
2015-09-29 14:36:11 +00:00
|
|
|
ValueType,
|
2015-05-05 18:25:48 +00:00
|
|
|
vtkm::cont::ArrayHandle<ValueType>,
|
|
|
|
FunctorType> transformed =
|
2015-09-29 14:36:11 +00:00
|
|
|
vtkm::cont::make_ArrayHandleTransform<ValueType>(input, functor);
|
2015-05-05 18:25:48 +00:00
|
|
|
|
|
|
|
typedef typename vtkm::cont::ArrayHandle<ValueType>::PortalControl Portal;
|
|
|
|
input.Allocate(length);
|
|
|
|
Portal portal = input.GetPortalControl();
|
|
|
|
for(vtkm::Id i=0; i < length; ++i)
|
|
|
|
{
|
2015-05-07 22:34:06 +00:00
|
|
|
portal.Set(i, TestValue(i, ValueType()) );
|
2015-05-05 18:25:48 +00:00
|
|
|
}
|
|
|
|
|
2015-09-29 14:36:11 +00:00
|
|
|
vtkm::cont::ArrayHandle< ValueType > result;
|
2015-05-05 18:25:48 +00:00
|
|
|
|
|
|
|
vtkm::worklet::DispatcherMapField< PassThrough, DeviceAdapterTag > dispatcher;
|
|
|
|
dispatcher.Invoke(transformed, result);
|
|
|
|
|
|
|
|
//verify that the control portal works
|
|
|
|
for(vtkm::Id i=0; i < length; ++i)
|
|
|
|
{
|
2015-09-29 14:36:11 +00:00
|
|
|
const ValueType result_v = result.GetPortalConstControl().Get(i);
|
|
|
|
const ValueType correct_value = functor(TestValue(i, ValueType()));
|
|
|
|
const ValueType control_value = transformed.GetPortalConstControl().Get(i);
|
2015-05-07 22:34:06 +00:00
|
|
|
VTKM_TEST_ASSERT(test_equal(result_v, correct_value),
|
|
|
|
"Transform Handle Failed");
|
|
|
|
VTKM_TEST_ASSERT(test_equal(result_v, control_value),
|
|
|
|
"Transform Handle Control Failed");
|
2015-05-05 18:25:48 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
struct TestCountingTransformAsInput
|
|
|
|
{
|
|
|
|
template< typename ValueType>
|
|
|
|
VTKM_CONT_EXPORT void operator()(const ValueType vtkmNotUsed(v)) const
|
|
|
|
{
|
2015-05-07 22:34:06 +00:00
|
|
|
typedef typename vtkm::VecTraits<ValueType>::ComponentType ComponentType;
|
|
|
|
typedef ComponentType OutputValueType;
|
2015-05-05 18:25:48 +00:00
|
|
|
typedef fancy_array_detail::ValueSquared<OutputValueType> FunctorType;
|
|
|
|
|
|
|
|
vtkm::Id length = ARRAY_SIZE;
|
|
|
|
FunctorType functor;
|
|
|
|
|
|
|
|
//need to initialize the start value or else vectors will have
|
|
|
|
//random values to start
|
2015-05-07 22:34:06 +00:00
|
|
|
ComponentType component_value(0);
|
|
|
|
const ValueType start = ValueType(component_value);
|
2015-05-05 18:25:48 +00:00
|
|
|
|
2015-09-15 04:55:44 +00:00
|
|
|
vtkm::cont::ArrayHandleCounting< ValueType > counting(start,
|
|
|
|
ValueType(1),
|
|
|
|
length);
|
2015-05-05 18:25:48 +00:00
|
|
|
|
|
|
|
vtkm::cont::ArrayHandleTransform<
|
|
|
|
OutputValueType,
|
|
|
|
vtkm::cont::ArrayHandleCounting<ValueType>,
|
|
|
|
FunctorType>
|
|
|
|
countingTransformed =
|
|
|
|
vtkm::cont::make_ArrayHandleTransform<OutputValueType>(counting,
|
|
|
|
functor);
|
|
|
|
|
|
|
|
vtkm::cont::ArrayHandle< OutputValueType > result;
|
|
|
|
|
|
|
|
vtkm::worklet::DispatcherMapField< PassThrough, DeviceAdapterTag > dispatcher;
|
|
|
|
dispatcher.Invoke(countingTransformed, result);
|
|
|
|
|
|
|
|
//verify that the control portal works
|
|
|
|
for(vtkm::Id i=0; i < length; ++i)
|
|
|
|
{
|
|
|
|
const OutputValueType result_v = result.GetPortalConstControl().Get(i);
|
2015-05-07 22:34:06 +00:00
|
|
|
const OutputValueType correct_value =
|
|
|
|
functor(ValueType(component_value));
|
|
|
|
const OutputValueType control_value =
|
|
|
|
countingTransformed.GetPortalConstControl().Get(i);
|
|
|
|
VTKM_TEST_ASSERT(test_equal(result_v, correct_value),
|
|
|
|
"Transform Counting Handle Failed");
|
|
|
|
VTKM_TEST_ASSERT(test_equal(result_v, control_value),
|
|
|
|
"Transform Counting Handle Control Failed");
|
2015-07-30 22:43:19 +00:00
|
|
|
component_value = ComponentType(component_value + ComponentType(1));
|
2015-05-05 18:25:48 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2015-09-01 21:42:45 +00:00
|
|
|
struct TestCastAsInput
|
|
|
|
{
|
|
|
|
template<typename CastToType>
|
|
|
|
VTKM_CONT_EXPORT
|
|
|
|
void operator()(CastToType vtkmNotUsed(type)) const
|
|
|
|
{
|
2015-09-15 04:55:44 +00:00
|
|
|
typedef vtkm::cont::ArrayHandleIndex InputArrayType;
|
2015-09-01 21:42:45 +00:00
|
|
|
|
2015-09-15 04:55:44 +00:00
|
|
|
InputArrayType input(ARRAY_SIZE);
|
2015-11-11 22:13:04 +00:00
|
|
|
vtkm::cont::ArrayHandleCast<CastToType,
|
2015-09-22 14:11:51 +00:00
|
|
|
InputArrayType> castArray =
|
2015-11-11 22:13:04 +00:00
|
|
|
vtkm::cont::make_ArrayHandleCast(input, CastToType());
|
2015-09-01 21:42:45 +00:00
|
|
|
vtkm::cont::ArrayHandle<CastToType> result;
|
|
|
|
|
|
|
|
vtkm::worklet::DispatcherMapField< PassThrough, DeviceAdapterTag > dispatcher;
|
|
|
|
dispatcher.Invoke(castArray, result);
|
|
|
|
|
|
|
|
// verify results
|
|
|
|
vtkm::Id length = ARRAY_SIZE;
|
|
|
|
for (vtkm::Id i = 0; i < length; ++i)
|
|
|
|
{
|
|
|
|
VTKM_TEST_ASSERT(
|
|
|
|
result.GetPortalConstControl().Get(i) ==
|
|
|
|
static_cast<CastToType>(input.GetPortalConstControl().Get(i)),
|
|
|
|
"Casting ArrayHandle Failed");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2015-09-28 23:19:38 +00:00
|
|
|
template<vtkm::IdComponent NUM_COMPONENTS>
|
|
|
|
struct TestGroupVecAsInput
|
|
|
|
{
|
|
|
|
template<typename ComponentType>
|
|
|
|
VTKM_CONT_EXPORT
|
|
|
|
void operator()(ComponentType) const
|
|
|
|
{
|
|
|
|
typedef vtkm::Vec<ComponentType, NUM_COMPONENTS> ValueType;
|
|
|
|
|
|
|
|
ComponentType testValues[ARRAY_SIZE*NUM_COMPONENTS];
|
|
|
|
|
|
|
|
for(vtkm::Id index = 0; index < ARRAY_SIZE*NUM_COMPONENTS; ++index)
|
|
|
|
{
|
|
|
|
testValues[index] = TestValue(index, ComponentType());
|
|
|
|
}
|
|
|
|
vtkm::cont::ArrayHandle<ComponentType> baseArray =
|
|
|
|
vtkm::cont::make_ArrayHandle(testValues, ARRAY_SIZE*NUM_COMPONENTS);
|
|
|
|
|
|
|
|
vtkm::cont::ArrayHandleGroupVec<
|
|
|
|
vtkm::cont::ArrayHandle<ComponentType>, NUM_COMPONENTS> groupArray(
|
|
|
|
baseArray);
|
|
|
|
VTKM_TEST_ASSERT(groupArray.GetNumberOfValues() == ARRAY_SIZE,
|
|
|
|
"Group array reporting wrong array size.");
|
|
|
|
|
|
|
|
vtkm::cont::ArrayHandle<ValueType> resultArray;
|
|
|
|
|
|
|
|
vtkm::worklet::DispatcherMapField< PassThrough, DeviceAdapterTag > dispatcher;
|
|
|
|
dispatcher.Invoke(groupArray, resultArray);
|
|
|
|
|
|
|
|
VTKM_TEST_ASSERT(resultArray.GetNumberOfValues() == ARRAY_SIZE,
|
|
|
|
"Got bad result array size.");
|
|
|
|
|
|
|
|
//verify that the control portal works
|
|
|
|
vtkm::Id totalIndex = 0;
|
|
|
|
for(vtkm::Id index = 0; index < ARRAY_SIZE; ++index)
|
|
|
|
{
|
|
|
|
const ValueType result = resultArray.GetPortalConstControl().Get(index);
|
|
|
|
for (vtkm::IdComponent componentIndex = 0;
|
|
|
|
componentIndex < NUM_COMPONENTS;
|
|
|
|
componentIndex++)
|
|
|
|
{
|
|
|
|
const ComponentType expectedValue =
|
|
|
|
TestValue(totalIndex, ComponentType());
|
2015-09-29 14:21:03 +00:00
|
|
|
VTKM_TEST_ASSERT(test_equal(result[componentIndex], expectedValue),
|
2015-09-28 23:19:38 +00:00
|
|
|
"Result array got wrong value.");
|
|
|
|
totalIndex++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
template<vtkm::IdComponent NUM_COMPONENTS>
|
|
|
|
struct TestGroupVecAsOutput
|
|
|
|
{
|
|
|
|
template<typename ComponentType>
|
|
|
|
VTKM_CONT_EXPORT
|
|
|
|
void operator()(ComponentType) const
|
|
|
|
{
|
|
|
|
typedef vtkm::Vec<ComponentType, NUM_COMPONENTS> ValueType;
|
|
|
|
|
|
|
|
ValueType testValues[ARRAY_SIZE];
|
|
|
|
|
|
|
|
for(vtkm::Id index = 0; index < ARRAY_SIZE; ++index)
|
|
|
|
{
|
|
|
|
testValues[index] = TestValue(index, ValueType());
|
|
|
|
}
|
|
|
|
vtkm::cont::ArrayHandle<ValueType> baseArray =
|
|
|
|
vtkm::cont::make_ArrayHandle(testValues, ARRAY_SIZE);
|
|
|
|
|
|
|
|
vtkm::cont::ArrayHandle<ComponentType> resultArray;
|
|
|
|
|
|
|
|
vtkm::cont::ArrayHandleGroupVec<
|
|
|
|
vtkm::cont::ArrayHandle<ComponentType>, NUM_COMPONENTS> groupArray(
|
|
|
|
resultArray);
|
|
|
|
|
|
|
|
vtkm::worklet::DispatcherMapField< PassThrough, DeviceAdapterTag > dispatcher;
|
|
|
|
dispatcher.Invoke(baseArray, groupArray);
|
|
|
|
|
|
|
|
VTKM_TEST_ASSERT(groupArray.GetNumberOfValues() == ARRAY_SIZE,
|
|
|
|
"Group array reporting wrong array size.");
|
|
|
|
|
|
|
|
VTKM_TEST_ASSERT(
|
|
|
|
resultArray.GetNumberOfValues() == ARRAY_SIZE*NUM_COMPONENTS,
|
|
|
|
"Got bad result array size.");
|
|
|
|
|
|
|
|
//verify that the control portal works
|
|
|
|
vtkm::Id totalIndex = 0;
|
|
|
|
for(vtkm::Id index = 0; index < ARRAY_SIZE; ++index)
|
|
|
|
{
|
|
|
|
const ValueType expectedValue = TestValue(index, ValueType());
|
|
|
|
for (vtkm::IdComponent componentIndex = 0;
|
|
|
|
componentIndex < NUM_COMPONENTS;
|
|
|
|
componentIndex++)
|
|
|
|
{
|
|
|
|
const ComponentType result =
|
|
|
|
resultArray.GetPortalConstControl().Get(totalIndex);
|
2015-09-29 14:21:03 +00:00
|
|
|
VTKM_TEST_ASSERT(test_equal(result, expectedValue[componentIndex]),
|
2015-09-28 23:19:38 +00:00
|
|
|
"Result array got wrong value.");
|
|
|
|
totalIndex++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
2015-07-13 17:01:41 +00:00
|
|
|
|
|
|
|
struct TestZipAsInput
|
|
|
|
{
|
|
|
|
template< typename KeyType, typename ValueType >
|
|
|
|
VTKM_CONT_EXPORT
|
|
|
|
void operator()(vtkm::Pair<KeyType,ValueType> vtkmNotUsed(pair)) const
|
|
|
|
{
|
|
|
|
typedef vtkm::Pair< KeyType, ValueType > PairType;
|
|
|
|
typedef typename vtkm::VecTraits<KeyType>::ComponentType KeyComponentType;
|
|
|
|
typedef typename vtkm::VecTraits<ValueType>::ComponentType ValueComponentType;
|
|
|
|
|
|
|
|
|
|
|
|
KeyType testKeys[ARRAY_SIZE];
|
|
|
|
ValueType testValues[ARRAY_SIZE];
|
|
|
|
|
|
|
|
for(vtkm::Id i=0; i < ARRAY_SIZE; ++i)
|
|
|
|
{
|
|
|
|
testKeys[i] = KeyType(static_cast<KeyComponentType>(ARRAY_SIZE - i));
|
|
|
|
testValues[i] = ValueType(static_cast<ValueComponentType>(i));
|
|
|
|
}
|
|
|
|
vtkm::cont::ArrayHandle< KeyType > keys =
|
|
|
|
vtkm::cont::make_ArrayHandle(testKeys, ARRAY_SIZE);
|
|
|
|
vtkm::cont::ArrayHandle< ValueType > values =
|
|
|
|
vtkm::cont::make_ArrayHandle(testValues, ARRAY_SIZE);
|
|
|
|
|
|
|
|
vtkm::cont::ArrayHandleZip<
|
|
|
|
vtkm::cont::ArrayHandle< KeyType >,
|
|
|
|
vtkm::cont::ArrayHandle< ValueType > > zip =
|
|
|
|
vtkm::cont::make_ArrayHandleZip(keys, values);
|
|
|
|
|
|
|
|
vtkm::cont::ArrayHandle< PairType > result;
|
|
|
|
|
|
|
|
vtkm::worklet::DispatcherMapField< PassThrough, DeviceAdapterTag > dispatcher;
|
|
|
|
dispatcher.Invoke(zip, result);
|
|
|
|
|
|
|
|
//verify that the control portal works
|
|
|
|
for(int i=0; i < ARRAY_SIZE; ++i)
|
|
|
|
{
|
|
|
|
const PairType result_v = result.GetPortalConstControl().Get(i);
|
|
|
|
const PairType correct_value(
|
|
|
|
KeyType(static_cast<KeyComponentType>(ARRAY_SIZE - i)),
|
|
|
|
ValueType(static_cast<ValueComponentType>(i)));
|
|
|
|
VTKM_TEST_ASSERT(test_equal(result_v, correct_value),
|
|
|
|
"ArrayHandleZip Failed as input");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
struct TestPermutationAsOutput
|
|
|
|
{
|
|
|
|
template< typename ValueType>
|
|
|
|
VTKM_CONT_EXPORT void operator()(const ValueType vtkmNotUsed(v)) const
|
|
|
|
{
|
|
|
|
const vtkm::Id length = ARRAY_SIZE;
|
|
|
|
|
|
|
|
typedef vtkm::cont::ArrayHandleCounting< vtkm::Id > KeyHandleType;
|
|
|
|
typedef vtkm::cont::ArrayHandle< ValueType > ValueHandleType;
|
|
|
|
typedef vtkm::cont::ArrayHandlePermutation< KeyHandleType,
|
|
|
|
ValueHandleType
|
|
|
|
> PermutationHandleType;
|
|
|
|
|
|
|
|
typedef typename vtkm::VecTraits<ValueType>::ComponentType ComponentType;
|
|
|
|
vtkm::cont::ArrayHandle<ValueType> input;
|
|
|
|
typedef typename vtkm::cont::ArrayHandle<ValueType>::PortalControl Portal;
|
|
|
|
input.Allocate(length);
|
|
|
|
Portal inputPortal = input.GetPortalControl();
|
|
|
|
for(vtkm::Id i=0; i < length; ++i)
|
|
|
|
{
|
|
|
|
inputPortal.Set(i,ValueType(ComponentType(i)));
|
|
|
|
}
|
|
|
|
|
|
|
|
ValueHandleType values;
|
|
|
|
values.Allocate(length*2);
|
|
|
|
|
|
|
|
KeyHandleType counting =
|
2015-09-15 04:55:44 +00:00
|
|
|
vtkm::cont::make_ArrayHandleCounting<vtkm::Id>(length, 1, length);
|
2015-07-13 17:01:41 +00:00
|
|
|
|
|
|
|
PermutationHandleType permutation =
|
|
|
|
vtkm::cont::make_ArrayHandlePermutation(counting, values);
|
|
|
|
vtkm::worklet::DispatcherMapField< PassThrough, DeviceAdapterTag > dispatcher;
|
|
|
|
dispatcher.Invoke(input, permutation);
|
|
|
|
|
|
|
|
//verify that the control portal works
|
|
|
|
for(vtkm::Id i=0; i <length; ++i)
|
|
|
|
{
|
|
|
|
const ValueType result_v = permutation.GetPortalConstControl().Get( i );
|
|
|
|
const ValueType correct_value = ValueType(ComponentType(i));
|
|
|
|
VTKM_TEST_ASSERT(test_equal(result_v, correct_value),
|
|
|
|
"Permutation Handle Failed As Output");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
struct TestZipAsOutput
|
|
|
|
{
|
|
|
|
template< typename KeyType, typename ValueType >
|
|
|
|
VTKM_CONT_EXPORT
|
|
|
|
void operator()(vtkm::Pair<KeyType,ValueType> vtkmNotUsed(pair)) const
|
|
|
|
{
|
|
|
|
typedef vtkm::Pair< KeyType, ValueType > PairType;
|
|
|
|
typedef typename vtkm::VecTraits<KeyType>::ComponentType KeyComponentType;
|
|
|
|
typedef typename vtkm::VecTraits<ValueType>::ComponentType ValueComponentType;
|
|
|
|
|
|
|
|
PairType testKeysAndValues[ARRAY_SIZE];
|
|
|
|
for(vtkm::Id i=0; i < ARRAY_SIZE; ++i)
|
|
|
|
{
|
|
|
|
testKeysAndValues[i] =
|
|
|
|
PairType(KeyType(static_cast<KeyComponentType>(ARRAY_SIZE - i)),
|
|
|
|
ValueType(static_cast<ValueComponentType>(i)) );
|
|
|
|
}
|
|
|
|
vtkm::cont::ArrayHandle< PairType > input =
|
|
|
|
vtkm::cont::make_ArrayHandle(testKeysAndValues, ARRAY_SIZE);
|
|
|
|
|
|
|
|
vtkm::cont::ArrayHandle< KeyType > result_keys;
|
|
|
|
vtkm::cont::ArrayHandle< ValueType > result_values;
|
|
|
|
vtkm::cont::ArrayHandleZip<
|
|
|
|
vtkm::cont::ArrayHandle< KeyType >,
|
|
|
|
vtkm::cont::ArrayHandle< ValueType > > result_zip =
|
|
|
|
vtkm::cont::make_ArrayHandleZip(result_keys, result_values);
|
|
|
|
|
|
|
|
vtkm::worklet::DispatcherMapField< PassThrough, DeviceAdapterTag > dispatcher;
|
|
|
|
dispatcher.Invoke(input, result_zip);
|
|
|
|
|
|
|
|
//now the two arrays we have zipped should have data inside them
|
|
|
|
for(int i=0; i < ARRAY_SIZE; ++i)
|
|
|
|
{
|
|
|
|
const KeyType result_key = result_keys.GetPortalConstControl().Get(i);
|
|
|
|
const ValueType result_value = result_values.GetPortalConstControl().Get(i);
|
|
|
|
|
|
|
|
VTKM_TEST_ASSERT(
|
|
|
|
test_equal(result_key, KeyType(static_cast<KeyComponentType>(ARRAY_SIZE - i))),
|
|
|
|
"ArrayHandleZip Failed as input for key");
|
|
|
|
VTKM_TEST_ASSERT(
|
|
|
|
test_equal(result_value, ValueType(static_cast<ValueComponentType>(i))),
|
|
|
|
"ArrayHandleZip Failed as input for value");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2015-05-05 18:25:48 +00:00
|
|
|
struct ZipTypesToTest
|
|
|
|
: vtkm::ListTagBase< vtkm::Pair< vtkm::UInt8, vtkm::Id >,
|
|
|
|
vtkm::Pair< vtkm::Int32, vtkm::Vec< vtkm::Float32, 3> >,
|
|
|
|
vtkm::Pair< vtkm::Float64, vtkm::Vec< vtkm::UInt8, 4> >,
|
|
|
|
vtkm::Pair< vtkm::Vec<vtkm::Float32,3>, vtkm::Vec<vtkm::Int8, 4> >,
|
|
|
|
vtkm::Pair< vtkm::Vec<vtkm::Float64,2>, vtkm::Int32 >
|
|
|
|
>
|
|
|
|
{ };
|
|
|
|
|
|
|
|
struct HandleTypesToTest
|
2015-05-08 19:32:06 +00:00
|
|
|
: vtkm::ListTagBase< vtkm::UInt8,
|
|
|
|
vtkm::UInt32,
|
2015-05-05 18:25:48 +00:00
|
|
|
vtkm::Int32,
|
|
|
|
vtkm::Int64,
|
|
|
|
vtkm::Vec<vtkm::Int32,2>,
|
|
|
|
vtkm::Vec<vtkm::UInt8,4>,
|
|
|
|
vtkm::Float32,
|
|
|
|
vtkm::Float64,
|
|
|
|
vtkm::Vec<vtkm::Float64,3>,
|
2015-09-15 04:55:44 +00:00
|
|
|
vtkm::Vec<vtkm::Float32,4>
|
2015-05-05 18:25:48 +00:00
|
|
|
>
|
|
|
|
{ };
|
|
|
|
|
2015-09-01 21:42:45 +00:00
|
|
|
struct CastTypesToTest
|
|
|
|
: vtkm::ListTagBase< vtkm::Int32,
|
|
|
|
vtkm::UInt32
|
|
|
|
>
|
|
|
|
{ };
|
|
|
|
|
2015-05-05 18:25:48 +00:00
|
|
|
|
|
|
|
struct TestAll
|
|
|
|
{
|
|
|
|
VTKM_CONT_EXPORT void operator()() const
|
|
|
|
{
|
|
|
|
std::cout << "Doing FancyArrayHandle tests" << std::endl;
|
|
|
|
|
|
|
|
std::cout << "-------------------------------------------" << std::endl;
|
2015-07-13 17:01:41 +00:00
|
|
|
std::cout << "Testing ArrayHandleCompositeVector as Input" << std::endl;
|
2015-05-05 18:25:48 +00:00
|
|
|
vtkm::testing::Testing::TryTypes(
|
2015-07-13 17:01:41 +00:00
|
|
|
TestingFancyArrayHandles<DeviceAdapterTag>::TestCompositeAsInput(),
|
|
|
|
vtkm::TypeListTagScalarAll());
|
2015-05-05 18:25:48 +00:00
|
|
|
|
2015-05-13 20:24:51 +00:00
|
|
|
std::cout << "-------------------------------------------" << std::endl;
|
|
|
|
std::cout << "Testing ArrayHandleConstant as Input" << std::endl;
|
|
|
|
vtkm::testing::Testing::TryTypes(
|
|
|
|
TestingFancyArrayHandles<DeviceAdapterTag>::TestConstantAsInput(),
|
|
|
|
HandleTypesToTest());
|
|
|
|
|
2015-05-05 18:25:48 +00:00
|
|
|
std::cout << "-------------------------------------------" << std::endl;
|
|
|
|
std::cout << "Testing ArrayHandleCounting as Input" << std::endl;
|
|
|
|
vtkm::testing::Testing::TryTypes(
|
|
|
|
TestingFancyArrayHandles<DeviceAdapterTag>::TestCountingAsInput(),
|
|
|
|
HandleTypesToTest());
|
|
|
|
|
|
|
|
std::cout << "-------------------------------------------" << std::endl;
|
|
|
|
std::cout << "Testing ArrayHandleImplicit as Input" << std::endl;
|
|
|
|
vtkm::testing::Testing::TryTypes(
|
|
|
|
TestingFancyArrayHandles<DeviceAdapterTag>::TestImplicitAsInput(),
|
|
|
|
HandleTypesToTest());
|
|
|
|
|
|
|
|
std::cout << "-------------------------------------------" << std::endl;
|
|
|
|
std::cout << "Testing ArrayHandlePermutation as Input" << std::endl;
|
|
|
|
vtkm::testing::Testing::TryTypes(
|
|
|
|
TestingFancyArrayHandles<DeviceAdapterTag>::TestPermutationAsInput(),
|
|
|
|
HandleTypesToTest());
|
|
|
|
|
|
|
|
std::cout << "-------------------------------------------" << std::endl;
|
|
|
|
std::cout << "Testing ArrayHandleTransform as Input" << std::endl;
|
|
|
|
vtkm::testing::Testing::TryTypes(
|
|
|
|
TestingFancyArrayHandles<DeviceAdapterTag>::TestTransformAsInput(),
|
|
|
|
HandleTypesToTest());
|
|
|
|
|
|
|
|
std::cout << "-------------------------------------------" << std::endl;
|
|
|
|
std::cout << "Testing ArrayHandleTransform with Counting as Input" << std::endl;
|
|
|
|
vtkm::testing::Testing::TryTypes(
|
|
|
|
TestingFancyArrayHandles<DeviceAdapterTag>::TestCountingTransformAsInput(),
|
|
|
|
HandleTypesToTest());
|
|
|
|
|
2015-09-01 21:42:45 +00:00
|
|
|
std::cout << "-------------------------------------------" << std::endl;
|
|
|
|
std::cout << "Testing ArrayHandleCast as Input" << std::endl;
|
|
|
|
vtkm::testing::Testing::TryTypes(
|
|
|
|
TestingFancyArrayHandles<DeviceAdapterTag>::TestCastAsInput(),
|
|
|
|
CastTypesToTest());
|
|
|
|
|
2015-09-28 23:19:38 +00:00
|
|
|
std::cout << "-------------------------------------------" << std::endl;
|
|
|
|
std::cout << "Testing ArrayHandleGroupVec<3> as Input" << std::endl;
|
|
|
|
vtkm::testing::Testing::TryTypes(
|
|
|
|
TestingFancyArrayHandles<DeviceAdapterTag>::TestGroupVecAsInput<3>(),
|
|
|
|
HandleTypesToTest());
|
|
|
|
|
|
|
|
std::cout << "-------------------------------------------" << std::endl;
|
|
|
|
std::cout << "Testing ArrayHandleGroupVec<4> as Input" << std::endl;
|
|
|
|
vtkm::testing::Testing::TryTypes(
|
|
|
|
TestingFancyArrayHandles<DeviceAdapterTag>::TestGroupVecAsInput<4>(),
|
|
|
|
HandleTypesToTest());
|
|
|
|
|
|
|
|
std::cout << "-------------------------------------------" << std::endl;
|
|
|
|
std::cout << "Testing ArrayHandleGroupVec<2> as Output" << std::endl;
|
|
|
|
vtkm::testing::Testing::TryTypes(
|
|
|
|
TestingFancyArrayHandles<DeviceAdapterTag>::TestGroupVecAsOutput<2>(),
|
|
|
|
vtkm::TypeListTagScalarAll());
|
|
|
|
|
|
|
|
std::cout << "-------------------------------------------" << std::endl;
|
|
|
|
std::cout << "Testing ArrayHandleGroupVec<3> as Output" << std::endl;
|
|
|
|
vtkm::testing::Testing::TryTypes(
|
|
|
|
TestingFancyArrayHandles<DeviceAdapterTag>::TestGroupVecAsOutput<3>(),
|
|
|
|
vtkm::TypeListTagScalarAll());
|
|
|
|
|
2015-05-08 19:32:06 +00:00
|
|
|
std::cout << "-------------------------------------------" << std::endl;
|
2015-07-13 17:01:41 +00:00
|
|
|
std::cout << "Testing ArrayHandleZip as Input" << std::endl;
|
2015-05-08 19:32:06 +00:00
|
|
|
vtkm::testing::Testing::TryTypes(
|
2015-07-13 17:01:41 +00:00
|
|
|
TestingFancyArrayHandles<DeviceAdapterTag>::TestZipAsInput(),
|
2015-05-08 19:32:06 +00:00
|
|
|
ZipTypesToTest());
|
|
|
|
|
|
|
|
std::cout << "-------------------------------------------" << std::endl;
|
|
|
|
std::cout << "Testing ArrayHandlePermutation as Output" << std::endl;
|
|
|
|
vtkm::testing::Testing::TryTypes(
|
|
|
|
TestingFancyArrayHandles<DeviceAdapterTag>::TestPermutationAsOutput(),
|
|
|
|
HandleTypesToTest());
|
2015-07-13 17:01:41 +00:00
|
|
|
|
|
|
|
std::cout << "-------------------------------------------" << std::endl;
|
|
|
|
std::cout << "Testing ArrayHandleZip as Output" << std::endl;
|
|
|
|
vtkm::testing::Testing::TryTypes(
|
|
|
|
TestingFancyArrayHandles<DeviceAdapterTag>::TestZipAsOutput(),
|
|
|
|
ZipTypesToTest());
|
2015-05-05 18:25:48 +00:00
|
|
|
}
|
|
|
|
};
|
|
|
|
public:
|
|
|
|
|
|
|
|
/// Run a suite of tests to check to see if a DeviceAdapter properly supports
|
|
|
|
/// all the fancy array handles that vtkm supports. Returns an
|
|
|
|
/// error code that can be returned from the main function of a test.
|
|
|
|
///
|
|
|
|
static VTKM_CONT_EXPORT int Run()
|
|
|
|
{
|
|
|
|
return vtkm::cont::testing::Testing::Run(TestAll());
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} // namespace vtkm::cont::testing
|
|
|
|
|
|
|
|
#endif //vtk_m_cont_testing_TestingFancyArrayHandles_h
|