  * @return Returns the thread index based on the current CUDA grid
  *            dimensions.
  */
-__device__ uint GetThreadIndex() {
+__device__ uint GetCurThreadIndex() {
     return __umul24(__umul24(blockIdx.y, gridDim.x) + blockIdx.x, blockDim.x) + threadIdx.x;
 }
 

__global__ void SetPhiValues(float* p_phivalues_in, float* p_phivalues_out, bool* p_valid_phi_values,
    const uint* p_vertex_neighbours, const uint* p_vertex_edge_offset_depth, const int* p_vertex_type,
    const uint* p_vertex_neighbours_offset, uint p_vertex_cnt, uint p_edge_cnt) {
    const uint idx = GetThreadIndex();
    if (idx >= p_vertex_cnt) return;
    if (!p_valid_phi_values[idx]) return;


 */
__global__ void SortNeighbourIds(uint* p_neighbour_ids, uint* p_neighbour_ids_offset, bool* p_valid_z_values,
    const uint* p_vertex_edge_offset_depth, const int* p_vertex_type, uint p_vertex_cnt, uint p_edge_cnt) {
    const uint idx = GetCurThreadIndex();
    if (idx >= p_vertex_cnt) return;
    if (!p_valid_z_values[idx]) return;

