
function [gxout, gyout] = matlabGid_to_routGxGy ( gid, max_clm_idx )

gx = mod(gid-1,max_clm_idx)+1 ;
gy = floor((gid-1)/max_clm_idx)+1;


gx = gx-1 ;
gy = gy-1  ;

gxout = gx ;
gyout = gy ;
