VTK
/Users/kitware/Dashboards/MyTests/VTK_BLD_Release_docs/Utilities/Doxygen/dox/Accelerators/Piston/vtkPistonDataWrangling.h
Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    vtkPistonDataWrangling.h
00005 
00006   Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
00007   All rights reserved.
00008   See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
00009 
00010      This software is distributed WITHOUT ANY WARRANTY; without even
00011      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
00012      PURPOSE.  See the above copyright notice for more information.
00013 
00014 =========================================================================*/
00023 #ifndef vtkPistonDataWrangling_h
00024 #define vtkPistonDataWrangling_h
00025 
00026 #include <thrust/version.h>
00027 #if THRUST_VERSION >= 100600
00028 # define SPACE thrust::device_space_tag
00029 #else
00030 # define SPACE thrust::detail::default_device_space_tag
00031 #endif
00032 
00033 namespace vtkpiston {
00034 
00035 void DeleteData(vtkPistonReference *);
00036 
00037 typedef struct
00038 {
00039   //GPU side representation of a vtkPolyData
00040   //this is the sibling of vtk_image3D in piston
00041   int nPoints;
00042   int vertsPer;
00043   thrust::device_vector<float> *points;
00044   thrust::device_vector<float> *scalars;
00045   thrust::device_vector<float> *normals;
00046 } vtk_polydata;
00047 
00048 struct tuple2float3 :
00049   thrust::unary_function<thrust::tuple<float, float, float>, float3>
00050 {
00051     __host__ __device__
00052       float3 operator()(thrust::tuple<float, float, float> xyz) {
00053         return make_float3((float) thrust::get<0>(xyz),
00054                            (float) thrust::get<1>(xyz),
00055                            (float) thrust::get<2>(xyz));
00056     }
00057 };
00058 
00059 struct float4tofloat3 : thrust::unary_function<float4, float3>
00060 {
00061   __host__ __device__
00062   float3 operator()(float4 xyzw) {
00063     return make_float3
00064           ((float) xyzw.x,
00065            (float) xyzw.y,
00066            (float) xyzw.z);
00067   }
00068 };
00069 
00070 } //namespace
00071 
00072 #endif //vtkPistonDataWrangling_h
00073 // VTK-HeaderTest-Exclude: vtkPistonDataWrangling.h