Commit e3a83e97 authored by Martin Reinecke's avatar Martin Reinecke

also fillIdx

parent f78699ac
......@@ -1587,8 +1587,19 @@ void fillIdx(const Baselines &baselines,
size_t nbu = (gconf.Nu()+1+side-1) >> logsquare,
nbv = (gconf.Nv()+1+side-1) >> logsquare;
vector<idx_t> acc(nbu*nbv+1, 0);
vector<idx_t> tmp(nrow*(chend-chbegin));
for (idx_t irow=0, idx=0; irow<nrow; ++irow)
vector<idx_t> tmp(nrow*(chend-chbegin),~idx_t(0));
#pragma omp parallel
{
idx_t nthr = my_num_threads();
idx_t id = my_thread_num();
idx_t nbase = nrow/nthr;
idx_t additional = nrow%nthr;
idx_t lo = id*nbase + ((id<additional) ? id : additional);
idx_t hi = lo+nbase+(id<additional);
vector<idx_t> lacc(nbu*nbv+1, 0);
for (idx_t irow=lo, idx=lo*(chend-chbegin); irow<hi; ++irow)
for (int ichan=chbegin; ichan<chend; ++ichan)
if (!flags(irow, ichan))
{
......@@ -1601,10 +1612,15 @@ void fillIdx(const Baselines &baselines,
gconf.getpix(uvw.u, uvw.v, u, v, iu0, iv0);
iu0 = (iu0+nsafe)>>logsquare;
iv0 = (iv0+nsafe)>>logsquare;
++acc[nbv*iu0 + iv0 + 1];
++lacc[nbv*iu0 + iv0 + 1];
tmp[idx++] = nbv*iu0 + iv0;
}
}
#pragma omp barrier
#pragma omp critical(xyz)
for (size_t i=0; i<acc.size(); ++i)
acc[i]+=lacc[i];
}
for (size_t i=1; i<acc.size(); ++i)
acc[i] += acc[i-1];
......@@ -1613,6 +1629,7 @@ void fillIdx(const Baselines &baselines,
for (int ichan=chbegin; ichan<chend; ++ichan)
if (!flags(irow, ichan))
{
while (tmp[idx]==idx_t(~0)) ++idx;
auto w = abs(baselines.effectiveCoord(RowChan{irow,idx_t(ichan)}).w);
if ((w>=wmin) && (w<wmax))
res[acc[tmp[idx++]]++] = baselines.getIdx(irow, ichan);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment