VTK
vtkPistonDataWrangling.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkPistonDataWrangling.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
24 #ifndef vtkPistonDataWrangling_h
25 #define vtkPistonDataWrangling_h
26 
27 #include <thrust/version.h>
28 #if THRUST_VERSION >= 100600
29 # define SPACE thrust::device_space_tag
30 #else
31 # define SPACE thrust::detail::default_device_space_tag
32 #endif
33 
34 namespace vtkpiston {
35 
37 
38 typedef struct
39 {
40  //GPU side representation of a vtkPolyData
41  //this is the sibling of vtk_image3D in piston
42  int nPoints;
43  int vertsPer;
44  thrust::device_vector<float> *points;
45  thrust::device_vector<float> *scalars;
46  thrust::device_vector<float> *normals;
47 } vtk_polydata;
48 
49 struct tuple2float3 :
50  thrust::unary_function<thrust::tuple<float, float, float>, float3>
51 {
52  __host__ __device__
53  float3 operator()(thrust::tuple<float, float, float> xyz) {
54  return make_float3((float) thrust::get<0>(xyz),
55  (float) thrust::get<1>(xyz),
56  (float) thrust::get<2>(xyz));
57  }
58 };
59 
60 struct float4tofloat3 : thrust::unary_function<float4, float3>
61 {
62  __host__ __device__
63  float3 operator()(float4 xyzw) {
64  return make_float3
65  ((float) xyzw.x,
66  (float) xyzw.y,
67  (float) xyzw.z);
68  }
69 };
70 
71 } //namespace
72 
73 #endif //vtkPistonDataWrangling_h
74 // VTK-HeaderTest-Exclude: vtkPistonDataWrangling.h
__host__ __device__ float3 operator()(float4 xyzw)
thrust::device_vector< float > * normals
thrust::device_vector< float > * scalars
thrust::device_vector< float > * points
__host__ __device__ float3 operator()(thrust::tuple< float, float, float > xyz)
Lower level handle on GPU resident data.
void DeleteData(vtkPistonReference *)