//# RFCubeLattice.cc: this defines RFCubeLattice
//# Copyright (C) 2000,2001
//# Associated Universities, Inc. Washington DC, USA.
//#
//# This library is free software; you can redistribute it and/or modify it
//# under the terms of the GNU Library General Public License as published by
//# the Free Software Foundation; either version 2 of the License, or (at your
//# option) any later version.
//#
//# This library is distributed in the hope that it will be useful, but WITHOUT
//# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
//# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
//# License for more details.
//#
//# You should have received a copy of the GNU Library General Public License
//# along with this library; if not, write to the Free Software Foundation,
//# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
//#
//# Correspondence concerning AIPS++ should be addressed as follows:
//# Internet email: aips2-request@nrao.edu.
//# Postal address: AIPS++ Project Office
//# National Radio Astronomy Observatory
//# 520 Edgemont Road
//# Charlottesville, VA 22903-2475 USA
//#
//# $Id$
#include <lattices/Lattices/LatticeStepper.h>
#include <flagging/Flagging/RFCubeLattice.h>
#include <flagging/Flagging/RFCommon.h>
namespace casa { //# NAMESPACE CASA - BEGIN
template<class T> RFCubeLatticeIterator<T>::RFCubeLatticeIterator ()
: n_chan(0), n_ifr(0), n_time(0), n_bit(0), n_corr(0)
{
iter_pos = 0;
//curs = casacore::Matrix<T>();
lattice = NULL;
}
template<class T> RFCubeLatticeIterator<T>::RFCubeLatticeIterator(std::vector<std::vector<bool> > *lat,
unsigned nchan, unsigned nifr,
unsigned ntime, unsigned nbit,
unsigned ncorr)
: n_chan(nchan), n_ifr(nifr), n_time(ntime), n_bit(nbit), n_corr(ncorr)
{
iter_pos = 0;
lattice = lat;
}
template<class T> RFCubeLatticeIterator<T>::~RFCubeLatticeIterator()
{
}
/*
The format is like this:
[ ... | agent1 | agent0 | corrN | ... | corr1 | corr0 ]
i.e. the length is number of agents + number of correlations.
Except (don't ask why) if nCorr = 1, the format is
[ ... | agent1 | agent0 | notUsed | corr0 ]
*/
template<class T> void RFCubeLatticeIterator<T>::reset()
{
iter_pos = 0;
return;
}
template<class T> void RFCubeLatticeIterator<T>::advance(casacore::uInt t1)
{
iter_pos = t1;
return;
}
template<class T> T
RFCubeLatticeIterator<T>::operator()(casacore::uInt chan, casacore::uInt ifr) const
{
T val = 0;
std::vector<bool> &l = (*lattice)[iter_pos];
if (n_bit == 2) {
unsigned indx = n_bit*(chan + n_chan*ifr);
val = l[indx] + 4*l[indx+1];