Merge branch 'master' of gitlab.kitware.com:Fasel/vtk-m into cell_to_point
This commit is contained in:
commit
480f0bd416
@ -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<vtkm::Float32>(x - lastx);
|
||||
vtkm::Float32 dy = static_cast<vtkm::Float32>(y - lasty);
|
||||
|
||||
if (mouse_state == 0)
|
||||
{
|
||||
|
@ -26,6 +26,7 @@
|
||||
|
||||
#include <vtkm/cont/cuda/DeviceAdapterCuda.h>
|
||||
#include <vtkm/cont/tbb/DeviceAdapterTBB.h>
|
||||
#include <vtkm/cont/DeviceAdapterSerial.h>
|
||||
|
||||
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<vtkm::UInt8>(96 * vtkm::Sin( input[0] * 10.f + t ) );
|
||||
color[2] = 160 + static_cast<vtkm::UInt8>(96 * vtkm::Cos( input[2] * 5.f + t ) );
|
||||
color[1] = static_cast<vtkm::UInt8>(160 + (96 * vtkm::Sin(input[0] * 10.f + t)));
|
||||
color[2] = static_cast<vtkm::UInt8>(160 + (96 * vtkm::Cos(input[2] * 5.f + t)));
|
||||
color[3] = 255;
|
||||
}
|
||||
};
|
||||
|
@ -18,6 +18,10 @@
|
||||
// this software.
|
||||
//============================================================================
|
||||
|
||||
#ifndef VTKM_DEVICE_ADAPTER
|
||||
#define VTKM_DEVICE_ADAPTER VTKM_DEVICE_ADAPTER_SERIAL
|
||||
#endif
|
||||
|
||||
#include <vtkm/worklet/TetrahedralizeExplicitGrid.h>
|
||||
#include <vtkm/worklet/DispatcherMapField.h>
|
||||
#include <vtkm/Math.h>
|
||||
@ -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::cont::CellSetSingleType<> >();
|
||||
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<vtkm::Float32>(x - lastx);
|
||||
vtkm::Float32 dy = static_cast<vtkm::Float32>(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 =
|
||||
|
@ -18,6 +18,10 @@
|
||||
// this software.
|
||||
//============================================================================
|
||||
|
||||
#ifndef VTKM_DEVICE_ADAPTER
|
||||
#define VTKM_DEVICE_ADAPTER VTKM_DEVICE_ADAPTER_SERIAL
|
||||
#endif
|
||||
|
||||
#include <vtkm/worklet/TetrahedralizeUniformGrid.h>
|
||||
#include <vtkm/worklet/DispatcherMapField.h>
|
||||
#include <vtkm/Math.h>
|
||||
@ -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<ndim> 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<vtkm::cont::CellSetSingleType<> >();
|
||||
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<vtkm::Float32>(x - lastx);
|
||||
vtkm::Float32 dy = static_cast<vtkm::Float32>(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)
|
||||
{
|
||||
|
@ -18,6 +18,10 @@
|
||||
// this software.
|
||||
//============================================================================
|
||||
|
||||
#ifndef VTKM_DEVICE_ADAPTER
|
||||
#define VTKM_DEVICE_ADAPTER VTKM_DEVICE_ADAPTER_SERIAL
|
||||
#endif
|
||||
|
||||
#include <vtkm/worklet/TetrahedralizeExplicitGrid.h>
|
||||
#include <vtkm/cont/CellSetExplicit.h>
|
||||
#include <vtkm/cont/DataSet.h>
|
||||
@ -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<DeviceAdapter> *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<vtkm::Vec<vtkm::Float64, 3> > 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::cont::CellSetSingleType<> >();
|
||||
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 =
|
||||
|
@ -18,6 +18,10 @@
|
||||
// this software.
|
||||
//============================================================================
|
||||
|
||||
#ifndef VTKM_DEVICE_ADAPTER
|
||||
#define VTKM_DEVICE_ADAPTER VTKM_DEVICE_ADAPTER_SERIAL
|
||||
#endif
|
||||
|
||||
#include <vtkm/worklet/TetrahedralizeUniformGrid.h>
|
||||
#include <vtkm/worklet/DispatcherMapField.h>
|
||||
#include <vtkm/Math.h>
|
||||
@ -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<ndim> 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<vtkm::cont::CellSetSingleType<> >();
|
||||
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)
|
||||
{
|
||||
|
@ -24,6 +24,7 @@
|
||||
#include <vtkm/cont/cuda/internal/ArrayManagerExecutionCuda.h>
|
||||
|
||||
#include <vtkm/cont/DeviceAdapterAlgorithm.h>
|
||||
#include <vtkm/cont/ErrorControlInternal.h>
|
||||
|
||||
// Here are the actual implementation of the algorithms.
|
||||
#include <vtkm/cont/cuda/internal/DeviceAdapterAlgorithmThrust.h>
|
||||
@ -42,6 +43,10 @@ struct DeviceAdapterAlgorithm<vtkm::cont::DeviceAdapterTagCuda>
|
||||
VTKM_CONT_EXPORT static void Synchronize()
|
||||
{
|
||||
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
|
||||
// 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 <vtkm/cont/ArrayHandle.h>
|
||||
#include <vtkm/cont/ErrorExecution.h>
|
||||
#include <vtkm/cont/Timer.h>
|
||||
#include <vtkm/Types.h>
|
||||
#include <vtkm/TypeTraits.h>
|
||||
#include <vtkm/UnaryPredicates.h>
|
||||
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user