Merge branch 'master' of gitlab.kitware.com:Fasel/vtk-m into cell_to_point

This commit is contained in:
Patricia Kroll Fasel - 090207 2015-11-03 13:48:23 -07:00
commit 480f0bd416
8 changed files with 59 additions and 32 deletions

@ -194,8 +194,8 @@ void displayCall()
// Allow rotations of the view // Allow rotations of the view
void mouseMove(int x, int y) void mouseMove(int x, int y)
{ {
int dx = x - lastx; vtkm::Float32 dx = static_cast<vtkm::Float32>(x - lastx);
int dy = y - lasty; vtkm::Float32 dy = static_cast<vtkm::Float32>(y - lasty);
if (mouse_state == 0) if (mouse_state == 0)
{ {

@ -26,6 +26,7 @@
#include <vtkm/cont/cuda/DeviceAdapterCuda.h> #include <vtkm/cont/cuda/DeviceAdapterCuda.h>
#include <vtkm/cont/tbb/DeviceAdapterTBB.h> #include <vtkm/cont/tbb/DeviceAdapterTBB.h>
#include <vtkm/cont/DeviceAdapterSerial.h>
struct GenerateSurfaceWorklet : public vtkm::worklet::WorkletMapField struct GenerateSurfaceWorklet : public vtkm::worklet::WorkletMapField
{ {
@ -46,8 +47,8 @@ struct GenerateSurfaceWorklet : public vtkm::worklet::WorkletMapField
output[2] = input[2]; output[2] = input[2];
color[0] = 0; color[0] = 0;
color[1] = 160 + static_cast<vtkm::UInt8>(96 * vtkm::Sin( input[0] * 10.f + t ) ); color[1] = static_cast<vtkm::UInt8>(160 + (96 * vtkm::Sin(input[0] * 10.f + t)));
color[2] = 160 + static_cast<vtkm::UInt8>(96 * vtkm::Cos( input[2] * 5.f + t ) ); color[2] = static_cast<vtkm::UInt8>(160 + (96 * vtkm::Cos(input[2] * 5.f + t)));
color[3] = 255; color[3] = 255;
} }
}; };

@ -18,6 +18,10 @@
// this software. // this software.
//============================================================================ //============================================================================
#ifndef VTKM_DEVICE_ADAPTER
#define VTKM_DEVICE_ADAPTER VTKM_DEVICE_ADAPTER_SERIAL
#endif
#include <vtkm/worklet/TetrahedralizeExplicitGrid.h> #include <vtkm/worklet/TetrahedralizeExplicitGrid.h>
#include <vtkm/worklet/DispatcherMapField.h> #include <vtkm/worklet/DispatcherMapField.h>
#include <vtkm/Math.h> #include <vtkm/Math.h>
@ -41,6 +45,8 @@
typedef VTKM_DEFAULT_DEVICE_ADAPTER_TAG DeviceAdapter; typedef VTKM_DEFAULT_DEVICE_ADAPTER_TAG DeviceAdapter;
namespace {
// Takes input uniform grid and outputs unstructured grid of tets // Takes input uniform grid and outputs unstructured grid of tets
vtkm::cont::DataSet outDataSet; vtkm::cont::DataSet outDataSet;
vtkm::Id numberOfInPoints; vtkm::Id numberOfInPoints;
@ -53,6 +59,8 @@ Quaternion qrot;
int lastx, lasty; int lastx, lasty;
int mouse_state = 1; int mouse_state = 1;
} // anonymous namespace
// //
// Test 3D explicit dataset // Test 3D explicit dataset
// //
@ -279,8 +287,8 @@ void displayCall()
// Allow rotations of the view // Allow rotations of the view
void mouseMove(int x, int y) void mouseMove(int x, int y)
{ {
int dx = x - lastx; vtkm::Float32 dx = static_cast<vtkm::Float32>(x - lastx);
int dy = y - lasty; vtkm::Float32 dy = static_cast<vtkm::Float32>(y - lasty);
if (mouse_state == 0) if (mouse_state == 0)
{ {

@ -18,6 +18,10 @@
// this software. // this software.
//============================================================================ //============================================================================
#ifndef VTKM_DEVICE_ADAPTER
#define VTKM_DEVICE_ADAPTER VTKM_DEVICE_ADAPTER_SERIAL
#endif
#include <vtkm/worklet/TetrahedralizeUniformGrid.h> #include <vtkm/worklet/TetrahedralizeUniformGrid.h>
#include <vtkm/worklet/DispatcherMapField.h> #include <vtkm/worklet/DispatcherMapField.h>
#include <vtkm/Math.h> #include <vtkm/Math.h>
@ -79,8 +83,7 @@ vtkm::cont::DataSet MakeTetrahedralizeTestDataSet(vtkm::Id3 dim)
vtkm::cont::CoordinateSystem("coordinates", 1, coordinates)); vtkm::cont::CoordinateSystem("coordinates", 1, coordinates));
// Generate cell set // Generate cell set
static const vtkm::IdComponent ndim = 3; vtkm::cont::CellSetStructured<3> cellSet("cells");
vtkm::cont::CellSetStructured<ndim> cellSet("cells");
cellSet.SetPointDimensions(vdims); cellSet.SetPointDimensions(vdims);
dataSet.AddCellSet(cellSet); dataSet.AddCellSet(cellSet);
@ -237,8 +240,8 @@ void displayCall()
// Allow rotations of the view // Allow rotations of the view
void mouseMove(int x, int y) void mouseMove(int x, int y)
{ {
int dx = x - lastx; vtkm::Float32 dx = static_cast<vtkm::Float32>(x - lastx);
int dy = y - lasty; vtkm::Float32 dy = static_cast<vtkm::Float32>(y - lasty);
if (mouse_state == 0) if (mouse_state == 0)
{ {

@ -18,6 +18,10 @@
// this software. // this software.
//============================================================================ //============================================================================
#ifndef VTKM_DEVICE_ADAPTER
#define VTKM_DEVICE_ADAPTER VTKM_DEVICE_ADAPTER_SERIAL
#endif
#include <vtkm/worklet/TetrahedralizeExplicitGrid.h> #include <vtkm/worklet/TetrahedralizeExplicitGrid.h>
#include <vtkm/cont/CellSetExplicit.h> #include <vtkm/cont/CellSetExplicit.h>
#include <vtkm/cont/DataSet.h> #include <vtkm/cont/DataSet.h>
@ -38,6 +42,8 @@
typedef VTKM_DEFAULT_DEVICE_ADAPTER_TAG DeviceAdapter; typedef VTKM_DEFAULT_DEVICE_ADAPTER_TAG DeviceAdapter;
namespace {
// Takes input uniform grid and outputs unstructured grid of triangles // Takes input uniform grid and outputs unstructured grid of triangles
vtkm::worklet::TetrahedralizeFilterExplicitGrid<DeviceAdapter> *tetrahedralizeFilter; vtkm::worklet::TetrahedralizeFilterExplicitGrid<DeviceAdapter> *tetrahedralizeFilter;
vtkm::cont::DataSet outDataSet; vtkm::cont::DataSet outDataSet;
@ -46,6 +52,8 @@ vtkm::Id numberOfInPoints;
// Point location of vertices from a CastAndCall but needs a static cast eventually // Point location of vertices from a CastAndCall but needs a static cast eventually
vtkm::cont::ArrayHandle<vtkm::Vec<vtkm::Float64, 3> > vertexArray; vtkm::cont::ArrayHandle<vtkm::Vec<vtkm::Float64, 3> > vertexArray;
} // anonymous namespace
// //
// Construct an input data set with uniform grid of indicated dimensions, origin and spacing // Construct an input data set with uniform grid of indicated dimensions, origin and spacing
// //

@ -18,6 +18,10 @@
// this software. // this software.
//============================================================================ //============================================================================
#ifndef VTKM_DEVICE_ADAPTER
#define VTKM_DEVICE_ADAPTER VTKM_DEVICE_ADAPTER_SERIAL
#endif
#include <vtkm/worklet/TetrahedralizeUniformGrid.h> #include <vtkm/worklet/TetrahedralizeUniformGrid.h>
#include <vtkm/worklet/DispatcherMapField.h> #include <vtkm/worklet/DispatcherMapField.h>
#include <vtkm/Math.h> #include <vtkm/Math.h>
@ -72,8 +76,7 @@ vtkm::cont::DataSet MakeTriangulateTestDataSet(vtkm::Id2 dim)
vtkm::cont::CoordinateSystem("coordinates", 1, coordinates)); vtkm::cont::CoordinateSystem("coordinates", 1, coordinates));
// Generate cell set // Generate cell set
static const vtkm::IdComponent ndim = 2; vtkm::cont::CellSetStructured<2> cellSet("cells");
vtkm::cont::CellSetStructured<ndim> cellSet("cells");
cellSet.SetPointDimensions(vtkm::make_Vec(dim[0] + 1, dim[1] + 1)); cellSet.SetPointDimensions(vtkm::make_Vec(dim[0] + 1, dim[1] + 1));
dataSet.AddCellSet(cellSet); dataSet.AddCellSet(cellSet);

@ -24,6 +24,7 @@
#include <vtkm/cont/cuda/internal/ArrayManagerExecutionCuda.h> #include <vtkm/cont/cuda/internal/ArrayManagerExecutionCuda.h>
#include <vtkm/cont/DeviceAdapterAlgorithm.h> #include <vtkm/cont/DeviceAdapterAlgorithm.h>
#include <vtkm/cont/ErrorControlInternal.h>
// Here are the actual implementation of the algorithms. // Here are the actual implementation of the algorithms.
#include <vtkm/cont/cuda/internal/DeviceAdapterAlgorithmThrust.h> #include <vtkm/cont/cuda/internal/DeviceAdapterAlgorithmThrust.h>
@ -42,6 +43,10 @@ struct DeviceAdapterAlgorithm<vtkm::cont::DeviceAdapterTagCuda>
VTKM_CONT_EXPORT static void Synchronize() VTKM_CONT_EXPORT static void Synchronize()
{ {
cudaError_t error = cudaDeviceSynchronize(); cudaError_t error = cudaDeviceSynchronize();
if (error != cudaSuccess)
{
throw vtkm::cont::ErrorControlInternal(cudaGetErrorString(error));
}
} }
}; };

@ -18,12 +18,11 @@
// Laboratory (LANL), the U.S. Government retains certain rights in // Laboratory (LANL), the U.S. Government retains certain rights in
// this software. // this software.
//============================================================================ //============================================================================
#ifndef vtk_m_cont_cuda_internal_DeviceAdapterThrust_h #ifndef vtk_m_cont_cuda_internal_DeviceAdapterAlgorithmThrust_h
#define vtk_m_cont_cuda_internal_DeviceAdapterThrust_h #define vtk_m_cont_cuda_internal_DeviceAdapterAlgorithmThrust_h
#include <vtkm/cont/ArrayHandle.h> #include <vtkm/cont/ArrayHandle.h>
#include <vtkm/cont/ErrorExecution.h> #include <vtkm/cont/ErrorExecution.h>
#include <vtkm/cont/Timer.h>
#include <vtkm/Types.h> #include <vtkm/Types.h>
#include <vtkm/TypeTraits.h> #include <vtkm/TypeTraits.h>
#include <vtkm/UnaryPredicates.h> #include <vtkm/UnaryPredicates.h>
@ -1285,4 +1284,4 @@ public:
} }
} // namespace vtkm::cont::cuda::internal } // namespace vtkm::cont::cuda::internal
#endif //vtk_m_cont_cuda_internal_DeviceAdapterThrust_h #endif //vtk_m_cont_cuda_internal_DeviceAdapterAlgorithmThrust_h