diff --git a/examples/isosurface/IsosurfaceUniformGrid.cxx b/examples/isosurface/IsosurfaceUniformGrid.cxx index b23b306a6..1aff52916 100644 --- a/examples/isosurface/IsosurfaceUniformGrid.cxx +++ b/examples/isosurface/IsosurfaceUniformGrid.cxx @@ -194,8 +194,8 @@ void displayCall() // Allow rotations of the view void mouseMove(int x, int y) { - int dx = x - lastx; - int dy = y - lasty; + vtkm::Float32 dx = static_cast(x - lastx); + vtkm::Float32 dy = static_cast(y - lasty); if (mouse_state == 0) { diff --git a/examples/multi_backend/MultiBackend.cxx b/examples/multi_backend/MultiBackend.cxx index db1e59613..d3c1c271c 100644 --- a/examples/multi_backend/MultiBackend.cxx +++ b/examples/multi_backend/MultiBackend.cxx @@ -26,6 +26,7 @@ #include #include +#include struct GenerateSurfaceWorklet : public vtkm::worklet::WorkletMapField { @@ -46,8 +47,8 @@ struct GenerateSurfaceWorklet : public vtkm::worklet::WorkletMapField output[2] = input[2]; color[0] = 0; - color[1] = 160 + static_cast(96 * vtkm::Sin( input[0] * 10.f + t ) ); - color[2] = 160 + static_cast(96 * vtkm::Cos( input[2] * 5.f + t ) ); + color[1] = static_cast(160 + (96 * vtkm::Sin(input[0] * 10.f + t))); + color[2] = static_cast(160 + (96 * vtkm::Cos(input[2] * 5.f + t))); color[3] = 255; } }; diff --git a/examples/tetrahedra/TetrahedralizeExplicitGrid.cxx b/examples/tetrahedra/TetrahedralizeExplicitGrid.cxx index 05150c013..60e30511d 100644 --- a/examples/tetrahedra/TetrahedralizeExplicitGrid.cxx +++ b/examples/tetrahedra/TetrahedralizeExplicitGrid.cxx @@ -18,6 +18,10 @@ // this software. //============================================================================ +#ifndef VTKM_DEVICE_ADAPTER +#define VTKM_DEVICE_ADAPTER VTKM_DEVICE_ADAPTER_SERIAL +#endif + #include #include #include @@ -41,6 +45,8 @@ typedef VTKM_DEFAULT_DEVICE_ADAPTER_TAG DeviceAdapter; +namespace { + // Takes input uniform grid and outputs unstructured grid of tets vtkm::cont::DataSet outDataSet; vtkm::Id numberOfInPoints; @@ -53,6 +59,8 @@ Quaternion qrot; int lastx, lasty; int mouse_state = 1; +} // anonymous namespace + // // Test 3D explicit dataset // @@ -135,7 +143,7 @@ vtkm::cont::DataSet MakeTetrahedralizeExplicitDataSet() return dataSet; } -// +// // Functor to retrieve vertex locations from the CoordinateSystem // Actually need a static cast to ArrayHandle from DynamicArrayHandleCoordinateSystem // but haven't been able to figure out what that is @@ -210,14 +218,14 @@ void displayCall() qrot.getRotMat(rotationMatrix); glMultMatrixf(rotationMatrix); glTranslatef(-0.5f, -0.5f, -0.5f); - + // Get cell set and the number of cells and vertices - vtkm::cont::CellSetSingleType<> cellSet = + vtkm::cont::CellSetSingleType<> cellSet = outDataSet.GetCellSet(0).CastTo >(); vtkm::Id numberOfCells = cellSet.GetNumberOfCells(); // Get the coordinate system and coordinate data - const vtkm::cont::DynamicArrayHandleCoordinateSystem coordArray = + const vtkm::cont::DynamicArrayHandleCoordinateSystem coordArray = outDataSet.GetCoordinateSystem(0).GetData(); // Need the actual vertex points from a static cast of the dynamic array but can't get it right @@ -279,8 +287,8 @@ void displayCall() // Allow rotations of the view void mouseMove(int x, int y) { - int dx = x - lastx; - int dy = y - lasty; + vtkm::Float32 dx = static_cast(x - lastx); + vtkm::Float32 dy = static_cast(y - lasty); if (mouse_state == 0) { @@ -312,7 +320,7 @@ void mouseCall(int button, int state, int x, int y) int main(int argc, char* argv[]) { std::cout << "TetrahedralizeExplicitGrid Example" << std::endl; - + // Create the input explicit cell set vtkm::cont::DataSet inDataSet = MakeTetrahedralizeExplicitDataSet(); vtkm::cont::CellSetExplicit<> &inCellSet = diff --git a/examples/tetrahedra/TetrahedralizeUniformGrid.cxx b/examples/tetrahedra/TetrahedralizeUniformGrid.cxx index 6c63acb55..41786493f 100644 --- a/examples/tetrahedra/TetrahedralizeUniformGrid.cxx +++ b/examples/tetrahedra/TetrahedralizeUniformGrid.cxx @@ -18,6 +18,10 @@ // this software. //============================================================================ +#ifndef VTKM_DEVICE_ADAPTER +#define VTKM_DEVICE_ADAPTER VTKM_DEVICE_ADAPTER_SERIAL +#endif + #include #include #include @@ -79,15 +83,14 @@ vtkm::cont::DataSet MakeTetrahedralizeTestDataSet(vtkm::Id3 dim) vtkm::cont::CoordinateSystem("coordinates", 1, coordinates)); // Generate cell set - static const vtkm::IdComponent ndim = 3; - vtkm::cont::CellSetStructured cellSet("cells"); + vtkm::cont::CellSetStructured<3> cellSet("cells"); cellSet.SetPointDimensions(vdims); dataSet.AddCellSet(cellSet); return dataSet; } -// +// // Functor to retrieve vertex locations from the CoordinateSystem // Actually need a static cast to ArrayHandle from DynamicArrayHandleCoordinateSystem // but haven't been able to figure out what that is @@ -163,10 +166,10 @@ void displayCall() qrot.getRotMat(rotationMatrix); glMultMatrixf(rotationMatrix); glTranslatef(-0.5f, -0.5f, -0.5f); - + // Get the cell set, coordinate system and coordinate data vtkm::cont::CellSetSingleType<> &cellSet = tetDataSet.GetCellSet(0).CastTo >(); - const vtkm::cont::DynamicArrayHandleCoordinateSystem &coordArray = + const vtkm::cont::DynamicArrayHandleCoordinateSystem &coordArray = tetDataSet.GetCoordinateSystem(0).GetData(); // Need the actual vertex points from a static cast of the dynamic array but can't get it right @@ -237,8 +240,8 @@ void displayCall() // Allow rotations of the view void mouseMove(int x, int y) { - int dx = x - lastx; - int dy = y - lasty; + vtkm::Float32 dx = static_cast(x - lastx); + vtkm::Float32 dy = static_cast(y - lasty); if (mouse_state == 0) { @@ -271,7 +274,7 @@ int main(int argc, char* argv[]) { std::cout << "TetrahedralizeUniformGrid Example" << std::endl; std::cout << "Parameters are [xdim ydim zdim [# of cellsToDisplay]]" << std::endl << std::endl; - + // Set the problem size and number of cells to display from command line if (argc >= 4) { diff --git a/examples/tetrahedra/TriangulateExplicitGrid.cxx b/examples/tetrahedra/TriangulateExplicitGrid.cxx index 29be357a8..d9e11f69f 100644 --- a/examples/tetrahedra/TriangulateExplicitGrid.cxx +++ b/examples/tetrahedra/TriangulateExplicitGrid.cxx @@ -18,6 +18,10 @@ // this software. //============================================================================ +#ifndef VTKM_DEVICE_ADAPTER +#define VTKM_DEVICE_ADAPTER VTKM_DEVICE_ADAPTER_SERIAL +#endif + #include #include #include @@ -38,6 +42,8 @@ typedef VTKM_DEFAULT_DEVICE_ADAPTER_TAG DeviceAdapter; +namespace { + // Takes input uniform grid and outputs unstructured grid of triangles vtkm::worklet::TetrahedralizeFilterExplicitGrid *tetrahedralizeFilter; vtkm::cont::DataSet outDataSet; @@ -46,6 +52,8 @@ vtkm::Id numberOfInPoints; // Point location of vertices from a CastAndCall but needs a static cast eventually vtkm::cont::ArrayHandle > vertexArray; +} // anonymous namespace + // // Construct an input data set with uniform grid of indicated dimensions, origin and spacing // @@ -140,7 +148,7 @@ vtkm::cont::DataSet MakeTriangulateExplicitDataSet() return dataSet; } -// +// // Functor to retrieve vertex locations from the CoordinateSystem // Actually need a static cast to ArrayHandle from DynamicArrayHandleCoordinateSystem // but haven't been able to figure out what that is @@ -187,12 +195,12 @@ void displayCall() glLineWidth(3.0f); // Get cell set and the number of cells and vertices - vtkm::cont::CellSetSingleType<> cellSet = + vtkm::cont::CellSetSingleType<> cellSet = outDataSet.GetCellSet(0).CastTo >(); vtkm::Id numberOfCells = cellSet.GetNumberOfCells(); // Get the coordinate system and coordinate data - const vtkm::cont::DynamicArrayHandleCoordinateSystem coordArray = + const vtkm::cont::DynamicArrayHandleCoordinateSystem coordArray = outDataSet.GetCoordinateSystem(0).GetData(); // Need the actual vertex points from a static cast of the dynamic array but can't get it right @@ -236,7 +244,7 @@ void displayCall() int main(int argc, char* argv[]) { std::cout << "TrianguleExplicitGrid Example" << std::endl; - + // Create the input uniform cell set vtkm::cont::DataSet inDataSet = MakeTriangulateExplicitDataSet(); vtkm::cont::CellSetExplicit<> &inCellSet = diff --git a/examples/tetrahedra/TriangulateUniformGrid.cxx b/examples/tetrahedra/TriangulateUniformGrid.cxx index b55d73bfe..3507b61f6 100644 --- a/examples/tetrahedra/TriangulateUniformGrid.cxx +++ b/examples/tetrahedra/TriangulateUniformGrid.cxx @@ -18,6 +18,10 @@ // this software. //============================================================================ +#ifndef VTKM_DEVICE_ADAPTER +#define VTKM_DEVICE_ADAPTER VTKM_DEVICE_ADAPTER_SERIAL +#endif + #include #include #include @@ -72,15 +76,14 @@ vtkm::cont::DataSet MakeTriangulateTestDataSet(vtkm::Id2 dim) vtkm::cont::CoordinateSystem("coordinates", 1, coordinates)); // Generate cell set - static const vtkm::IdComponent ndim = 2; - vtkm::cont::CellSetStructured cellSet("cells"); + vtkm::cont::CellSetStructured<2> cellSet("cells"); cellSet.SetPointDimensions(vtkm::make_Vec(dim[0] + 1, dim[1] + 1)); dataSet.AddCellSet(cellSet); return dataSet; } -// +// // Functor to retrieve vertex locations from the CoordinateSystem // Actually need a static cast to ArrayHandle from DynamicArrayHandleCoordinateSystem // but haven't been able to figure out what that is @@ -128,7 +131,7 @@ void displayCall() // Get the cellset, coordinate system and coordinate data vtkm::cont::CellSetSingleType<> &cellSet = tetDataSet.GetCellSet(0).CastTo >(); - const vtkm::cont::DynamicArrayHandleCoordinateSystem &coordArray = + const vtkm::cont::DynamicArrayHandleCoordinateSystem &coordArray = tetDataSet.GetCoordinateSystem(0).GetData(); // Need the actual vertex points from a static cast of the dynamic array but can't get it right @@ -181,7 +184,7 @@ int main(int argc, char* argv[]) { std::cout << "TrianguleUniformGrid Example" << std::endl; std::cout << "Parameters are [xdim ydim [# of cellsToDisplay]]" << std::endl << std::endl; - + // Set the problem size and number of cells to display from command line if (argc >= 3) { diff --git a/vtkm/cont/cuda/internal/DeviceAdapterAlgorithmCuda.h b/vtkm/cont/cuda/internal/DeviceAdapterAlgorithmCuda.h index 9f4317397..eba82d22d 100644 --- a/vtkm/cont/cuda/internal/DeviceAdapterAlgorithmCuda.h +++ b/vtkm/cont/cuda/internal/DeviceAdapterAlgorithmCuda.h @@ -24,6 +24,7 @@ #include #include +#include // Here are the actual implementation of the algorithms. #include @@ -42,6 +43,10 @@ struct DeviceAdapterAlgorithm VTKM_CONT_EXPORT static void Synchronize() { cudaError_t error = cudaDeviceSynchronize(); + if (error != cudaSuccess) + { + throw vtkm::cont::ErrorControlInternal(cudaGetErrorString(error)); + } } }; diff --git a/vtkm/cont/cuda/internal/DeviceAdapterAlgorithmThrust.h b/vtkm/cont/cuda/internal/DeviceAdapterAlgorithmThrust.h index dc194c6bc..0483f3d42 100644 --- a/vtkm/cont/cuda/internal/DeviceAdapterAlgorithmThrust.h +++ b/vtkm/cont/cuda/internal/DeviceAdapterAlgorithmThrust.h @@ -18,12 +18,11 @@ // Laboratory (LANL), the U.S. Government retains certain rights in // this software. //============================================================================ -#ifndef vtk_m_cont_cuda_internal_DeviceAdapterThrust_h -#define vtk_m_cont_cuda_internal_DeviceAdapterThrust_h +#ifndef vtk_m_cont_cuda_internal_DeviceAdapterAlgorithmThrust_h +#define vtk_m_cont_cuda_internal_DeviceAdapterAlgorithmThrust_h #include #include -#include #include #include #include @@ -1285,4 +1284,4 @@ public: } } // namespace vtkm::cont::cuda::internal -#endif //vtk_m_cont_cuda_internal_DeviceAdapterThrust_h +#endif //vtk_m_cont_cuda_internal_DeviceAdapterAlgorithmThrust_h