Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

CUDAMarchingCubes Class Reference

#include <CUDAMarchingCubes.h>

List of all members.

Public Methods

 CUDAMarchingCubes ()
 constructor. More...

 ~CUDAMarchingCubes ()
 destructor. More...

bool Initialize (uint3 maxgridsize)
uint3 GetMaxGridSize () const
bool SetVolumeData (float *volume, float *colors, uint3 gridsize, float3 gridOrigin, float3 boundingBox, bool cudaArray)
void SetSubVolume (uint3 start, uint3 end)
void computeIsosurface (float3 *vertOut, float3 *normOut, float3 *colOut, unsigned int maxverts)
 Run the Cuda part of the computation/////////////////////////////////////////////////////////////////////////////. More...

bool computeIsosurface (float *volume, float *colors, uint3 gridsize, float3 gridOrigin, float3 boundingBox, bool cudaArray, float3 *vertOut, float3 *normOut, float3 *colOut, unsigned int maxverts)
float computeSurfaceArea (float3 *verts, unsigned int triaCount)
void SetIsovalue (float isoval)
float GetIsovalue ()
unsigned int GetVertexCount ()
unsigned int GetActiveVoxelCount ()
unsigned int GetVoxelCount ()
bool UseColor ()
void Cleanup ()
size_t MemUsageAreaCalc (unsigned int triaCount) const

Static Public Methods

size_t MemUsageMC (unsigned int gx, unsigned int gy, unsigned int gz)


Constructor & Destructor Documentation

CUDAMarchingCubes::CUDAMarchingCubes  
 

constructor.

Definition at line 550 of file CUDAMarchingCubes.cu.

CUDAMarchingCubes::~CUDAMarchingCubes  
 

destructor.

Definition at line 586 of file CUDAMarchingCubes.cu.

References Cleanup.


Member Function Documentation

void CUDAMarchingCubes::Cleanup  
 

Frees all allocated memory and resets all variables.

Definition at line 591 of file CUDAMarchingCubes.cu.

Referenced by computeIsosurface, Initialize, SetVolumeData, and ~CUDAMarchingCubes.

bool CUDAMarchingCubes::computeIsosurface float *    volume,
float *    colors,
uint3    gridsize,
float3    gridOrigin,
float3    boundingBox,
bool    cudaArray,
float3 *    vertOut,
float3 *    normOut,
float3 *    colOut,
unsigned int    maxverts
 

Compute the isosurface using the Marching Cubes algorithm. The function initializes and frees device memory for each computation.

Parameters:
volume  The density grid values
colors  The color values per grid cell (may be NULL)
gridsize  The size of the density grid
cudaArray  Must be 'true' for device memory, 'false' for host memory
vertOut  Triangle vertices (device memory, output)
normOut  Triangle vertex normals (device memory, output)
colOut  Triangle vertex colors (device memory, output)
maxverts  The maximum number of output vertices
boundingBox  The original boundig box dimensions

Definition at line 972 of file CUDAMarchingCubes.cu.

References Cleanup, computeIsosurface, Initialize, and SetVolumeData.

void CUDAMarchingCubes::computeIsosurface float3 *    vertOut,
float3 *    normOut,
float3 *    colOut,
unsigned int    maxverts
 

Run the Cuda part of the computation/////////////////////////////////////////////////////////////////////////////.

Compute the isosurface using the Marching Cubes algorithm.

Parameters:
vertOut  Triangle vertices (device memory, output)
normOut  Triangle vertex normals (device memory, output)
colOut  Triangle vertex colors (device memory, output)
maxverts  The maximum number of output vertices

Definition at line 620 of file CUDAMarchingCubes.cu.

References NTHREADS, and ThrustScanWrapperUint2.

Referenced by CUDAQuickSurf::calc_surf, and computeIsosurface.

float CUDAMarchingCubes::computeSurfaceArea float3 *    verts,
unsigned int    triaCount
 

Compute the surface area of the current isosurface.

Parameters:
verts  The vertex list of all triangles (device memory)
triaCount  The maximum number of output vertices
Returns:
The total surface area or -1 if anthing failed

Definition at line 996 of file CUDAMarchingCubes.cu.

References ThrustScanWrapperArea.

unsigned int CUDAMarchingCubes::GetActiveVoxelCount   [inline]
 

Returns the total number of voxels that contribute to the isosurface.

Returns:
The voxel count

Definition at line 137 of file CUDAMarchingCubes.h.

float CUDAMarchingCubes::GetIsovalue   [inline]
 

Returns the current isovalue for the surface extraction.

Returns:
The isovalue used for the Marching Cubes computation

Definition at line 123 of file CUDAMarchingCubes.h.

uint3 CUDAMarchingCubes::GetMaxGridSize   const [inline]
 

Returns the maxgridsize supported by the current object

Returns:
Returns the maxgridsize supported by the current object

Definition at line 42 of file CUDAMarchingCubes.h.

Referenced by CUDAQuickSurf::calc_surf.

unsigned int CUDAMarchingCubes::GetVertexCount   [inline]
 

Returns the total number of triangle vertices of the isosurface.

Returns:
The vertex count

Definition at line 130 of file CUDAMarchingCubes.h.

Referenced by CUDAQuickSurf::calc_surf.

unsigned int CUDAMarchingCubes::GetVoxelCount   [inline]
 

Returns the total number of voxels.

Returns:
The voxel count

Definition at line 144 of file CUDAMarchingCubes.h.

bool CUDAMarchingCubes::Initialize uint3    maxgridsize
 

Initialization: Set variables and allocate device memory for computation

Parameters:
maxgridsize  The maximum size of the volumetric map in voxels
Returns:
'true' if initialization was successful, 'false' otherwise

Definition at line 791 of file CUDAMarchingCubes.cu.

References allocateTextures, and Cleanup.

Referenced by CUDAQuickSurf::calc_surf, and computeIsosurface.

size_t CUDAMarchingCubes::MemUsageAreaCalc unsigned int    triaCount const [inline]
 

Return the amount of GPU memory that is be needed for the area calculation for a given number of triangles. TODO this number does not include memory for thrust::scan

Parameters:
triaCount  The number of triangles
Returns:
The memory size in bytes

Definition at line 187 of file CUDAMarchingCubes.h.

size_t CUDAMarchingCubes::MemUsageMC unsigned int    gx,
unsigned int    gy,
unsigned int    gz
[inline, static]
 

Return the amount of GPU memory that is be needed for the Marching Cubes calculation for a given grid size. TODO the allotments for the 3-D texture map and thrust are just a guess

Parameters:
gx  The width of the density grid
gy  The height of the density grid
gz  The depth of the density grid
Returns:
The memory size in bytes

Definition at line 168 of file CUDAMarchingCubes.h.

Referenced by CUDAQuickSurf::alloc_bufs.

void CUDAMarchingCubes::SetIsovalue float    isoval [inline]
 

Set the isovalue for the surface extraction.

Parameters:
isoval  The isovalue used for the Marching Cubes computation

Definition at line 116 of file CUDAMarchingCubes.h.

Referenced by CUDAQuickSurf::calc_surf.

void CUDAMarchingCubes::SetSubVolume uint3    start,
uint3    end
 

Set the volume sub-region for which the isosurface will be extracted.

Parameters:
start  starting voxel index for sub-region of volume
end  ending voxel index for sub-region of volume

Definition at line 958 of file CUDAMarchingCubes.cu.

Referenced by CUDAQuickSurf::calc_surf.

bool CUDAMarchingCubes::SetVolumeData float *    volume,
float *    colors,
uint3    gridsize,
float3    gridOrigin,
float3    boundingBox,
bool    cudaArray
 

Set or update the density grid data. For device memory, this is just a pointer assignment. For host memory, this includes allocation of device memory and device-host copying.

Parameters:
volume  The density grid values
colors  The color values per grid cell (may be NULL)
gridsize  The size of the density grid (must comply with the grid size set at initialization!)
gridOrigin  Origin of the volume
boundingBox  The original boundig box dimensions
cudaArray  Must be 'true' for device memory, 'false' for host memory
Returns:
'true' if data assignment was successful, 'false' otherwise

Definition at line 824 of file CUDAMarchingCubes.cu.

References bindVolumeTexture, Cleanup, and NULL.

Referenced by CUDAQuickSurf::calc_surf, and computeIsosurface.

bool CUDAMarchingCubes::UseColor   [inline]
 

Returns wether a color table was computed for the surface or not.

Returns:
'true' if colors were computed, 'false' otherwise

Definition at line 151 of file CUDAMarchingCubes.h.


The documentation for this class was generated from the following files:
Generated on Sat May 26 01:49:09 2012 for VMD (current) by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002