VTK
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 #define SPACE thrust::detail::default_device_space_tag
00027 
00028 namespace vtkpiston {
00029 
00030 void DeleteData(vtkPistonReference *);
00031 
00032 typedef struct
00033 {
00034   //GPU side representation of a vtkPolyData
00035   //this is the sibling of vtk_image3D in piston
00036   int nPoints;
00037   int vertsPer;
00038   thrust::device_vector<float> *points;
00039   thrust::device_vector<float> *scalars;
00040   thrust::device_vector<float> *normals;
00041 } vtk_polydata;
00042 
00043 struct tuple2float3 :
00044   thrust::unary_function<thrust::tuple<float, float, float>, float3>
00045 {
00046     __host__ __device__
00047       float3 operator()(thrust::tuple<float, float, float> xyz) {
00048         return make_float3((float) thrust::get<0>(xyz),
00049                            (float) thrust::get<1>(xyz),
00050                            (float) thrust::get<2>(xyz));
00051     }
00052 };
00053 
00054 struct float4tofloat3 : thrust::unary_function<float4, float3>
00055 {
00056   __host__ __device__
00057   float3 operator()(float4 xyzw) {
00058     return make_float3
00059           ((float) xyzw.x,
00060            (float) xyzw.y,
00061            (float) xyzw.z);
00062   }
00063 };
00064 
00065 } //namespace
00066 
00067 #endif //__vtkPistonDataWrangling_h
00068 // VTK-HeaderTest-Exclude: vtkPistonDataWrangling.h