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 =========================================================================*/
23 #ifndef vtkPistonDataWrangling_h
24 #define vtkPistonDataWrangling_h
25 
26 #include <thrust/version.h>
27 #if THRUST_VERSION >= 100600
28 # define SPACE thrust::device_space_tag
29 #else
30 # define SPACE thrust::detail::default_device_space_tag
31 #endif
32 
33 namespace vtkpiston {
34 
36 
37 typedef struct
38 {
39  //GPU side representation of a vtkPolyData
40  //this is the sibling of vtk_image3D in piston
41  int nPoints;
42  int vertsPer;
43  thrust::device_vector<float> *points;
44  thrust::device_vector<float> *scalars;
45  thrust::device_vector<float> *normals;
46 } vtk_polydata;
47 
48 struct tuple2float3 :
49  thrust::unary_function<thrust::tuple<float, float, float>, float3>
50 {
51  __host__ __device__
52  float3 operator()(thrust::tuple<float, float, float> xyz) {
53  return make_float3((float) thrust::get<0>(xyz),
54  (float) thrust::get<1>(xyz),
55  (float) thrust::get<2>(xyz));
56  }
57 };
58 
59 struct float4tofloat3 : thrust::unary_function<float4, float3>
60 {
61  __host__ __device__
62  float3 operator()(float4 xyzw) {
63  return make_float3
64  ((float) xyzw.x,
65  (float) xyzw.y,
66  (float) xyzw.z);
67  }
68 };
69 
70 } //namespace
71 
72 #endif //vtkPistonDataWrangling_h
73 // 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 *)