 
 // ----------------------------------------------------------------------------
 /* Compute the norm of a table with 3 double */
-__device__ TCompute norm(TCompute vec[Dim3D])
+__device__ TypeCompute norm(TypeCompute vec[SizeDim3D])
 {
   return sqrt(vec[0] * vec[0] + vec[1] * vec[1] + vec[2] * vec[2]);
 }


  // Compute the ID on depthmap values according to pixel position and depth map dimensions
  int depthMapId = computeVoxelIDDepth(pixel);
  TCompute depth = depths[depthMapId];
  if (depth == -1)
    {
    return;
    }
  int gridId = computeVoxelIDGrid(voxelIndex);  // Get the distance between voxel and camera
  TCompute realDepth = norm(voxelCenterCamera);
  TVolumetric newValue;
  rayPotential<TVolumetric>(realDepth, depth, newValue);
  // Update the value to the output

// ----------------------------------------------------------------------------
/* Ray potential function which computes the increment to the current voxel */
template<typename TVolumetric>
__device__ void rayPotential(TypeCompute realDistance, TypeCompute depthMapDistance, TVolumetric& res)
{
  TypeCompute diff = (realDistance - depthMapDistance);

  TypeCompute absoluteDiff = abs(diff);
  // Can't divide by zero
  int sign = diff != 0 ? diff / absoluteDiff : 0;

  if (absoluteDiff > c_rayPotentialDelta)
    res = diff > 0 ? 0 : -c_rayPotentialEta*c_rayPotentialRho;
  else if (absoluteDiff > c_rayPotentialThick)
    res = c_rayPotentialRho*sign;
  else
    res = (c_rayPotentialRho / c_rayPotentialThick)* diff;
