mirror of
https://gitlab.kitware.com/vtk/vtk-m
synced 2024-10-05 09:59:12 +00:00
ad1e7b5bdb
This mechanism sets up CMake variables that allow a user to select which modules/libraries to create. Dependencies will be tracked down to ensure that all of a module's dependencies are also enabled. The modules are also arranged into groups. Groups allow you to set the enable flag for a group of modules at once. Thus, if you have several modules that are likely to be used together, you can create a group for them. This can be handy in converting user-friendly CMake options (such as `VTKm_ENABLE_RENDERING`) to the modules that enable that by pointing to the appropriate group.
90 lines
2.4 KiB
C++
90 lines
2.4 KiB
C++
//============================================================================
|
|
// 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.
|
|
//============================================================================
|
|
|
|
#include <vtkm/cont/arg/TransportTagArrayOut.h>
|
|
|
|
#include <vtkm/exec/FunctorBase.h>
|
|
|
|
#include <vtkm/cont/ArrayHandle.h>
|
|
#include <vtkm/cont/ArrayHandleIndex.h>
|
|
#include <vtkm/cont/DeviceAdapter.h>
|
|
#include <vtkm/cont/TryExecute.h>
|
|
|
|
#include <vtkm/cont/testing/Testing.h>
|
|
|
|
namespace
|
|
{
|
|
|
|
static constexpr vtkm::Id ARRAY_SIZE = 10;
|
|
|
|
template <typename PortalType>
|
|
struct TestKernelOut : public vtkm::exec::FunctorBase
|
|
{
|
|
PortalType Portal;
|
|
|
|
VTKM_EXEC
|
|
void operator()(vtkm::Id index) const
|
|
{
|
|
using ValueType = typename PortalType::ValueType;
|
|
this->Portal.Set(index, TestValue(index, ValueType()));
|
|
}
|
|
};
|
|
|
|
template <typename Device>
|
|
struct TryArrayOutType
|
|
{
|
|
template <typename T>
|
|
void operator()(T) const
|
|
{
|
|
using ArrayHandleType = vtkm::cont::ArrayHandle<T>;
|
|
ArrayHandleType handle;
|
|
|
|
using PortalType = typename ArrayHandleType::WritePortalType;
|
|
|
|
vtkm::cont::arg::Transport<vtkm::cont::arg::TransportTagArrayOut, ArrayHandleType, Device>
|
|
transport;
|
|
|
|
vtkm::cont::Token token;
|
|
|
|
TestKernelOut<PortalType> kernel;
|
|
kernel.Portal =
|
|
transport(handle, vtkm::cont::ArrayHandleIndex(ARRAY_SIZE), ARRAY_SIZE, ARRAY_SIZE, token);
|
|
|
|
VTKM_TEST_ASSERT(handle.GetNumberOfValues() == ARRAY_SIZE,
|
|
"ArrayOut transport did not allocate array correctly.");
|
|
|
|
vtkm::cont::DeviceAdapterAlgorithm<Device>::Schedule(kernel, ARRAY_SIZE);
|
|
token.DetachFromAll();
|
|
|
|
CheckPortal(handle.ReadPortal());
|
|
}
|
|
};
|
|
|
|
template <typename Device>
|
|
bool TryArrayOutTransport(Device device)
|
|
{
|
|
std::cout << "Trying ArrayOut transport with " << device.GetName() << std::endl;
|
|
vtkm::testing::Testing::TryTypes(TryArrayOutType<Device>());
|
|
return true;
|
|
}
|
|
|
|
void TestArrayOutTransport()
|
|
{
|
|
VTKM_TEST_ASSERT(
|
|
vtkm::cont::TryExecute([](auto device) { return TryArrayOutTransport(device); }));
|
|
}
|
|
|
|
} // Anonymous namespace
|
|
|
|
int UnitTestTransportArrayOut(int argc, char* argv[])
|
|
{
|
|
return vtkm::cont::testing::Testing::Run(TestArrayOutTransport, argc, argv);
|
|
}
|