concept spatial perfect hash in category parallel computing

appears as: spatial perfect hash
Parallel and High Performance Computing

This is an excerpt from Manning's book Parallel and High Performance Computing.

This sets the stage for the design of a spatial hash to perform the neighbor finding operation. We can guarantee that there are no collisions in our spatial hash by making the buckets in the hash the size of the finest cells in the AMR mesh. The algorithm then becomes:

Listing 5.8 The read phase of the remapping of a value on the CPU
remap2.c from PerfectHash
211 for(int jc = 0; jc < ncells_target; jc++) {
212    int ii = mesh_target.i[jc];    #A
213    int jj = mesh_target.j[jc];    #A
214    int lev = mesh_target.level[jc];    #A
215    int lev_mod = two_to_the(levmx - lev);
216    double value_sum = 0.0;
217    for(int jjj = jj*lev_mod; jjj < (jj+1)*lev_mod; jjj++) {    #B
218       for(int iii = ii*lev_mod; iii < (ii+1)*lev_mod; iii++) {    #B
219          int ic = hash_table[jjj*i_max+iii];
220          value_sum += value_source[ic] / (double)four_to_the(levmx-mesh_source.level[ic]); #C
221       }
222    }
223    value_remap[jc] += value_sum;
224 }