
function [gidout] = getRoutGid (gid, max_clm_idx)

%% change row -> clm, clm->row
%% change my gid to my gx, gy

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

% tmp=gx ;
% gx=gy ;
% gy=tmp ;

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

gidout = gx * max_clm_idx + gy ;