function local_nr = GlobalToLocal_vmap(global_nr,vector_of_elems)

Globals2D;

elem_global = floor((global_nr - 1) / N_p) + 1;
elem_local = find(vector_of_elems == elem_global);
elem_nr = global_nr - (elem_global - 1) * N_p;
local_nr = (elem_local - 1) * N_p + elem_nr;

end