Commit 7bd57b70 authored by Kenneth Moreland's avatar Kenneth Moreland Committed by Kitware Robot
Browse files

Merge topic 'vtk-m-test-linking'

9ccf982a Remove direct usage of VTK-m in LOD test
ec591255 Remove references to VTK-m header files from VTK filters
ea855589

 Remove VTK-m includes and libs from test compile
Acked-by: Kitware Robot's avatarKitware Robot <kwrobot@kitware.com>
Acked-by: default avatarRobert Maynard <robert.maynard@kitware.com>
Merge-request: !3610
parents 88e4cdde 9ccf982a
include_directories(${VTKm_INCLUDE_DIRS})
vtk_add_test_cxx(${vtk-module}CxxTests tests
TestVTKMCleanGrid.cxx
TestVTKMClip.cxx
......@@ -19,6 +17,3 @@ vtk_add_test_cxx(${vtk-module}CxxTests tests
vtk_test_cxx_executable(${vtk-module}CxxTests tests
RENDERING_FACTORY
)
# Allow vtkm_cont library to be used from tests
target_link_libraries(vtkAcceleratorsVTKmCxxTests LINK_PRIVATE ${VTKm_LIBRARIES})
......@@ -13,6 +13,11 @@
=========================================================================*/
// Uncomment this to directly compare serial and TBB versions
// #define FORCE_VTKM_DEVICE
// TODO: Make a way to force the VTK-m device without actually loading VTK-m
// headers (and all subsequent dependent headers).
#include "vtkActor.h"
#include "vtkCamera.h"
......@@ -46,11 +51,15 @@
#include "vtkWindowToImageFilter.h"
#include "vtkXMLPolyDataReader.h"
#ifdef FORCE_VTKM_DEVICE
#include <vtkm/cont/RuntimeDeviceTracker.h>
#include <vtkm/cont/serial/DeviceAdapterSerial.h>
#include <vtkm/cont/tbb/DeviceAdapterTBB.h>
#endif // FORCE_VTKM_DEVICE
#include <iomanip>
#include <sstream>
......@@ -298,6 +307,8 @@ void RunBenchmark(int gridSize)
#endif
}
#ifdef FORCE_VTKM_DEVICE
vtkm::cont::RuntimeDeviceTracker tracker =
vtkm::cont::GetGlobalRuntimeDeviceTracker();
......@@ -326,6 +337,19 @@ void RunBenchmark(int gridSize)
}
#endif // VTKM_ENABLE_TBB
#else // !FORCE_VTKM_DEVICE
// Run VTKm
vtkSmartPointer<vtkPolyData> vtkmResult;
double vtkmTime = 0.;
{
VTKmFilterGenerator generator(gridSize);
vtkmTime = BenchmarkFilter(generator, input);
vtkmResult = generator.Result;
}
#endif
// Run VTK -- average clustered points
vtkSmartPointer<vtkPolyData> vtkResultAvePts;
double vtkTimeAvePts = 0.;
......@@ -349,6 +373,8 @@ void RunBenchmark(int gridSize)
<< "Input dataset has " << input->GetNumberOfPoints() << " points "
"and " << input->GetNumberOfCells() << " cells.\n";
#ifdef FORCE_VTKM_DEVICE
std::cerr << "vtkmLevelOfDetail (serial, average clustered points): "
<< vtkmTimeSerial << " seconds, "
<< vtkmResultSerial->GetNumberOfPoints() << " points, "
......@@ -364,6 +390,15 @@ void RunBenchmark(int gridSize)
}
#endif // VTKM_ENABLE_TBB
#else // !FORCE_VTKM_DEVICE
std::cerr << "vtkmLevelOfDetail (average clustered points): "
<< vtkmTime << " seconds, "
<< vtkmResult->GetNumberOfPoints() << " points, "
<< vtkmResult->GetNumberOfCells() << " cells.\n";
#endif // !FORCE_VTKM_DEVICE
std::cerr << "vtkQuadricClustering (average clustered points): "
<< vtkTimeAvePts << " seconds, "
<< vtkResultAvePts->GetNumberOfPoints() << " points, "
......@@ -373,11 +408,17 @@ void RunBenchmark(int gridSize)
<< vtkResult->GetNumberOfPoints() << " points, "
<< vtkResult->GetNumberOfCells() << " cells.\n";
#ifdef FORCE_VTKM_DEVICE
#ifdef VTKM_ENABLE_TBB
RenderResults(gridSize, input,
vtkmTimeTBB, vtkmResultTBB,
vtkTime, vtkResult);
#endif // VTKM_ENABLE_TBB
#else // !FORCE_VTKM_DEVICE
RenderResults(gridSize, input,
vtkmTime, vtkmResult,
vtkTime, vtkResult);
#endif // !FORCE_VTKM_DEVICE
}
void RunBenchmarks()
......
......@@ -30,6 +30,7 @@
#include "vtkmlib/ArrayConverters.h"
#include "vtkmlib/DataSetConverters.h"
#include "vtkmlib/ImplicitFunctionConverter.h"
#include "vtkmlib/PolyDataConverter.h"
#include "vtkmlib/Storage.h"
#include "vtkmlib/UnstructuredGridConverter.h"
......@@ -61,7 +62,8 @@ void vtkmClip::PrintSelf(std::ostream &os, vtkIndent indent)
vtkmClip::vtkmClip()
: ClipValue(0.),
ComputeScalars(true),
ClipFunction(nullptr)
ClipFunction(nullptr),
ClipFunctionConverter(new tovtkm::ImplicitFunctionConverter)
{
// Clip active point scalars by default
this->SetInputArrayToProcess(0, 0, 0, vtkDataObject::FIELD_ASSOCIATION_POINTS,
......@@ -90,7 +92,7 @@ void vtkmClip::SetClipFunction(vtkImplicitFunction *clipFunction)
if (this->ClipFunction != clipFunction)
{
this->ClipFunction = clipFunction;
this->ClipFunctionConverter.Set(clipFunction);
this->ClipFunctionConverter->Set(clipFunction);
this->Modified();
}
}
......@@ -151,7 +153,7 @@ int vtkmClip::RequestData(vtkInformation *,
vtkmInputFilterPolicy policy;
if (this->ClipFunction)
{
auto function = this->ClipFunctionConverter.Get();
auto function = this->ClipFunctionConverter->Get();
if (function.GetValid())
{
functionFilter.SetImplicitFunction(function);
......
......@@ -27,12 +27,17 @@
#include "vtkAcceleratorsVTKmModule.h" // For export macro
#include "vtkUnstructuredGridAlgorithm.h"
#include "vtkmlib/ImplicitFunctionConverter.h" // For ImplicitFunctionConverter
#include <memory> // For std::shared_ptr
#include <memory> // For std::unique_ptr
class vtkImplicitFunction;
namespace tovtkm {
class ImplicitFunctionConverter;
} // namespace tovtkm
class VTKACCELERATORSVTKM_EXPORT vtkmClip : public vtkUnstructuredGridAlgorithm
{
public:
......@@ -77,7 +82,7 @@ protected:
bool ComputeScalars;
vtkImplicitFunction *ClipFunction;
tovtkm::ImplicitFunctionConverter ClipFunctionConverter;
std::unique_ptr<tovtkm::ImplicitFunctionConverter> ClipFunctionConverter;
private:
vtkmClip(const vtkmClip&) = delete;
......
......@@ -49,7 +49,6 @@
#include "vtkPolyDataAlgorithm.h"
#include "vtkAcceleratorsVTKmModule.h" //required for correct implementation
#include "vtkmConfig.h" //required for general vtkm setup
class VTKACCELERATORSVTKM_EXPORT vtkmLevelOfDetail : public vtkPolyDataAlgorithm
{
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment