diff --git a/Appl/CEP/CS1/CS1_BGLProc/src/AH_BGL_Processing.cc b/Appl/CEP/CS1/CS1_BGLProc/src/AH_BGL_Processing.cc index 26841e12363c6fac4596eabc6e361afdbf32e94c..ade7a8fc0aa2e690e9cf614c50efc04d264b66e2 100644 --- a/Appl/CEP/CS1/CS1_BGLProc/src/AH_BGL_Processing.cc +++ b/Appl/CEP/CS1/CS1_BGLProc/src/AH_BGL_Processing.cc @@ -21,11 +21,16 @@ //# Always #include <lofar_config.h> first! #include <lofar_config.h> + #include <Common/lofar_iostream.h> #include <Common/Timer.h> -#include <AH_BGL_Processing.h> +#include <CS1_BGLProc/AH_BGL_Processing.h> +#include <CS1_BGLProc/WH_BGL_Processing.h> #include <CS1_Interface/CS1_Config.h> +#include <CS1_Interface/Stub_BGL_Subband.h> +#include <CS1_Interface/Stub_BGL_RFI_Mitigation.h> +#include <CS1_Interface/Stub_BGL_Visibilities.h> // tinyCEP // Transporters @@ -33,173 +38,182 @@ #include <Transport/TH_Mem.h> #include <Transport/TH_Socket.h> +#include <Blob/KeyValueMap.h> + #if defined HAVE_BGL #include <rts.h> #endif -using namespace LOFAR; - -AH_BGL_Processing::AH_BGL_Processing() -: itsWHs(0), - itsSubbandStub(0), - itsRFI_MitigationStub(0), - itsVisibilitiesStub(0) -{ -} - -AH_BGL_Processing::~AH_BGL_Processing() -{ - undefine(); -} - -void AH_BGL_Processing::undefine() +namespace LOFAR { - for (uint i = 0; i < itsWHs.size(); i ++) { - delete itsWHs[i]; - } - itsWHs.clear(); + namespace CS1 + { + + AH_BGL_Processing::AH_BGL_Processing() + : itsWHs(0), + itsSubbandStub(0), + itsRFI_MitigationStub(0), + itsVisibilitiesStub(0) + { + } - delete itsSubbandStub; itsSubbandStub = 0; - delete itsRFI_MitigationStub; itsRFI_MitigationStub = 0; - delete itsVisibilitiesStub; itsVisibilitiesStub = 0; -} + AH_BGL_Processing::~AH_BGL_Processing() + { + undefine(); + } -unsigned AH_BGL_Processing::remapOnTree(unsigned logicalNode) -{ - int mpiNode = ((((logicalNode >> 0) & 1) ) << 0) | - ((((logicalNode >> 5) & 1) ^ 1) << 1) | - ((((logicalNode >> 1) & 1) ) << 2) | - ((((logicalNode >> 4) & 1) ) << 3) | - ((((logicalNode >> 2) & 1) ) << 4) | - ((((logicalNode >> 3) & 1) ) << 5); + void AH_BGL_Processing::undefine() + { + for (uint i = 0; i < itsWHs.size(); i ++) { + delete itsWHs[i]; + } + itsWHs.clear(); + + delete itsSubbandStub; itsSubbandStub = 0; + delete itsRFI_MitigationStub; itsRFI_MitigationStub = 0; + delete itsVisibilitiesStub; itsVisibilitiesStub = 0; + } + + unsigned AH_BGL_Processing::remapOnTree(unsigned logicalNode) + { + int mpiNode = ((((logicalNode >> 0) & 1) ) << 0) | + ((((logicalNode >> 5) & 1) ^ 1) << 1) | + ((((logicalNode >> 1) & 1) ) << 2) | + ((((logicalNode >> 4) & 1) ) << 3) | + ((((logicalNode >> 2) & 1) ) << 4) | + ((((logicalNode >> 3) & 1) ) << 5); #if defined HAVE_MPI - ASSERTSTR(mpiNode < TH_MPI::getNumberOfNodes(), "not enough MPI nodes allocated"); + ASSERTSTR(mpiNode < TH_MPI::getNumberOfNodes(), "not enough MPI nodes allocated"); #endif - return mpiNode; -} + return mpiNode; + } -void AH_BGL_Processing::define(const LOFAR::KeyValueMap&) { + void AH_BGL_Processing::define(const KeyValueMap&) { - LOG_TRACE_FLOW_STR("Start of AH_BGL_Processing::define()"); + LOG_TRACE_FLOW_STR("Start of AH_BGL_Processing::define()"); - unsigned nrSubBands = itsParamSet.getInt32("Observation.NSubbands"); - vector<double> baseFreqs = itsParamSet.getDoubleVector("Observation.RefFreqs"); - unsigned slavesPerSubBand = itsParamSet.getInt32("BGLProc.SlavesPerSubband"); - unsigned subbandsPerCell = itsParamSet.getInt32("BGLProc.SubbandsPerCell"); - unsigned slavesPerCell = slavesPerSubBand * subbandsPerCell; + unsigned nrSubBands = itsParamSet.getInt32("Observation.NSubbands"); + vector<double> baseFreqs = itsParamSet.getDoubleVector("Observation.RefFreqs"); + unsigned slavesPerSubBand = itsParamSet.getInt32("BGLProc.SlavesPerSubband"); + unsigned subbandsPerCell = itsParamSet.getInt32("BGLProc.SubbandsPerCell"); +// unsigned slavesPerCell = slavesPerSubBand * subbandsPerCell; - ASSERTSTR(nrSubBands <= baseFreqs.size(), "Not enough base frequencies in Data.RefFreqs specified"); + ASSERTSTR(nrSubBands <= baseFreqs.size(), "Not enough base frequencies in Data.RefFreqs specified"); - itsSubbandStub = new Stub_BGL_Subband(true, itsParamSet); - itsRFI_MitigationStub = new Stub_BGL_RFI_Mitigation(true, itsParamSet); - itsVisibilitiesStub = new Stub_BGL_Visibilities(true, itsParamSet); + itsSubbandStub = new Stub_BGL_Subband(true, itsParamSet); + itsRFI_MitigationStub = new Stub_BGL_RFI_Mitigation(true, itsParamSet); + itsVisibilitiesStub = new Stub_BGL_Visibilities(true, itsParamSet); #if defined HAVE_BGL - struct BGLPersonality personality; - int retval = rts_get_personality(&personality, sizeof personality); - ASSERTSTR(retval == 0, "Could not get personality"); - bool virtualNodeMode = personality.opFlags & BGLPERSONALITY_OPFLAGS_VIRTUALNM; - int nrNodesPerCell = virtualNodeMode ? 16 : 8; + struct BGLPersonality personality; + int retval = rts_get_personality(&personality, sizeof personality); + ASSERTSTR(retval == 0, "Could not get personality"); + bool virtualNodeMode = personality.opFlags & BGLPERSONALITY_OPFLAGS_VIRTUALNM; + int nrNodesPerCell = virtualNodeMode ? 16 : 8; - ASSERTSTR(slavesPerCell < nrNodesPerCell, "too many slaves per cell"); + ASSERTSTR(slavesPerCell < nrNodesPerCell, "too many slaves per cell"); #endif - int node = 0; + int node = 0; - for (int subband = 0; subband < nrSubBands; subband ++) { - for (int slave = 0; slave < slavesPerSubBand; slave ++) { - WH_BGL_Processing *wh = new WH_BGL_Processing("BGL_Proc", baseFreqs[subband], itsParamSet); - itsWHs.push_back(wh); - TinyDataManager &dm = wh->getDataManager(); - itsSubbandStub->connect(subband, slave, dm, WH_BGL_Processing::SUBBAND_CHANNEL); - //itsRFI_MitigationStub->connect(subband, slave, dm, WH_BGL_Processing::RFI_MITIGATION_CHANNEL); - itsVisibilitiesStub->connect(subband, slave, dm, WH_BGL_Processing::VISIBILITIES_CHANNEL); + for (uint subband = 0; subband < nrSubBands; subband ++) { + for (uint slave = 0; slave < slavesPerSubBand; slave ++) { + WH_BGL_Processing *wh = new WH_BGL_Processing("BGL_Proc", baseFreqs[subband], itsParamSet); + itsWHs.push_back(wh); + TinyDataManager &dm = wh->getDataManager(); + itsSubbandStub->connect(subband, slave, dm, WH_BGL_Processing::SUBBAND_CHANNEL); + //itsRFI_MitigationStub->connect(subband, slave, dm, WH_BGL_Processing::RFI_MITIGATION_CHANNEL); + itsVisibilitiesStub->connect(subband, slave, dm, WH_BGL_Processing::VISIBILITIES_CHANNEL); #if defined HAVE_BGL - // check if current compute cell is full - if (node % slavesPerCell == 0) { - // advance to next compute cell - node = (node + nrNodesPerCell - 1) & -nrNodesPerCell; - } + // check if current compute cell is full + if (node % slavesPerCell == 0) { + // advance to next compute cell + node = (node + nrNodesPerCell - 1) & -nrNodesPerCell; + } #endif - wh->runOnNode(remapOnTree(node ++)); - } - } + wh->runOnNode(remapOnTree(node ++)); + } + } #if defined HAVE_MPI - ASSERTSTR (node <= TH_MPI::getNumberOfNodes(), "CS1_BGL_Proc needs " << node << " nodes, " << TH_MPI::getNumberOfNodes() << " available"); + ASSERTSTR (node <= TH_MPI::getNumberOfNodes(), "CS1_BGL_Proc needs " << node << " nodes, " << TH_MPI::getNumberOfNodes() << " available"); #endif - LOG_TRACE_FLOW_STR("Finished define()"); -} + LOG_TRACE_FLOW_STR("Finished define()"); + } -void AH_BGL_Processing::init() -{ - for (uint i = 0; i < itsWHs.size(); i ++) { - WH_BGL_Processing *wh = itsWHs[i]; - wh->basePreprocess(); + void AH_BGL_Processing::init() + { + for (uint i = 0; i < itsWHs.size(); i ++) { + WH_BGL_Processing *wh = itsWHs[i]; + wh->basePreprocess(); #if defined HAVE_MPI - if (wh->getNode() == TH_MPI::getCurrentRank()) { - DH_RFI_Mitigation *dh = wh->get_DH_RFI_Mitigation(); - DH_RFI_Mitigation::ChannelFlagsType *flags = dh->getChannelFlags(); + if (wh->getNode() == TH_MPI::getCurrentRank()) { + DH_RFI_Mitigation *dh = wh->get_DH_RFI_Mitigation(); + DH_RFI_Mitigation::ChannelFlagsType *flags = dh->getChannelFlags(); - memset(flags, 0, sizeof(DH_RFI_Mitigation::ChannelFlagsType)); - } + memset(flags, 0, sizeof(DH_RFI_Mitigation::ChannelFlagsType)); + } #endif - } + } - std::cerr << "init done\n"; - std::cerr.flush(); -} + std::cerr << "init done\n"; + std::cerr.flush(); + } -void AH_BGL_Processing::run(int steps) { - LOG_TRACE_FLOW_STR("Start AH_BGL_Processing::run() " ); - for (int i = 0; i < steps; i++) { - char timer_name[32]; - sprintf(timer_name, "baseProcess(%d)", i); - class NSTimer timer(timer_name, true); - - LOG_TRACE_LOOP_STR("processing run " << i ); - std::cerr << "run " << i << " of " << steps << '\n'; - std::cerr.flush(); - - timer.start(); - for (uint j = 0; j < itsWHs.size(); j ++) { - itsWHs[j]->baseProcess(); + void AH_BGL_Processing::run(int steps) { + LOG_TRACE_FLOW_STR("Start AH_BGL_Processing::run() " ); + for (int i = 0; i < steps; i++) { + char timer_name[32]; + sprintf(timer_name, "baseProcess(%d)", i); + class NSTimer timer(timer_name, true); + + LOG_TRACE_LOOP_STR("processing run " << i ); + std::cerr << "run " << i << " of " << steps << '\n'; + std::cerr.flush(); + + timer.start(); + for (uint j = 0; j < itsWHs.size(); j ++) { + itsWHs[j]->baseProcess(); + } + timer.stop(); + + std::cerr << "run " << i << " of " << steps << " done\n"; + std::cerr.flush(); + } + LOG_TRACE_FLOW_STR("Finished AH_BGL_Processing::run() " ); } - timer.stop(); - std::cerr << "run " << i << " of " << steps << " done\n"; - std::cerr.flush(); - } - LOG_TRACE_FLOW_STR("Finished AH_BGL_Processing::run() " ); -} + // void AH_BGL_Processing::postrun() { + // vector<WorkHolder*>::iterator it = itsWHs.begin(); + // for (; it < itsWHs.end(); it++) { + // (*it)->basePostprocess(); + // } + // } -// void AH_BGL_Processing::postrun() { -// vector<WorkHolder*>::iterator it = itsWHs.begin(); -// for (; it < itsWHs.end(); it++) { -// (*it)->basePostprocess(); -// } -// } - -void AH_BGL_Processing::dump() const { - vector<WH_BGL_Processing *>::const_iterator it; - for (it = itsWHs.begin(); it < itsWHs.end(); it++) { + void AH_BGL_Processing::dump() const { + vector<WH_BGL_Processing *>::const_iterator it; + for (it = itsWHs.begin(); it < itsWHs.end(); it++) { #if defined HAVE_MPI - if ((*it)->getNode() == TH_MPI::getCurrentRank()) { - (*it)->dump(); - } + if ((*it)->getNode() == TH_MPI::getCurrentRank()) { + (*it)->dump(); + } #else - (*it)->dump(); + (*it)->dump(); #endif - } -} + } + } + + void AH_BGL_Processing::quit() { + undefine(); + } + + } // namespace CS1 -void AH_BGL_Processing::quit() { - undefine(); -} +} // namespace LOFAR diff --git a/Appl/CEP/CS1/CS1_BGLProc/src/AH_BGL_Processing.h b/Appl/CEP/CS1/CS1_BGLProc/src/AH_BGL_Processing.h index 7fdeffb5efa97558ab278d542cdde5eca36a2b58..c06294f43b461452e3bd0a3e9f4137ee935fab5b 100644 --- a/Appl/CEP/CS1/CS1_BGLProc/src/AH_BGL_Processing.h +++ b/Appl/CEP/CS1/CS1_BGLProc/src/AH_BGL_Processing.h @@ -18,42 +18,47 @@ //# //# $Id$ -#ifndef LOFAR_APPL_CEP_CS1_CS1_BGL_PROC_AH_BGLPROCESSING_H -#define LOFAR_APPL_CEP_CS1_CS1_BGL_PROC_AH_BGLPROCESSING_H +#ifndef LOFAR_CS1_BGL_PROC_AH_BGL_PROCESSING_H +#define LOFAR_CS1_BGL_PROC_AH_BGL_PROCESSING_H #include <tinyCEP/TinyApplicationHolder.h> -#include <tinyCEP/WorkHolder.h> -#include <WH_BGL_Processing.h> -#include <CS1_Interface/Stub_BGL_Subband.h> -#include <CS1_Interface/Stub_BGL_RFI_Mitigation.h> -#include <CS1_Interface/Stub_BGL_Visibilities.h> +namespace LOFAR +{ + namespace CS1 + { + //# Forward declarations + class WH_BGL_Processing; + class Stub_BGL_Subband; + class Stub_BGL_RFI_Mitigation; + class Stub_BGL_Visibilities; -namespace LOFAR { + // Description of class. + class AH_BGL_Processing: public TinyApplicationHolder + { + public: + AH_BGL_Processing(); + virtual ~AH_BGL_Processing(); + virtual void undefine(); + virtual void define(const KeyValueMap&); + virtual void init(); + virtual void run(int nsteps); + /* virtual void postrun (); */ + virtual void dump() const; + virtual void quit(); + + private: + static unsigned remapOnTree(unsigned logicalNode); + + vector<WH_BGL_Processing *> itsWHs; + + Stub_BGL_Subband *itsSubbandStub; + Stub_BGL_RFI_Mitigation *itsRFI_MitigationStub; + Stub_BGL_Visibilities *itsVisibilitiesStub; + }; + + } // namespace CS1 + +} // namespace LOFAR -// Description of class. -class AH_BGL_Processing: public TinyApplicationHolder -{ - public: - AH_BGL_Processing(); - virtual ~AH_BGL_Processing(); - virtual void undefine(); - virtual void define(const LOFAR::KeyValueMap&); - virtual void init(); - virtual void run(int nsteps); -/* virtual void postrun (); */ - virtual void dump() const; - virtual void quit(); - - private: - static unsigned remapOnTree(unsigned logicalNode); - - vector<WH_BGL_Processing *> itsWHs; - - Stub_BGL_Subband *itsSubbandStub; - Stub_BGL_RFI_Mitigation *itsRFI_MitigationStub; - Stub_BGL_Visibilities *itsVisibilitiesStub; -}; - -} #endif diff --git a/Appl/CEP/CS1/CS1_BGLProc/src/CS1_BGL_Processing_main.cc b/Appl/CEP/CS1/CS1_BGLProc/src/CS1_BGL_Processing_main.cc index 6399106245f1f977a0db72b6c5f66cb08907507a..94ab83e5df14a1048492a9f6b11da09112185255 100644 --- a/Appl/CEP/CS1/CS1_BGLProc/src/CS1_BGL_Processing_main.cc +++ b/Appl/CEP/CS1/CS1_BGLProc/src/CS1_BGL_Processing_main.cc @@ -18,7 +18,6 @@ //# //# $Id$ - #include <lofar_config.h> #include <PLC/ACCmain.h> @@ -26,12 +25,14 @@ #include <tinyCEP/ApplicationHolderController.h> #include <CS1_BGLProc/AH_BGL_Processing.h> +using namespace LOFAR; +using namespace LOFAR::CS1; int main(int argc, char **argv) { INIT_LOGGER("CS1_BGL_Processing"); // Figuring out nrRuns here is ugly ... - LOFAR::ACC::APS::ParameterSet ps("CS1.parset"); + ACC::APS::ParameterSet ps("CS1.parset"); int nrSeconds = ps.getInt32("General.NRuns"); int nrSlaves = ps.getInt32("BGLProc.SlavesPerSubband"); int nrRuns = nrSeconds / nrSlaves; @@ -39,5 +40,5 @@ int main(int argc, char **argv) { AH_BGL_Processing myAH; ApplicationHolderController myAHController(myAH, nrRuns); - return LOFAR::ACC::PLC::ACCmain(argc, argv, &myAHController); + return ACC::PLC::ACCmain(argc, argv, &myAHController); } diff --git a/Appl/CEP/CS1/CS1_BGLProc/src/FIR.h b/Appl/CEP/CS1/CS1_BGLProc/src/FIR.h index 403e6e9fe7ee86d07c55249302bc76d7ff966247..e74b9efad568a3c4e526360102cd712b46dc6937 100644 --- a/Appl/CEP/CS1/CS1_BGLProc/src/FIR.h +++ b/Appl/CEP/CS1/CS1_BGLProc/src/FIR.h @@ -28,43 +28,49 @@ #include <rts.h> -namespace LOFAR { +namespace LOFAR +{ + namespace CS1 + { -struct phase_shift { - dcomplex v0, dv; -}; + struct phase_shift { + dcomplex v0, dv; + }; -typedef LOFAR::bitset<NR_SUBBAND_CHANNELS> inputFlagsType[NR_STATIONS][NR_TAPS - 1 + NR_SAMPLES_PER_INTEGRATION]; -typedef LOFAR::bitset<NR_SAMPLES_PER_INTEGRATION> flagsType[NR_STATIONS]; + typedef bitset<NR_SUBBAND_CHANNELS> inputFlagsType[NR_STATIONS][NR_TAPS - 1 + NR_SAMPLES_PER_INTEGRATION]; + typedef bitset<NR_SAMPLES_PER_INTEGRATION> flagsType[NR_STATIONS]; -extern "C" { - void _filter(fcomplex delayLine[NR_TAPS], - const float weights[NR_TAPS], - const DH_Subband::SampleType samples[], - fcomplex out[], - int nr_samples_div_16); + extern "C" { + void _filter(fcomplex delayLine[NR_TAPS], + const float weights[NR_TAPS], + const DH_Subband::SampleType samples[], + fcomplex out[], + int nr_samples_div_16); - // void _compute_flags(const inputFlagsType *input, flagsType *flags); + // void _compute_flags(const inputFlagsType *input, flagsType *flags); - void _transpose_4x8(fcomplex *out, - const fcomplex *in, - int length, - int input_stride, - int output_stride); + void _transpose_4x8(fcomplex *out, + const fcomplex *in, + int length, + int input_stride, + int output_stride); - void _phase_shift_and_transpose(fcomplex *out, - const fcomplex *in, - const struct phase_shift *); + void _phase_shift_and_transpose(fcomplex *out, + const fcomplex *in, + const struct phase_shift *); - void _fast_memcpy(void *dst, const void *src, size_t bytes); - void _memzero(void *dst, size_t bytes); // bytes must be multiple of 128 - void _prefetch(const void *src, size_t count, size_t stride); + void _fast_memcpy(void *dst, const void *src, size_t bytes); + void _memzero(void *dst, size_t bytes); // bytes must be multiple of 128 + void _prefetch(const void *src, size_t count, size_t stride); - void _bgl_mutex_lock(BGL_Mutex *), _bgl_mutex_unlock(BGL_Mutex *); - unsigned long long _rdtsc(); -}; + void _bgl_mutex_lock(BGL_Mutex *), _bgl_mutex_unlock(BGL_Mutex *); + unsigned long long _rdtsc(); + }; + + } // namespace CS1 + +} // namespace LOFAR -} #endif #endif diff --git a/Appl/CEP/CS1/CS1_BGLProc/src/WH_BGL_Processing.cc b/Appl/CEP/CS1/CS1_BGLProc/src/WH_BGL_Processing.cc index 31218300eeb4f7caff3ac2597fc69d4d4fe648c8..76e292938308b19d238f5c291c7fd451836189ad 100644 --- a/Appl/CEP/CS1/CS1_BGLProc/src/WH_BGL_Processing.cc +++ b/Appl/CEP/CS1/CS1_BGLProc/src/WH_BGL_Processing.cc @@ -22,9 +22,9 @@ #include <lofar_config.h> //# Includes -#include <WH_BGL_Processing.h> -#include <Correlator.h> -#include <FIR.h> +#include <CS1_BGLProc/WH_BGL_Processing.h> +#include <CS1_BGLProc/Correlator.h> +#include <CS1_BGLProc/FIR.h> #include <Common/Timer.h> #include <Transport/TH_MPI.h> @@ -33,8 +33,6 @@ #include <complex> #include <cmath> -#include <config.h> - #if defined HAVE_MASS #include <mass.h> #endif @@ -43,1610 +41,1616 @@ #include <rts.h> #endif -using namespace LOFAR; - +namespace LOFAR +{ + namespace CS1 + { #if !defined HAVE_MASS -inline static dcomplex cosisin(double x) -{ - return makedcomplex(cos(x), sin(x)); -} + inline static dcomplex cosisin(double x) + { + return makedcomplex(cos(x), sin(x)); + } #endif - -FIR WH_BGL_Processing::itsFIRs[NR_STATIONS][NR_POLARIZATIONS][NR_SUBBAND_CHANNELS] CACHE_ALIGNED; -fcomplex WH_BGL_Processing::samples[NR_SUBBAND_CHANNELS][NR_STATIONS][NR_SAMPLES_PER_INTEGRATION][NR_POLARIZATIONS] CACHE_ALIGNED; -LOFAR::bitset<NR_SAMPLES_PER_INTEGRATION> WH_BGL_Processing::flags[NR_STATIONS] CACHE_ALIGNED; -unsigned WH_BGL_Processing::itsNrValidSamples[NR_BASELINES] CACHE_ALIGNED; -float WH_BGL_Processing::correlationWeights[NR_SAMPLES_PER_INTEGRATION + 1] CACHE_ALIGNED; -float WH_BGL_Processing::thresholds[NR_BASELINES][NR_SUBBAND_CHANNELS]; + FIR WH_BGL_Processing::itsFIRs[NR_STATIONS][NR_POLARIZATIONS][NR_SUBBAND_CHANNELS] CACHE_ALIGNED; + fcomplex WH_BGL_Processing::samples[NR_SUBBAND_CHANNELS][NR_STATIONS][NR_SAMPLES_PER_INTEGRATION][NR_POLARIZATIONS] CACHE_ALIGNED; + bitset<NR_SAMPLES_PER_INTEGRATION> WH_BGL_Processing::flags[NR_STATIONS] CACHE_ALIGNED; + unsigned WH_BGL_Processing::itsNrValidSamples[NR_BASELINES] CACHE_ALIGNED; + float WH_BGL_Processing::correlationWeights[NR_SAMPLES_PER_INTEGRATION + 1] CACHE_ALIGNED; + float WH_BGL_Processing::thresholds[NR_BASELINES][NR_SUBBAND_CHANNELS]; #if defined HAVE_BGL && !defined C_IMPLEMENTATION -static BGL_Mutex *mutex; + static BGL_Mutex *mutex; #endif -static NSTimer computeFlagsTimer("computeFlags", true); -static NSTimer FIRtimer("FIRtimer", true); -static NSTimer FFTtimer("FFT", true); -static NSTimer doPPFtimer("doPPF()", true); -static NSTimer doCorrelateTimer("doCorrelate()", true); -static NSTimer weightTimer("weight", true); -static NSTimer totalTimer("total", true); + static NSTimer computeFlagsTimer("computeFlags", true); + static NSTimer FIRtimer("FIRtimer", true); + static NSTimer FFTtimer("FFT", true); + static NSTimer doPPFtimer("doPPF()", true); + static NSTimer doCorrelateTimer("doCorrelate()", true); + static NSTimer weightTimer("weight", true); + static NSTimer totalTimer("total", true); -const float FIR::weights[NR_SUBBAND_CHANNELS][NR_TAPS] CACHE_ALIGNED = { + const float FIR::weights[NR_SUBBAND_CHANNELS][NR_TAPS] CACHE_ALIGNED = { #if NR_SUBBAND_CHANNELS == 256 && NR_TAPS == 16 - { 0.011659500, -0.011535200, 0.005131880, 0.001219900, - -0.006891530, 0.011598600, -0.015420900, 1.000000000, - -0.011661800, 0.009847130, -0.005852040, 0.000558600, - 0.005549120, -0.011758700, 0.011716500, 0.000414833 }, - { 0.011602000, -0.011311400, 0.004715490, 0.001878750, - -0.007926170, 0.013340200, -0.019147200, 0.999948000, - -0.007870030, 0.008086100, -0.004807840, -0.000105072, - 0.005967150, -0.011982000, 0.011773000, 0.000414623 }, - { 0.011544100, -0.011087500, 0.004299990, 0.002535060, - -0.008955820, 0.015071700, -0.022840300, 0.999843000, - -0.004045800, 0.006315690, -0.003759060, -0.000771025, - 0.006385910, -0.012205000, 0.011829000, 0.000414214 }, - { 0.011485700, -0.010863400, 0.003885440, 0.003188740, - -0.009980360, 0.016793100, -0.026500200, 0.999686000, - -0.000189332, 0.004536100, -0.002705860, -0.001439170, - 0.006805360, -0.012427700, 0.011884500, 0.000413633 }, - { 0.011426900, -0.010639200, 0.003471880, 0.003839710, - -0.010999700, 0.018503900, -0.030126600, 0.999477000, - 0.003699140, 0.002747570, -0.001648360, -0.002109420, - 0.007225430, -0.012650100, 0.011939500, 0.000412915 }, - { 0.011367600, -0.010414900, 0.003059380, 0.004487890, - -0.012013600, 0.020204200, -0.033719300, 0.999215000, - 0.007619390, 0.000950314, -0.000586709, -0.002781680, - 0.007646080, -0.012872200, 0.011993900, 0.000412106 }, - { 0.011307900, -0.010190500, 0.002647990, 0.005133180, - -0.013021900, 0.021893500, -0.037278100, 0.998901000, - 0.011571200, -0.000855436, 0.000478948, -0.003455870, - 0.008067240, -0.013093800, 0.012047800, 0.000411265 }, - { 0.011247800, -0.009966110, 0.002237740, 0.005775510, - -0.014024700, 0.023571800, -0.040802900, 0.998535000, - 0.015554300, -0.002669450, 0.001548470, -0.004131890, - 0.008488880, -0.013315100, 0.012101100, 0.000410456 }, - { 0.011187300, -0.009741670, 0.001828700, 0.006414810, - -0.015021700, 0.025238900, -0.044293400, 0.998117000, - 0.019568500, -0.004491510, 0.002621710, -0.004809650, - 0.008910910, -0.013535900, 0.012153900, 0.000409752 }, - { 0.011126400, -0.009517230, 0.001420910, 0.007050970, - -0.016012700, 0.026894500, -0.047749500, 0.997646000, - 0.023613500, -0.006321360, 0.003698520, -0.005489070, - 0.009333300, -0.013756200, 0.012206100, 0.000409230 }, - { 0.011065200, -0.009292840, 0.001014430, 0.007683930, - -0.016997800, 0.028538400, -0.051171100, 0.997124000, - 0.027689100, -0.008158790, 0.004778750, -0.006170040, - 0.009755990, -0.013976000, 0.012257600, 0.000408972 }, - { 0.011003500, -0.009068510, 0.000609294, 0.008313610, - -0.017976700, 0.030170600, -0.054557800, 0.996549000, - 0.031795100, -0.010003500, 0.005862260, -0.006852470, - 0.010178900, -0.014195300, 0.012308600, 0.000409063 }, - { 0.010941500, -0.008844280, 0.000205562, 0.008939920, - -0.018949300, 0.031790600, -0.057909700, 0.995922000, - 0.035931100, -0.011855400, 0.006948890, -0.007536270, - 0.010602000, -0.014414000, 0.012358900, 0.000409585 }, - { 0.010879200, -0.008620160, -0.000196720, 0.009562800, - -0.019915600, 0.033398500, -0.061226400, 0.995244000, - 0.040096900, -0.013714100, 0.008038500, -0.008221360, - 0.011025300, -0.014632100, 0.012408600, 0.000410621 }, - { 0.010816400, -0.008396190, -0.000597505, 0.010182200, - -0.020875300, 0.034994000, -0.064507900, 0.994513000, - 0.044292300, -0.015579400, 0.009130930, -0.008907620, - 0.011448600, -0.014849700, 0.012457700, 0.000412251 }, - { 0.010753400, -0.008172400, -0.000996745, 0.010797900, - -0.021828400, 0.036576900, -0.067754100, 0.993731000, - 0.048517000, -0.017451100, 0.010226000, -0.009594970, - 0.011871900, -0.015066500, 0.012506100, 0.000414547 }, - { 0.010690100, -0.007948800, -0.001394390, 0.011410000, - -0.022774800, 0.038147100, -0.070964600, 0.992897000, - 0.052770700, -0.019328800, 0.011323700, -0.010283300, - 0.012295200, -0.015282700, 0.012553800, 0.000417579 }, - { 0.010626400, -0.007725430, -0.001790400, 0.012018300, - -0.023714300, 0.039704400, -0.074139500, 0.992011000, - 0.057053200, -0.021212500, 0.012423600, -0.010972500, - 0.012718300, -0.015498200, 0.012600900, 0.000421406 }, - { 0.010562400, -0.007502300, -0.002184730, 0.012622900, - -0.024646800, 0.041248500, -0.077278600, 0.991074000, - 0.061364100, -0.023101700, 0.013525800, -0.011662600, - 0.013141300, -0.015712900, 0.012647200, 0.000426080 }, - { 0.010498200, -0.007279450, -0.002577320, 0.013223500, - -0.025572200, 0.042779400, -0.080381600, 0.990085000, - 0.065703200, -0.024996400, 0.014630100, -0.012353300, - 0.013564100, -0.015926800, 0.012692900, 0.000431643 }, - { 0.010433600, -0.007056910, -0.002968140, 0.013820200, - -0.026490500, 0.044296800, -0.083448600, 0.989045000, - 0.070070300, -0.026896100, 0.015736200, -0.013044600, - 0.013986600, -0.016140000, 0.012737800, 0.000438126 }, - { 0.010368800, -0.006834680, -0.003357130, 0.014412800, - -0.027401400, 0.045800700, -0.086479400, 0.987953000, - 0.074464900, -0.028800600, 0.016844000, -0.013736500, - 0.014408800, -0.016352300, 0.012782000, 0.000445550 }, - { 0.010303700, -0.006612810, -0.003744260, 0.015001400, - -0.028304900, 0.047290800, -0.089473800, 0.986810000, - 0.078886800, -0.030709800, 0.017953500, -0.014428700, - 0.014830600, -0.016563700, 0.012825500, 0.000453924 }, - { 0.010238400, -0.006391310, -0.004129480, 0.015585700, - -0.029200900, 0.048766900, -0.092431700, 0.985617000, - 0.083335800, -0.032623200, 0.019064300, -0.015121200, - 0.015251900, -0.016774300, 0.012868200, 0.000463250 }, - { 0.010172900, -0.006170210, -0.004512750, 0.016165800, - -0.030089200, 0.050229000, -0.095353100, 0.984372000, - 0.087811500, -0.034540800, 0.020176400, -0.015814000, - 0.015672700, -0.016983900, 0.012910200, 0.000473514 }, - { 0.010107100, -0.005949540, -0.004894020, 0.016741600, - -0.030969900, 0.051676900, -0.098237800, 0.983076000, - 0.092313600, -0.036462100, 0.021289600, -0.016506800, - 0.016092900, -0.017192600, 0.012951400, 0.000484696 }, - { 0.010041100, -0.005729310, -0.005273240, 0.017313100, - -0.031842600, 0.053110400, -0.101086000, 0.981730000, - 0.096841900, -0.038386900, 0.022403700, -0.017199700, - 0.016512500, -0.017400200, 0.012991800, 0.000496767 }, - { 0.009974950, -0.005509550, -0.005650390, 0.017880100, - -0.032707500, 0.054529300, -0.103897000, 0.980333000, - 0.101396000, -0.040315000, 0.023518600, -0.017892400, - 0.016931400, -0.017606900, 0.013031400, 0.000509689 }, - { 0.009908570, -0.005290280, -0.006025420, 0.018442500, - -0.033564300, 0.055933600, -0.106671000, 0.978886000, - 0.105975000, -0.042246100, 0.024634100, -0.018585000, - 0.017349500, -0.017812500, 0.013070200, 0.000523415 }, - { 0.009842020, -0.005071530, -0.006398270, 0.019000400, - -0.034413000, 0.057323100, -0.109408000, 0.977388000, - 0.110580000, -0.044180000, 0.025750100, -0.019277200, - 0.017766900, -0.018017000, 0.013108200, 0.000537896 }, - { 0.009775290, -0.004853320, -0.006768930, 0.019553700, - -0.035253500, 0.058697600, -0.112107000, 0.975840000, - 0.115210000, -0.046116200, 0.026866300, -0.019969100, - 0.018183300, -0.018220400, 0.013145400, 0.000553077 }, - { 0.009708410, -0.004635680, -0.007137330, 0.020102300, - -0.036085600, 0.060057000, -0.114770000, 0.974242000, - 0.119864000, -0.048054700, 0.027982600, -0.020660400, - 0.018598800, -0.018422700, 0.013181700, 0.000568899 }, - { 0.009641370, -0.004418620, -0.007503460, 0.020646100, - -0.036909400, 0.061401200, -0.117395000, 0.972595000, - 0.124542000, -0.049995000, 0.029098800, -0.021351200, - 0.019013400, -0.018623700, 0.013217200, 0.000585302 }, - { 0.009574200, -0.004202160, -0.007867250, 0.021185100, - -0.037724600, 0.062730000, -0.119983000, 0.970897000, - 0.129244000, -0.051936900, 0.030214800, -0.022041200, - 0.019426800, -0.018823600, 0.013251800, 0.000602227 }, - { 0.009506900, -0.003986340, -0.008228680, 0.021719200, - -0.038531200, 0.064043400, -0.122533000, 0.969150000, - 0.133970000, -0.053880200, 0.031330400, -0.022730400, - 0.019839200, -0.019022200, 0.013285600, 0.000619615 }, - { 0.009439470, -0.003771170, -0.008587720, 0.022248400, - -0.039329200, 0.065341100, -0.125045000, 0.967354000, - 0.138719000, -0.055824500, 0.032445500, -0.023418700, - 0.020250300, -0.019219600, 0.013318400, 0.000637409 }, - { 0.009371930, -0.003556670, -0.008944310, 0.022772500, - -0.040118300, 0.066623100, -0.127520000, 0.965508000, - 0.143491000, -0.057769600, 0.033559800, -0.024106000, - 0.020660300, -0.019415600, 0.013350400, 0.000655555 }, - { 0.009304290, -0.003342870, -0.009298430, 0.023291700, - -0.040898700, 0.067889200, -0.129958000, 0.963614000, - 0.148285000, -0.059715200, 0.034673200, -0.024792100, - 0.021068900, -0.019610300, 0.013381400, 0.000674005 }, - { 0.009236550, -0.003129790, -0.009650030, 0.023805700, - -0.041670100, 0.069139400, -0.132357000, 0.961670000, - 0.153101000, -0.061661000, 0.035785500, -0.025477100, - 0.021476100, -0.019803700, 0.013411500, 0.000692716 }, - { 0.009168730, -0.002917450, -0.009999080, 0.024314500, - -0.042432500, 0.070373400, -0.134719000, 0.959678000, - 0.157939000, -0.063606700, 0.036896600, -0.026160600, - 0.021882000, -0.019995700, 0.013440700, 0.000711649 }, - { 0.009100820, -0.002705870, -0.010345600, 0.024818200, - -0.043185700, 0.071591300, -0.137043000, 0.957637000, - 0.162799000, -0.065552000, 0.038006300, -0.026842800, - 0.022286300, -0.020186200, 0.013469000, 0.000730774 }, - { 0.009032840, -0.002495060, -0.010689400, 0.025316500, - -0.043929900, 0.072792800, -0.139329000, 0.955548000, - 0.167680000, -0.067496700, 0.039114400, -0.027523400, - 0.022689100, -0.020375300, 0.013496200, 0.000750066 }, - { 0.008964800, -0.002285070, -0.011030600, 0.025809600, - -0.044664700, 0.073977900, -0.141578000, 0.953411000, - 0.172581000, -0.069440400, 0.040220700, -0.028202300, - 0.023090300, -0.020562800, 0.013522500, 0.000769507 }, - { 0.008896700, -0.002075890, -0.011369100, 0.026297300, - -0.045390300, 0.075146500, -0.143788000, 0.951226000, - 0.177503000, -0.071382800, 0.041325100, -0.028879500, - 0.023489900, -0.020748900, 0.013547900, 0.000789086 }, - { 0.008828540, -0.001867560, -0.011704900, 0.026779500, - -0.046106400, 0.076298500, -0.145960000, 0.948994000, - 0.182445000, -0.073323800, 0.042427300, -0.029554900, - 0.023887600, -0.020933400, 0.013572200, 0.000808800 }, - { 0.008760350, -0.001660090, -0.012037900, 0.027256300, - -0.046813100, 0.077433700, -0.148095000, 0.946714000, - 0.187407000, -0.075262900, 0.043527300, -0.030228300, - 0.024283600, -0.021116400, 0.013595500, 0.000828649 }, - { 0.008692120, -0.001453500, -0.012368200, 0.027727600, - -0.047510200, 0.078552200, -0.150191000, 0.944386000, - 0.192388000, -0.077199800, 0.044624900, -0.030899600, - 0.024677800, -0.021297700, 0.013617800, 0.000848641 }, - { 0.008623860, -0.001247820, -0.012695600, 0.028193200, - -0.048197700, 0.079653700, -0.152249000, 0.942012000, - 0.197388000, -0.079134300, 0.045719800, -0.031568700, - 0.025070000, -0.021477300, 0.013639100, 0.000868789 }, - { 0.008555590, -0.001043050, -0.013020200, 0.028653300, - -0.048875600, 0.080738200, -0.154269000, 0.939591000, - 0.202406000, -0.081066100, 0.046811900, -0.032235500, - 0.025460200, -0.021655300, 0.013659300, 0.000889109 }, - { 0.008487300, -0.000839230, -0.013341900, 0.029107700, - -0.049543700, 0.081805600, -0.156252000, 0.937123000, - 0.207442000, -0.082994900, 0.047901000, -0.032900000, - 0.025848400, -0.021831600, 0.013678500, 0.000909621 }, - { 0.008419010, -0.000636364, -0.013660700, 0.029556500, - -0.050202100, 0.082855900, -0.158196000, 0.934609000, - 0.212496000, -0.084920300, 0.048986900, -0.033562000, - 0.026234500, -0.022006200, 0.013696600, 0.000930348 }, - { 0.008350720, -0.000434476, -0.013976600, 0.029999400, - -0.050850500, 0.083888900, -0.160102000, 0.932049000, - 0.217568000, -0.086842200, 0.050069600, -0.034221300, - 0.026618500, -0.022179000, 0.013713600, 0.000951314 }, - { 0.008282450, -0.000233582, -0.014289400, 0.030436600, - -0.051489100, 0.084904600, -0.161970000, 0.929443000, - 0.222657000, -0.088760100, 0.051148700, -0.034878000, - 0.027000200, -0.022350000, 0.013729500, 0.000972545 }, - { 0.008214200, -0.000033699, -0.014599300, 0.030868000, - -0.052117600, 0.085902800, -0.163800000, 0.926792000, - 0.227762000, -0.090673700, 0.052224200, -0.035531800, - 0.027379600, -0.022519100, 0.013744400, 0.000994065 }, - { 0.008145980, 0.000165153, -0.014906200, 0.031293500, - -0.052736100, 0.086883600, -0.165592000, 0.924095000, - 0.232883000, -0.092582800, 0.053295800, -0.036182700, - 0.027756600, -0.022686400, 0.013758100, 0.001015900 }, - { 0.008077800, 0.000362959, -0.015210000, 0.031713100, - -0.053344600, 0.087846900, -0.167346000, 0.921353000, - 0.238020000, -0.094487100, 0.054363300, -0.036830600, - 0.028131300, -0.022851800, 0.013770700, 0.001038070 }, - { 0.008009680, 0.000559702, -0.015510700, 0.032126700, - -0.053942900, 0.088792500, -0.169062000, 0.918566000, - 0.243173000, -0.096386300, 0.055426700, -0.037475400, - 0.028503500, -0.023015300, 0.013782200, 0.001060610 }, - { 0.007941610, 0.000755366, -0.015808300, 0.032534400, - -0.054531000, 0.089720400, -0.170740000, 0.915735000, - 0.248340000, -0.098280000, 0.056485700, -0.038117000, - 0.028873100, -0.023176800, 0.013792600, 0.001083520 }, - { 0.007873600, 0.000949933, -0.016102800, 0.032936000, - -0.055108900, 0.090630600, -0.172380000, 0.912859000, - 0.253523000, -0.100168000, 0.057540100, -0.038755100, - 0.029240200, -0.023336400, 0.013801800, 0.001106820 }, - { 0.007805680, 0.001143390, -0.016394100, 0.033331600, - -0.055676400, 0.091523000, -0.173982000, 0.909939000, - 0.258719000, -0.102050000, 0.058589800, -0.039389900, - 0.029604600, -0.023493900, 0.013809800, 0.001130530 }, - { 0.007737840, 0.001335720, -0.016682300, 0.033721100, - -0.056233700, 0.092397600, -0.175546000, 0.906976000, - 0.263929000, -0.103925000, 0.059634500, -0.040021100, - 0.029966300, -0.023649400, 0.013816700, 0.001154660 }, - { 0.007670090, 0.001526900, -0.016967200, 0.034104500, - -0.056780500, 0.093254300, -0.177073000, 0.903969000, - 0.269153000, -0.105794000, 0.060674200, -0.040648600, - 0.030325200, -0.023802800, 0.013822400, 0.001179210 }, - { 0.007602450, 0.001716930, -0.017248900, 0.034481800, - -0.057317000, 0.094092900, -0.178561000, 0.900919000, - 0.274389000, -0.107656000, 0.061708600, -0.041272400, - 0.030681200, -0.023954100, 0.013826900, 0.001204190 }, - { 0.007534920, 0.001905780, -0.017527400, 0.034852800, - -0.057842900, 0.094913600, -0.180012000, 0.897826000, - 0.279638000, -0.109510000, 0.062737600, -0.041892300, - 0.031034400, -0.024103300, 0.013830200, 0.001229590 }, - { 0.007467500, 0.002093450, -0.017802500, 0.035217700, - -0.058358400, 0.095716300, -0.181426000, 0.894690000, - 0.284899000, -0.111357000, 0.063761000, -0.042508200, - 0.031384600, -0.024250300, 0.013832300, 0.001255410 }, - { 0.007400210, 0.002279910, -0.018074400, 0.035576300, - -0.058863300, 0.096500800, -0.182801000, 0.891512000, - 0.290172000, -0.113196000, 0.064778500, -0.043120000, - 0.031731800, -0.024395100, 0.013833100, 0.001281660 }, - { 0.007333050, 0.002465150, -0.018342900, 0.035928600, - -0.059357700, 0.097267200, -0.184139000, 0.888292000, - 0.295456000, -0.115027000, 0.065790100, -0.043727700, - 0.032075900, -0.024537700, 0.013832800, 0.001308310 }, - { 0.007266020, 0.002649160, -0.018608200, 0.036274700, - -0.059841400, 0.098015500, -0.185440000, 0.885030000, - 0.300751000, -0.116849000, 0.066795600, -0.044331000, - 0.032416900, -0.024678000, 0.013831200, 0.001335360 }, - { 0.007199140, 0.002831930, -0.018870000, 0.036614400, - -0.060314500, 0.098745500, -0.186703000, 0.881727000, - 0.306057000, -0.118663000, 0.067794800, -0.044930000, - 0.032754700, -0.024816100, 0.013828300, 0.001362810 }, - { 0.007132410, 0.003013430, -0.019128500, 0.036947800, - -0.060777000, 0.099457400, -0.187929000, 0.878383000, - 0.311372000, -0.120467000, 0.068787400, -0.045524500, - 0.033089200, -0.024951900, 0.013824200, 0.001390630 }, - { 0.007065840, 0.003193670, -0.019383500, 0.037274800, - -0.061228700, 0.100151000, -0.189118000, 0.874998000, - 0.316697000, -0.122261000, 0.069773400, -0.046114300, - 0.033420400, -0.025085300, 0.013818800, 0.001418820 }, - { 0.006999420, 0.003372610, -0.019635200, 0.037595400, - -0.061669700, 0.100826000, -0.190269000, 0.871573000, - 0.322032000, -0.124046000, 0.070752600, -0.046699500, - 0.033748200, -0.025216300, 0.013812100, 0.001447370 }, - { 0.006933170, 0.003550250, -0.019883400, 0.037909600, - -0.062100000, 0.101483000, -0.191383000, 0.868108000, - 0.327374000, -0.125821000, 0.071724700, -0.047279900, - 0.034072600, -0.025345000, 0.013804200, 0.001476260 }, - { 0.006867080, 0.003726580, -0.020128100, 0.038217400, - -0.062519400, 0.102122000, -0.192461000, 0.864602000, - 0.332726000, -0.127585000, 0.072689700, -0.047855300, - 0.034393500, -0.025471200, 0.013794900, 0.001505490 }, - { 0.006801170, 0.003901590, -0.020369400, 0.038518700, - -0.062928100, 0.102742000, -0.193501000, 0.861058000, - 0.338085000, -0.129339000, 0.073647200, -0.048425700, - 0.034710800, -0.025595000, 0.013784300, 0.001535060 }, - { 0.006735430, 0.004075260, -0.020607200, 0.038813500, - -0.063325900, 0.103344000, -0.194505000, 0.857474000, - 0.343451000, -0.131082000, 0.074597300, -0.048991000, - 0.035024600, -0.025716300, 0.013772400, 0.001564950 }, - { 0.006669880, 0.004247570, -0.020841500, 0.039101900, - -0.063712900, 0.103928000, -0.195471000, 0.853851000, - 0.348824000, -0.132813000, 0.075539700, -0.049551100, - 0.035334600, -0.025835000, 0.013759200, 0.001595150 }, - { 0.006604510, 0.004418520, -0.021072300, 0.039383700, - -0.064089100, 0.104493000, -0.196402000, 0.850190000, - 0.354204000, -0.134532000, 0.076474100, -0.050105900, - 0.035641000, -0.025951300, 0.013744600, 0.001625680 }, - { 0.006539330, 0.004588100, -0.021299500, 0.039659100, - -0.064454400, 0.105040000, -0.197295000, 0.846491000, - 0.359590000, -0.136240000, 0.077400500, -0.050655300, - 0.035943500, -0.026065000, 0.013728700, 0.001656520 }, - { 0.006474340, 0.004756290, -0.021523200, 0.039927800, - -0.064808800, 0.105568000, -0.198153000, 0.842754000, - 0.364982000, -0.137935000, 0.078318700, -0.051199100, - 0.036242200, -0.026176100, 0.013711400, 0.001687680 }, - { 0.006409560, 0.004923090, -0.021743400, 0.040190100, - -0.065152300, 0.106078000, -0.198974000, 0.838980000, - 0.370379000, -0.139618000, 0.079228600, -0.051737300, - 0.036537000, -0.026284600, 0.013692700, 0.001719160 }, - { 0.006344970, 0.005088480, -0.021959900, 0.040445700, - -0.065484900, 0.106570000, -0.199758000, 0.835168000, - 0.375780000, -0.141287000, 0.080129800, -0.052269800, - 0.036827900, -0.026390400, 0.013672700, 0.001750970 }, - { 0.006280600, 0.005252450, -0.022172900, 0.040694800, - -0.065806500, 0.107043000, -0.200507000, 0.831320000, - 0.381186000, -0.142944000, 0.081022300, -0.052796500, - 0.037114800, -0.026493600, 0.013651200, 0.001783110 }, - { 0.006216440, 0.005415000, -0.022382300, 0.040937300, - -0.066117300, 0.107498000, -0.201220000, 0.827436000, - 0.386596000, -0.144586000, 0.081905900, -0.053317300, - 0.037397500, -0.026594100, 0.013628400, 0.001815590 }, - { 0.006152510, 0.005576110, -0.022588000, 0.041173200, - -0.066417100, 0.107935000, -0.201897000, 0.823515000, - 0.392009000, -0.146215000, 0.082780500, -0.053832000, - 0.037676200, -0.026691800, 0.013604200, 0.001848420 }, - { 0.006088800, 0.005735770, -0.022790200, 0.041402500, - -0.066706000, 0.108353000, -0.202539000, 0.819559000, - 0.397425000, -0.147830000, 0.083645800, -0.054340600, - 0.037950700, -0.026786800, 0.013578500, 0.001881610 }, - { 0.006025320, 0.005893980, -0.022988700, 0.041625200, - -0.066983900, 0.108753000, -0.203145000, 0.815568000, - 0.402843000, -0.149431000, 0.084501700, -0.054843000, - 0.038221000, -0.026879000, 0.013551500, 0.001915170 }, - { 0.005962090, 0.006050720, -0.023183600, 0.041841300, - -0.067250900, 0.109135000, -0.203715000, 0.811542000, - 0.408264000, -0.151016000, 0.085348100, -0.055339100, - 0.038486900, -0.026968500, 0.013523000, 0.001949110 }, - { 0.005899110, 0.006205990, -0.023374800, 0.042050800, - -0.067507000, 0.109498000, -0.204250000, 0.807481000, - 0.413686000, -0.152586000, 0.086184700, -0.055828800, - 0.038748600, -0.027055100, 0.013493100, 0.001983430 }, - { 0.005836370, 0.006359780, -0.023562400, 0.042253600, - -0.067752100, 0.109843000, -0.204751000, 0.803387000, - 0.419109000, -0.154141000, 0.087011400, -0.056312000, - 0.039005800, -0.027138800, 0.013461700, 0.002018150 }, - { 0.005773900, 0.006512080, -0.023746300, 0.042449800, - -0.067986300, 0.110170000, -0.205216000, 0.799258000, - 0.424533000, -0.155681000, 0.087828100, -0.056788600, - 0.039258600, -0.027219700, 0.013428900, 0.002053260 }, - { 0.005711700, 0.006662890, -0.023926500, 0.042639300, - -0.068209600, 0.110479000, -0.205646000, 0.795096000, - 0.429957000, -0.157204000, 0.088634500, -0.057258500, - 0.039506900, -0.027297700, 0.013394600, 0.002088790 }, - { 0.005649770, 0.006812190, -0.024103100, 0.042822200, - -0.068422000, 0.110769000, -0.206042000, 0.790902000, - 0.435380000, -0.158711000, 0.089430600, -0.057721700, - 0.039750700, -0.027372700, 0.013358900, 0.002124730 }, - { 0.005588130, 0.006959980, -0.024275900, 0.042998500, - -0.068623400, 0.111041000, -0.206403000, 0.786674000, - 0.440803000, -0.160201000, 0.090216100, -0.058177900, - 0.039989900, -0.027444800, 0.013321700, 0.002161090 }, - { 0.005526770, 0.007106250, -0.024445100, 0.043168100, - -0.068814000, 0.111295000, -0.206731000, 0.782415000, - 0.446225000, -0.161674000, 0.090990900, -0.058627200, - 0.040224400, -0.027514000, 0.013283000, 0.002197860 }, - { 0.005465700, 0.007251000, -0.024610600, 0.043331100, - -0.068993700, 0.111531000, -0.207023000, 0.778123000, - 0.451645000, -0.163130000, 0.091754800, -0.059069400, - 0.040454200, -0.027580100, 0.013242800, 0.002235060 }, - { 0.005404930, 0.007394220, -0.024772300, 0.043487500, - -0.069162500, 0.111750000, -0.207282000, 0.773801000, - 0.457063000, -0.164568000, 0.092507700, -0.059504500, - 0.040679200, -0.027643200, 0.013201200, 0.002272680 }, - { 0.005344460, 0.007535900, -0.024930400, 0.043637200, - -0.069320400, 0.111950000, -0.207508000, 0.769447000, - 0.462478000, -0.165988000, 0.093249500, -0.059932300, - 0.040899500, -0.027703300, 0.013158100, 0.002310720 }, - { 0.005284290, 0.007676030, -0.025084700, 0.043780300, - -0.069467500, 0.112132000, -0.207699000, 0.765063000, - 0.467891000, -0.167391000, 0.093979900, -0.060352800, - 0.041114900, -0.027760300, 0.013113400, 0.002349170 }, - { 0.005224440, 0.007814610, -0.025235300, 0.043916800, - -0.069603800, 0.112296000, -0.207857000, 0.760649000, - 0.473299000, -0.168774000, 0.094698800, -0.060765800, - 0.041325400, -0.027814200, 0.013067200, 0.002388040 }, - { 0.005164890, 0.007951640, -0.025382200, 0.044046600, - -0.069729300, 0.112442000, -0.207982000, 0.756204000, - 0.478704000, -0.170139000, 0.095406000, -0.061171400, - 0.041530900, -0.027865000, 0.013019600, 0.002427310 }, - { 0.005105670, 0.008087110, -0.025525400, 0.044169900, - -0.069844000, 0.112571000, -0.208074000, 0.751731000, - 0.484104000, -0.171485000, 0.096101500, -0.061569300, - 0.041731400, -0.027912700, 0.012970400, 0.002466990 }, - { 0.005046750, 0.008221000, -0.025664900, 0.044286500, - -0.069947900, 0.112682000, -0.208133000, 0.747228000, - 0.489500000, -0.172811000, 0.096785000, -0.061959600, - 0.041926900, -0.027957300, 0.012919600, 0.002507070 }, - { 0.004988160, 0.008353330, -0.025800600, 0.044396600, - -0.070041100, 0.112775000, -0.208159000, 0.742698000, - 0.494890000, -0.174118000, 0.097456400, -0.062342100, - 0.042117300, -0.027998600, 0.012867400, 0.002547540 }, - { 0.004929880, 0.008484080, -0.025932700, 0.044500000, - -0.070123600, 0.112850000, -0.208153000, 0.738138000, - 0.500274000, -0.175405000, 0.098115500, -0.062716700, - 0.042302600, -0.028036800, 0.012813600, 0.002588390 }, - { 0.004871920, 0.008613240, -0.026060900, 0.044596900, - -0.070195500, 0.112908000, -0.208114000, 0.733552000, - 0.505652000, -0.176671000, 0.098762300, -0.063083500, - 0.042482700, -0.028071700, 0.012758200, 0.002629630 }, - { 0.004814280, 0.008740820, -0.026185500, 0.044687200, - -0.070256600, 0.112949000, -0.208043000, 0.728938000, - 0.511023000, -0.177917000, 0.099396500, -0.063442100, - 0.042657500, -0.028103500, 0.012701300, 0.002671240 }, - { 0.004756970, 0.008866800, -0.026306400, 0.044771000, - -0.070307200, 0.112972000, -0.207941000, 0.724297000, - 0.516386000, -0.179142000, 0.100018000, -0.063792700, - 0.042827100, -0.028131900, 0.012642800, 0.002713230 }, - { 0.004699970, 0.008991190, -0.026423500, 0.044848200, - -0.070347100, 0.112977000, -0.207806000, 0.719630000, - 0.521742000, -0.180346000, 0.100627000, -0.064135100, - 0.042991400, -0.028157100, 0.012582800, 0.002755580 }, - { 0.004643290, 0.009113970, -0.026536900, 0.044918900, - -0.070376500, 0.112966000, -0.207641000, 0.714936000, - 0.527090000, -0.181528000, 0.101222000, -0.064469200, - 0.043150300, -0.028179000, 0.012521200, 0.002798310 }, - { 0.004586940, 0.009235160, -0.026646600, 0.044983100, - -0.070395400, 0.112937000, -0.207444000, 0.710218000, - 0.532429000, -0.182688000, 0.101805000, -0.064795000, - 0.043303700, -0.028197600, 0.012458000, 0.002841390 }, - { 0.004530910, 0.009354740, -0.026752600, 0.045040800, - -0.070403800, 0.112891000, -0.207216000, 0.705474000, - 0.537759000, -0.183827000, 0.102374000, -0.065112400, - 0.043451800, -0.028212900, 0.012393300, 0.002884840 }, - { 0.004475210, 0.009472700, -0.026854800, 0.045092000, - -0.070401800, 0.112828000, -0.206957000, 0.700705000, - 0.543079000, -0.184943000, 0.102930000, -0.065421200, - 0.043594300, -0.028224800, 0.012327000, 0.002928660 }, - { 0.004419840, 0.009589060, -0.026953400, 0.045136800, - -0.070389300, 0.112748000, -0.206667000, 0.695912000, - 0.548389000, -0.186036000, 0.103473000, -0.065721500, - 0.043731300, -0.028233400, 0.012259000, 0.002972840 }, - { 0.004364790, 0.009703800, -0.027048300, 0.045175100, - -0.070366500, 0.112651000, -0.206347000, 0.691096000, - 0.553689000, -0.187106000, 0.104001000, -0.066013100, - 0.043862800, -0.028238600, 0.012189500, 0.003017380 }, - { 0.004310080, 0.009816920, -0.027139400, 0.045207000, - -0.070333300, 0.112537000, -0.205997000, 0.686256000, - 0.558978000, -0.188154000, 0.104516000, -0.066296000, - 0.043988600, -0.028240400, 0.012118400, 0.003062300 }, - { 0.004255710, 0.009928420, -0.027226900, 0.045232400, - -0.070289900, 0.112406000, -0.205617000, 0.681393000, - 0.564255000, -0.189177000, 0.105017000, -0.066570100, - 0.044108700, -0.028238700, 0.012045700, 0.003107590 }, - { 0.004201670, 0.010038300, -0.027310700, 0.045251500, - -0.070236200, 0.112259000, -0.205208000, 0.676508000, - 0.569520000, -0.190177000, 0.105504000, -0.066835300, - 0.044223200, -0.028233700, 0.011971400, 0.003153250 }, - { 0.004147990, 0.010146600, -0.027390800, 0.045264300, - -0.070172300, 0.112096000, -0.204769000, 0.671600000, - 0.574773000, -0.191153000, 0.105976000, -0.067091500, - 0.044332000, -0.028225200, 0.011895500, 0.003199290 }, - { 0.004094650, 0.010253200, -0.027467200, 0.045270600, - -0.070098300, 0.111916000, -0.204300000, 0.666671000, - 0.580013000, -0.192105000, 0.106435000, -0.067338800, - 0.044435000, -0.028213200, 0.011818000, 0.003245720 }, - { 0.004041660, 0.010358200, -0.027540000, 0.045270700, - -0.070014200, 0.111719000, -0.203803000, 0.661721000, - 0.585239000, -0.193032000, 0.106879000, -0.067576900, - 0.044532100, -0.028197800, 0.011738900, 0.003292530 }, - { 0.003989040, 0.010461600, -0.027609100, 0.045264500, - -0.069920000, 0.111506000, -0.203277000, 0.656750000, - 0.590452000, -0.193934000, 0.107308000, -0.067805900, - 0.044623500, -0.028178800, 0.011658200, 0.003339730 }, - { 0.003936790, 0.010563400, -0.027674600, 0.045252000, - -0.069815800, 0.111277000, -0.202722000, 0.651759000, - 0.595651000, -0.194811000, 0.107722000, -0.068025700, - 0.044708900, -0.028156400, 0.011575800, 0.003387320 }, - { 0.003884900, 0.010663500, -0.027736400, 0.045233300, - -0.069701700, 0.111032000, -0.202139000, 0.646748000, - 0.600834000, -0.195663000, 0.108122000, -0.068236100, - 0.044788500, -0.028130400, 0.011491900, 0.003435300 }, - { 0.003833390, 0.010762100, -0.027794600, 0.045208300, - -0.069577700, 0.110771000, -0.201528000, 0.641718000, - 0.606003000, -0.196489000, 0.108507000, -0.068437200, - 0.044862100, -0.028101000, 0.011406300, 0.003483680 }, - { 0.003782260, 0.010859000, -0.027849100, 0.045177200, - -0.069443800, 0.110495000, -0.200890000, 0.636669000, - 0.611156000, -0.197289000, 0.108877000, -0.068628900, - 0.044929800, -0.028067900, 0.011319200, 0.003532460 }, - { 0.003731520, 0.010954200, -0.027900100, 0.045139900, - -0.069300200, 0.110202000, -0.200223000, 0.631601000, - 0.616292000, -0.198062000, 0.109231000, -0.068811100, - 0.044991400, -0.028031300, 0.011230400, 0.003581630 }, - { 0.003681160, 0.011047900, -0.027947400, 0.045096500, - -0.069146800, 0.109894000, -0.199530000, 0.626516000, - 0.621413000, -0.198809000, 0.109570000, -0.068983800, - 0.045047000, -0.027991200, 0.011139900, 0.003631200 }, - { 0.003631200, 0.011139900, -0.027991200, 0.045047000, - -0.068983800, 0.109570000, -0.198809000, 0.621413000, - 0.626516000, -0.199530000, 0.109894000, -0.069146800, - 0.045096500, -0.027947400, 0.011047900, 0.003681160 }, - { 0.003581630, 0.011230400, -0.028031300, 0.044991400, - -0.068811100, 0.109231000, -0.198062000, 0.616292000, - 0.631601000, -0.200223000, 0.110202000, -0.069300200, - 0.045139900, -0.027900100, 0.010954200, 0.003731520 }, - { 0.003532460, 0.011319200, -0.028067900, 0.044929800, - -0.068628900, 0.108877000, -0.197289000, 0.611156000, - 0.636669000, -0.200890000, 0.110495000, -0.069443800, - 0.045177200, -0.027849100, 0.010859000, 0.003782260 }, - { 0.003483680, 0.011406300, -0.028101000, 0.044862100, - -0.068437200, 0.108507000, -0.196489000, 0.606003000, - 0.641718000, -0.201528000, 0.110771000, -0.069577700, - 0.045208300, -0.027794600, 0.010762100, 0.003833390 }, - { 0.003435300, 0.011491900, -0.028130400, 0.044788500, - -0.068236100, 0.108122000, -0.195663000, 0.600834000, - 0.646748000, -0.202139000, 0.111032000, -0.069701700, - 0.045233300, -0.027736400, 0.010663500, 0.003884900 }, - { 0.003387320, 0.011575800, -0.028156400, 0.044708900, - -0.068025700, 0.107722000, -0.194811000, 0.595651000, - 0.651759000, -0.202722000, 0.111277000, -0.069815800, - 0.045252000, -0.027674600, 0.010563400, 0.003936790 }, - { 0.003339730, 0.011658200, -0.028178800, 0.044623500, - -0.067805900, 0.107308000, -0.193934000, 0.590452000, - 0.656750000, -0.203277000, 0.111506000, -0.069920000, - 0.045264500, -0.027609100, 0.010461600, 0.003989040 }, - { 0.003292530, 0.011738900, -0.028197800, 0.044532100, - -0.067576900, 0.106879000, -0.193032000, 0.585239000, - 0.661721000, -0.203803000, 0.111719000, -0.070014200, - 0.045270700, -0.027540000, 0.010358200, 0.004041660 }, - { 0.003245720, 0.011818000, -0.028213200, 0.044435000, - -0.067338800, 0.106435000, -0.192105000, 0.580013000, - 0.666671000, -0.204300000, 0.111916000, -0.070098300, - 0.045270600, -0.027467200, 0.010253200, 0.004094650 }, - { 0.003199290, 0.011895500, -0.028225200, 0.044332000, - -0.067091500, 0.105976000, -0.191153000, 0.574773000, - 0.671600000, -0.204769000, 0.112096000, -0.070172300, - 0.045264300, -0.027390800, 0.010146600, 0.004147990 }, - { 0.003153250, 0.011971400, -0.028233700, 0.044223200, - -0.066835300, 0.105504000, -0.190177000, 0.569520000, - 0.676508000, -0.205208000, 0.112259000, -0.070236200, - 0.045251500, -0.027310700, 0.010038300, 0.004201670 }, - { 0.003107590, 0.012045700, -0.028238700, 0.044108700, - -0.066570100, 0.105017000, -0.189177000, 0.564255000, - 0.681393000, -0.205617000, 0.112406000, -0.070289900, - 0.045232400, -0.027226900, 0.009928420, 0.004255710 }, - { 0.003062300, 0.012118400, -0.028240400, 0.043988600, - -0.066296000, 0.104516000, -0.188154000, 0.558978000, - 0.686256000, -0.205997000, 0.112537000, -0.070333300, - 0.045207000, -0.027139400, 0.009816920, 0.004310080 }, - { 0.003017380, 0.012189500, -0.028238600, 0.043862800, - -0.066013100, 0.104001000, -0.187106000, 0.553689000, - 0.691096000, -0.206347000, 0.112651000, -0.070366500, - 0.045175100, -0.027048300, 0.009703800, 0.004364790 }, - { 0.002972840, 0.012259000, -0.028233400, 0.043731300, - -0.065721500, 0.103473000, -0.186036000, 0.548389000, - 0.695912000, -0.206667000, 0.112748000, -0.070389300, - 0.045136800, -0.026953400, 0.009589060, 0.004419840 }, - { 0.002928660, 0.012327000, -0.028224800, 0.043594300, - -0.065421200, 0.102930000, -0.184943000, 0.543079000, - 0.700705000, -0.206957000, 0.112828000, -0.070401800, - 0.045092000, -0.026854800, 0.009472700, 0.004475210 }, - { 0.002884840, 0.012393300, -0.028212900, 0.043451800, - -0.065112400, 0.102374000, -0.183827000, 0.537759000, - 0.705474000, -0.207216000, 0.112891000, -0.070403800, - 0.045040800, -0.026752600, 0.009354740, 0.004530910 }, - { 0.002841390, 0.012458000, -0.028197600, 0.043303700, - -0.064795000, 0.101805000, -0.182688000, 0.532429000, - 0.710218000, -0.207444000, 0.112937000, -0.070395400, - 0.044983100, -0.026646600, 0.009235160, 0.004586940 }, - { 0.002798310, 0.012521200, -0.028179000, 0.043150300, - -0.064469200, 0.101222000, -0.181528000, 0.527090000, - 0.714936000, -0.207641000, 0.112966000, -0.070376500, - 0.044918900, -0.026536900, 0.009113970, 0.004643290 }, - { 0.002755580, 0.012582800, -0.028157100, 0.042991400, - -0.064135100, 0.100627000, -0.180346000, 0.521742000, - 0.719630000, -0.207806000, 0.112977000, -0.070347100, - 0.044848200, -0.026423500, 0.008991190, 0.004699970 }, - { 0.002713230, 0.012642800, -0.028131900, 0.042827100, - -0.063792700, 0.100018000, -0.179142000, 0.516386000, - 0.724297000, -0.207941000, 0.112972000, -0.070307200, - 0.044771000, -0.026306400, 0.008866800, 0.004756970 }, - { 0.002671240, 0.012701300, -0.028103500, 0.042657500, - -0.063442100, 0.099396500, -0.177917000, 0.511023000, - 0.728938000, -0.208043000, 0.112949000, -0.070256600, - 0.044687200, -0.026185500, 0.008740820, 0.004814280 }, - { 0.002629630, 0.012758200, -0.028071700, 0.042482700, - -0.063083500, 0.098762300, -0.176671000, 0.505652000, - 0.733552000, -0.208114000, 0.112908000, -0.070195500, - 0.044596900, -0.026060900, 0.008613240, 0.004871920 }, - { 0.002588390, 0.012813600, -0.028036800, 0.042302600, - -0.062716700, 0.098115500, -0.175405000, 0.500274000, - 0.738138000, -0.208153000, 0.112850000, -0.070123600, - 0.044500000, -0.025932700, 0.008484080, 0.004929880 }, - { 0.002547540, 0.012867400, -0.027998600, 0.042117300, - -0.062342100, 0.097456400, -0.174118000, 0.494890000, - 0.742698000, -0.208159000, 0.112775000, -0.070041100, - 0.044396600, -0.025800600, 0.008353330, 0.004988160 }, - { 0.002507070, 0.012919600, -0.027957300, 0.041926900, - -0.061959600, 0.096785000, -0.172811000, 0.489500000, - 0.747228000, -0.208133000, 0.112682000, -0.069947900, - 0.044286500, -0.025664900, 0.008221000, 0.005046750 }, - { 0.002466990, 0.012970400, -0.027912700, 0.041731400, - -0.061569300, 0.096101500, -0.171485000, 0.484104000, - 0.751731000, -0.208074000, 0.112571000, -0.069844000, - 0.044169900, -0.025525400, 0.008087110, 0.005105670 }, - { 0.002427310, 0.013019600, -0.027865000, 0.041530900, - -0.061171400, 0.095406000, -0.170139000, 0.478704000, - 0.756204000, -0.207982000, 0.112442000, -0.069729300, - 0.044046600, -0.025382200, 0.007951640, 0.005164890 }, - { 0.002388040, 0.013067200, -0.027814200, 0.041325400, - -0.060765800, 0.094698800, -0.168774000, 0.473299000, - 0.760649000, -0.207857000, 0.112296000, -0.069603800, - 0.043916800, -0.025235300, 0.007814610, 0.005224440 }, - { 0.002349170, 0.013113400, -0.027760300, 0.041114900, - -0.060352800, 0.093979900, -0.167391000, 0.467891000, - 0.765063000, -0.207699000, 0.112132000, -0.069467500, - 0.043780300, -0.025084700, 0.007676030, 0.005284290 }, - { 0.002310720, 0.013158100, -0.027703300, 0.040899500, - -0.059932300, 0.093249500, -0.165988000, 0.462478000, - 0.769447000, -0.207508000, 0.111950000, -0.069320400, - 0.043637200, -0.024930400, 0.007535900, 0.005344460 }, - { 0.002272680, 0.013201200, -0.027643200, 0.040679200, - -0.059504500, 0.092507700, -0.164568000, 0.457063000, - 0.773801000, -0.207282000, 0.111750000, -0.069162500, - 0.043487500, -0.024772300, 0.007394220, 0.005404930 }, - { 0.002235060, 0.013242800, -0.027580100, 0.040454200, - -0.059069400, 0.091754800, -0.163130000, 0.451645000, - 0.778123000, -0.207023000, 0.111531000, -0.068993700, - 0.043331100, -0.024610600, 0.007251000, 0.005465700 }, - { 0.002197860, 0.013283000, -0.027514000, 0.040224400, - -0.058627200, 0.090990900, -0.161674000, 0.446225000, - 0.782415000, -0.206731000, 0.111295000, -0.068814000, - 0.043168100, -0.024445100, 0.007106250, 0.005526770 }, - { 0.002161090, 0.013321700, -0.027444800, 0.039989900, - -0.058177900, 0.090216100, -0.160201000, 0.440803000, - 0.786674000, -0.206403000, 0.111041000, -0.068623400, - 0.042998500, -0.024275900, 0.006959980, 0.005588130 }, - { 0.002124730, 0.013358900, -0.027372700, 0.039750700, - -0.057721700, 0.089430600, -0.158711000, 0.435380000, - 0.790902000, -0.206042000, 0.110769000, -0.068422000, - 0.042822200, -0.024103100, 0.006812190, 0.005649770 }, - { 0.002088790, 0.013394600, -0.027297700, 0.039506900, - -0.057258500, 0.088634500, -0.157204000, 0.429957000, - 0.795096000, -0.205646000, 0.110479000, -0.068209600, - 0.042639300, -0.023926500, 0.006662890, 0.005711700 }, - { 0.002053260, 0.013428900, -0.027219700, 0.039258600, - -0.056788600, 0.087828100, -0.155681000, 0.424533000, - 0.799258000, -0.205216000, 0.110170000, -0.067986300, - 0.042449800, -0.023746300, 0.006512080, 0.005773900 }, - { 0.002018150, 0.013461700, -0.027138800, 0.039005800, - -0.056312000, 0.087011400, -0.154141000, 0.419109000, - 0.803387000, -0.204751000, 0.109843000, -0.067752100, - 0.042253600, -0.023562400, 0.006359780, 0.005836370 }, - { 0.001983430, 0.013493100, -0.027055100, 0.038748600, - -0.055828800, 0.086184700, -0.152586000, 0.413686000, - 0.807481000, -0.204250000, 0.109498000, -0.067507000, - 0.042050800, -0.023374800, 0.006205990, 0.005899110 }, - { 0.001949110, 0.013523000, -0.026968500, 0.038486900, - -0.055339100, 0.085348100, -0.151016000, 0.408264000, - 0.811542000, -0.203715000, 0.109135000, -0.067250900, - 0.041841300, -0.023183600, 0.006050720, 0.005962090 }, - { 0.001915170, 0.013551500, -0.026879000, 0.038221000, - -0.054843000, 0.084501700, -0.149431000, 0.402843000, - 0.815568000, -0.203145000, 0.108753000, -0.066983900, - 0.041625200, -0.022988700, 0.005893980, 0.006025320 }, - { 0.001881610, 0.013578500, -0.026786800, 0.037950700, - -0.054340600, 0.083645800, -0.147830000, 0.397425000, - 0.819559000, -0.202539000, 0.108353000, -0.066706000, - 0.041402500, -0.022790200, 0.005735770, 0.006088800 }, - { 0.001848420, 0.013604200, -0.026691800, 0.037676200, - -0.053832000, 0.082780500, -0.146215000, 0.392009000, - 0.823515000, -0.201897000, 0.107935000, -0.066417100, - 0.041173200, -0.022588000, 0.005576110, 0.006152510 }, - { 0.001815590, 0.013628400, -0.026594100, 0.037397500, - -0.053317300, 0.081905900, -0.144586000, 0.386596000, - 0.827436000, -0.201220000, 0.107498000, -0.066117300, - 0.040937300, -0.022382300, 0.005415000, 0.006216440 }, - { 0.001783110, 0.013651200, -0.026493600, 0.037114800, - -0.052796500, 0.081022300, -0.142944000, 0.381186000, - 0.831320000, -0.200507000, 0.107043000, -0.065806500, - 0.040694800, -0.022172900, 0.005252450, 0.006280600 }, - { 0.001750970, 0.013672700, -0.026390400, 0.036827900, - -0.052269800, 0.080129800, -0.141287000, 0.375780000, - 0.835168000, -0.199758000, 0.106570000, -0.065484900, - 0.040445700, -0.021959900, 0.005088480, 0.006344970 }, - { 0.001719160, 0.013692700, -0.026284600, 0.036537000, - -0.051737300, 0.079228600, -0.139618000, 0.370379000, - 0.838980000, -0.198974000, 0.106078000, -0.065152300, - 0.040190100, -0.021743400, 0.004923090, 0.006409560 }, - { 0.001687680, 0.013711400, -0.026176100, 0.036242200, - -0.051199100, 0.078318700, -0.137935000, 0.364982000, - 0.842754000, -0.198153000, 0.105568000, -0.064808800, - 0.039927800, -0.021523200, 0.004756290, 0.006474340 }, - { 0.001656520, 0.013728700, -0.026065000, 0.035943500, - -0.050655300, 0.077400500, -0.136240000, 0.359590000, - 0.846491000, -0.197295000, 0.105040000, -0.064454400, - 0.039659100, -0.021299500, 0.004588100, 0.006539330 }, - { 0.001625680, 0.013744600, -0.025951300, 0.035641000, - -0.050105900, 0.076474100, -0.134532000, 0.354204000, - 0.850190000, -0.196402000, 0.104493000, -0.064089100, - 0.039383700, -0.021072300, 0.004418520, 0.006604510 }, - { 0.001595150, 0.013759200, -0.025835000, 0.035334600, - -0.049551100, 0.075539700, -0.132813000, 0.348824000, - 0.853851000, -0.195471000, 0.103928000, -0.063712900, - 0.039101900, -0.020841500, 0.004247570, 0.006669880 }, - { 0.001564950, 0.013772400, -0.025716300, 0.035024600, - -0.048991000, 0.074597300, -0.131082000, 0.343451000, - 0.857474000, -0.194505000, 0.103344000, -0.063325900, - 0.038813500, -0.020607200, 0.004075260, 0.006735430 }, - { 0.001535060, 0.013784300, -0.025595000, 0.034710800, - -0.048425700, 0.073647200, -0.129339000, 0.338085000, - 0.861058000, -0.193501000, 0.102742000, -0.062928100, - 0.038518700, -0.020369400, 0.003901590, 0.006801170 }, - { 0.001505490, 0.013794900, -0.025471200, 0.034393500, - -0.047855300, 0.072689700, -0.127585000, 0.332726000, - 0.864602000, -0.192461000, 0.102122000, -0.062519400, - 0.038217400, -0.020128100, 0.003726580, 0.006867080 }, - { 0.001476260, 0.013804200, -0.025345000, 0.034072600, - -0.047279900, 0.071724700, -0.125821000, 0.327374000, - 0.868108000, -0.191383000, 0.101483000, -0.062100000, - 0.037909600, -0.019883400, 0.003550250, 0.006933170 }, - { 0.001447370, 0.013812100, -0.025216300, 0.033748200, - -0.046699500, 0.070752600, -0.124046000, 0.322032000, - 0.871573000, -0.190269000, 0.100826000, -0.061669700, - 0.037595400, -0.019635200, 0.003372610, 0.006999420 }, - { 0.001418820, 0.013818800, -0.025085300, 0.033420400, - -0.046114300, 0.069773400, -0.122261000, 0.316697000, - 0.874998000, -0.189118000, 0.100151000, -0.061228700, - 0.037274800, -0.019383500, 0.003193670, 0.007065840 }, - { 0.001390630, 0.013824200, -0.024951900, 0.033089200, - -0.045524500, 0.068787400, -0.120467000, 0.311372000, - 0.878383000, -0.187929000, 0.099457400, -0.060777000, - 0.036947800, -0.019128500, 0.003013430, 0.007132410 }, - { 0.001362810, 0.013828300, -0.024816100, 0.032754700, - -0.044930000, 0.067794800, -0.118663000, 0.306057000, - 0.881727000, -0.186703000, 0.098745500, -0.060314500, - 0.036614400, -0.018870000, 0.002831930, 0.007199140 }, - { 0.001335360, 0.013831200, -0.024678000, 0.032416900, - -0.044331000, 0.066795600, -0.116849000, 0.300751000, - 0.885030000, -0.185440000, 0.098015500, -0.059841400, - 0.036274700, -0.018608200, 0.002649160, 0.007266020 }, - { 0.001308310, 0.013832800, -0.024537700, 0.032075900, - -0.043727700, 0.065790100, -0.115027000, 0.295456000, - 0.888292000, -0.184139000, 0.097267200, -0.059357700, - 0.035928600, -0.018342900, 0.002465150, 0.007333050 }, - { 0.001281660, 0.013833100, -0.024395100, 0.031731800, - -0.043120000, 0.064778500, -0.113196000, 0.290172000, - 0.891512000, -0.182801000, 0.096500800, -0.058863300, - 0.035576300, -0.018074400, 0.002279910, 0.007400210 }, - { 0.001255410, 0.013832300, -0.024250300, 0.031384600, - -0.042508200, 0.063761000, -0.111357000, 0.284899000, - 0.894690000, -0.181426000, 0.095716300, -0.058358400, - 0.035217700, -0.017802500, 0.002093450, 0.007467500 }, - { 0.001229590, 0.013830200, -0.024103300, 0.031034400, - -0.041892300, 0.062737600, -0.109510000, 0.279638000, - 0.897826000, -0.180012000, 0.094913600, -0.057842900, - 0.034852800, -0.017527400, 0.001905780, 0.007534920 }, - { 0.001204190, 0.013826900, -0.023954100, 0.030681200, - -0.041272400, 0.061708600, -0.107656000, 0.274389000, - 0.900919000, -0.178561000, 0.094092900, -0.057317000, - 0.034481800, -0.017248900, 0.001716930, 0.007602450 }, - { 0.001179210, 0.013822400, -0.023802800, 0.030325200, - -0.040648600, 0.060674200, -0.105794000, 0.269153000, - 0.903969000, -0.177073000, 0.093254300, -0.056780500, - 0.034104500, -0.016967200, 0.001526900, 0.007670090 }, - { 0.001154660, 0.013816700, -0.023649400, 0.029966300, - -0.040021100, 0.059634500, -0.103925000, 0.263929000, - 0.906976000, -0.175546000, 0.092397600, -0.056233700, - 0.033721100, -0.016682300, 0.001335720, 0.007737840 }, - { 0.001130530, 0.013809800, -0.023493900, 0.029604600, - -0.039389900, 0.058589800, -0.102050000, 0.258719000, - 0.909939000, -0.173982000, 0.091523000, -0.055676400, - 0.033331600, -0.016394100, 0.001143390, 0.007805680 }, - { 0.001106820, 0.013801800, -0.023336400, 0.029240200, - -0.038755100, 0.057540100, -0.100168000, 0.253523000, - 0.912859000, -0.172380000, 0.090630600, -0.055108900, - 0.032936000, -0.016102800, 0.000949933, 0.007873600 }, - { 0.001083520, 0.013792600, -0.023176800, 0.028873100, - -0.038117000, 0.056485700, -0.098280000, 0.248340000, - 0.915735000, -0.170740000, 0.089720400, -0.054531000, - 0.032534400, -0.015808300, 0.000755366, 0.007941610 }, - { 0.001060610, 0.013782200, -0.023015300, 0.028503500, - -0.037475400, 0.055426700, -0.096386300, 0.243173000, - 0.918566000, -0.169062000, 0.088792500, -0.053942900, - 0.032126700, -0.015510700, 0.000559702, 0.008009680 }, - { 0.001038070, 0.013770700, -0.022851800, 0.028131300, - -0.036830600, 0.054363300, -0.094487100, 0.238020000, - 0.921353000, -0.167346000, 0.087846900, -0.053344600, - 0.031713100, -0.015210000, 0.000362959, 0.008077800 }, - { 0.001015900, 0.013758100, -0.022686400, 0.027756600, - -0.036182700, 0.053295800, -0.092582800, 0.232883000, - 0.924095000, -0.165592000, 0.086883600, -0.052736100, - 0.031293500, -0.014906200, 0.000165153, 0.008145980 }, - { 0.000994065, 0.013744400, -0.022519100, 0.027379600, - -0.035531800, 0.052224200, -0.090673700, 0.227762000, - 0.926792000, -0.163800000, 0.085902800, -0.052117600, - 0.030868000, -0.014599300, -0.000033699, 0.008214200 }, - { 0.000972545, 0.013729500, -0.022350000, 0.027000200, - -0.034878000, 0.051148700, -0.088760100, 0.222657000, - 0.929443000, -0.161970000, 0.084904600, -0.051489100, - 0.030436600, -0.014289400, -0.000233582, 0.008282450 }, - { 0.000951314, 0.013713600, -0.022179000, 0.026618500, - -0.034221300, 0.050069600, -0.086842200, 0.217568000, - 0.932049000, -0.160102000, 0.083888900, -0.050850500, - 0.029999400, -0.013976600, -0.000434476, 0.008350720 }, - { 0.000930348, 0.013696600, -0.022006200, 0.026234500, - -0.033562000, 0.048986900, -0.084920300, 0.212496000, - 0.934609000, -0.158196000, 0.082855900, -0.050202100, - 0.029556500, -0.013660700, -0.000636364, 0.008419010 }, - { 0.000909621, 0.013678500, -0.021831600, 0.025848400, - -0.032900000, 0.047901000, -0.082994900, 0.207442000, - 0.937123000, -0.156252000, 0.081805600, -0.049543700, - 0.029107700, -0.013341900, -0.000839230, 0.008487300 }, - { 0.000889109, 0.013659300, -0.021655300, 0.025460200, - -0.032235500, 0.046811900, -0.081066100, 0.202406000, - 0.939591000, -0.154269000, 0.080738200, -0.048875600, - 0.028653300, -0.013020200, -0.001043050, 0.008555590 }, - { 0.000868789, 0.013639100, -0.021477300, 0.025070000, - -0.031568700, 0.045719800, -0.079134300, 0.197388000, - 0.942012000, -0.152249000, 0.079653700, -0.048197700, - 0.028193200, -0.012695600, -0.001247820, 0.008623860 }, - { 0.000848641, 0.013617800, -0.021297700, 0.024677800, - -0.030899600, 0.044624900, -0.077199800, 0.192388000, - 0.944386000, -0.150191000, 0.078552200, -0.047510200, - 0.027727600, -0.012368200, -0.001453500, 0.008692120 }, - { 0.000828649, 0.013595500, -0.021116400, 0.024283600, - -0.030228300, 0.043527300, -0.075262900, 0.187407000, - 0.946714000, -0.148095000, 0.077433700, -0.046813100, - 0.027256300, -0.012037900, -0.001660090, 0.008760350 }, - { 0.000808800, 0.013572200, -0.020933400, 0.023887600, - -0.029554900, 0.042427300, -0.073323800, 0.182445000, - 0.948994000, -0.145960000, 0.076298500, -0.046106400, - 0.026779500, -0.011704900, -0.001867560, 0.008828540 }, - { 0.000789086, 0.013547900, -0.020748900, 0.023489900, - -0.028879500, 0.041325100, -0.071382800, 0.177503000, - 0.951226000, -0.143788000, 0.075146500, -0.045390300, - 0.026297300, -0.011369100, -0.002075890, 0.008896700 }, - { 0.000769507, 0.013522500, -0.020562800, 0.023090300, - -0.028202300, 0.040220700, -0.069440400, 0.172581000, - 0.953411000, -0.141578000, 0.073977900, -0.044664700, - 0.025809600, -0.011030600, -0.002285070, 0.008964800 }, - { 0.000750066, 0.013496200, -0.020375300, 0.022689100, - -0.027523400, 0.039114400, -0.067496700, 0.167680000, - 0.955548000, -0.139329000, 0.072792800, -0.043929900, - 0.025316500, -0.010689400, -0.002495060, 0.009032840 }, - { 0.000730774, 0.013469000, -0.020186200, 0.022286300, - -0.026842800, 0.038006300, -0.065552000, 0.162799000, - 0.957637000, -0.137043000, 0.071591300, -0.043185700, - 0.024818200, -0.010345600, -0.002705870, 0.009100820 }, - { 0.000711649, 0.013440700, -0.019995700, 0.021882000, - -0.026160600, 0.036896600, -0.063606700, 0.157939000, - 0.959678000, -0.134719000, 0.070373400, -0.042432500, - 0.024314500, -0.009999080, -0.002917450, 0.009168730 }, - { 0.000692716, 0.013411500, -0.019803700, 0.021476100, - -0.025477100, 0.035785500, -0.061661000, 0.153101000, - 0.961670000, -0.132357000, 0.069139400, -0.041670100, - 0.023805700, -0.009650030, -0.003129790, 0.009236550 }, - { 0.000674005, 0.013381400, -0.019610300, 0.021068900, - -0.024792100, 0.034673200, -0.059715200, 0.148285000, - 0.963614000, -0.129958000, 0.067889200, -0.040898700, - 0.023291700, -0.009298430, -0.003342870, 0.009304290 }, - { 0.000655555, 0.013350400, -0.019415600, 0.020660300, - -0.024106000, 0.033559800, -0.057769600, 0.143491000, - 0.965508000, -0.127520000, 0.066623100, -0.040118300, - 0.022772500, -0.008944310, -0.003556670, 0.009371930 }, - { 0.000637409, 0.013318400, -0.019219600, 0.020250300, - -0.023418700, 0.032445500, -0.055824500, 0.138719000, - 0.967354000, -0.125045000, 0.065341100, -0.039329200, - 0.022248400, -0.008587720, -0.003771170, 0.009439470 }, - { 0.000619615, 0.013285600, -0.019022200, 0.019839200, - -0.022730400, 0.031330400, -0.053880200, 0.133970000, - 0.969150000, -0.122533000, 0.064043400, -0.038531200, - 0.021719200, -0.008228680, -0.003986340, 0.009506900 }, - { 0.000602227, 0.013251800, -0.018823600, 0.019426800, - -0.022041200, 0.030214800, -0.051936900, 0.129244000, - 0.970897000, -0.119983000, 0.062730000, -0.037724600, - 0.021185100, -0.007867250, -0.004202160, 0.009574200 }, - { 0.000585302, 0.013217200, -0.018623700, 0.019013400, - -0.021351200, 0.029098800, -0.049995000, 0.124542000, - 0.972595000, -0.117395000, 0.061401200, -0.036909400, - 0.020646100, -0.007503460, -0.004418620, 0.009641370 }, - { 0.000568899, 0.013181700, -0.018422700, 0.018598800, - -0.020660400, 0.027982600, -0.048054700, 0.119864000, - 0.974242000, -0.114770000, 0.060057000, -0.036085600, - 0.020102300, -0.007137330, -0.004635680, 0.009708410 }, - { 0.000553077, 0.013145400, -0.018220400, 0.018183300, - -0.019969100, 0.026866300, -0.046116200, 0.115210000, - 0.975840000, -0.112107000, 0.058697600, -0.035253500, - 0.019553700, -0.006768930, -0.004853320, 0.009775290 }, - { 0.000537896, 0.013108200, -0.018017000, 0.017766900, - -0.019277200, 0.025750100, -0.044180000, 0.110580000, - 0.977388000, -0.109408000, 0.057323100, -0.034413000, - 0.019000400, -0.006398270, -0.005071530, 0.009842020 }, - { 0.000523415, 0.013070200, -0.017812500, 0.017349500, - -0.018585000, 0.024634100, -0.042246100, 0.105975000, - 0.978886000, -0.106671000, 0.055933600, -0.033564300, - 0.018442500, -0.006025420, -0.005290280, 0.009908570 }, - { 0.000509689, 0.013031400, -0.017606900, 0.016931400, - -0.017892400, 0.023518600, -0.040315000, 0.101396000, - 0.980333000, -0.103897000, 0.054529300, -0.032707500, - 0.017880100, -0.005650390, -0.005509550, 0.009974950 }, - { 0.000496767, 0.012991800, -0.017400200, 0.016512500, - -0.017199700, 0.022403700, -0.038386900, 0.096841900, - 0.981730000, -0.101086000, 0.053110400, -0.031842600, - 0.017313100, -0.005273240, -0.005729310, 0.010041100 }, - { 0.000484696, 0.012951400, -0.017192600, 0.016092900, - -0.016506800, 0.021289600, -0.036462100, 0.092313600, - 0.983076000, -0.098237800, 0.051676900, -0.030969900, - 0.016741600, -0.004894020, -0.005949540, 0.010107100 }, - { 0.000473514, 0.012910200, -0.016983900, 0.015672700, - -0.015814000, 0.020176400, -0.034540800, 0.087811500, - 0.984372000, -0.095353100, 0.050229000, -0.030089200, - 0.016165800, -0.004512750, -0.006170210, 0.010172900 }, - { 0.000463250, 0.012868200, -0.016774300, 0.015251900, - -0.015121200, 0.019064300, -0.032623200, 0.083335800, - 0.985617000, -0.092431700, 0.048766900, -0.029200900, - 0.015585700, -0.004129480, -0.006391310, 0.010238400 }, - { 0.000453924, 0.012825500, -0.016563700, 0.014830600, - -0.014428700, 0.017953500, -0.030709800, 0.078886800, - 0.986810000, -0.089473800, 0.047290800, -0.028304900, - 0.015001400, -0.003744260, -0.006612810, 0.010303700 }, - { 0.000445550, 0.012782000, -0.016352300, 0.014408800, - -0.013736500, 0.016844000, -0.028800600, 0.074464900, - 0.987953000, -0.086479400, 0.045800700, -0.027401400, - 0.014412800, -0.003357130, -0.006834680, 0.010368800 }, - { 0.000438126, 0.012737800, -0.016140000, 0.013986600, - -0.013044600, 0.015736200, -0.026896100, 0.070070300, - 0.989045000, -0.083448600, 0.044296800, -0.026490500, - 0.013820200, -0.002968140, -0.007056910, 0.010433600 }, - { 0.000431643, 0.012692900, -0.015926800, 0.013564100, - -0.012353300, 0.014630100, -0.024996400, 0.065703200, - 0.990085000, -0.080381600, 0.042779400, -0.025572200, - 0.013223500, -0.002577320, -0.007279450, 0.010498200 }, - { 0.000426080, 0.012647200, -0.015712900, 0.013141300, - -0.011662600, 0.013525800, -0.023101700, 0.061364100, - 0.991074000, -0.077278600, 0.041248500, -0.024646800, - 0.012622900, -0.002184730, -0.007502300, 0.010562400 }, - { 0.000421406, 0.012600900, -0.015498200, 0.012718300, - -0.010972500, 0.012423600, -0.021212500, 0.057053200, - 0.992011000, -0.074139500, 0.039704400, -0.023714300, - 0.012018300, -0.001790400, -0.007725430, 0.010626400 }, - { 0.000417579, 0.012553800, -0.015282700, 0.012295200, - -0.010283300, 0.011323700, -0.019328800, 0.052770700, - 0.992897000, -0.070964600, 0.038147100, -0.022774800, - 0.011410000, -0.001394390, -0.007948800, 0.010690100 }, - { 0.000414547, 0.012506100, -0.015066500, 0.011871900, - -0.009594970, 0.010226000, -0.017451100, 0.048517000, - 0.993731000, -0.067754100, 0.036576900, -0.021828400, - 0.010797900, -0.000996745, -0.008172400, 0.010753400 }, - { 0.000412251, 0.012457700, -0.014849700, 0.011448600, - -0.008907620, 0.009130930, -0.015579400, 0.044292300, - 0.994513000, -0.064507900, 0.034994000, -0.020875300, - 0.010182200, -0.000597505, -0.008396190, 0.010816400 }, - { 0.000410621, 0.012408600, -0.014632100, 0.011025300, - -0.008221360, 0.008038500, -0.013714100, 0.040096900, - 0.995244000, -0.061226400, 0.033398500, -0.019915600, - 0.009562800, -0.000196720, -0.008620160, 0.010879200 }, - { 0.000409585, 0.012358900, -0.014414000, 0.010602000, - -0.007536270, 0.006948890, -0.011855400, 0.035931100, - 0.995922000, -0.057909700, 0.031790600, -0.018949300, - 0.008939920, 0.000205562, -0.008844280, 0.010941500 }, - { 0.000409063, 0.012308600, -0.014195300, 0.010178900, - -0.006852470, 0.005862260, -0.010003500, 0.031795100, - 0.996549000, -0.054557800, 0.030170600, -0.017976700, - 0.008313610, 0.000609294, -0.009068510, 0.011003500 }, - { 0.000408972, 0.012257600, -0.013976000, 0.009755990, - -0.006170040, 0.004778750, -0.008158790, 0.027689100, - 0.997124000, -0.051171100, 0.028538400, -0.016997800, - 0.007683930, 0.001014430, -0.009292840, 0.011065200 }, - { 0.000409230, 0.012206100, -0.013756200, 0.009333300, - -0.005489070, 0.003698520, -0.006321360, 0.023613500, - 0.997646000, -0.047749500, 0.026894500, -0.016012700, - 0.007050970, 0.001420910, -0.009517230, 0.011126400 }, - { 0.000409752, 0.012153900, -0.013535900, 0.008910910, - -0.004809650, 0.002621710, -0.004491510, 0.019568500, - 0.998117000, -0.044293400, 0.025238900, -0.015021700, - 0.006414810, 0.001828700, -0.009741670, 0.011187300 }, - { 0.000410456, 0.012101100, -0.013315100, 0.008488880, - -0.004131890, 0.001548470, -0.002669450, 0.015554300, - 0.998535000, -0.040802900, 0.023571800, -0.014024700, - 0.005775510, 0.002237740, -0.009966110, 0.011247800 }, - { 0.000411265, 0.012047800, -0.013093800, 0.008067240, - -0.003455870, 0.000478948, -0.000855436, 0.011571200, - 0.998901000, -0.037278100, 0.021893500, -0.013021900, - 0.005133180, 0.002647990, -0.010190500, 0.011307900 }, - { 0.000412106, 0.011993900, -0.012872200, 0.007646080, - -0.002781680, -0.000586709, 0.000950314, 0.007619390, - 0.999215000, -0.033719300, 0.020204200, -0.012013600, - 0.004487890, 0.003059380, -0.010414900, 0.011367600 }, - { 0.000412915, 0.011939500, -0.012650100, 0.007225430, - -0.002109420, -0.001648360, 0.002747570, 0.003699140, - 0.999477000, -0.030126600, 0.018503900, -0.010999700, - 0.003839710, 0.003471880, -0.010639200, 0.011426900 }, - { 0.000413633, 0.011884500, -0.012427700, 0.006805360, - -0.001439170, -0.002705860, 0.004536100, -0.000189332, - 0.999686000, -0.026500200, 0.016793100, -0.009980360, - 0.003188740, 0.003885440, -0.010863400, 0.011485700 }, - { 0.000414214, 0.011829000, -0.012205000, 0.006385910, - -0.000771025, -0.003759060, 0.006315690, -0.004045800, - 0.999843000, -0.022840300, 0.015071700, -0.008955820, - 0.002535060, 0.004299990, -0.011087500, 0.011544100 }, - { 0.000414623, 0.011773000, -0.011982000, 0.005967150, - -0.000105072, -0.004807840, 0.008086100, -0.007870030, - 0.999948000, -0.019147200, 0.013340200, -0.007926170, - 0.001878750, 0.004715490, -0.011311400, 0.011602000 }, - { 0.000414833, 0.011716500, -0.011758700, 0.005549120, - 0.000558600, -0.005852040, 0.009847130, -0.011661800, - 1.000000000, -0.015420900, 0.011598600, -0.006891530, - 0.001219900, 0.005131880, -0.011535200, 0.011659500 }, + { 0.011659500, -0.011535200, 0.005131880, 0.001219900, + -0.006891530, 0.011598600, -0.015420900, 1.000000000, + -0.011661800, 0.009847130, -0.005852040, 0.000558600, + 0.005549120, -0.011758700, 0.011716500, 0.000414833 }, + { 0.011602000, -0.011311400, 0.004715490, 0.001878750, + -0.007926170, 0.013340200, -0.019147200, 0.999948000, + -0.007870030, 0.008086100, -0.004807840, -0.000105072, + 0.005967150, -0.011982000, 0.011773000, 0.000414623 }, + { 0.011544100, -0.011087500, 0.004299990, 0.002535060, + -0.008955820, 0.015071700, -0.022840300, 0.999843000, + -0.004045800, 0.006315690, -0.003759060, -0.000771025, + 0.006385910, -0.012205000, 0.011829000, 0.000414214 }, + { 0.011485700, -0.010863400, 0.003885440, 0.003188740, + -0.009980360, 0.016793100, -0.026500200, 0.999686000, + -0.000189332, 0.004536100, -0.002705860, -0.001439170, + 0.006805360, -0.012427700, 0.011884500, 0.000413633 }, + { 0.011426900, -0.010639200, 0.003471880, 0.003839710, + -0.010999700, 0.018503900, -0.030126600, 0.999477000, + 0.003699140, 0.002747570, -0.001648360, -0.002109420, + 0.007225430, -0.012650100, 0.011939500, 0.000412915 }, + { 0.011367600, -0.010414900, 0.003059380, 0.004487890, + -0.012013600, 0.020204200, -0.033719300, 0.999215000, + 0.007619390, 0.000950314, -0.000586709, -0.002781680, + 0.007646080, -0.012872200, 0.011993900, 0.000412106 }, + { 0.011307900, -0.010190500, 0.002647990, 0.005133180, + -0.013021900, 0.021893500, -0.037278100, 0.998901000, + 0.011571200, -0.000855436, 0.000478948, -0.003455870, + 0.008067240, -0.013093800, 0.012047800, 0.000411265 }, + { 0.011247800, -0.009966110, 0.002237740, 0.005775510, + -0.014024700, 0.023571800, -0.040802900, 0.998535000, + 0.015554300, -0.002669450, 0.001548470, -0.004131890, + 0.008488880, -0.013315100, 0.012101100, 0.000410456 }, + { 0.011187300, -0.009741670, 0.001828700, 0.006414810, + -0.015021700, 0.025238900, -0.044293400, 0.998117000, + 0.019568500, -0.004491510, 0.002621710, -0.004809650, + 0.008910910, -0.013535900, 0.012153900, 0.000409752 }, + { 0.011126400, -0.009517230, 0.001420910, 0.007050970, + -0.016012700, 0.026894500, -0.047749500, 0.997646000, + 0.023613500, -0.006321360, 0.003698520, -0.005489070, + 0.009333300, -0.013756200, 0.012206100, 0.000409230 }, + { 0.011065200, -0.009292840, 0.001014430, 0.007683930, + -0.016997800, 0.028538400, -0.051171100, 0.997124000, + 0.027689100, -0.008158790, 0.004778750, -0.006170040, + 0.009755990, -0.013976000, 0.012257600, 0.000408972 }, + { 0.011003500, -0.009068510, 0.000609294, 0.008313610, + -0.017976700, 0.030170600, -0.054557800, 0.996549000, + 0.031795100, -0.010003500, 0.005862260, -0.006852470, + 0.010178900, -0.014195300, 0.012308600, 0.000409063 }, + { 0.010941500, -0.008844280, 0.000205562, 0.008939920, + -0.018949300, 0.031790600, -0.057909700, 0.995922000, + 0.035931100, -0.011855400, 0.006948890, -0.007536270, + 0.010602000, -0.014414000, 0.012358900, 0.000409585 }, + { 0.010879200, -0.008620160, -0.000196720, 0.009562800, + -0.019915600, 0.033398500, -0.061226400, 0.995244000, + 0.040096900, -0.013714100, 0.008038500, -0.008221360, + 0.011025300, -0.014632100, 0.012408600, 0.000410621 }, + { 0.010816400, -0.008396190, -0.000597505, 0.010182200, + -0.020875300, 0.034994000, -0.064507900, 0.994513000, + 0.044292300, -0.015579400, 0.009130930, -0.008907620, + 0.011448600, -0.014849700, 0.012457700, 0.000412251 }, + { 0.010753400, -0.008172400, -0.000996745, 0.010797900, + -0.021828400, 0.036576900, -0.067754100, 0.993731000, + 0.048517000, -0.017451100, 0.010226000, -0.009594970, + 0.011871900, -0.015066500, 0.012506100, 0.000414547 }, + { 0.010690100, -0.007948800, -0.001394390, 0.011410000, + -0.022774800, 0.038147100, -0.070964600, 0.992897000, + 0.052770700, -0.019328800, 0.011323700, -0.010283300, + 0.012295200, -0.015282700, 0.012553800, 0.000417579 }, + { 0.010626400, -0.007725430, -0.001790400, 0.012018300, + -0.023714300, 0.039704400, -0.074139500, 0.992011000, + 0.057053200, -0.021212500, 0.012423600, -0.010972500, + 0.012718300, -0.015498200, 0.012600900, 0.000421406 }, + { 0.010562400, -0.007502300, -0.002184730, 0.012622900, + -0.024646800, 0.041248500, -0.077278600, 0.991074000, + 0.061364100, -0.023101700, 0.013525800, -0.011662600, + 0.013141300, -0.015712900, 0.012647200, 0.000426080 }, + { 0.010498200, -0.007279450, -0.002577320, 0.013223500, + -0.025572200, 0.042779400, -0.080381600, 0.990085000, + 0.065703200, -0.024996400, 0.014630100, -0.012353300, + 0.013564100, -0.015926800, 0.012692900, 0.000431643 }, + { 0.010433600, -0.007056910, -0.002968140, 0.013820200, + -0.026490500, 0.044296800, -0.083448600, 0.989045000, + 0.070070300, -0.026896100, 0.015736200, -0.013044600, + 0.013986600, -0.016140000, 0.012737800, 0.000438126 }, + { 0.010368800, -0.006834680, -0.003357130, 0.014412800, + -0.027401400, 0.045800700, -0.086479400, 0.987953000, + 0.074464900, -0.028800600, 0.016844000, -0.013736500, + 0.014408800, -0.016352300, 0.012782000, 0.000445550 }, + { 0.010303700, -0.006612810, -0.003744260, 0.015001400, + -0.028304900, 0.047290800, -0.089473800, 0.986810000, + 0.078886800, -0.030709800, 0.017953500, -0.014428700, + 0.014830600, -0.016563700, 0.012825500, 0.000453924 }, + { 0.010238400, -0.006391310, -0.004129480, 0.015585700, + -0.029200900, 0.048766900, -0.092431700, 0.985617000, + 0.083335800, -0.032623200, 0.019064300, -0.015121200, + 0.015251900, -0.016774300, 0.012868200, 0.000463250 }, + { 0.010172900, -0.006170210, -0.004512750, 0.016165800, + -0.030089200, 0.050229000, -0.095353100, 0.984372000, + 0.087811500, -0.034540800, 0.020176400, -0.015814000, + 0.015672700, -0.016983900, 0.012910200, 0.000473514 }, + { 0.010107100, -0.005949540, -0.004894020, 0.016741600, + -0.030969900, 0.051676900, -0.098237800, 0.983076000, + 0.092313600, -0.036462100, 0.021289600, -0.016506800, + 0.016092900, -0.017192600, 0.012951400, 0.000484696 }, + { 0.010041100, -0.005729310, -0.005273240, 0.017313100, + -0.031842600, 0.053110400, -0.101086000, 0.981730000, + 0.096841900, -0.038386900, 0.022403700, -0.017199700, + 0.016512500, -0.017400200, 0.012991800, 0.000496767 }, + { 0.009974950, -0.005509550, -0.005650390, 0.017880100, + -0.032707500, 0.054529300, -0.103897000, 0.980333000, + 0.101396000, -0.040315000, 0.023518600, -0.017892400, + 0.016931400, -0.017606900, 0.013031400, 0.000509689 }, + { 0.009908570, -0.005290280, -0.006025420, 0.018442500, + -0.033564300, 0.055933600, -0.106671000, 0.978886000, + 0.105975000, -0.042246100, 0.024634100, -0.018585000, + 0.017349500, -0.017812500, 0.013070200, 0.000523415 }, + { 0.009842020, -0.005071530, -0.006398270, 0.019000400, + -0.034413000, 0.057323100, -0.109408000, 0.977388000, + 0.110580000, -0.044180000, 0.025750100, -0.019277200, + 0.017766900, -0.018017000, 0.013108200, 0.000537896 }, + { 0.009775290, -0.004853320, -0.006768930, 0.019553700, + -0.035253500, 0.058697600, -0.112107000, 0.975840000, + 0.115210000, -0.046116200, 0.026866300, -0.019969100, + 0.018183300, -0.018220400, 0.013145400, 0.000553077 }, + { 0.009708410, -0.004635680, -0.007137330, 0.020102300, + -0.036085600, 0.060057000, -0.114770000, 0.974242000, + 0.119864000, -0.048054700, 0.027982600, -0.020660400, + 0.018598800, -0.018422700, 0.013181700, 0.000568899 }, + { 0.009641370, -0.004418620, -0.007503460, 0.020646100, + -0.036909400, 0.061401200, -0.117395000, 0.972595000, + 0.124542000, -0.049995000, 0.029098800, -0.021351200, + 0.019013400, -0.018623700, 0.013217200, 0.000585302 }, + { 0.009574200, -0.004202160, -0.007867250, 0.021185100, + -0.037724600, 0.062730000, -0.119983000, 0.970897000, + 0.129244000, -0.051936900, 0.030214800, -0.022041200, + 0.019426800, -0.018823600, 0.013251800, 0.000602227 }, + { 0.009506900, -0.003986340, -0.008228680, 0.021719200, + -0.038531200, 0.064043400, -0.122533000, 0.969150000, + 0.133970000, -0.053880200, 0.031330400, -0.022730400, + 0.019839200, -0.019022200, 0.013285600, 0.000619615 }, + { 0.009439470, -0.003771170, -0.008587720, 0.022248400, + -0.039329200, 0.065341100, -0.125045000, 0.967354000, + 0.138719000, -0.055824500, 0.032445500, -0.023418700, + 0.020250300, -0.019219600, 0.013318400, 0.000637409 }, + { 0.009371930, -0.003556670, -0.008944310, 0.022772500, + -0.040118300, 0.066623100, -0.127520000, 0.965508000, + 0.143491000, -0.057769600, 0.033559800, -0.024106000, + 0.020660300, -0.019415600, 0.013350400, 0.000655555 }, + { 0.009304290, -0.003342870, -0.009298430, 0.023291700, + -0.040898700, 0.067889200, -0.129958000, 0.963614000, + 0.148285000, -0.059715200, 0.034673200, -0.024792100, + 0.021068900, -0.019610300, 0.013381400, 0.000674005 }, + { 0.009236550, -0.003129790, -0.009650030, 0.023805700, + -0.041670100, 0.069139400, -0.132357000, 0.961670000, + 0.153101000, -0.061661000, 0.035785500, -0.025477100, + 0.021476100, -0.019803700, 0.013411500, 0.000692716 }, + { 0.009168730, -0.002917450, -0.009999080, 0.024314500, + -0.042432500, 0.070373400, -0.134719000, 0.959678000, + 0.157939000, -0.063606700, 0.036896600, -0.026160600, + 0.021882000, -0.019995700, 0.013440700, 0.000711649 }, + { 0.009100820, -0.002705870, -0.010345600, 0.024818200, + -0.043185700, 0.071591300, -0.137043000, 0.957637000, + 0.162799000, -0.065552000, 0.038006300, -0.026842800, + 0.022286300, -0.020186200, 0.013469000, 0.000730774 }, + { 0.009032840, -0.002495060, -0.010689400, 0.025316500, + -0.043929900, 0.072792800, -0.139329000, 0.955548000, + 0.167680000, -0.067496700, 0.039114400, -0.027523400, + 0.022689100, -0.020375300, 0.013496200, 0.000750066 }, + { 0.008964800, -0.002285070, -0.011030600, 0.025809600, + -0.044664700, 0.073977900, -0.141578000, 0.953411000, + 0.172581000, -0.069440400, 0.040220700, -0.028202300, + 0.023090300, -0.020562800, 0.013522500, 0.000769507 }, + { 0.008896700, -0.002075890, -0.011369100, 0.026297300, + -0.045390300, 0.075146500, -0.143788000, 0.951226000, + 0.177503000, -0.071382800, 0.041325100, -0.028879500, + 0.023489900, -0.020748900, 0.013547900, 0.000789086 }, + { 0.008828540, -0.001867560, -0.011704900, 0.026779500, + -0.046106400, 0.076298500, -0.145960000, 0.948994000, + 0.182445000, -0.073323800, 0.042427300, -0.029554900, + 0.023887600, -0.020933400, 0.013572200, 0.000808800 }, + { 0.008760350, -0.001660090, -0.012037900, 0.027256300, + -0.046813100, 0.077433700, -0.148095000, 0.946714000, + 0.187407000, -0.075262900, 0.043527300, -0.030228300, + 0.024283600, -0.021116400, 0.013595500, 0.000828649 }, + { 0.008692120, -0.001453500, -0.012368200, 0.027727600, + -0.047510200, 0.078552200, -0.150191000, 0.944386000, + 0.192388000, -0.077199800, 0.044624900, -0.030899600, + 0.024677800, -0.021297700, 0.013617800, 0.000848641 }, + { 0.008623860, -0.001247820, -0.012695600, 0.028193200, + -0.048197700, 0.079653700, -0.152249000, 0.942012000, + 0.197388000, -0.079134300, 0.045719800, -0.031568700, + 0.025070000, -0.021477300, 0.013639100, 0.000868789 }, + { 0.008555590, -0.001043050, -0.013020200, 0.028653300, + -0.048875600, 0.080738200, -0.154269000, 0.939591000, + 0.202406000, -0.081066100, 0.046811900, -0.032235500, + 0.025460200, -0.021655300, 0.013659300, 0.000889109 }, + { 0.008487300, -0.000839230, -0.013341900, 0.029107700, + -0.049543700, 0.081805600, -0.156252000, 0.937123000, + 0.207442000, -0.082994900, 0.047901000, -0.032900000, + 0.025848400, -0.021831600, 0.013678500, 0.000909621 }, + { 0.008419010, -0.000636364, -0.013660700, 0.029556500, + -0.050202100, 0.082855900, -0.158196000, 0.934609000, + 0.212496000, -0.084920300, 0.048986900, -0.033562000, + 0.026234500, -0.022006200, 0.013696600, 0.000930348 }, + { 0.008350720, -0.000434476, -0.013976600, 0.029999400, + -0.050850500, 0.083888900, -0.160102000, 0.932049000, + 0.217568000, -0.086842200, 0.050069600, -0.034221300, + 0.026618500, -0.022179000, 0.013713600, 0.000951314 }, + { 0.008282450, -0.000233582, -0.014289400, 0.030436600, + -0.051489100, 0.084904600, -0.161970000, 0.929443000, + 0.222657000, -0.088760100, 0.051148700, -0.034878000, + 0.027000200, -0.022350000, 0.013729500, 0.000972545 }, + { 0.008214200, -0.000033699, -0.014599300, 0.030868000, + -0.052117600, 0.085902800, -0.163800000, 0.926792000, + 0.227762000, -0.090673700, 0.052224200, -0.035531800, + 0.027379600, -0.022519100, 0.013744400, 0.000994065 }, + { 0.008145980, 0.000165153, -0.014906200, 0.031293500, + -0.052736100, 0.086883600, -0.165592000, 0.924095000, + 0.232883000, -0.092582800, 0.053295800, -0.036182700, + 0.027756600, -0.022686400, 0.013758100, 0.001015900 }, + { 0.008077800, 0.000362959, -0.015210000, 0.031713100, + -0.053344600, 0.087846900, -0.167346000, 0.921353000, + 0.238020000, -0.094487100, 0.054363300, -0.036830600, + 0.028131300, -0.022851800, 0.013770700, 0.001038070 }, + { 0.008009680, 0.000559702, -0.015510700, 0.032126700, + -0.053942900, 0.088792500, -0.169062000, 0.918566000, + 0.243173000, -0.096386300, 0.055426700, -0.037475400, + 0.028503500, -0.023015300, 0.013782200, 0.001060610 }, + { 0.007941610, 0.000755366, -0.015808300, 0.032534400, + -0.054531000, 0.089720400, -0.170740000, 0.915735000, + 0.248340000, -0.098280000, 0.056485700, -0.038117000, + 0.028873100, -0.023176800, 0.013792600, 0.001083520 }, + { 0.007873600, 0.000949933, -0.016102800, 0.032936000, + -0.055108900, 0.090630600, -0.172380000, 0.912859000, + 0.253523000, -0.100168000, 0.057540100, -0.038755100, + 0.029240200, -0.023336400, 0.013801800, 0.001106820 }, + { 0.007805680, 0.001143390, -0.016394100, 0.033331600, + -0.055676400, 0.091523000, -0.173982000, 0.909939000, + 0.258719000, -0.102050000, 0.058589800, -0.039389900, + 0.029604600, -0.023493900, 0.013809800, 0.001130530 }, + { 0.007737840, 0.001335720, -0.016682300, 0.033721100, + -0.056233700, 0.092397600, -0.175546000, 0.906976000, + 0.263929000, -0.103925000, 0.059634500, -0.040021100, + 0.029966300, -0.023649400, 0.013816700, 0.001154660 }, + { 0.007670090, 0.001526900, -0.016967200, 0.034104500, + -0.056780500, 0.093254300, -0.177073000, 0.903969000, + 0.269153000, -0.105794000, 0.060674200, -0.040648600, + 0.030325200, -0.023802800, 0.013822400, 0.001179210 }, + { 0.007602450, 0.001716930, -0.017248900, 0.034481800, + -0.057317000, 0.094092900, -0.178561000, 0.900919000, + 0.274389000, -0.107656000, 0.061708600, -0.041272400, + 0.030681200, -0.023954100, 0.013826900, 0.001204190 }, + { 0.007534920, 0.001905780, -0.017527400, 0.034852800, + -0.057842900, 0.094913600, -0.180012000, 0.897826000, + 0.279638000, -0.109510000, 0.062737600, -0.041892300, + 0.031034400, -0.024103300, 0.013830200, 0.001229590 }, + { 0.007467500, 0.002093450, -0.017802500, 0.035217700, + -0.058358400, 0.095716300, -0.181426000, 0.894690000, + 0.284899000, -0.111357000, 0.063761000, -0.042508200, + 0.031384600, -0.024250300, 0.013832300, 0.001255410 }, + { 0.007400210, 0.002279910, -0.018074400, 0.035576300, + -0.058863300, 0.096500800, -0.182801000, 0.891512000, + 0.290172000, -0.113196000, 0.064778500, -0.043120000, + 0.031731800, -0.024395100, 0.013833100, 0.001281660 }, + { 0.007333050, 0.002465150, -0.018342900, 0.035928600, + -0.059357700, 0.097267200, -0.184139000, 0.888292000, + 0.295456000, -0.115027000, 0.065790100, -0.043727700, + 0.032075900, -0.024537700, 0.013832800, 0.001308310 }, + { 0.007266020, 0.002649160, -0.018608200, 0.036274700, + -0.059841400, 0.098015500, -0.185440000, 0.885030000, + 0.300751000, -0.116849000, 0.066795600, -0.044331000, + 0.032416900, -0.024678000, 0.013831200, 0.001335360 }, + { 0.007199140, 0.002831930, -0.018870000, 0.036614400, + -0.060314500, 0.098745500, -0.186703000, 0.881727000, + 0.306057000, -0.118663000, 0.067794800, -0.044930000, + 0.032754700, -0.024816100, 0.013828300, 0.001362810 }, + { 0.007132410, 0.003013430, -0.019128500, 0.036947800, + -0.060777000, 0.099457400, -0.187929000, 0.878383000, + 0.311372000, -0.120467000, 0.068787400, -0.045524500, + 0.033089200, -0.024951900, 0.013824200, 0.001390630 }, + { 0.007065840, 0.003193670, -0.019383500, 0.037274800, + -0.061228700, 0.100151000, -0.189118000, 0.874998000, + 0.316697000, -0.122261000, 0.069773400, -0.046114300, + 0.033420400, -0.025085300, 0.013818800, 0.001418820 }, + { 0.006999420, 0.003372610, -0.019635200, 0.037595400, + -0.061669700, 0.100826000, -0.190269000, 0.871573000, + 0.322032000, -0.124046000, 0.070752600, -0.046699500, + 0.033748200, -0.025216300, 0.013812100, 0.001447370 }, + { 0.006933170, 0.003550250, -0.019883400, 0.037909600, + -0.062100000, 0.101483000, -0.191383000, 0.868108000, + 0.327374000, -0.125821000, 0.071724700, -0.047279900, + 0.034072600, -0.025345000, 0.013804200, 0.001476260 }, + { 0.006867080, 0.003726580, -0.020128100, 0.038217400, + -0.062519400, 0.102122000, -0.192461000, 0.864602000, + 0.332726000, -0.127585000, 0.072689700, -0.047855300, + 0.034393500, -0.025471200, 0.013794900, 0.001505490 }, + { 0.006801170, 0.003901590, -0.020369400, 0.038518700, + -0.062928100, 0.102742000, -0.193501000, 0.861058000, + 0.338085000, -0.129339000, 0.073647200, -0.048425700, + 0.034710800, -0.025595000, 0.013784300, 0.001535060 }, + { 0.006735430, 0.004075260, -0.020607200, 0.038813500, + -0.063325900, 0.103344000, -0.194505000, 0.857474000, + 0.343451000, -0.131082000, 0.074597300, -0.048991000, + 0.035024600, -0.025716300, 0.013772400, 0.001564950 }, + { 0.006669880, 0.004247570, -0.020841500, 0.039101900, + -0.063712900, 0.103928000, -0.195471000, 0.853851000, + 0.348824000, -0.132813000, 0.075539700, -0.049551100, + 0.035334600, -0.025835000, 0.013759200, 0.001595150 }, + { 0.006604510, 0.004418520, -0.021072300, 0.039383700, + -0.064089100, 0.104493000, -0.196402000, 0.850190000, + 0.354204000, -0.134532000, 0.076474100, -0.050105900, + 0.035641000, -0.025951300, 0.013744600, 0.001625680 }, + { 0.006539330, 0.004588100, -0.021299500, 0.039659100, + -0.064454400, 0.105040000, -0.197295000, 0.846491000, + 0.359590000, -0.136240000, 0.077400500, -0.050655300, + 0.035943500, -0.026065000, 0.013728700, 0.001656520 }, + { 0.006474340, 0.004756290, -0.021523200, 0.039927800, + -0.064808800, 0.105568000, -0.198153000, 0.842754000, + 0.364982000, -0.137935000, 0.078318700, -0.051199100, + 0.036242200, -0.026176100, 0.013711400, 0.001687680 }, + { 0.006409560, 0.004923090, -0.021743400, 0.040190100, + -0.065152300, 0.106078000, -0.198974000, 0.838980000, + 0.370379000, -0.139618000, 0.079228600, -0.051737300, + 0.036537000, -0.026284600, 0.013692700, 0.001719160 }, + { 0.006344970, 0.005088480, -0.021959900, 0.040445700, + -0.065484900, 0.106570000, -0.199758000, 0.835168000, + 0.375780000, -0.141287000, 0.080129800, -0.052269800, + 0.036827900, -0.026390400, 0.013672700, 0.001750970 }, + { 0.006280600, 0.005252450, -0.022172900, 0.040694800, + -0.065806500, 0.107043000, -0.200507000, 0.831320000, + 0.381186000, -0.142944000, 0.081022300, -0.052796500, + 0.037114800, -0.026493600, 0.013651200, 0.001783110 }, + { 0.006216440, 0.005415000, -0.022382300, 0.040937300, + -0.066117300, 0.107498000, -0.201220000, 0.827436000, + 0.386596000, -0.144586000, 0.081905900, -0.053317300, + 0.037397500, -0.026594100, 0.013628400, 0.001815590 }, + { 0.006152510, 0.005576110, -0.022588000, 0.041173200, + -0.066417100, 0.107935000, -0.201897000, 0.823515000, + 0.392009000, -0.146215000, 0.082780500, -0.053832000, + 0.037676200, -0.026691800, 0.013604200, 0.001848420 }, + { 0.006088800, 0.005735770, -0.022790200, 0.041402500, + -0.066706000, 0.108353000, -0.202539000, 0.819559000, + 0.397425000, -0.147830000, 0.083645800, -0.054340600, + 0.037950700, -0.026786800, 0.013578500, 0.001881610 }, + { 0.006025320, 0.005893980, -0.022988700, 0.041625200, + -0.066983900, 0.108753000, -0.203145000, 0.815568000, + 0.402843000, -0.149431000, 0.084501700, -0.054843000, + 0.038221000, -0.026879000, 0.013551500, 0.001915170 }, + { 0.005962090, 0.006050720, -0.023183600, 0.041841300, + -0.067250900, 0.109135000, -0.203715000, 0.811542000, + 0.408264000, -0.151016000, 0.085348100, -0.055339100, + 0.038486900, -0.026968500, 0.013523000, 0.001949110 }, + { 0.005899110, 0.006205990, -0.023374800, 0.042050800, + -0.067507000, 0.109498000, -0.204250000, 0.807481000, + 0.413686000, -0.152586000, 0.086184700, -0.055828800, + 0.038748600, -0.027055100, 0.013493100, 0.001983430 }, + { 0.005836370, 0.006359780, -0.023562400, 0.042253600, + -0.067752100, 0.109843000, -0.204751000, 0.803387000, + 0.419109000, -0.154141000, 0.087011400, -0.056312000, + 0.039005800, -0.027138800, 0.013461700, 0.002018150 }, + { 0.005773900, 0.006512080, -0.023746300, 0.042449800, + -0.067986300, 0.110170000, -0.205216000, 0.799258000, + 0.424533000, -0.155681000, 0.087828100, -0.056788600, + 0.039258600, -0.027219700, 0.013428900, 0.002053260 }, + { 0.005711700, 0.006662890, -0.023926500, 0.042639300, + -0.068209600, 0.110479000, -0.205646000, 0.795096000, + 0.429957000, -0.157204000, 0.088634500, -0.057258500, + 0.039506900, -0.027297700, 0.013394600, 0.002088790 }, + { 0.005649770, 0.006812190, -0.024103100, 0.042822200, + -0.068422000, 0.110769000, -0.206042000, 0.790902000, + 0.435380000, -0.158711000, 0.089430600, -0.057721700, + 0.039750700, -0.027372700, 0.013358900, 0.002124730 }, + { 0.005588130, 0.006959980, -0.024275900, 0.042998500, + -0.068623400, 0.111041000, -0.206403000, 0.786674000, + 0.440803000, -0.160201000, 0.090216100, -0.058177900, + 0.039989900, -0.027444800, 0.013321700, 0.002161090 }, + { 0.005526770, 0.007106250, -0.024445100, 0.043168100, + -0.068814000, 0.111295000, -0.206731000, 0.782415000, + 0.446225000, -0.161674000, 0.090990900, -0.058627200, + 0.040224400, -0.027514000, 0.013283000, 0.002197860 }, + { 0.005465700, 0.007251000, -0.024610600, 0.043331100, + -0.068993700, 0.111531000, -0.207023000, 0.778123000, + 0.451645000, -0.163130000, 0.091754800, -0.059069400, + 0.040454200, -0.027580100, 0.013242800, 0.002235060 }, + { 0.005404930, 0.007394220, -0.024772300, 0.043487500, + -0.069162500, 0.111750000, -0.207282000, 0.773801000, + 0.457063000, -0.164568000, 0.092507700, -0.059504500, + 0.040679200, -0.027643200, 0.013201200, 0.002272680 }, + { 0.005344460, 0.007535900, -0.024930400, 0.043637200, + -0.069320400, 0.111950000, -0.207508000, 0.769447000, + 0.462478000, -0.165988000, 0.093249500, -0.059932300, + 0.040899500, -0.027703300, 0.013158100, 0.002310720 }, + { 0.005284290, 0.007676030, -0.025084700, 0.043780300, + -0.069467500, 0.112132000, -0.207699000, 0.765063000, + 0.467891000, -0.167391000, 0.093979900, -0.060352800, + 0.041114900, -0.027760300, 0.013113400, 0.002349170 }, + { 0.005224440, 0.007814610, -0.025235300, 0.043916800, + -0.069603800, 0.112296000, -0.207857000, 0.760649000, + 0.473299000, -0.168774000, 0.094698800, -0.060765800, + 0.041325400, -0.027814200, 0.013067200, 0.002388040 }, + { 0.005164890, 0.007951640, -0.025382200, 0.044046600, + -0.069729300, 0.112442000, -0.207982000, 0.756204000, + 0.478704000, -0.170139000, 0.095406000, -0.061171400, + 0.041530900, -0.027865000, 0.013019600, 0.002427310 }, + { 0.005105670, 0.008087110, -0.025525400, 0.044169900, + -0.069844000, 0.112571000, -0.208074000, 0.751731000, + 0.484104000, -0.171485000, 0.096101500, -0.061569300, + 0.041731400, -0.027912700, 0.012970400, 0.002466990 }, + { 0.005046750, 0.008221000, -0.025664900, 0.044286500, + -0.069947900, 0.112682000, -0.208133000, 0.747228000, + 0.489500000, -0.172811000, 0.096785000, -0.061959600, + 0.041926900, -0.027957300, 0.012919600, 0.002507070 }, + { 0.004988160, 0.008353330, -0.025800600, 0.044396600, + -0.070041100, 0.112775000, -0.208159000, 0.742698000, + 0.494890000, -0.174118000, 0.097456400, -0.062342100, + 0.042117300, -0.027998600, 0.012867400, 0.002547540 }, + { 0.004929880, 0.008484080, -0.025932700, 0.044500000, + -0.070123600, 0.112850000, -0.208153000, 0.738138000, + 0.500274000, -0.175405000, 0.098115500, -0.062716700, + 0.042302600, -0.028036800, 0.012813600, 0.002588390 }, + { 0.004871920, 0.008613240, -0.026060900, 0.044596900, + -0.070195500, 0.112908000, -0.208114000, 0.733552000, + 0.505652000, -0.176671000, 0.098762300, -0.063083500, + 0.042482700, -0.028071700, 0.012758200, 0.002629630 }, + { 0.004814280, 0.008740820, -0.026185500, 0.044687200, + -0.070256600, 0.112949000, -0.208043000, 0.728938000, + 0.511023000, -0.177917000, 0.099396500, -0.063442100, + 0.042657500, -0.028103500, 0.012701300, 0.002671240 }, + { 0.004756970, 0.008866800, -0.026306400, 0.044771000, + -0.070307200, 0.112972000, -0.207941000, 0.724297000, + 0.516386000, -0.179142000, 0.100018000, -0.063792700, + 0.042827100, -0.028131900, 0.012642800, 0.002713230 }, + { 0.004699970, 0.008991190, -0.026423500, 0.044848200, + -0.070347100, 0.112977000, -0.207806000, 0.719630000, + 0.521742000, -0.180346000, 0.100627000, -0.064135100, + 0.042991400, -0.028157100, 0.012582800, 0.002755580 }, + { 0.004643290, 0.009113970, -0.026536900, 0.044918900, + -0.070376500, 0.112966000, -0.207641000, 0.714936000, + 0.527090000, -0.181528000, 0.101222000, -0.064469200, + 0.043150300, -0.028179000, 0.012521200, 0.002798310 }, + { 0.004586940, 0.009235160, -0.026646600, 0.044983100, + -0.070395400, 0.112937000, -0.207444000, 0.710218000, + 0.532429000, -0.182688000, 0.101805000, -0.064795000, + 0.043303700, -0.028197600, 0.012458000, 0.002841390 }, + { 0.004530910, 0.009354740, -0.026752600, 0.045040800, + -0.070403800, 0.112891000, -0.207216000, 0.705474000, + 0.537759000, -0.183827000, 0.102374000, -0.065112400, + 0.043451800, -0.028212900, 0.012393300, 0.002884840 }, + { 0.004475210, 0.009472700, -0.026854800, 0.045092000, + -0.070401800, 0.112828000, -0.206957000, 0.700705000, + 0.543079000, -0.184943000, 0.102930000, -0.065421200, + 0.043594300, -0.028224800, 0.012327000, 0.002928660 }, + { 0.004419840, 0.009589060, -0.026953400, 0.045136800, + -0.070389300, 0.112748000, -0.206667000, 0.695912000, + 0.548389000, -0.186036000, 0.103473000, -0.065721500, + 0.043731300, -0.028233400, 0.012259000, 0.002972840 }, + { 0.004364790, 0.009703800, -0.027048300, 0.045175100, + -0.070366500, 0.112651000, -0.206347000, 0.691096000, + 0.553689000, -0.187106000, 0.104001000, -0.066013100, + 0.043862800, -0.028238600, 0.012189500, 0.003017380 }, + { 0.004310080, 0.009816920, -0.027139400, 0.045207000, + -0.070333300, 0.112537000, -0.205997000, 0.686256000, + 0.558978000, -0.188154000, 0.104516000, -0.066296000, + 0.043988600, -0.028240400, 0.012118400, 0.003062300 }, + { 0.004255710, 0.009928420, -0.027226900, 0.045232400, + -0.070289900, 0.112406000, -0.205617000, 0.681393000, + 0.564255000, -0.189177000, 0.105017000, -0.066570100, + 0.044108700, -0.028238700, 0.012045700, 0.003107590 }, + { 0.004201670, 0.010038300, -0.027310700, 0.045251500, + -0.070236200, 0.112259000, -0.205208000, 0.676508000, + 0.569520000, -0.190177000, 0.105504000, -0.066835300, + 0.044223200, -0.028233700, 0.011971400, 0.003153250 }, + { 0.004147990, 0.010146600, -0.027390800, 0.045264300, + -0.070172300, 0.112096000, -0.204769000, 0.671600000, + 0.574773000, -0.191153000, 0.105976000, -0.067091500, + 0.044332000, -0.028225200, 0.011895500, 0.003199290 }, + { 0.004094650, 0.010253200, -0.027467200, 0.045270600, + -0.070098300, 0.111916000, -0.204300000, 0.666671000, + 0.580013000, -0.192105000, 0.106435000, -0.067338800, + 0.044435000, -0.028213200, 0.011818000, 0.003245720 }, + { 0.004041660, 0.010358200, -0.027540000, 0.045270700, + -0.070014200, 0.111719000, -0.203803000, 0.661721000, + 0.585239000, -0.193032000, 0.106879000, -0.067576900, + 0.044532100, -0.028197800, 0.011738900, 0.003292530 }, + { 0.003989040, 0.010461600, -0.027609100, 0.045264500, + -0.069920000, 0.111506000, -0.203277000, 0.656750000, + 0.590452000, -0.193934000, 0.107308000, -0.067805900, + 0.044623500, -0.028178800, 0.011658200, 0.003339730 }, + { 0.003936790, 0.010563400, -0.027674600, 0.045252000, + -0.069815800, 0.111277000, -0.202722000, 0.651759000, + 0.595651000, -0.194811000, 0.107722000, -0.068025700, + 0.044708900, -0.028156400, 0.011575800, 0.003387320 }, + { 0.003884900, 0.010663500, -0.027736400, 0.045233300, + -0.069701700, 0.111032000, -0.202139000, 0.646748000, + 0.600834000, -0.195663000, 0.108122000, -0.068236100, + 0.044788500, -0.028130400, 0.011491900, 0.003435300 }, + { 0.003833390, 0.010762100, -0.027794600, 0.045208300, + -0.069577700, 0.110771000, -0.201528000, 0.641718000, + 0.606003000, -0.196489000, 0.108507000, -0.068437200, + 0.044862100, -0.028101000, 0.011406300, 0.003483680 }, + { 0.003782260, 0.010859000, -0.027849100, 0.045177200, + -0.069443800, 0.110495000, -0.200890000, 0.636669000, + 0.611156000, -0.197289000, 0.108877000, -0.068628900, + 0.044929800, -0.028067900, 0.011319200, 0.003532460 }, + { 0.003731520, 0.010954200, -0.027900100, 0.045139900, + -0.069300200, 0.110202000, -0.200223000, 0.631601000, + 0.616292000, -0.198062000, 0.109231000, -0.068811100, + 0.044991400, -0.028031300, 0.011230400, 0.003581630 }, + { 0.003681160, 0.011047900, -0.027947400, 0.045096500, + -0.069146800, 0.109894000, -0.199530000, 0.626516000, + 0.621413000, -0.198809000, 0.109570000, -0.068983800, + 0.045047000, -0.027991200, 0.011139900, 0.003631200 }, + { 0.003631200, 0.011139900, -0.027991200, 0.045047000, + -0.068983800, 0.109570000, -0.198809000, 0.621413000, + 0.626516000, -0.199530000, 0.109894000, -0.069146800, + 0.045096500, -0.027947400, 0.011047900, 0.003681160 }, + { 0.003581630, 0.011230400, -0.028031300, 0.044991400, + -0.068811100, 0.109231000, -0.198062000, 0.616292000, + 0.631601000, -0.200223000, 0.110202000, -0.069300200, + 0.045139900, -0.027900100, 0.010954200, 0.003731520 }, + { 0.003532460, 0.011319200, -0.028067900, 0.044929800, + -0.068628900, 0.108877000, -0.197289000, 0.611156000, + 0.636669000, -0.200890000, 0.110495000, -0.069443800, + 0.045177200, -0.027849100, 0.010859000, 0.003782260 }, + { 0.003483680, 0.011406300, -0.028101000, 0.044862100, + -0.068437200, 0.108507000, -0.196489000, 0.606003000, + 0.641718000, -0.201528000, 0.110771000, -0.069577700, + 0.045208300, -0.027794600, 0.010762100, 0.003833390 }, + { 0.003435300, 0.011491900, -0.028130400, 0.044788500, + -0.068236100, 0.108122000, -0.195663000, 0.600834000, + 0.646748000, -0.202139000, 0.111032000, -0.069701700, + 0.045233300, -0.027736400, 0.010663500, 0.003884900 }, + { 0.003387320, 0.011575800, -0.028156400, 0.044708900, + -0.068025700, 0.107722000, -0.194811000, 0.595651000, + 0.651759000, -0.202722000, 0.111277000, -0.069815800, + 0.045252000, -0.027674600, 0.010563400, 0.003936790 }, + { 0.003339730, 0.011658200, -0.028178800, 0.044623500, + -0.067805900, 0.107308000, -0.193934000, 0.590452000, + 0.656750000, -0.203277000, 0.111506000, -0.069920000, + 0.045264500, -0.027609100, 0.010461600, 0.003989040 }, + { 0.003292530, 0.011738900, -0.028197800, 0.044532100, + -0.067576900, 0.106879000, -0.193032000, 0.585239000, + 0.661721000, -0.203803000, 0.111719000, -0.070014200, + 0.045270700, -0.027540000, 0.010358200, 0.004041660 }, + { 0.003245720, 0.011818000, -0.028213200, 0.044435000, + -0.067338800, 0.106435000, -0.192105000, 0.580013000, + 0.666671000, -0.204300000, 0.111916000, -0.070098300, + 0.045270600, -0.027467200, 0.010253200, 0.004094650 }, + { 0.003199290, 0.011895500, -0.028225200, 0.044332000, + -0.067091500, 0.105976000, -0.191153000, 0.574773000, + 0.671600000, -0.204769000, 0.112096000, -0.070172300, + 0.045264300, -0.027390800, 0.010146600, 0.004147990 }, + { 0.003153250, 0.011971400, -0.028233700, 0.044223200, + -0.066835300, 0.105504000, -0.190177000, 0.569520000, + 0.676508000, -0.205208000, 0.112259000, -0.070236200, + 0.045251500, -0.027310700, 0.010038300, 0.004201670 }, + { 0.003107590, 0.012045700, -0.028238700, 0.044108700, + -0.066570100, 0.105017000, -0.189177000, 0.564255000, + 0.681393000, -0.205617000, 0.112406000, -0.070289900, + 0.045232400, -0.027226900, 0.009928420, 0.004255710 }, + { 0.003062300, 0.012118400, -0.028240400, 0.043988600, + -0.066296000, 0.104516000, -0.188154000, 0.558978000, + 0.686256000, -0.205997000, 0.112537000, -0.070333300, + 0.045207000, -0.027139400, 0.009816920, 0.004310080 }, + { 0.003017380, 0.012189500, -0.028238600, 0.043862800, + -0.066013100, 0.104001000, -0.187106000, 0.553689000, + 0.691096000, -0.206347000, 0.112651000, -0.070366500, + 0.045175100, -0.027048300, 0.009703800, 0.004364790 }, + { 0.002972840, 0.012259000, -0.028233400, 0.043731300, + -0.065721500, 0.103473000, -0.186036000, 0.548389000, + 0.695912000, -0.206667000, 0.112748000, -0.070389300, + 0.045136800, -0.026953400, 0.009589060, 0.004419840 }, + { 0.002928660, 0.012327000, -0.028224800, 0.043594300, + -0.065421200, 0.102930000, -0.184943000, 0.543079000, + 0.700705000, -0.206957000, 0.112828000, -0.070401800, + 0.045092000, -0.026854800, 0.009472700, 0.004475210 }, + { 0.002884840, 0.012393300, -0.028212900, 0.043451800, + -0.065112400, 0.102374000, -0.183827000, 0.537759000, + 0.705474000, -0.207216000, 0.112891000, -0.070403800, + 0.045040800, -0.026752600, 0.009354740, 0.004530910 }, + { 0.002841390, 0.012458000, -0.028197600, 0.043303700, + -0.064795000, 0.101805000, -0.182688000, 0.532429000, + 0.710218000, -0.207444000, 0.112937000, -0.070395400, + 0.044983100, -0.026646600, 0.009235160, 0.004586940 }, + { 0.002798310, 0.012521200, -0.028179000, 0.043150300, + -0.064469200, 0.101222000, -0.181528000, 0.527090000, + 0.714936000, -0.207641000, 0.112966000, -0.070376500, + 0.044918900, -0.026536900, 0.009113970, 0.004643290 }, + { 0.002755580, 0.012582800, -0.028157100, 0.042991400, + -0.064135100, 0.100627000, -0.180346000, 0.521742000, + 0.719630000, -0.207806000, 0.112977000, -0.070347100, + 0.044848200, -0.026423500, 0.008991190, 0.004699970 }, + { 0.002713230, 0.012642800, -0.028131900, 0.042827100, + -0.063792700, 0.100018000, -0.179142000, 0.516386000, + 0.724297000, -0.207941000, 0.112972000, -0.070307200, + 0.044771000, -0.026306400, 0.008866800, 0.004756970 }, + { 0.002671240, 0.012701300, -0.028103500, 0.042657500, + -0.063442100, 0.099396500, -0.177917000, 0.511023000, + 0.728938000, -0.208043000, 0.112949000, -0.070256600, + 0.044687200, -0.026185500, 0.008740820, 0.004814280 }, + { 0.002629630, 0.012758200, -0.028071700, 0.042482700, + -0.063083500, 0.098762300, -0.176671000, 0.505652000, + 0.733552000, -0.208114000, 0.112908000, -0.070195500, + 0.044596900, -0.026060900, 0.008613240, 0.004871920 }, + { 0.002588390, 0.012813600, -0.028036800, 0.042302600, + -0.062716700, 0.098115500, -0.175405000, 0.500274000, + 0.738138000, -0.208153000, 0.112850000, -0.070123600, + 0.044500000, -0.025932700, 0.008484080, 0.004929880 }, + { 0.002547540, 0.012867400, -0.027998600, 0.042117300, + -0.062342100, 0.097456400, -0.174118000, 0.494890000, + 0.742698000, -0.208159000, 0.112775000, -0.070041100, + 0.044396600, -0.025800600, 0.008353330, 0.004988160 }, + { 0.002507070, 0.012919600, -0.027957300, 0.041926900, + -0.061959600, 0.096785000, -0.172811000, 0.489500000, + 0.747228000, -0.208133000, 0.112682000, -0.069947900, + 0.044286500, -0.025664900, 0.008221000, 0.005046750 }, + { 0.002466990, 0.012970400, -0.027912700, 0.041731400, + -0.061569300, 0.096101500, -0.171485000, 0.484104000, + 0.751731000, -0.208074000, 0.112571000, -0.069844000, + 0.044169900, -0.025525400, 0.008087110, 0.005105670 }, + { 0.002427310, 0.013019600, -0.027865000, 0.041530900, + -0.061171400, 0.095406000, -0.170139000, 0.478704000, + 0.756204000, -0.207982000, 0.112442000, -0.069729300, + 0.044046600, -0.025382200, 0.007951640, 0.005164890 }, + { 0.002388040, 0.013067200, -0.027814200, 0.041325400, + -0.060765800, 0.094698800, -0.168774000, 0.473299000, + 0.760649000, -0.207857000, 0.112296000, -0.069603800, + 0.043916800, -0.025235300, 0.007814610, 0.005224440 }, + { 0.002349170, 0.013113400, -0.027760300, 0.041114900, + -0.060352800, 0.093979900, -0.167391000, 0.467891000, + 0.765063000, -0.207699000, 0.112132000, -0.069467500, + 0.043780300, -0.025084700, 0.007676030, 0.005284290 }, + { 0.002310720, 0.013158100, -0.027703300, 0.040899500, + -0.059932300, 0.093249500, -0.165988000, 0.462478000, + 0.769447000, -0.207508000, 0.111950000, -0.069320400, + 0.043637200, -0.024930400, 0.007535900, 0.005344460 }, + { 0.002272680, 0.013201200, -0.027643200, 0.040679200, + -0.059504500, 0.092507700, -0.164568000, 0.457063000, + 0.773801000, -0.207282000, 0.111750000, -0.069162500, + 0.043487500, -0.024772300, 0.007394220, 0.005404930 }, + { 0.002235060, 0.013242800, -0.027580100, 0.040454200, + -0.059069400, 0.091754800, -0.163130000, 0.451645000, + 0.778123000, -0.207023000, 0.111531000, -0.068993700, + 0.043331100, -0.024610600, 0.007251000, 0.005465700 }, + { 0.002197860, 0.013283000, -0.027514000, 0.040224400, + -0.058627200, 0.090990900, -0.161674000, 0.446225000, + 0.782415000, -0.206731000, 0.111295000, -0.068814000, + 0.043168100, -0.024445100, 0.007106250, 0.005526770 }, + { 0.002161090, 0.013321700, -0.027444800, 0.039989900, + -0.058177900, 0.090216100, -0.160201000, 0.440803000, + 0.786674000, -0.206403000, 0.111041000, -0.068623400, + 0.042998500, -0.024275900, 0.006959980, 0.005588130 }, + { 0.002124730, 0.013358900, -0.027372700, 0.039750700, + -0.057721700, 0.089430600, -0.158711000, 0.435380000, + 0.790902000, -0.206042000, 0.110769000, -0.068422000, + 0.042822200, -0.024103100, 0.006812190, 0.005649770 }, + { 0.002088790, 0.013394600, -0.027297700, 0.039506900, + -0.057258500, 0.088634500, -0.157204000, 0.429957000, + 0.795096000, -0.205646000, 0.110479000, -0.068209600, + 0.042639300, -0.023926500, 0.006662890, 0.005711700 }, + { 0.002053260, 0.013428900, -0.027219700, 0.039258600, + -0.056788600, 0.087828100, -0.155681000, 0.424533000, + 0.799258000, -0.205216000, 0.110170000, -0.067986300, + 0.042449800, -0.023746300, 0.006512080, 0.005773900 }, + { 0.002018150, 0.013461700, -0.027138800, 0.039005800, + -0.056312000, 0.087011400, -0.154141000, 0.419109000, + 0.803387000, -0.204751000, 0.109843000, -0.067752100, + 0.042253600, -0.023562400, 0.006359780, 0.005836370 }, + { 0.001983430, 0.013493100, -0.027055100, 0.038748600, + -0.055828800, 0.086184700, -0.152586000, 0.413686000, + 0.807481000, -0.204250000, 0.109498000, -0.067507000, + 0.042050800, -0.023374800, 0.006205990, 0.005899110 }, + { 0.001949110, 0.013523000, -0.026968500, 0.038486900, + -0.055339100, 0.085348100, -0.151016000, 0.408264000, + 0.811542000, -0.203715000, 0.109135000, -0.067250900, + 0.041841300, -0.023183600, 0.006050720, 0.005962090 }, + { 0.001915170, 0.013551500, -0.026879000, 0.038221000, + -0.054843000, 0.084501700, -0.149431000, 0.402843000, + 0.815568000, -0.203145000, 0.108753000, -0.066983900, + 0.041625200, -0.022988700, 0.005893980, 0.006025320 }, + { 0.001881610, 0.013578500, -0.026786800, 0.037950700, + -0.054340600, 0.083645800, -0.147830000, 0.397425000, + 0.819559000, -0.202539000, 0.108353000, -0.066706000, + 0.041402500, -0.022790200, 0.005735770, 0.006088800 }, + { 0.001848420, 0.013604200, -0.026691800, 0.037676200, + -0.053832000, 0.082780500, -0.146215000, 0.392009000, + 0.823515000, -0.201897000, 0.107935000, -0.066417100, + 0.041173200, -0.022588000, 0.005576110, 0.006152510 }, + { 0.001815590, 0.013628400, -0.026594100, 0.037397500, + -0.053317300, 0.081905900, -0.144586000, 0.386596000, + 0.827436000, -0.201220000, 0.107498000, -0.066117300, + 0.040937300, -0.022382300, 0.005415000, 0.006216440 }, + { 0.001783110, 0.013651200, -0.026493600, 0.037114800, + -0.052796500, 0.081022300, -0.142944000, 0.381186000, + 0.831320000, -0.200507000, 0.107043000, -0.065806500, + 0.040694800, -0.022172900, 0.005252450, 0.006280600 }, + { 0.001750970, 0.013672700, -0.026390400, 0.036827900, + -0.052269800, 0.080129800, -0.141287000, 0.375780000, + 0.835168000, -0.199758000, 0.106570000, -0.065484900, + 0.040445700, -0.021959900, 0.005088480, 0.006344970 }, + { 0.001719160, 0.013692700, -0.026284600, 0.036537000, + -0.051737300, 0.079228600, -0.139618000, 0.370379000, + 0.838980000, -0.198974000, 0.106078000, -0.065152300, + 0.040190100, -0.021743400, 0.004923090, 0.006409560 }, + { 0.001687680, 0.013711400, -0.026176100, 0.036242200, + -0.051199100, 0.078318700, -0.137935000, 0.364982000, + 0.842754000, -0.198153000, 0.105568000, -0.064808800, + 0.039927800, -0.021523200, 0.004756290, 0.006474340 }, + { 0.001656520, 0.013728700, -0.026065000, 0.035943500, + -0.050655300, 0.077400500, -0.136240000, 0.359590000, + 0.846491000, -0.197295000, 0.105040000, -0.064454400, + 0.039659100, -0.021299500, 0.004588100, 0.006539330 }, + { 0.001625680, 0.013744600, -0.025951300, 0.035641000, + -0.050105900, 0.076474100, -0.134532000, 0.354204000, + 0.850190000, -0.196402000, 0.104493000, -0.064089100, + 0.039383700, -0.021072300, 0.004418520, 0.006604510 }, + { 0.001595150, 0.013759200, -0.025835000, 0.035334600, + -0.049551100, 0.075539700, -0.132813000, 0.348824000, + 0.853851000, -0.195471000, 0.103928000, -0.063712900, + 0.039101900, -0.020841500, 0.004247570, 0.006669880 }, + { 0.001564950, 0.013772400, -0.025716300, 0.035024600, + -0.048991000, 0.074597300, -0.131082000, 0.343451000, + 0.857474000, -0.194505000, 0.103344000, -0.063325900, + 0.038813500, -0.020607200, 0.004075260, 0.006735430 }, + { 0.001535060, 0.013784300, -0.025595000, 0.034710800, + -0.048425700, 0.073647200, -0.129339000, 0.338085000, + 0.861058000, -0.193501000, 0.102742000, -0.062928100, + 0.038518700, -0.020369400, 0.003901590, 0.006801170 }, + { 0.001505490, 0.013794900, -0.025471200, 0.034393500, + -0.047855300, 0.072689700, -0.127585000, 0.332726000, + 0.864602000, -0.192461000, 0.102122000, -0.062519400, + 0.038217400, -0.020128100, 0.003726580, 0.006867080 }, + { 0.001476260, 0.013804200, -0.025345000, 0.034072600, + -0.047279900, 0.071724700, -0.125821000, 0.327374000, + 0.868108000, -0.191383000, 0.101483000, -0.062100000, + 0.037909600, -0.019883400, 0.003550250, 0.006933170 }, + { 0.001447370, 0.013812100, -0.025216300, 0.033748200, + -0.046699500, 0.070752600, -0.124046000, 0.322032000, + 0.871573000, -0.190269000, 0.100826000, -0.061669700, + 0.037595400, -0.019635200, 0.003372610, 0.006999420 }, + { 0.001418820, 0.013818800, -0.025085300, 0.033420400, + -0.046114300, 0.069773400, -0.122261000, 0.316697000, + 0.874998000, -0.189118000, 0.100151000, -0.061228700, + 0.037274800, -0.019383500, 0.003193670, 0.007065840 }, + { 0.001390630, 0.013824200, -0.024951900, 0.033089200, + -0.045524500, 0.068787400, -0.120467000, 0.311372000, + 0.878383000, -0.187929000, 0.099457400, -0.060777000, + 0.036947800, -0.019128500, 0.003013430, 0.007132410 }, + { 0.001362810, 0.013828300, -0.024816100, 0.032754700, + -0.044930000, 0.067794800, -0.118663000, 0.306057000, + 0.881727000, -0.186703000, 0.098745500, -0.060314500, + 0.036614400, -0.018870000, 0.002831930, 0.007199140 }, + { 0.001335360, 0.013831200, -0.024678000, 0.032416900, + -0.044331000, 0.066795600, -0.116849000, 0.300751000, + 0.885030000, -0.185440000, 0.098015500, -0.059841400, + 0.036274700, -0.018608200, 0.002649160, 0.007266020 }, + { 0.001308310, 0.013832800, -0.024537700, 0.032075900, + -0.043727700, 0.065790100, -0.115027000, 0.295456000, + 0.888292000, -0.184139000, 0.097267200, -0.059357700, + 0.035928600, -0.018342900, 0.002465150, 0.007333050 }, + { 0.001281660, 0.013833100, -0.024395100, 0.031731800, + -0.043120000, 0.064778500, -0.113196000, 0.290172000, + 0.891512000, -0.182801000, 0.096500800, -0.058863300, + 0.035576300, -0.018074400, 0.002279910, 0.007400210 }, + { 0.001255410, 0.013832300, -0.024250300, 0.031384600, + -0.042508200, 0.063761000, -0.111357000, 0.284899000, + 0.894690000, -0.181426000, 0.095716300, -0.058358400, + 0.035217700, -0.017802500, 0.002093450, 0.007467500 }, + { 0.001229590, 0.013830200, -0.024103300, 0.031034400, + -0.041892300, 0.062737600, -0.109510000, 0.279638000, + 0.897826000, -0.180012000, 0.094913600, -0.057842900, + 0.034852800, -0.017527400, 0.001905780, 0.007534920 }, + { 0.001204190, 0.013826900, -0.023954100, 0.030681200, + -0.041272400, 0.061708600, -0.107656000, 0.274389000, + 0.900919000, -0.178561000, 0.094092900, -0.057317000, + 0.034481800, -0.017248900, 0.001716930, 0.007602450 }, + { 0.001179210, 0.013822400, -0.023802800, 0.030325200, + -0.040648600, 0.060674200, -0.105794000, 0.269153000, + 0.903969000, -0.177073000, 0.093254300, -0.056780500, + 0.034104500, -0.016967200, 0.001526900, 0.007670090 }, + { 0.001154660, 0.013816700, -0.023649400, 0.029966300, + -0.040021100, 0.059634500, -0.103925000, 0.263929000, + 0.906976000, -0.175546000, 0.092397600, -0.056233700, + 0.033721100, -0.016682300, 0.001335720, 0.007737840 }, + { 0.001130530, 0.013809800, -0.023493900, 0.029604600, + -0.039389900, 0.058589800, -0.102050000, 0.258719000, + 0.909939000, -0.173982000, 0.091523000, -0.055676400, + 0.033331600, -0.016394100, 0.001143390, 0.007805680 }, + { 0.001106820, 0.013801800, -0.023336400, 0.029240200, + -0.038755100, 0.057540100, -0.100168000, 0.253523000, + 0.912859000, -0.172380000, 0.090630600, -0.055108900, + 0.032936000, -0.016102800, 0.000949933, 0.007873600 }, + { 0.001083520, 0.013792600, -0.023176800, 0.028873100, + -0.038117000, 0.056485700, -0.098280000, 0.248340000, + 0.915735000, -0.170740000, 0.089720400, -0.054531000, + 0.032534400, -0.015808300, 0.000755366, 0.007941610 }, + { 0.001060610, 0.013782200, -0.023015300, 0.028503500, + -0.037475400, 0.055426700, -0.096386300, 0.243173000, + 0.918566000, -0.169062000, 0.088792500, -0.053942900, + 0.032126700, -0.015510700, 0.000559702, 0.008009680 }, + { 0.001038070, 0.013770700, -0.022851800, 0.028131300, + -0.036830600, 0.054363300, -0.094487100, 0.238020000, + 0.921353000, -0.167346000, 0.087846900, -0.053344600, + 0.031713100, -0.015210000, 0.000362959, 0.008077800 }, + { 0.001015900, 0.013758100, -0.022686400, 0.027756600, + -0.036182700, 0.053295800, -0.092582800, 0.232883000, + 0.924095000, -0.165592000, 0.086883600, -0.052736100, + 0.031293500, -0.014906200, 0.000165153, 0.008145980 }, + { 0.000994065, 0.013744400, -0.022519100, 0.027379600, + -0.035531800, 0.052224200, -0.090673700, 0.227762000, + 0.926792000, -0.163800000, 0.085902800, -0.052117600, + 0.030868000, -0.014599300, -0.000033699, 0.008214200 }, + { 0.000972545, 0.013729500, -0.022350000, 0.027000200, + -0.034878000, 0.051148700, -0.088760100, 0.222657000, + 0.929443000, -0.161970000, 0.084904600, -0.051489100, + 0.030436600, -0.014289400, -0.000233582, 0.008282450 }, + { 0.000951314, 0.013713600, -0.022179000, 0.026618500, + -0.034221300, 0.050069600, -0.086842200, 0.217568000, + 0.932049000, -0.160102000, 0.083888900, -0.050850500, + 0.029999400, -0.013976600, -0.000434476, 0.008350720 }, + { 0.000930348, 0.013696600, -0.022006200, 0.026234500, + -0.033562000, 0.048986900, -0.084920300, 0.212496000, + 0.934609000, -0.158196000, 0.082855900, -0.050202100, + 0.029556500, -0.013660700, -0.000636364, 0.008419010 }, + { 0.000909621, 0.013678500, -0.021831600, 0.025848400, + -0.032900000, 0.047901000, -0.082994900, 0.207442000, + 0.937123000, -0.156252000, 0.081805600, -0.049543700, + 0.029107700, -0.013341900, -0.000839230, 0.008487300 }, + { 0.000889109, 0.013659300, -0.021655300, 0.025460200, + -0.032235500, 0.046811900, -0.081066100, 0.202406000, + 0.939591000, -0.154269000, 0.080738200, -0.048875600, + 0.028653300, -0.013020200, -0.001043050, 0.008555590 }, + { 0.000868789, 0.013639100, -0.021477300, 0.025070000, + -0.031568700, 0.045719800, -0.079134300, 0.197388000, + 0.942012000, -0.152249000, 0.079653700, -0.048197700, + 0.028193200, -0.012695600, -0.001247820, 0.008623860 }, + { 0.000848641, 0.013617800, -0.021297700, 0.024677800, + -0.030899600, 0.044624900, -0.077199800, 0.192388000, + 0.944386000, -0.150191000, 0.078552200, -0.047510200, + 0.027727600, -0.012368200, -0.001453500, 0.008692120 }, + { 0.000828649, 0.013595500, -0.021116400, 0.024283600, + -0.030228300, 0.043527300, -0.075262900, 0.187407000, + 0.946714000, -0.148095000, 0.077433700, -0.046813100, + 0.027256300, -0.012037900, -0.001660090, 0.008760350 }, + { 0.000808800, 0.013572200, -0.020933400, 0.023887600, + -0.029554900, 0.042427300, -0.073323800, 0.182445000, + 0.948994000, -0.145960000, 0.076298500, -0.046106400, + 0.026779500, -0.011704900, -0.001867560, 0.008828540 }, + { 0.000789086, 0.013547900, -0.020748900, 0.023489900, + -0.028879500, 0.041325100, -0.071382800, 0.177503000, + 0.951226000, -0.143788000, 0.075146500, -0.045390300, + 0.026297300, -0.011369100, -0.002075890, 0.008896700 }, + { 0.000769507, 0.013522500, -0.020562800, 0.023090300, + -0.028202300, 0.040220700, -0.069440400, 0.172581000, + 0.953411000, -0.141578000, 0.073977900, -0.044664700, + 0.025809600, -0.011030600, -0.002285070, 0.008964800 }, + { 0.000750066, 0.013496200, -0.020375300, 0.022689100, + -0.027523400, 0.039114400, -0.067496700, 0.167680000, + 0.955548000, -0.139329000, 0.072792800, -0.043929900, + 0.025316500, -0.010689400, -0.002495060, 0.009032840 }, + { 0.000730774, 0.013469000, -0.020186200, 0.022286300, + -0.026842800, 0.038006300, -0.065552000, 0.162799000, + 0.957637000, -0.137043000, 0.071591300, -0.043185700, + 0.024818200, -0.010345600, -0.002705870, 0.009100820 }, + { 0.000711649, 0.013440700, -0.019995700, 0.021882000, + -0.026160600, 0.036896600, -0.063606700, 0.157939000, + 0.959678000, -0.134719000, 0.070373400, -0.042432500, + 0.024314500, -0.009999080, -0.002917450, 0.009168730 }, + { 0.000692716, 0.013411500, -0.019803700, 0.021476100, + -0.025477100, 0.035785500, -0.061661000, 0.153101000, + 0.961670000, -0.132357000, 0.069139400, -0.041670100, + 0.023805700, -0.009650030, -0.003129790, 0.009236550 }, + { 0.000674005, 0.013381400, -0.019610300, 0.021068900, + -0.024792100, 0.034673200, -0.059715200, 0.148285000, + 0.963614000, -0.129958000, 0.067889200, -0.040898700, + 0.023291700, -0.009298430, -0.003342870, 0.009304290 }, + { 0.000655555, 0.013350400, -0.019415600, 0.020660300, + -0.024106000, 0.033559800, -0.057769600, 0.143491000, + 0.965508000, -0.127520000, 0.066623100, -0.040118300, + 0.022772500, -0.008944310, -0.003556670, 0.009371930 }, + { 0.000637409, 0.013318400, -0.019219600, 0.020250300, + -0.023418700, 0.032445500, -0.055824500, 0.138719000, + 0.967354000, -0.125045000, 0.065341100, -0.039329200, + 0.022248400, -0.008587720, -0.003771170, 0.009439470 }, + { 0.000619615, 0.013285600, -0.019022200, 0.019839200, + -0.022730400, 0.031330400, -0.053880200, 0.133970000, + 0.969150000, -0.122533000, 0.064043400, -0.038531200, + 0.021719200, -0.008228680, -0.003986340, 0.009506900 }, + { 0.000602227, 0.013251800, -0.018823600, 0.019426800, + -0.022041200, 0.030214800, -0.051936900, 0.129244000, + 0.970897000, -0.119983000, 0.062730000, -0.037724600, + 0.021185100, -0.007867250, -0.004202160, 0.009574200 }, + { 0.000585302, 0.013217200, -0.018623700, 0.019013400, + -0.021351200, 0.029098800, -0.049995000, 0.124542000, + 0.972595000, -0.117395000, 0.061401200, -0.036909400, + 0.020646100, -0.007503460, -0.004418620, 0.009641370 }, + { 0.000568899, 0.013181700, -0.018422700, 0.018598800, + -0.020660400, 0.027982600, -0.048054700, 0.119864000, + 0.974242000, -0.114770000, 0.060057000, -0.036085600, + 0.020102300, -0.007137330, -0.004635680, 0.009708410 }, + { 0.000553077, 0.013145400, -0.018220400, 0.018183300, + -0.019969100, 0.026866300, -0.046116200, 0.115210000, + 0.975840000, -0.112107000, 0.058697600, -0.035253500, + 0.019553700, -0.006768930, -0.004853320, 0.009775290 }, + { 0.000537896, 0.013108200, -0.018017000, 0.017766900, + -0.019277200, 0.025750100, -0.044180000, 0.110580000, + 0.977388000, -0.109408000, 0.057323100, -0.034413000, + 0.019000400, -0.006398270, -0.005071530, 0.009842020 }, + { 0.000523415, 0.013070200, -0.017812500, 0.017349500, + -0.018585000, 0.024634100, -0.042246100, 0.105975000, + 0.978886000, -0.106671000, 0.055933600, -0.033564300, + 0.018442500, -0.006025420, -0.005290280, 0.009908570 }, + { 0.000509689, 0.013031400, -0.017606900, 0.016931400, + -0.017892400, 0.023518600, -0.040315000, 0.101396000, + 0.980333000, -0.103897000, 0.054529300, -0.032707500, + 0.017880100, -0.005650390, -0.005509550, 0.009974950 }, + { 0.000496767, 0.012991800, -0.017400200, 0.016512500, + -0.017199700, 0.022403700, -0.038386900, 0.096841900, + 0.981730000, -0.101086000, 0.053110400, -0.031842600, + 0.017313100, -0.005273240, -0.005729310, 0.010041100 }, + { 0.000484696, 0.012951400, -0.017192600, 0.016092900, + -0.016506800, 0.021289600, -0.036462100, 0.092313600, + 0.983076000, -0.098237800, 0.051676900, -0.030969900, + 0.016741600, -0.004894020, -0.005949540, 0.010107100 }, + { 0.000473514, 0.012910200, -0.016983900, 0.015672700, + -0.015814000, 0.020176400, -0.034540800, 0.087811500, + 0.984372000, -0.095353100, 0.050229000, -0.030089200, + 0.016165800, -0.004512750, -0.006170210, 0.010172900 }, + { 0.000463250, 0.012868200, -0.016774300, 0.015251900, + -0.015121200, 0.019064300, -0.032623200, 0.083335800, + 0.985617000, -0.092431700, 0.048766900, -0.029200900, + 0.015585700, -0.004129480, -0.006391310, 0.010238400 }, + { 0.000453924, 0.012825500, -0.016563700, 0.014830600, + -0.014428700, 0.017953500, -0.030709800, 0.078886800, + 0.986810000, -0.089473800, 0.047290800, -0.028304900, + 0.015001400, -0.003744260, -0.006612810, 0.010303700 }, + { 0.000445550, 0.012782000, -0.016352300, 0.014408800, + -0.013736500, 0.016844000, -0.028800600, 0.074464900, + 0.987953000, -0.086479400, 0.045800700, -0.027401400, + 0.014412800, -0.003357130, -0.006834680, 0.010368800 }, + { 0.000438126, 0.012737800, -0.016140000, 0.013986600, + -0.013044600, 0.015736200, -0.026896100, 0.070070300, + 0.989045000, -0.083448600, 0.044296800, -0.026490500, + 0.013820200, -0.002968140, -0.007056910, 0.010433600 }, + { 0.000431643, 0.012692900, -0.015926800, 0.013564100, + -0.012353300, 0.014630100, -0.024996400, 0.065703200, + 0.990085000, -0.080381600, 0.042779400, -0.025572200, + 0.013223500, -0.002577320, -0.007279450, 0.010498200 }, + { 0.000426080, 0.012647200, -0.015712900, 0.013141300, + -0.011662600, 0.013525800, -0.023101700, 0.061364100, + 0.991074000, -0.077278600, 0.041248500, -0.024646800, + 0.012622900, -0.002184730, -0.007502300, 0.010562400 }, + { 0.000421406, 0.012600900, -0.015498200, 0.012718300, + -0.010972500, 0.012423600, -0.021212500, 0.057053200, + 0.992011000, -0.074139500, 0.039704400, -0.023714300, + 0.012018300, -0.001790400, -0.007725430, 0.010626400 }, + { 0.000417579, 0.012553800, -0.015282700, 0.012295200, + -0.010283300, 0.011323700, -0.019328800, 0.052770700, + 0.992897000, -0.070964600, 0.038147100, -0.022774800, + 0.011410000, -0.001394390, -0.007948800, 0.010690100 }, + { 0.000414547, 0.012506100, -0.015066500, 0.011871900, + -0.009594970, 0.010226000, -0.017451100, 0.048517000, + 0.993731000, -0.067754100, 0.036576900, -0.021828400, + 0.010797900, -0.000996745, -0.008172400, 0.010753400 }, + { 0.000412251, 0.012457700, -0.014849700, 0.011448600, + -0.008907620, 0.009130930, -0.015579400, 0.044292300, + 0.994513000, -0.064507900, 0.034994000, -0.020875300, + 0.010182200, -0.000597505, -0.008396190, 0.010816400 }, + { 0.000410621, 0.012408600, -0.014632100, 0.011025300, + -0.008221360, 0.008038500, -0.013714100, 0.040096900, + 0.995244000, -0.061226400, 0.033398500, -0.019915600, + 0.009562800, -0.000196720, -0.008620160, 0.010879200 }, + { 0.000409585, 0.012358900, -0.014414000, 0.010602000, + -0.007536270, 0.006948890, -0.011855400, 0.035931100, + 0.995922000, -0.057909700, 0.031790600, -0.018949300, + 0.008939920, 0.000205562, -0.008844280, 0.010941500 }, + { 0.000409063, 0.012308600, -0.014195300, 0.010178900, + -0.006852470, 0.005862260, -0.010003500, 0.031795100, + 0.996549000, -0.054557800, 0.030170600, -0.017976700, + 0.008313610, 0.000609294, -0.009068510, 0.011003500 }, + { 0.000408972, 0.012257600, -0.013976000, 0.009755990, + -0.006170040, 0.004778750, -0.008158790, 0.027689100, + 0.997124000, -0.051171100, 0.028538400, -0.016997800, + 0.007683930, 0.001014430, -0.009292840, 0.011065200 }, + { 0.000409230, 0.012206100, -0.013756200, 0.009333300, + -0.005489070, 0.003698520, -0.006321360, 0.023613500, + 0.997646000, -0.047749500, 0.026894500, -0.016012700, + 0.007050970, 0.001420910, -0.009517230, 0.011126400 }, + { 0.000409752, 0.012153900, -0.013535900, 0.008910910, + -0.004809650, 0.002621710, -0.004491510, 0.019568500, + 0.998117000, -0.044293400, 0.025238900, -0.015021700, + 0.006414810, 0.001828700, -0.009741670, 0.011187300 }, + { 0.000410456, 0.012101100, -0.013315100, 0.008488880, + -0.004131890, 0.001548470, -0.002669450, 0.015554300, + 0.998535000, -0.040802900, 0.023571800, -0.014024700, + 0.005775510, 0.002237740, -0.009966110, 0.011247800 }, + { 0.000411265, 0.012047800, -0.013093800, 0.008067240, + -0.003455870, 0.000478948, -0.000855436, 0.011571200, + 0.998901000, -0.037278100, 0.021893500, -0.013021900, + 0.005133180, 0.002647990, -0.010190500, 0.011307900 }, + { 0.000412106, 0.011993900, -0.012872200, 0.007646080, + -0.002781680, -0.000586709, 0.000950314, 0.007619390, + 0.999215000, -0.033719300, 0.020204200, -0.012013600, + 0.004487890, 0.003059380, -0.010414900, 0.011367600 }, + { 0.000412915, 0.011939500, -0.012650100, 0.007225430, + -0.002109420, -0.001648360, 0.002747570, 0.003699140, + 0.999477000, -0.030126600, 0.018503900, -0.010999700, + 0.003839710, 0.003471880, -0.010639200, 0.011426900 }, + { 0.000413633, 0.011884500, -0.012427700, 0.006805360, + -0.001439170, -0.002705860, 0.004536100, -0.000189332, + 0.999686000, -0.026500200, 0.016793100, -0.009980360, + 0.003188740, 0.003885440, -0.010863400, 0.011485700 }, + { 0.000414214, 0.011829000, -0.012205000, 0.006385910, + -0.000771025, -0.003759060, 0.006315690, -0.004045800, + 0.999843000, -0.022840300, 0.015071700, -0.008955820, + 0.002535060, 0.004299990, -0.011087500, 0.011544100 }, + { 0.000414623, 0.011773000, -0.011982000, 0.005967150, + -0.000105072, -0.004807840, 0.008086100, -0.007870030, + 0.999948000, -0.019147200, 0.013340200, -0.007926170, + 0.001878750, 0.004715490, -0.011311400, 0.011602000 }, + { 0.000414833, 0.011716500, -0.011758700, 0.005549120, + 0.000558600, -0.005852040, 0.009847130, -0.011661800, + 1.000000000, -0.015420900, 0.011598600, -0.006891530, + 0.001219900, 0.005131880, -0.011535200, 0.011659500 }, #else - 0 + 0 #endif -}; + }; #if defined C_IMPLEMENTATION -FIR::FIR() -{ - memset(itsDelayLine, 0, sizeof itsDelayLine); -} + FIR::FIR() + { + memset(itsDelayLine, 0, sizeof itsDelayLine); + } -fcomplex FIR::processNextSample(fcomplex sample, const float weights[NR_TAPS]) -{ - fcomplex sum = sample * weights[0]; - itsDelayLine[0] = sample; + fcomplex FIR::processNextSample(fcomplex sample, const float weights[NR_TAPS]) + { + fcomplex sum = sample * weights[0]; + itsDelayLine[0] = sample; - for (int tap = NR_TAPS; -- tap > 0;) { - sum += weights[tap] * itsDelayLine[tap]; - itsDelayLine[tap] = itsDelayLine[tap - 1]; - } + for (int tap = NR_TAPS; -- tap > 0;) { + sum += weights[tap] * itsDelayLine[tap]; + itsDelayLine[tap] = itsDelayLine[tap - 1]; + } - return sum; -} + return sum; + } #endif -WH_BGL_Processing::WH_BGL_Processing(const string& name, double baseFrequency, const ACC::APS::ParameterSet &ps) -: - WorkHolder(NR_IN_CHANNELS, NR_OUT_CHANNELS, name, "WH_Correlator"), - itsBaseFrequency(baseFrequency), - itsPS(ps) -{ - ASSERT(ps.getInt32("BGLProc.NPPFTaps") == NR_TAPS); - ASSERT(ps.getInt32("Observation.NStations") == NR_STATIONS); - ASSERT(ps.getInt32("Observation.NPolarisations") == NR_POLARIZATIONS); - ASSERT(ps.getInt32("Observation.NSubbandSamples") == NR_SUBBAND_SAMPLES); - ASSERT(ps.getInt32("Observation.NChannels") == NR_SUBBAND_CHANNELS); + WH_BGL_Processing::WH_BGL_Processing(const string& name, double baseFrequency, const ACC::APS::ParameterSet &ps) + : + WorkHolder(NR_IN_CHANNELS, NR_OUT_CHANNELS, name, "WH_Correlator"), + itsBaseFrequency(baseFrequency), + itsPS(ps) + { + ASSERT(ps.getInt32("BGLProc.NPPFTaps") == NR_TAPS); + ASSERT(ps.getInt32("Observation.NStations") == NR_STATIONS); + ASSERT(ps.getInt32("Observation.NPolarisations") == NR_POLARIZATIONS); + ASSERT(ps.getInt32("Observation.NSubbandSamples") == NR_SUBBAND_SAMPLES); + ASSERT(ps.getInt32("Observation.NChannels") == NR_SUBBAND_CHANNELS); #if !defined C_IMPLEMENTATION - ASSERT(NR_SAMPLES_PER_INTEGRATION % 16 == 0); + ASSERT(NR_SAMPLES_PER_INTEGRATION % 16 == 0); #endif - getDataManager().addInDataHolder(SUBBAND_CHANNEL, new DH_Subband("input", ps)); - getDataManager().addInDataHolder(RFI_MITIGATION_CHANNEL, new DH_RFI_Mitigation("RFI")); - getDataManager().addOutDataHolder(VISIBILITIES_CHANNEL, new DH_Visibilities("output", ps)); -} + getDataManager().addInDataHolder(SUBBAND_CHANNEL, new DH_Subband("input", ps)); + getDataManager().addInDataHolder(RFI_MITIGATION_CHANNEL, new DH_RFI_Mitigation("RFI")); + getDataManager().addOutDataHolder(VISIBILITIES_CHANNEL, new DH_Visibilities("output", ps)); + } -WH_BGL_Processing::~WH_BGL_Processing() -{ -} + WH_BGL_Processing::~WH_BGL_Processing() + { + } -WorkHolder* WH_BGL_Processing::construct(const string &name, double baseFrequency, const ACC::APS::ParameterSet &ps) -{ - return new WH_BGL_Processing(name, baseFrequency, ps); -} + WorkHolder* WH_BGL_Processing::construct(const string &name, double baseFrequency, const ACC::APS::ParameterSet &ps) + { + return new WH_BGL_Processing(name, baseFrequency, ps); + } -WH_BGL_Processing* WH_BGL_Processing::make(const string &name) -{ - return new WH_BGL_Processing(name, itsBaseFrequency, itsPS); -} + WH_BGL_Processing* WH_BGL_Processing::make(const string &name) + { + return new WH_BGL_Processing(name, itsBaseFrequency, itsPS); + } -void WH_BGL_Processing::preprocess() -{ + void WH_BGL_Processing::preprocess() + { #if defined HAVE_BGL && NR_SUBBAND_CHANNELS == 256 - fftw_import_wisdom_from_string("(FFTW-2.1.5 (256 529 -1 0 1 1 1 352 0) (128 529 -1 0 1 1 0 2817 0) (64 529 -1 0 1 1 0 1409 0) (32 529 -1 0 1 1 0 705 0) (16 529 -1 0 1 1 0 353 0) (8 529 -1 0 1 1 0 177 0) (4 529 -1 0 1 1 0 89 0) (2 529 -1 0 1 1 0 45 0))"); - itsFFTWPlan = fftw_create_plan(NR_SUBBAND_CHANNELS, FFTW_FORWARD, FFTW_USE_WISDOM); + fftw_import_wisdom_from_string("(FFTW-2.1.5 (256 529 -1 0 1 1 1 352 0) (128 529 -1 0 1 1 0 2817 0) (64 529 -1 0 1 1 0 1409 0) (32 529 -1 0 1 1 0 705 0) (16 529 -1 0 1 1 0 353 0) (8 529 -1 0 1 1 0 177 0) (4 529 -1 0 1 1 0 89 0) (2 529 -1 0 1 1 0 45 0))"); + itsFFTWPlan = fftw_create_plan(NR_SUBBAND_CHANNELS, FFTW_FORWARD, FFTW_USE_WISDOM); #else - itsFFTWPlan = fftw_create_plan(NR_SUBBAND_CHANNELS, FFTW_FORWARD, FFTW_ESTIMATE); + itsFFTWPlan = fftw_create_plan(NR_SUBBAND_CHANNELS, FFTW_FORWARD, FFTW_ESTIMATE); #endif - for (int i = 1; i <= NR_SAMPLES_PER_INTEGRATION; i ++) { + for (int i = 1; i <= NR_SAMPLES_PER_INTEGRATION; i ++) { #if INPUT_TYPE == I4COMPLEX_TYPE - correlationWeights[i] = 1.0 / i; + correlationWeights[i] = 1.0 / i; #else - correlationWeights[i] = 1.0e-6 / i; + correlationWeights[i] = 1.0e-6 / i; #endif - } + } - for (int bl = 0; bl < NR_BASELINES; bl ++) { - for (int ch = 0; ch < NR_SUBBAND_CHANNELS; ch ++) { - thresholds[bl][ch] = 5.0e37; - } - } + for (int bl = 0; bl < NR_BASELINES; bl ++) { + for (int ch = 0; ch < NR_SUBBAND_CHANNELS; ch ++) { + thresholds[bl][ch] = 5.0e37; + } + } #if defined HAVE_BGL && !defined C_IMPLEMENTATION - mutex = rts_allocate_mutex(); + mutex = rts_allocate_mutex(); #endif -} + } -void WH_BGL_Processing::computeFlags() -{ + void WH_BGL_Processing::computeFlags() + { #if NR_SUBBAND_CHANNELS == 1 - DH_Subband::AllFlagsType *input = get_DH_Subband()->getFlags(); + DH_Subband::AllFlagsType *input = get_DH_Subband()->getFlags(); - LOFAR::bitset<NR_INPUT_SAMPLES> (&flags)[NR_STATIONS] = *input; + bitset<NR_INPUT_SAMPLES> (&flags)[NR_STATIONS] = *input; #else - typedef LOFAR::bitset<NR_SUBBAND_CHANNELS> inputType[NR_STATIONS][NR_TAPS - 1 + NR_SAMPLES_PER_INTEGRATION]; + typedef bitset<NR_SUBBAND_CHANNELS> inputType[NR_STATIONS][NR_TAPS - 1 + NR_SAMPLES_PER_INTEGRATION]; - inputType *input = (inputType *) get_DH_Subband()->getFlags(); + inputType *input = (inputType *) get_DH_Subband()->getFlags(); - computeFlagsTimer.start(); + computeFlagsTimer.start(); #if 1 || defined C_IMPLEMENTATION - memset(flags, 0, sizeof flags); - - for (int stat = 0; stat < NR_STATIONS; stat ++) { - int invalid_count = 0; - - for (int time = 0; time < NR_TAPS - 1; time ++, invalid_count --) { - if ((*input)[stat][time].any()) { - invalid_count = NR_TAPS; - } - } - - for (int time = 0; time < NR_SAMPLES_PER_INTEGRATION; time ++, invalid_count --) { - if ((*input)[stat][NR_TAPS - 1 + time].any()) { - invalid_count = NR_TAPS; + memset(flags, 0, sizeof flags); + + for (int stat = 0; stat < NR_STATIONS; stat ++) { + int invalid_count = 0; + + for (int time = 0; time < NR_TAPS - 1; time ++, invalid_count --) { + if ((*input)[stat][time].any()) { + invalid_count = NR_TAPS; + } + } + + for (int time = 0; time < NR_SAMPLES_PER_INTEGRATION; time ++, invalid_count --) { + if ((*input)[stat][NR_TAPS - 1 + time].any()) { + invalid_count = NR_TAPS; + } + + if (invalid_count > 0) { + flags[stat][time] = true; + } + } } - - if (invalid_count > 0) { - flags[stat][time] = true; - } - } - } #else - _compute_flags(input, &flags); // broken + _compute_flags(input, &flags); // broken #endif #endif - for (int stat2 = 0; stat2 < NR_STATIONS; stat2 ++) { - for (int stat1 = 0; stat1 <= stat2; stat1 ++) { - itsNrValidSamples[DH_Visibilities::baseline(stat1, stat2)] = NR_SAMPLES_PER_INTEGRATION - (flags[stat1] | flags[stat2]).count(); - } - } + for (int stat2 = 0; stat2 < NR_STATIONS; stat2 ++) { + for (int stat1 = 0; stat1 <= stat2; stat1 ++) { + itsNrValidSamples[DH_Visibilities::baseline(stat1, stat2)] = NR_SAMPLES_PER_INTEGRATION - (flags[stat1] | flags[stat2]).count(); + } + } - computeFlagsTimer.stop(); -} + computeFlagsTimer.stop(); + } #if defined DELAY_COMPENSATION #if defined C_IMPLEMENTATION -fcomplex WH_BGL_Processing::phaseShift(int time, int chan, const DH_Subband::DelayIntervalType &delay) const -{ - double timeInterpolatedDelay = delay.delayAtBegin + ((double) time / CHANNEL_BANDWIDTH) * (delay.delayAfterEnd - delay.delayAtBegin); - double frequency = itsBaseFrequency + chan * CHANNEL_BANDWIDTH; - double phaseShift = timeInterpolatedDelay * frequency; - double phi = 2.0 * M_PI * phaseShift; + fcomplex WH_BGL_Processing::phaseShift(int time, int chan, const DH_Subband::DelayIntervalType &delay) const + { + double timeInterpolatedDelay = delay.delayAtBegin + ((double) time / CHANNEL_BANDWIDTH) * (delay.delayAfterEnd - delay.delayAtBegin); + double frequency = itsBaseFrequency + chan * CHANNEL_BANDWIDTH; + double phaseShift = timeInterpolatedDelay * frequency; + double phi = 2.0 * M_PI * phaseShift; - return makefcomplex(std::cos(phi), std::sin(phi)); -} + return makefcomplex(std::cos(phi), std::sin(phi)); + } #else -void WH_BGL_Processing::computePhaseShifts(struct phase_shift phaseShifts[NR_SAMPLES_PER_INTEGRATION], const DH_Subband::DelayIntervalType &delay) const -{ - double phiBegin = 2 * M_PI * delay.delayAtBegin; - double phiEnd = 2 * M_PI * delay.delayAfterEnd; - double deltaPhi = (phiEnd - phiBegin) / NR_SAMPLES_PER_INTEGRATION; - dcomplex v = cosisin(phiBegin * itsBaseFrequency); - dcomplex dv = cosisin(phiBegin * CHANNEL_BANDWIDTH); - dcomplex vf = cosisin(deltaPhi * itsBaseFrequency); - dcomplex dvf = cosisin(deltaPhi * CHANNEL_BANDWIDTH); - - for (int time = 0; time < NR_SAMPLES_PER_INTEGRATION; time ++) { - phaseShifts[time].v0 = v; v *= vf; - phaseShifts[time].dv = dv; dv *= dvf; - } -} + void WH_BGL_Processing::computePhaseShifts(struct phase_shift phaseShifts[NR_SAMPLES_PER_INTEGRATION], const DH_Subband::DelayIntervalType &delay) const + { + double phiBegin = 2 * M_PI * delay.delayAtBegin; + double phiEnd = 2 * M_PI * delay.delayAfterEnd; + double deltaPhi = (phiEnd - phiBegin) / NR_SAMPLES_PER_INTEGRATION; + dcomplex v = cosisin(phiBegin * itsBaseFrequency); + dcomplex dv = cosisin(phiBegin * CHANNEL_BANDWIDTH); + dcomplex vf = cosisin(deltaPhi * itsBaseFrequency); + dcomplex dvf = cosisin(deltaPhi * CHANNEL_BANDWIDTH); + + for (int time = 0; time < NR_SAMPLES_PER_INTEGRATION; time ++) { + phaseShifts[time].v0 = v; v *= vf; + phaseShifts[time].dv = dv; dv *= dvf; + } + } #endif #endif -void WH_BGL_Processing::doPPF() -{ - doPPFtimer.start(); + void WH_BGL_Processing::doPPF() + { + doPPFtimer.start(); #if defined HAVE_BGL && !defined C_IMPLEMENTATION - _bgl_mutex_lock(mutex); + _bgl_mutex_lock(mutex); #endif #if defined C_IMPLEMENTATION && defined WORDS_BIGENDIAN - get_DH_Subband()->swapBytes(); + get_DH_Subband()->swapBytes(); #endif - typedef DH_Subband::SampleType inputType[NR_STATIONS][NR_TAPS - 1 + NR_SAMPLES_PER_INTEGRATION][NR_SUBBAND_CHANNELS][NR_POLARIZATIONS]; + typedef DH_Subband::SampleType inputType[NR_STATIONS][NR_TAPS - 1 + NR_SAMPLES_PER_INTEGRATION][NR_SUBBAND_CHANNELS][NR_POLARIZATIONS]; - inputType *input = (inputType *) get_DH_Subband()->getSamples(); + inputType *input = (inputType *) get_DH_Subband()->getSamples(); #if defined DELAY_COMPENSATION - DH_Subband::AllDelaysType *delays = get_DH_Subband()->getDelays(); + DH_Subband::AllDelaysType *delays = get_DH_Subband()->getDelays(); #endif - for (int stat = 0; stat < NR_STATIONS; stat ++) { + for (int stat = 0; stat < NR_STATIONS; stat ++) { #if defined C_IMPLEMENTATION - fcomplex fftOutData[NR_SUBBAND_CHANNELS]; - static fcomplex fftInData[NR_TAPS - 1 + NR_SAMPLES_PER_INTEGRATION][NR_POLARIZATIONS][NR_SUBBAND_CHANNELS]; - - FIRtimer.start(); - for (int pol = 0; pol < NR_POLARIZATIONS; pol ++) { - for (int chan = 0; chan < NR_SUBBAND_CHANNELS; chan ++) { - for (int time = 0; time < NR_TAPS - 1 + NR_SAMPLES_PER_INTEGRATION; time ++) { - fcomplex sample = makefcomplex((*input)[stat][time][chan][pol]); - fftInData[time][pol][chan] = itsFIRs[stat][pol][chan].processNextSample(sample, FIR::weights[chan]); - } - } - } - FIRtimer.stop(); - - FFTtimer.start(); - for (int time = 0; time < NR_SAMPLES_PER_INTEGRATION; time ++) { - for (int pol = 0; pol < NR_POLARIZATIONS; pol ++) { - if (flags[stat][time]) { - for (int chan = 0; chan < NR_SUBBAND_CHANNELS; chan ++) { - samples[chan][stat][time][pol] = makefcomplex(0, 0); - } - } else { - fftw_one(itsFFTWPlan, - (fftw_complex *) fftInData[NR_TAPS - 1 + time][pol], - (fftw_complex *) fftOutData); - - for (int chan = 0; chan < NR_SUBBAND_CHANNELS; chan ++) { + fcomplex fftOutData[NR_SUBBAND_CHANNELS]; + static fcomplex fftInData[NR_TAPS - 1 + NR_SAMPLES_PER_INTEGRATION][NR_POLARIZATIONS][NR_SUBBAND_CHANNELS]; + + FIRtimer.start(); + for (int pol = 0; pol < NR_POLARIZATIONS; pol ++) { + for (int chan = 0; chan < NR_SUBBAND_CHANNELS; chan ++) { + for (int time = 0; time < NR_TAPS - 1 + NR_SAMPLES_PER_INTEGRATION; time ++) { + fcomplex sample = makefcomplex((*input)[stat][time][chan][pol]); + fftInData[time][pol][chan] = itsFIRs[stat][pol][chan].processNextSample(sample, FIR::weights[chan]); + } + } + } + FIRtimer.stop(); + + FFTtimer.start(); + for (int time = 0; time < NR_SAMPLES_PER_INTEGRATION; time ++) { + for (int pol = 0; pol < NR_POLARIZATIONS; pol ++) { + if (flags[stat][time]) { + for (int chan = 0; chan < NR_SUBBAND_CHANNELS; chan ++) { + samples[chan][stat][time][pol] = makefcomplex(0, 0); + } + } else { + fftw_one(itsFFTWPlan, + (fftw_complex *) fftInData[NR_TAPS - 1 + time][pol], + (fftw_complex *) fftOutData); + + for (int chan = 0; chan < NR_SUBBAND_CHANNELS; chan ++) { #if defined DELAY_COMPENSATION - fftOutData[chan] *= phaseShift(time, chan, (*delays)[stat]); + fftOutData[chan] *= phaseShift(time, chan, (*delays)[stat]); #endif - samples[chan][stat][time][pol] = fftOutData[chan]; - } - } - } - } - FFTtimer.stop(); + samples[chan][stat][time][pol] = fftOutData[chan]; + } + } + } + } + FFTtimer.stop(); #else // assembly implementation - static fcomplex tmp1[4][NR_SAMPLES_PER_INTEGRATION] CACHE_ALIGNED; - static fcomplex fftInData[NR_SAMPLES_PER_INTEGRATION][NR_POLARIZATIONS][NR_SUBBAND_CHANNELS + 4] CACHE_ALIGNED; - static fcomplex fftOutData[2][NR_POLARIZATIONS][NR_SUBBAND_CHANNELS] CACHE_ALIGNED; - - for (int chan = 0; chan < NR_SUBBAND_CHANNELS; chan += 4) { - for (int pol = 0; pol < NR_POLARIZATIONS; pol ++) { - for (int ch = 0; ch < 4; ch ++) { - FIRtimer.start(); - _filter(0, // itsFIRs[stat][pol][chan + ch].itsDelayLine, - FIR::weights[chan + ch], - &(*input)[stat][0][chan + ch][pol], - tmp1[ch], - NR_SAMPLES_PER_INTEGRATION / NR_TAPS); - FIRtimer.stop(); - } - - _transpose_4x8(&fftInData[0][pol][chan], - &tmp1[0][0], - NR_SAMPLES_PER_INTEGRATION, - sizeof(fcomplex) * NR_SAMPLES_PER_INTEGRATION, - sizeof(fcomplex) * NR_POLARIZATIONS * (NR_SUBBAND_CHANNELS + 4)); - } - } + static fcomplex tmp1[4][NR_SAMPLES_PER_INTEGRATION] CACHE_ALIGNED; + static fcomplex fftInData[NR_SAMPLES_PER_INTEGRATION][NR_POLARIZATIONS][NR_SUBBAND_CHANNELS + 4] CACHE_ALIGNED; + static fcomplex fftOutData[2][NR_POLARIZATIONS][NR_SUBBAND_CHANNELS] CACHE_ALIGNED; + + for (int chan = 0; chan < NR_SUBBAND_CHANNELS; chan += 4) { + for (int pol = 0; pol < NR_POLARIZATIONS; pol ++) { + for (int ch = 0; ch < 4; ch ++) { + FIRtimer.start(); + _filter(0, // itsFIRs[stat][pol][chan + ch].itsDelayLine, + FIR::weights[chan + ch], + &(*input)[stat][0][chan + ch][pol], + tmp1[ch], + NR_SAMPLES_PER_INTEGRATION / NR_TAPS); + FIRtimer.stop(); + } + + _transpose_4x8(&fftInData[0][pol][chan], + &tmp1[0][0], + NR_SAMPLES_PER_INTEGRATION, + sizeof(fcomplex) * NR_SAMPLES_PER_INTEGRATION, + sizeof(fcomplex) * NR_POLARIZATIONS * (NR_SUBBAND_CHANNELS + 4)); + } + } #if defined DELAY_COMPENSATION - struct phase_shift phaseShifts[NR_SAMPLES_PER_INTEGRATION]; + struct phase_shift phaseShifts[NR_SAMPLES_PER_INTEGRATION]; - computePhaseShifts(phaseShifts, (*delays)[stat]); + computePhaseShifts(phaseShifts, (*delays)[stat]); #endif - for (int time = 0; time < NR_SAMPLES_PER_INTEGRATION; time += 2) { - FFTtimer.start(); - for (int t = 0; t < 2; t ++) { - if (flags[stat][time + t]) { - _memzero(fftOutData[t], sizeof(fftOutData[t])); - } else { - _prefetch(fftInData[time + t], - sizeof(fcomplex[NR_POLARIZATIONS][NR_SUBBAND_CHANNELS]) / CACHE_LINE_SIZE, - CACHE_LINE_SIZE); - - for (int pol = 0; pol < NR_POLARIZATIONS; pol ++) { - fftw_one(itsFFTWPlan, - (fftw_complex *) fftInData[time + t][pol], - (fftw_complex *) fftOutData[t][pol]); - } - } - } - FFTtimer.stop(); + for (int time = 0; time < NR_SAMPLES_PER_INTEGRATION; time += 2) { + FFTtimer.start(); + for (int t = 0; t < 2; t ++) { + if (flags[stat][time + t]) { + _memzero(fftOutData[t], sizeof(fftOutData[t])); + } else { + _prefetch(fftInData[time + t], + sizeof(fcomplex[NR_POLARIZATIONS][NR_SUBBAND_CHANNELS]) / CACHE_LINE_SIZE, + CACHE_LINE_SIZE); + + for (int pol = 0; pol < NR_POLARIZATIONS; pol ++) { + fftw_one(itsFFTWPlan, + (fftw_complex *) fftInData[time + t][pol], + (fftw_complex *) fftOutData[t][pol]); + } + } + } + FFTtimer.stop(); #if defined DELAY_COMPENSATION - _phase_shift_and_transpose(&samples[0][stat][time][0], - &fftOutData[0][0][0], - &phaseShifts[time]); + _phase_shift_and_transpose(&samples[0][stat][time][0], + &fftOutData[0][0][0], + &phaseShifts[time]); #else - _transpose_4x8(&samples[0][stat][time][0], - &fftOutData[0][0][0], - NR_SUBBAND_CHANNELS, - sizeof(fcomplex) * NR_SUBBAND_CHANNELS, - sizeof(fcomplex) * NR_POLARIZATIONS * NR_SAMPLES_PER_INTEGRATION * NR_STATIONS); + _transpose_4x8(&samples[0][stat][time][0], + &fftOutData[0][0][0], + NR_SUBBAND_CHANNELS, + sizeof(fcomplex) * NR_SUBBAND_CHANNELS, + sizeof(fcomplex) * NR_POLARIZATIONS * NR_SAMPLES_PER_INTEGRATION * NR_STATIONS); #endif - } + } #endif - } + } #if defined HAVE_BGL && !defined C_IMPLEMENTATION - _bgl_mutex_unlock(mutex); + _bgl_mutex_unlock(mutex); #endif - doPPFtimer.stop(); -} + doPPFtimer.stop(); + } -void WH_BGL_Processing::bypassPPF() -{ - DH_Subband::AllSamplesType *input = get_DH_Subband()->getSamples(); + void WH_BGL_Processing::bypassPPF() + { + DH_Subband::AllSamplesType *input = get_DH_Subband()->getSamples(); - for (int stat = 0; stat < NR_STATIONS; stat ++) { - for (int time = 0; time < NR_SAMPLES_PER_INTEGRATION; time ++) { - for (int pol = 0; pol < NR_POLARIZATIONS; pol ++) { - samples[0][stat][time][pol] = makefcomplex((*input)[stat][time][pol]); + for (int stat = 0; stat < NR_STATIONS; stat ++) { + for (int time = 0; time < NR_SAMPLES_PER_INTEGRATION; time ++) { + for (int pol = 0; pol < NR_POLARIZATIONS; pol ++) { + samples[0][stat][time][pol] = makefcomplex((*input)[stat][time][pol]); + } + } } } - } -} -void WH_BGL_Processing::doCorrelate() -{ - doCorrelateTimer.start(); + void WH_BGL_Processing::doCorrelate() + { + doCorrelateTimer.start(); - DH_RFI_Mitigation::ChannelFlagsType *RFI_Flags = get_DH_RFI_Mitigation()->getChannelFlags(); - DH_Visibilities::AllVisibilitiesType *visibilities = get_DH_Visibilities()->getVisibilities(); - DH_Visibilities::AllNrValidSamplesType *nrValidSamples = get_DH_Visibilities()->getNrValidSamples(); + DH_RFI_Mitigation::ChannelFlagsType *RFI_Flags = get_DH_RFI_Mitigation()->getChannelFlags(); + DH_Visibilities::AllVisibilitiesType *visibilities = get_DH_Visibilities()->getVisibilities(); + DH_Visibilities::AllNrValidSamplesType *nrValidSamples = get_DH_Visibilities()->getNrValidSamples(); #if defined C_IMPLEMENTATION - for (int ch = 0; ch < NR_SUBBAND_CHANNELS; ch ++) { - for (int stat2 = 0; stat2 < NR_STATIONS; stat2 ++) { - for (int stat1 = 0; stat1 <= stat2; stat1 ++) { - int bl = DH_Visibilities::baseline(stat1, stat2), nrValid = 0; - - if (!(*RFI_Flags)[stat1][ch] && !(*RFI_Flags)[stat2][ch]) { - for (int pol1 = 0; pol1 < NR_POLARIZATIONS; pol1 ++) { - for (int pol2 = 0; pol2 < NR_POLARIZATIONS; pol2 ++) { - dcomplex sum = makedcomplex(0, 0); - for (int time = 0; time < NR_SAMPLES_PER_INTEGRATION; time ++) { - sum += samples[ch][stat1][time][pol1] * ~samples[ch][stat2][time][pol2]; - } - sum *= correlationWeights[itsNrValidSamples[bl]]; - if (real(sum) * real(sum) + imag(sum) * imag(sum) > thresholds[bl][ch]) { - goto invalid; // C++ lacks syntax to break from nested loop - } - (*visibilities)[bl][ch][pol1][pol2] = sum; - } - } - nrValid = itsNrValidSamples[bl]; - } + for (int ch = 0; ch < NR_SUBBAND_CHANNELS; ch ++) { + for (int stat2 = 0; stat2 < NR_STATIONS; stat2 ++) { + for (int stat1 = 0; stat1 <= stat2; stat1 ++) { + int bl = DH_Visibilities::baseline(stat1, stat2), nrValid = 0; + + if (!(*RFI_Flags)[stat1][ch] && !(*RFI_Flags)[stat2][ch]) { + for (int pol1 = 0; pol1 < NR_POLARIZATIONS; pol1 ++) { + for (int pol2 = 0; pol2 < NR_POLARIZATIONS; pol2 ++) { + dcomplex sum = makedcomplex(0, 0); + for (int time = 0; time < NR_SAMPLES_PER_INTEGRATION; time ++) { + sum += samples[ch][stat1][time][pol1] * ~samples[ch][stat2][time][pol2]; + } + sum *= correlationWeights[itsNrValidSamples[bl]]; + if (real(sum) * real(sum) + imag(sum) * imag(sum) > thresholds[bl][ch]) { + goto invalid; // C++ lacks syntax to break from nested loop + } + (*visibilities)[bl][ch][pol1][pol2] = sum; + } + } + nrValid = itsNrValidSamples[bl]; + } - if (nrValid == 0) { -invalid: for (int pol1 = 0; pol1 < NR_POLARIZATIONS; pol1 ++) { - for (int pol2 = 0; pol2 < NR_POLARIZATIONS; pol2 ++) { - (*visibilities)[bl][ch][pol1][pol2] = makefcomplex(0, 0); - } - } - } - (*nrValidSamples)[bl][ch] = nrValid; + if (nrValid == 0) { + invalid: for (int pol1 = 0; pol1 < NR_POLARIZATIONS; pol1 ++) { + for (int pol2 = 0; pol2 < NR_POLARIZATIONS; pol2 ++) { + (*visibilities)[bl][ch][pol1][pol2] = makefcomplex(0, 0); + } + } + } + (*nrValidSamples)[bl][ch] = nrValid; + } + } } - } - } #else - // Blue Gene/L assembler version. + // Blue Gene/L assembler version. - for (int bl = 0; bl < NR_BASELINES; bl ++) { - for (int ch = 0; ch < NR_SUBBAND_CHANNELS; ch ++) { - (*nrValidSamples)[bl][ch] = itsNrValidSamples[bl]; - } - } - - for (int ch = 0; ch < NR_SUBBAND_CHANNELS; ch ++) { - // build a map of valid stations - int nrValidStations = 0, map[NR_STATIONS]; - - for (int stat2 = 0; stat2 < NR_STATIONS; stat2 ++) { - if (!(*RFI_Flags)[stat2][ch]) { - map[nrValidStations ++] = stat2; - } else { // clear correlations that involve invalided stations - for (int stat1 = 0; stat1 < NR_STATIONS; stat1 ++) { - int bl = stat1 < stat2 ? DH_Visibilities::baseline(stat1, stat2) : - DH_Visibilities::baseline(stat2, stat1); - //_clear_correlation(&(*visibilities)[bl][ch]); - (*nrValidSamples)[bl][ch] = 0; - } + for (int bl = 0; bl < NR_BASELINES; bl ++) { + for (int ch = 0; ch < NR_SUBBAND_CHANNELS; ch ++) { + (*nrValidSamples)[bl][ch] = itsNrValidSamples[bl]; + } } - } - if (nrValidStations == 0) { - break; - } - - // Divide the correlation matrix into blocks of 3x2, 2x2, 3+2, 2+1, and 1x1. - - // do the first (auto)correlation(s) (these are the "left"most 1 or 3 - // squares in the corner of the triangle) - if (nrValidStations % 2 == 0) { - int stat10 = map[0], stat11 = map[1]; - - _auto_correlate_2( - &samples[ch][stat10], - &samples[ch][stat11], - &(*visibilities)[DH_Visibilities::baseline(stat10, stat10)][ch], - &(*visibilities)[DH_Visibilities::baseline(stat10, stat11)][ch], - &(*visibilities)[DH_Visibilities::baseline(stat11, stat11)][ch]); - } else { - int stat10 = map[0]; - - _auto_correlate_1( - &samples[ch][stat10], - &(*visibilities)[DH_Visibilities::baseline(stat10, stat10)][ch]); - } - - for (int stat2 = nrValidStations % 2 ? 1 : 2; stat2 < nrValidStations; stat2 += 2) { - int stat1 = 0; - - // do as many 3x2 blocks as possible - for (; stat1 + 3 <= stat2; stat1 += 3) { - int stat10 = map[stat1], stat11 = map[stat1+1], stat12 = map[stat1+2]; - int stat20 = map[stat2], stat21 = map[stat2+1]; - - _correlate_3x2( - &samples[ch][stat10], - &samples[ch][stat11], - &samples[ch][stat12], - &samples[ch][stat20], - &samples[ch][stat21], - &(*visibilities)[DH_Visibilities::baseline(stat10, stat20)][ch], - &(*visibilities)[DH_Visibilities::baseline(stat10, stat21)][ch], - &(*visibilities)[DH_Visibilities::baseline(stat11, stat20)][ch], - &(*visibilities)[DH_Visibilities::baseline(stat11, stat21)][ch], - &(*visibilities)[DH_Visibilities::baseline(stat12, stat20)][ch], - &(*visibilities)[DH_Visibilities::baseline(stat12, stat21)][ch]); - } - - // see if a 2x2 block is necessary - if (stat1 + 2 <= stat2) { - int stat10 = map[stat1], stat11 = map[stat1+1]; - int stat20 = map[stat2], stat21 = map[stat2+1]; - - _correlate_2x2( - &samples[ch][stat10], - &samples[ch][stat11], - &samples[ch][stat20], - &samples[ch][stat21], - &(*visibilities)[DH_Visibilities::baseline(stat10, stat20)][ch], - &(*visibilities)[DH_Visibilities::baseline(stat10, stat21)][ch], - &(*visibilities)[DH_Visibilities::baseline(stat11, stat20)][ch], - &(*visibilities)[DH_Visibilities::baseline(stat11, stat21)][ch]); - stat1 += 2; - } - - // do the remaining (auto)correlations near the diagonal - if (stat1 == stat2) { - int stat10 = map[stat1], stat11 = map[stat1+1]; - - _auto_correlate_2( - &samples[ch][stat10], - &samples[ch][stat11], - &(*visibilities)[DH_Visibilities::baseline(stat10,stat10)][ch], - &(*visibilities)[DH_Visibilities::baseline(stat10,stat11)][ch], - &(*visibilities)[DH_Visibilities::baseline(stat11,stat11)][ch]); - } else { - int stat10 = map[stat1], stat11 = map[stat1+1], stat12 = map[stat1+2]; - - _auto_correlate_3( - &samples[ch][stat10], - &samples[ch][stat11], - &samples[ch][stat12], - &(*visibilities)[DH_Visibilities::baseline(stat10,stat11)][ch], - &(*visibilities)[DH_Visibilities::baseline(stat10,stat12)][ch], - &(*visibilities)[DH_Visibilities::baseline(stat11,stat11)][ch], - &(*visibilities)[DH_Visibilities::baseline(stat11,stat12)][ch], - &(*visibilities)[DH_Visibilities::baseline(stat12,stat12)][ch]); + for (int ch = 0; ch < NR_SUBBAND_CHANNELS; ch ++) { + // build a map of valid stations + int nrValidStations = 0, map[NR_STATIONS]; + + for (int stat2 = 0; stat2 < NR_STATIONS; stat2 ++) { + if (!(*RFI_Flags)[stat2][ch]) { + map[nrValidStations ++] = stat2; + } else { // clear correlations that involve invalided stations + for (int stat1 = 0; stat1 < NR_STATIONS; stat1 ++) { + int bl = stat1 < stat2 ? DH_Visibilities::baseline(stat1, stat2) : + DH_Visibilities::baseline(stat2, stat1); + //_clear_correlation(&(*visibilities)[bl][ch]); + (*nrValidSamples)[bl][ch] = 0; + } + } + } + + if (nrValidStations == 0) { + break; + } + + // Divide the correlation matrix into blocks of 3x2, 2x2, 3+2, 2+1, and 1x1. + + // do the first (auto)correlation(s) (these are the "left"most 1 or 3 + // squares in the corner of the triangle) + if (nrValidStations % 2 == 0) { + int stat10 = map[0], stat11 = map[1]; + + _auto_correlate_2( + &samples[ch][stat10], + &samples[ch][stat11], + &(*visibilities)[DH_Visibilities::baseline(stat10, stat10)][ch], + &(*visibilities)[DH_Visibilities::baseline(stat10, stat11)][ch], + &(*visibilities)[DH_Visibilities::baseline(stat11, stat11)][ch]); + } else { + int stat10 = map[0]; + + _auto_correlate_1( + &samples[ch][stat10], + &(*visibilities)[DH_Visibilities::baseline(stat10, stat10)][ch]); + } + + for (int stat2 = nrValidStations % 2 ? 1 : 2; stat2 < nrValidStations; stat2 += 2) { + int stat1 = 0; + + // do as many 3x2 blocks as possible + for (; stat1 + 3 <= stat2; stat1 += 3) { + int stat10 = map[stat1], stat11 = map[stat1+1], stat12 = map[stat1+2]; + int stat20 = map[stat2], stat21 = map[stat2+1]; + + _correlate_3x2( + &samples[ch][stat10], + &samples[ch][stat11], + &samples[ch][stat12], + &samples[ch][stat20], + &samples[ch][stat21], + &(*visibilities)[DH_Visibilities::baseline(stat10, stat20)][ch], + &(*visibilities)[DH_Visibilities::baseline(stat10, stat21)][ch], + &(*visibilities)[DH_Visibilities::baseline(stat11, stat20)][ch], + &(*visibilities)[DH_Visibilities::baseline(stat11, stat21)][ch], + &(*visibilities)[DH_Visibilities::baseline(stat12, stat20)][ch], + &(*visibilities)[DH_Visibilities::baseline(stat12, stat21)][ch]); + } + + // see if a 2x2 block is necessary + if (stat1 + 2 <= stat2) { + int stat10 = map[stat1], stat11 = map[stat1+1]; + int stat20 = map[stat2], stat21 = map[stat2+1]; + + _correlate_2x2( + &samples[ch][stat10], + &samples[ch][stat11], + &samples[ch][stat20], + &samples[ch][stat21], + &(*visibilities)[DH_Visibilities::baseline(stat10, stat20)][ch], + &(*visibilities)[DH_Visibilities::baseline(stat10, stat21)][ch], + &(*visibilities)[DH_Visibilities::baseline(stat11, stat20)][ch], + &(*visibilities)[DH_Visibilities::baseline(stat11, stat21)][ch]); + stat1 += 2; + } + + // do the remaining (auto)correlations near the diagonal + if (stat1 == stat2) { + int stat10 = map[stat1], stat11 = map[stat1+1]; + + _auto_correlate_2( + &samples[ch][stat10], + &samples[ch][stat11], + &(*visibilities)[DH_Visibilities::baseline(stat10,stat10)][ch], + &(*visibilities)[DH_Visibilities::baseline(stat10,stat11)][ch], + &(*visibilities)[DH_Visibilities::baseline(stat11,stat11)][ch]); + } else { + int stat10 = map[stat1], stat11 = map[stat1+1], stat12 = map[stat1+2]; + + _auto_correlate_3( + &samples[ch][stat10], + &samples[ch][stat11], + &samples[ch][stat12], + &(*visibilities)[DH_Visibilities::baseline(stat10,stat11)][ch], + &(*visibilities)[DH_Visibilities::baseline(stat10,stat12)][ch], + &(*visibilities)[DH_Visibilities::baseline(stat11,stat11)][ch], + &(*visibilities)[DH_Visibilities::baseline(stat11,stat12)][ch], + &(*visibilities)[DH_Visibilities::baseline(stat12,stat12)][ch]); + } + } } - } - } - weightTimer.start(); + weightTimer.start(); #if 0 - for (int bl = 0; bl < NR_BASELINES; bl ++) { - for (int ch = 0; ch < NR_SUBBAND_CHANNELS; ch ++) { - float weight = correlationWeights[(*nrValidSamples)[bl][ch]]; - bool invalid = false; - - for (int pol1 = 0; pol1 < NR_POLARIZATIONS; pol1 ++) { - for (int pol2 = 0; pol2 < NR_POLARIZATIONS; pol2 ++) { - fcomplex vis = (*visibilities)[bl][ch][pol1][pol2] * weight; - - (*visibilities)[bl][ch][pol1][pol2] = vis; - invalid |= real(vis) * real(vis) + imag(vis) * imag(vis) > thresholds[bl][ch]; - } - } - - if (invalid) { - (*nrValidSamples)[bl][ch] = 0; - for (int pol1 = 0; pol1 < NR_POLARIZATIONS; pol1 ++) { - for (int pol2 = 0; pol2 < NR_POLARIZATIONS; pol2 ++) { - (*visibilities)[bl][ch][pol1][pol2] = makefcomplex(0, 0); - } - } + for (int bl = 0; bl < NR_BASELINES; bl ++) { + for (int ch = 0; ch < NR_SUBBAND_CHANNELS; ch ++) { + float weight = correlationWeights[(*nrValidSamples)[bl][ch]]; + bool invalid = false; + + for (int pol1 = 0; pol1 < NR_POLARIZATIONS; pol1 ++) { + for (int pol2 = 0; pol2 < NR_POLARIZATIONS; pol2 ++) { + fcomplex vis = (*visibilities)[bl][ch][pol1][pol2] * weight; + + (*visibilities)[bl][ch][pol1][pol2] = vis; + invalid |= real(vis) * real(vis) + imag(vis) * imag(vis) > thresholds[bl][ch]; + } + } + + if (invalid) { + (*nrValidSamples)[bl][ch] = 0; + for (int pol1 = 0; pol1 < NR_POLARIZATIONS; pol1 ++) { + for (int pol2 = 0; pol2 < NR_POLARIZATIONS; pol2 ++) { + (*visibilities)[bl][ch][pol1][pol2] = makefcomplex(0, 0); + } + } + } + } } - } - } #else - //_weigh_visibilities(visibilities, nrValidSamples, correlationWeights); - _post_process_visibilities(visibilities, nrValidSamples, correlationWeights, thresholds); + //_weigh_visibilities(visibilities, nrValidSamples, correlationWeights); + _post_process_visibilities(visibilities, nrValidSamples, correlationWeights, thresholds); #endif - weightTimer.stop(); + weightTimer.stop(); #endif - doCorrelateTimer.stop(); -} + doCorrelateTimer.stop(); + } -void WH_BGL_Processing::process() -{ - totalTimer.start(); - computeFlags(); + void WH_BGL_Processing::process() + { + totalTimer.start(); + computeFlags(); #if NR_SUBBAND_CHANNELS > 1 - doPPF(); + doPPF(); #else - bypassPPF(); + bypassPPF(); #endif - doCorrelate(); - totalTimer.stop(); -} + doCorrelate(); + totalTimer.stop(); + } -void WH_BGL_Processing::postprocess() -{ - fftw_destroy_plan(itsFFTWPlan); -} + void WH_BGL_Processing::postprocess() + { + fftw_destroy_plan(itsFFTWPlan); + } -void WH_BGL_Processing::dump() const -{ -} + void WH_BGL_Processing::dump() const + { + } + + + } // namespace CS1 + +} // namespace LOFAR diff --git a/Appl/CEP/CS1/CS1_BGLProc/src/WH_BGL_Processing.h b/Appl/CEP/CS1/CS1_BGLProc/src/WH_BGL_Processing.h index 19043075643bdb7743befd0bae463c78bd4abd34..f7deba84d77c71d3eadfc1a42d000d79152bf948 100644 --- a/Appl/CEP/CS1/CS1_BGLProc/src/WH_BGL_Processing.h +++ b/Appl/CEP/CS1/CS1_BGLProc/src/WH_BGL_Processing.h @@ -28,7 +28,6 @@ #define DELAY_COMPENSATION #include <fftw.h> -#include <bitset> #include <tinyCEP/WorkHolder.h> #include <CS1_Interface/bitset.h> @@ -51,86 +50,90 @@ namespace LOFAR { + namespace CS1 + { -class FIR { - public: + class FIR { + public: #if defined C_IMPLEMENTATION - FIR(); + FIR(); - fcomplex processNextSample(fcomplex sample, const float weights[NR_TAPS]); + fcomplex processNextSample(fcomplex sample, const float weights[NR_TAPS]); - fcomplex itsDelayLine[NR_TAPS]; + fcomplex itsDelayLine[NR_TAPS]; #endif - static const float weights[NR_SUBBAND_CHANNELS][NR_TAPS]; -}; - -class WH_BGL_Processing: public WorkHolder { - public: - enum inDataHolders { - SUBBAND_CHANNEL, - RFI_MITIGATION_CHANNEL, - NR_IN_CHANNELS + static const float weights[NR_SUBBAND_CHANNELS][NR_TAPS]; }; - enum outDataHolders { - VISIBILITIES_CHANNEL, - NR_OUT_CHANNELS - }; - - explicit WH_BGL_Processing(const string &name, double baseFrequency, const ACC::APS::ParameterSet &ps); - virtual ~WH_BGL_Processing(); - - static WorkHolder *construct(const string &name, double baseFrequency, const ACC::APS::ParameterSet &); - virtual WH_BGL_Processing *make(const string &name); - - virtual void preprocess(); - virtual void process(); - virtual void dump() const; - virtual void postprocess(); - - DH_Subband *get_DH_Subband() { - return dynamic_cast<DH_Subband *>(getDataManager().getInHolder(SUBBAND_CHANNEL)); - } - - DH_RFI_Mitigation *get_DH_RFI_Mitigation() { - return dynamic_cast<DH_RFI_Mitigation *>(getDataManager().getInHolder(RFI_MITIGATION_CHANNEL)); - } - - DH_Visibilities *get_DH_Visibilities() { - return dynamic_cast<DH_Visibilities *>(getDataManager().getOutHolder(VISIBILITIES_CHANNEL)); - } - - private: - /// forbid copy constructor - WH_BGL_Processing(const WH_BGL_Processing&); + class WH_BGL_Processing: public WorkHolder { + public: + enum inDataHolders { + SUBBAND_CHANNEL, + RFI_MITIGATION_CHANNEL, + NR_IN_CHANNELS + }; + + enum outDataHolders { + VISIBILITIES_CHANNEL, + NR_OUT_CHANNELS + }; + + explicit WH_BGL_Processing(const string &name, double baseFrequency, const ACC::APS::ParameterSet &ps); + virtual ~WH_BGL_Processing(); + + static WorkHolder *construct(const string &name, double baseFrequency, const ACC::APS::ParameterSet &); + virtual WH_BGL_Processing *make(const string &name); + + virtual void preprocess(); + virtual void process(); + virtual void dump() const; + virtual void postprocess(); + + DH_Subband *get_DH_Subband() { + return dynamic_cast<DH_Subband *>(getDataManager().getInHolder(SUBBAND_CHANNEL)); + } + + DH_RFI_Mitigation *get_DH_RFI_Mitigation() { + return dynamic_cast<DH_RFI_Mitigation *>(getDataManager().getInHolder(RFI_MITIGATION_CHANNEL)); + } + + DH_Visibilities *get_DH_Visibilities() { + return dynamic_cast<DH_Visibilities *>(getDataManager().getOutHolder(VISIBILITIES_CHANNEL)); + } + + private: + /// forbid copy constructor + WH_BGL_Processing(const WH_BGL_Processing&); - /// forbid assignment - WH_BGL_Processing& operator= (const WH_BGL_Processing&); + /// forbid assignment + WH_BGL_Processing& operator= (const WH_BGL_Processing&); - void doPPF(), bypassPPF(); - void computeFlags(); - void doCorrelate(); + void doPPF(), bypassPPF(); + void computeFlags(); + void doCorrelate(); #if defined DELAY_COMPENSATION #if defined C_IMPLEMENTATION - fcomplex phaseShift(int time, int chan, const DH_Subband::DelayIntervalType &delay) const; + fcomplex phaseShift(int time, int chan, const DH_Subband::DelayIntervalType &delay) const; #else - void computePhaseShifts(struct phase_shift phaseShifts[NR_SAMPLES_PER_INTEGRATION], const DH_Subband::DelayIntervalType &delay) const; + void computePhaseShifts(struct phase_shift phaseShifts[NR_SAMPLES_PER_INTEGRATION], const DH_Subband::DelayIntervalType &delay) const; #endif #endif - /// FIR Filter variables - fftw_plan itsFFTWPlan; - double itsBaseFrequency; - const ACC::APS::ParameterSet &itsPS; - static FIR itsFIRs[NR_STATIONS][NR_POLARIZATIONS][NR_SUBBAND_CHANNELS] CACHE_ALIGNED; - - static fcomplex samples[NR_SUBBAND_CHANNELS][NR_STATIONS][NR_SAMPLES_PER_INTEGRATION][NR_POLARIZATIONS] CACHE_ALIGNED; - static LOFAR::bitset<NR_SAMPLES_PER_INTEGRATION> flags[NR_STATIONS] CACHE_ALIGNED; - static unsigned itsNrValidSamples[NR_BASELINES] CACHE_ALIGNED; - static float correlationWeights[NR_SAMPLES_PER_INTEGRATION + 1] CACHE_ALIGNED; - static float thresholds[NR_BASELINES][NR_SUBBAND_CHANNELS]; -}; + /// FIR Filter variables + fftw_plan itsFFTWPlan; + double itsBaseFrequency; + const ACC::APS::ParameterSet &itsPS; + static FIR itsFIRs[NR_STATIONS][NR_POLARIZATIONS][NR_SUBBAND_CHANNELS] CACHE_ALIGNED; + + static fcomplex samples[NR_SUBBAND_CHANNELS][NR_STATIONS][NR_SAMPLES_PER_INTEGRATION][NR_POLARIZATIONS] CACHE_ALIGNED; + static bitset<NR_SAMPLES_PER_INTEGRATION> flags[NR_STATIONS] CACHE_ALIGNED; + static unsigned itsNrValidSamples[NR_BASELINES] CACHE_ALIGNED; + static float correlationWeights[NR_SAMPLES_PER_INTEGRATION + 1] CACHE_ALIGNED; + static float thresholds[NR_BASELINES][NR_SUBBAND_CHANNELS]; + }; + + } // namespace CS1 } // namespace LOFAR diff --git a/Appl/CEP/CS1/CS1_BGLProc/test/tWH_BGL_Processing.cc b/Appl/CEP/CS1/CS1_BGLProc/test/tWH_BGL_Processing.cc index 5bef72fc2dd729c7bcbc90faa9ed22232a69b8cb..653ada00e36fc494d44e036e65856df35692a0a9 100644 --- a/Appl/CEP/CS1/CS1_BGLProc/test/tWH_BGL_Processing.cc +++ b/Appl/CEP/CS1/CS1_BGLProc/test/tWH_BGL_Processing.cc @@ -40,9 +40,9 @@ #include <cstring> #include <exception> +using namespace LOFAR; +using namespace LOFAR::CS1; -namespace LOFAR -{ #if defined HAVE_BGL static BGL_Barrier *barrier; #endif @@ -241,10 +241,6 @@ void doWork() wh.basePostprocess(); } -} // namespace LOFAR - - -using namespace LOFAR; int main (int argc, const char **argv) { @@ -252,14 +248,16 @@ int main (int argc, const char **argv) #if defined HAVE_MPI TH_MPI::initMPI(argc, argv); +#else + argc = argc; argv = argv; // Keep compiler happy ;-) #endif try { doWork(); - } catch (LOFAR::Exception e) { + } catch (Exception& e) { cerr << "Caught exception: " << e.what() << endl; retval = 1; - } catch (std::exception e) { + } catch (std::exception& e) { cerr << "Caught exception: " << e.what() << endl; retval = 1; } catch (...) { diff --git a/Appl/CEP/CS1/CS1_DelayCompensation/include/CS1_DelayCompensation/AH_DelayCompensation.h b/Appl/CEP/CS1/CS1_DelayCompensation/include/CS1_DelayCompensation/AH_DelayCompensation.h index 769240aa9c3935d892717f5be69705498bb881fd..9a1634030f9b2c8c3d568d4cfada8c7b5767ec77 100644 --- a/Appl/CEP/CS1/CS1_DelayCompensation/include/CS1_DelayCompensation/AH_DelayCompensation.h +++ b/Appl/CEP/CS1/CS1_DelayCompensation/include/CS1_DelayCompensation/AH_DelayCompensation.h @@ -33,11 +33,11 @@ namespace LOFAR { - //# Forward Declarations - class Stub_Delay; - namespace CS1 { + //# Forward Declarations + class Stub_Delay; + // \addtogroup CS1_DelayCompensation // @{ diff --git a/Appl/CEP/CS1/CS1_DelayCompensation/include/CS1_DelayCompensation/WH_DelayCompensation.h b/Appl/CEP/CS1/CS1_DelayCompensation/include/CS1_DelayCompensation/WH_DelayCompensation.h index ab89762a0f0b58636b1fb3476beeb637c9a634d6..f38657c7eefb0459321653d389cce07680464b5e 100644 --- a/Appl/CEP/CS1/CS1_DelayCompensation/include/CS1_DelayCompensation/WH_DelayCompensation.h +++ b/Appl/CEP/CS1/CS1_DelayCompensation/include/CS1_DelayCompensation/WH_DelayCompensation.h @@ -43,7 +43,6 @@ namespace LOFAR class TimeCoord; } - namespace CS1 { // \addtogroup CS1_DelayCompensation diff --git a/Appl/CEP/CS1/CS1_DelayCompensation/src/WH_DelayCompensation.cc b/Appl/CEP/CS1/CS1_DelayCompensation/src/WH_DelayCompensation.cc index 0883503ee4237bb294d192ce393e3996c616751b..43751af461c493217a63ba208cc3762afb1b147a 100644 --- a/Appl/CEP/CS1/CS1_DelayCompensation/src/WH_DelayCompensation.cc +++ b/Appl/CEP/CS1/CS1_DelayCompensation/src/WH_DelayCompensation.cc @@ -299,6 +299,7 @@ namespace LOFAR return new ConverterClient(itsConverterConfig.server, itsConverterConfig.port); } + return 0; } diff --git a/Appl/CEP/CS1/CS1_DelayCompensation/test/Makefile.am b/Appl/CEP/CS1/CS1_DelayCompensation/test/Makefile.am index e97165353e0cb49ce5ca69f067d0e6f70d3e83fa..ff550e7519c84211f70944b58fe64956ede44b9e 100644 --- a/Appl/CEP/CS1/CS1_DelayCompensation/test/Makefile.am +++ b/Appl/CEP/CS1/CS1_DelayCompensation/test/Makefile.am @@ -7,7 +7,7 @@ CHECKTOOLPROGS = tWH_DelayCompensation # scripts and possible programs to run tests TESTS = tWH_DelayCompensation.sh -XFAIL_TESTS = +XFAIL_TESTS = tWH_DelayCompensation_SOURCES = tWH_DelayCompensation.cc tWH_DelayCompensation_LDADD = ../src/libcs1_delaycompensation.la diff --git a/Appl/CEP/CS1/CS1_DelayCompensation/test/tWH_DelayCompensation.cc b/Appl/CEP/CS1/CS1_DelayCompensation/test/tWH_DelayCompensation.cc index 48000c526046867ca5cd788c4afef93140bfac02..1c9bf17831f66fdca2f58a4c40088bf1ab744303 100644 --- a/Appl/CEP/CS1/CS1_DelayCompensation/test/tWH_DelayCompensation.cc +++ b/Appl/CEP/CS1/CS1_DelayCompensation/test/tWH_DelayCompensation.cc @@ -28,7 +28,6 @@ #include <CS1_DelayCompensation/WH_DelayCompensation.h> #include <APS/ParameterSet.h> -using namespace LOFAR; using namespace LOFAR::ACC::APS; using namespace LOFAR::CS1; diff --git a/Appl/CEP/CS1/CS1_Interface/include/CS1_Interface/CS1_Config.h b/Appl/CEP/CS1/CS1_Interface/include/CS1_Interface/CS1_Config.h index 4cdda627c481a25a62b38604ad30c443c23fcf92..bd1d7a7ca007812422bfe5f0af1c9b77526ddd22 100644 --- a/Appl/CEP/CS1/CS1_Interface/include/CS1_Interface/CS1_Config.h +++ b/Appl/CEP/CS1/CS1_Interface/include/CS1_Interface/CS1_Config.h @@ -20,8 +20,8 @@ //# //# $Id$ -#ifndef LOFAR_APPL_CEP_CS1_CS1_INTERFACE_CS1_CONFIG_H -#define LOFAR_APPL_CEP_CS1_CS1_INTERFACE_CS1_CONFIG_H +#ifndef LOFAR_CS1_INTERFACE_CS1_CONFIG_H +#define LOFAR_CS1_INTERFACE_CS1_CONFIG_H /* This is included by C++ and assembly files. Do not put anything but constants here! */ diff --git a/Appl/CEP/CS1/CS1_Interface/include/CS1_Interface/DH_Delay.h b/Appl/CEP/CS1/CS1_Interface/include/CS1_Interface/DH_Delay.h index 6b5a967a550a549085bd395d77c2085970c6ab90..3d2b4aa6f006c8cf5cbdb1e9fe05a18060c2c354 100644 --- a/Appl/CEP/CS1/CS1_Interface/include/CS1_Interface/DH_Delay.h +++ b/Appl/CEP/CS1/CS1_Interface/include/CS1_Interface/DH_Delay.h @@ -20,50 +20,53 @@ //# //# $Id$ -#ifndef LOFAR_APPL_CEP_CS1_CS1_INTERFACE_DELAY_H -#define LOFAR_APPL_CEP_CS1_CS1_INTERFACE_DELAY_H +#ifndef LOFAR_CS1_INTERFACE_DH_DELAY_H +#define LOFAR_CS1_INTERFACE_DH_DELAY_H #include <Transport/DataHolder.h> namespace LOFAR { + namespace CS1 + { + class DH_Delay: public DataHolder + { + public: + explicit DH_Delay (const string &name, uint nrRSPs); -class DH_Delay: public DataHolder -{ -public: - explicit DH_Delay (const string &name, uint nrRSPs); - - DH_Delay(const DH_Delay &); + DH_Delay(const DH_Delay &); - virtual ~DH_Delay(); + virtual ~DH_Delay(); - DataHolder *clone() const; + DataHolder *clone() const; - // Allocate the buffers. - virtual void init(); + // Allocate the buffers. + virtual void init(); - // accessor functions to the blob data - int getCoarseDelay(uint station) const; - void setCoarseDelay(uint station, int delay); - float getFineDelayAtBegin(uint station) const; - void setFineDelayAtBegin(uint station, float delay); - float getFineDelayAfterEnd(uint station) const; - void setFineDelayAfterEnd(uint station, float delay); + // accessor functions to the blob data + int getCoarseDelay(uint station) const; + void setCoarseDelay(uint station, int delay); + float getFineDelayAtBegin(uint station) const; + void setFineDelayAtBegin(uint station, float delay); + float getFineDelayAfterEnd(uint station) const; + void setFineDelayAfterEnd(uint station, float delay); - private: - /// Forbid assignment. - DH_Delay &operator = (const DH_Delay &); + private: + /// Forbid assignment. + DH_Delay &operator = (const DH_Delay &); + + // Fill the pointers (itsBuffer) to the data in the blob. + virtual void fillDataPointers(); - // Fill the pointers (itsBuffer) to the data in the blob. - virtual void fillDataPointers(); + /// pointers to data in the blob + int *itsCoarseDelays; + float *itsFineDelaysAtBegin; + float *itsFineDelaysAfterEnd; + uint itsNrRSPs; + }; - /// pointers to data in the blob - int *itsCoarseDelays; - float *itsFineDelaysAtBegin; - float *itsFineDelaysAfterEnd; - uint itsNrRSPs; -}; + } // namespace CS1 +} // namespace LOFAR -} #endif diff --git a/Appl/CEP/CS1/CS1_Interface/include/CS1_Interface/DH_RFI_Mitigation.h b/Appl/CEP/CS1/CS1_Interface/include/CS1_Interface/DH_RFI_Mitigation.h index ff2f35fb1ded31dae3111c5d48491ba58e1ab734..f4a358a3e6dc3405ba1b6c63d0fc670100b30871 100644 --- a/Appl/CEP/CS1/CS1_Interface/include/CS1_Interface/DH_RFI_Mitigation.h +++ b/Appl/CEP/CS1/CS1_Interface/include/CS1_Interface/DH_RFI_Mitigation.h @@ -20,8 +20,8 @@ //# //# $Id$ -#ifndef LOFAR_APPL_CEP_CS1_CS1_INTERFACE_DH_RFI_MITIGATION_H -#define LOFAR_APPL_CEP_CS1_CS1_INTERFACE_DH_RFI_MITIGATION_H +#ifndef LOFAR_CS1_INTERFACE_DH_RFI_MITIGATION_H +#define LOFAR_CS1_INTERFACE_DH_RFI_MITIGATION_H #include <CS1_Interface/CS1_Config.h> #include <CS1_Interface/bitset.h> @@ -31,47 +31,49 @@ namespace LOFAR { + namespace CS1 + { + class DH_RFI_Mitigation: public DataHolder + { + public: + typedef bitset<NR_SUBBAND_CHANNELS> ChannelFlagsType[NR_STATIONS]; -class DH_RFI_Mitigation: public DataHolder -{ -public: - typedef LOFAR::bitset<NR_SUBBAND_CHANNELS> ChannelFlagsType[NR_STATIONS]; + explicit DH_RFI_Mitigation(const string& name); - explicit DH_RFI_Mitigation(const string& name); + DH_RFI_Mitigation(const DH_RFI_Mitigation&); - DH_RFI_Mitigation(const DH_RFI_Mitigation&); + virtual ~DH_RFI_Mitigation(); - virtual ~DH_RFI_Mitigation(); + DataHolder *clone() const; - DataHolder *clone() const; + virtual void init(); - virtual void init(); + ChannelFlagsType *getChannelFlags() + { + return itsChannelFlags; + } - ChannelFlagsType *getChannelFlags() - { - return itsChannelFlags; - } + const ChannelFlagsType *getChannelFlags() const + { + return itsChannelFlags; + } - const ChannelFlagsType *getChannelFlags() const - { - return itsChannelFlags; - } + const size_t nrChannelFlags() const + { + return NR_STATIONS * NR_SUBBAND_CHANNELS; + } - const size_t nrChannelFlags() const - { - return NR_STATIONS * NR_SUBBAND_CHANNELS; - } - -private: - /// Forbid assignment. - DH_RFI_Mitigation &operator = (const DH_RFI_Mitigation&); - - ChannelFlagsType *itsChannelFlags; + private: + /// Forbid assignment. + DH_RFI_Mitigation &operator = (const DH_RFI_Mitigation&); - void fillDataPointers(); -}; + ChannelFlagsType *itsChannelFlags; + void fillDataPointers(); + }; + } } -#endif +#endif /* BGL_PROCESSING */ + #endif diff --git a/Appl/CEP/CS1/CS1_Interface/include/CS1_Interface/DH_RSP.h b/Appl/CEP/CS1/CS1_Interface/include/CS1_Interface/DH_RSP.h index 9c0f99c77f4d4fce0c5fbf478a95485edab1cd29..72d616d46a860d2c8f50298509521f494200334e 100644 --- a/Appl/CEP/CS1/CS1_Interface/include/CS1_Interface/DH_RSP.h +++ b/Appl/CEP/CS1/CS1_Interface/include/CS1_Interface/DH_RSP.h @@ -21,9 +21,8 @@ //# //# $Id$ -#ifndef LOFAR_APPL_CEP_CS1_CS1_INTERFACE_DH_RSP_H -#define LOFAR_APPL_CEP_CS1_CS1_INTERFACE_DH_RSP_H - +#ifndef LOFAR_CS1_INTERFACE_DH_RSP_H +#define LOFAR_CS1_INTERFACE_DH_RSP_H #include <APS/ParameterSet.h> #include <Transport/DataHolder.h> @@ -32,108 +31,112 @@ namespace LOFAR { + namespace CS1 + { -class DH_RSP: public DataHolder -{ -public: - typedef i16complex BufferType; + class DH_RSP: public DataHolder + { + public: + typedef i16complex BufferType; - explicit DH_RSP (const string &name, - const ACC::APS::ParameterSet &pset); + explicit DH_RSP (const string &name, + const ACC::APS::ParameterSet &pset); - DH_RSP(const DH_RSP&); + DH_RSP(const DH_RSP&); - virtual ~DH_RSP(); + virtual ~DH_RSP(); - DataHolder *clone() const; + DataHolder *clone() const; - /// Allocate the buffers. - virtual void init(); + /// Allocate the buffers. + virtual void init(); - /// Accessor functions - const int getStationID() const; - void setStationID(int); - const int getInvalidCount() const; - void setInvalidCount(int); - const timestamp_t getTimeStamp() const; - void setTimeStamp(timestamp_t); - const int getDelay() const; - void setDelay(int); + /// Accessor functions + const int getStationID() const; + void setStationID(int); + const int getInvalidCount() const; + void setInvalidCount(int); + const timestamp_t getTimeStamp() const; + void setTimeStamp(timestamp_t); + const int getDelay() const; + void setDelay(int); - BufferType* getBuffer(); + BufferType* getBuffer(); - /// Get read access to the Buffer. - const BufferType* getBuffer() const; + /// Get read access to the Buffer. + const BufferType* getBuffer() const; - uint getBufferSize() const; + uint getBufferSize() const; - /// Reset the buffer - void resetBuffer(); + /// Reset the buffer + void resetBuffer(); - RectMatrix<BufferType>& getDataMatrix() const; + RectMatrix<BufferType>& getDataMatrix() const; - private: - /// Forbid assignment. - DH_RSP& operator= (const DH_RSP&); + private: + /// Forbid assignment. + DH_RSP& operator= (const DH_RSP&); - // Fill the pointers (itsBuffer) to the data in the blob. - virtual void fillDataPointers(); + // Fill the pointers (itsBuffer) to the data in the blob. + virtual void fillDataPointers(); - /// pointers to data in the blob - BufferType* itsBuffer; - int* itsStationID; - int* itsInvalidCount; - int* itsDelay; - timestamp_t* itsTimeStamp; + /// pointers to data in the blob + BufferType* itsBuffer; + int* itsStationID; + int* itsInvalidCount; + int* itsDelay; + timestamp_t* itsTimeStamp; - int itsNTimes; - int itsNoPolarisations; - unsigned int itsBufSize; + int itsNTimes; + int itsNoPolarisations; + unsigned int itsBufSize; - const ACC::APS::ParameterSet &itsPSet; + const ACC::APS::ParameterSet &itsPSet; - RectMatrix<BufferType> *itsMatrix; -}; + RectMatrix<BufferType> *itsMatrix; + }; -inline DH_RSP::BufferType *DH_RSP::getBuffer() - { return itsBuffer; } + inline DH_RSP::BufferType *DH_RSP::getBuffer() + { return itsBuffer; } -inline uint DH_RSP::getBufferSize() const - { return itsBufSize; } + inline uint DH_RSP::getBufferSize() const + { return itsBufSize; } -inline const DH_RSP::BufferType *DH_RSP::getBuffer() const - { return itsBuffer; } + inline const DH_RSP::BufferType *DH_RSP::getBuffer() const + { return itsBuffer; } + + inline const int DH_RSP::getStationID() const + { return *itsStationID; } -inline const int DH_RSP::getStationID() const - { return *itsStationID; } + inline void DH_RSP::setStationID(int id) + { *itsStationID = id; } -inline void DH_RSP::setStationID(int id) - { *itsStationID = id; } + inline const int DH_RSP::getInvalidCount() const + { return *itsInvalidCount; } -inline const int DH_RSP::getInvalidCount() const - { return *itsInvalidCount; } + inline void DH_RSP::setInvalidCount(int count) + { *itsInvalidCount = count; } -inline void DH_RSP::setInvalidCount(int count) - { *itsInvalidCount = count; } + inline const timestamp_t DH_RSP::getTimeStamp() const + { return *itsTimeStamp; } -inline const timestamp_t DH_RSP::getTimeStamp() const - { return *itsTimeStamp; } + inline void DH_RSP::setTimeStamp(timestamp_t timestamp) + { *itsTimeStamp = timestamp; } -inline void DH_RSP::setTimeStamp(timestamp_t timestamp) - { *itsTimeStamp = timestamp; } + inline const int DH_RSP::getDelay() const + { return *itsDelay; } -inline const int DH_RSP::getDelay() const - { return *itsDelay; } + inline void DH_RSP::setDelay(int delay) + { *itsDelay = delay; } -inline void DH_RSP::setDelay(int delay) - { *itsDelay = delay; } + inline void DH_RSP::resetBuffer() + { memset(itsBuffer, 0, itsBufSize); } -inline void DH_RSP::resetBuffer() - { memset(itsBuffer, 0, itsBufSize); } + inline RectMatrix<DH_RSP::BufferType> &DH_RSP::getDataMatrix() const + { return *itsMatrix; } -inline RectMatrix<DH_RSP::BufferType> &DH_RSP::getDataMatrix() const - { return *itsMatrix; } + } // namespace CS1 -} +} // namespace LOFAR #endif diff --git a/Appl/CEP/CS1/CS1_Interface/include/CS1_Interface/DH_RSPSync.h b/Appl/CEP/CS1/CS1_Interface/include/CS1_Interface/DH_RSPSync.h index 8188a31547d02e8ba6c26897ff314ded7abb480d..711697db2254a5b62b1824e33067e5d8c8936d9a 100644 --- a/Appl/CEP/CS1/CS1_Interface/include/CS1_Interface/DH_RSPSync.h +++ b/Appl/CEP/CS1/CS1_Interface/include/CS1_Interface/DH_RSPSync.h @@ -20,8 +20,8 @@ //# //# $Id$ -#ifndef LOFAR_APPL_CEP_CS1_CS1_INTERFACE_DH_RSPSYNC_H -#define LOFAR_APPL_CEP_CS1_CS1_INTERFACE_DH_RSPSYNC_H +#ifndef LOFAR_CS1_INTERFACE_DH_RSPSYNC_H +#define LOFAR_CS1_INTERFACE_DH_RSPSYNC_H #include <Transport/DataHolder.h> @@ -29,44 +29,51 @@ namespace LOFAR { - class DH_RSPSync: public DataHolder -{ -public: + namespace CS1 + { + + class DH_RSPSync: public DataHolder + { + public: - explicit DH_RSPSync (const string& name); + explicit DH_RSPSync (const string& name); - DH_RSPSync(const DH_RSPSync&); + DH_RSPSync(const DH_RSPSync&); - virtual ~DH_RSPSync(); + virtual ~DH_RSPSync(); - DataHolder* clone() const; + DataHolder* clone() const; - /// Allocate the buffers. - virtual void init(); + /// Allocate the buffers. + virtual void init(); - /// Set the sync stamp - void setSyncStamp(const timestamp_t syncStamp); + /// Set the sync stamp + void setSyncStamp(const timestamp_t syncStamp); - /// Get the sync stamp - const timestamp_t getSyncStamp() const; - void incrementStamp(const int value); + /// Get the sync stamp + const timestamp_t getSyncStamp() const; + void incrementStamp(const int value); -private: - /// Forbid assignment. - DH_RSPSync& operator= (const DH_RSPSync&); + private: + /// Forbid assignment. + DH_RSPSync& operator= (const DH_RSPSync&); - timestamp_t* itsSyncStamp; + timestamp_t* itsSyncStamp; - void fillDataPointers(); -}; + void fillDataPointers(); + }; -inline void DH_RSPSync::setSyncStamp(const timestamp_t syncStamp) - { *itsSyncStamp = syncStamp; } + inline void DH_RSPSync::setSyncStamp(const timestamp_t syncStamp) + { *itsSyncStamp = syncStamp; } -inline const timestamp_t DH_RSPSync::getSyncStamp() const - { return *itsSyncStamp;} + inline const timestamp_t DH_RSPSync::getSyncStamp() const + { return *itsSyncStamp;} + + inline void DH_RSPSync::incrementStamp(const int value) + { *itsSyncStamp += value;} + + } // namespace CS1 + +} // namespace LOFAR -inline void DH_RSPSync::incrementStamp(const int value) - { *itsSyncStamp += value;} -} #endif diff --git a/Appl/CEP/CS1/CS1_Interface/include/CS1_Interface/DH_Subband.h b/Appl/CEP/CS1/CS1_Interface/include/CS1_Interface/DH_Subband.h index df6f995062ff91e57a14bb916317433d539bdd67..e274570b13b02f400d63661e778e5065b810c674 100644 --- a/Appl/CEP/CS1/CS1_Interface/include/CS1_Interface/DH_Subband.h +++ b/Appl/CEP/CS1/CS1_Interface/include/CS1_Interface/DH_Subband.h @@ -20,8 +20,8 @@ //# //# $Id$ -#ifndef LOFAR_APPL_CEP_CS1_CS1_INTERFACE_DH_SUBBAND_H -#define LOFAR_APPL_CEP_CS1_CS1_INTERFACE_DH_SUBBAND_H +#ifndef LOFAR_CS1_INTERFACE_DH_SUBBAND_H +#define LOFAR_CS1_INTERFACE_DH_SUBBAND_H #include <CS1_Interface/CS1_Config.h> #include <CS1_Interface/RectMatrix.h> @@ -33,124 +33,129 @@ namespace LOFAR { + namespace CS1 + { -class DH_Subband: public DataHolder -{ -public: - // samples are ALWAYS stored in little endian format ! + class DH_Subband: public DataHolder + { + public: + // samples are ALWAYS stored in little endian format ! #if INPUT_TYPE == I4COMPLEX_TYPE - typedef i4complex SampleType; + typedef i4complex SampleType; #elif INPUT_TYPE == I16COMPLEX_TYPE - typedef i16complex SampleType; + typedef i16complex SampleType; #else #error INPUT_TYPE not supported #endif - // Fine-grained delays - typedef struct { - float delayAtBegin, delayAfterEnd; - } DelayIntervalType; + // Fine-grained delays + typedef struct { + float delayAtBegin, delayAfterEnd; + } DelayIntervalType; - explicit DH_Subband(const string &name, - const LOFAR::ACC::APS::ParameterSet &pSet); + explicit DH_Subband(const string &name, + const ACC::APS::ParameterSet &pSet); - DH_Subband(const DH_Subband &); + DH_Subband(const DH_Subband &); - virtual ~DH_Subband(); + virtual ~DH_Subband(); - DataHolder *clone() const; + DataHolder *clone() const; - virtual void init(); + virtual void init(); - RectMatrix<SampleType> &getSamplesMatrix() const - { - return *itsSamplesMatrix; - } + RectMatrix<SampleType> &getSamplesMatrix() const + { + return *itsSamplesMatrix; + } - SampleType &getSample(unsigned station, unsigned time, unsigned pol) - { - return itsSamples[NR_POLARIZATIONS * (itsNrInputSamples * station + time) + pol]; - } + SampleType &getSample(unsigned station, unsigned time, unsigned pol) + { + return itsSamples[NR_POLARIZATIONS * (itsNrInputSamples * station + time) + pol]; + } - const size_t nrSamples() const - { - return itsNrStations * itsNrInputSamples * NR_POLARIZATIONS; - } + const size_t nrSamples() const + { + return itsNrStations * itsNrInputSamples * NR_POLARIZATIONS; + } - DelayIntervalType &getDelay(unsigned station) - { - return itsDelays[station]; - } + DelayIntervalType &getDelay(unsigned station) + { + return itsDelays[station]; + } - const size_t nrFlags() const - { - return itsNrStations * ((itsNrInputSamples + 31) & ~31); - } + const size_t nrFlags() const + { + return itsNrStations * ((itsNrInputSamples + 31) & ~31); + } - const size_t nrDelays() const - { - return itsNrStations; - } + const size_t nrDelays() const + { + return itsNrStations; + } #if defined BGL_PROCESSING - // Samples - typedef SampleType AllSamplesType[NR_STATIONS][NR_INPUT_SAMPLES][NR_POLARIZATIONS]; - - // Flags - typedef LOFAR::bitset<NR_INPUT_SAMPLES> AllFlagsType[NR_STATIONS]; - - // Fine-grained delays - typedef DelayIntervalType AllDelaysType[NR_STATIONS]; - - AllSamplesType *getSamples() - { - return (AllSamplesType *) itsSamples; - } - - const AllSamplesType *getSamples() const - { - return (const AllSamplesType *) itsSamples; - } - - AllFlagsType *getFlags() - { - return (AllFlagsType *) itsFlags; - } - - const AllFlagsType *getFlags() const - { - return (const AllFlagsType *) itsFlags; - } + // Samples + typedef SampleType AllSamplesType[NR_STATIONS][NR_INPUT_SAMPLES][NR_POLARIZATIONS]; + + // Flags + typedef bitset<NR_INPUT_SAMPLES> AllFlagsType[NR_STATIONS]; + + // Fine-grained delays + typedef DelayIntervalType AllDelaysType[NR_STATIONS]; + + AllSamplesType *getSamples() + { + return (AllSamplesType *) itsSamples; + } + + const AllSamplesType *getSamples() const + { + return (const AllSamplesType *) itsSamples; + } + + AllFlagsType *getFlags() + { + return (AllFlagsType *) itsFlags; + } + + const AllFlagsType *getFlags() const + { + return (const AllFlagsType *) itsFlags; + } + + AllDelaysType *getDelays() + { + return (AllDelaysType *) itsDelays; + } + + const AllDelaysType *getDelays() const + { + return (const AllDelaysType *) itsDelays; + } +#endif - AllDelaysType *getDelays() - { - return (AllDelaysType *) itsDelays; - } + void swapBytes(); - const AllDelaysType *getDelays() const - { - return (const AllDelaysType *) itsDelays; - } -#endif + private: + /// Forbid assignment. + DH_Subband &operator = (const DH_Subband &); - void swapBytes(); + unsigned itsNrStations; + unsigned itsNrInputSamples; -private: - /// Forbid assignment. - DH_Subband &operator = (const DH_Subband &); + SampleType *itsSamples; + // RectMatrix cannot be used for bitsets, thus not for flags + RectMatrix<SampleType> *itsSamplesMatrix; + uint32 *itsFlags; + DelayIntervalType *itsDelays; - unsigned itsNrStations; - unsigned itsNrInputSamples; + void fillDataPointers(); + }; - SampleType *itsSamples; - // RectMatrix cannot be used for bitsets, thus not for flags - RectMatrix<SampleType> *itsSamplesMatrix; - uint32 *itsFlags; - DelayIntervalType *itsDelays; + } // namespace CS1 - void fillDataPointers(); -}; +} // namespace LOFAR -} #endif diff --git a/Appl/CEP/CS1/CS1_Interface/include/CS1_Interface/DH_Visibilities.h b/Appl/CEP/CS1/CS1_Interface/include/CS1_Interface/DH_Visibilities.h index c09d54dab0e81e7b13ebc8f9852ba91fb56c5df4..27decf64dfd2f20b69a92639fa680901ead081be 100644 --- a/Appl/CEP/CS1/CS1_Interface/include/CS1_Interface/DH_Visibilities.h +++ b/Appl/CEP/CS1/CS1_Interface/include/CS1_Interface/DH_Visibilities.h @@ -20,8 +20,8 @@ //# //# $Id$ -#ifndef LOFAR_APPL_CEP_CS1_CS1_INTERFACE_DH_VISIBILITIES_H -#define LOFAR_APPL_CEP_CS1_CS1_INTERFACE_DH_VISIBILITIES_H +#ifndef LOFAR_CS1_INTERFACE_DH_VISIBILITIES_H +#define LOFAR_CS1_INTERFACE_DH_VISIBILITIES_H #include <Transport/DataHolder.h> #include <Common/lofar_complex.h> @@ -29,89 +29,98 @@ namespace LOFAR { -class DH_Visibilities: public DataHolder -{ -public: - typedef fcomplex VisibilityType; - typedef unsigned short NrValidSamplesType; + namespace CS1 + { - // Constructor with centerFreq being the center frequency of the subband - explicit DH_Visibilities(const string& name, - const LOFAR::ACC::APS::ParameterSet &pSet); + class DH_Visibilities: public DataHolder + { + public: + typedef fcomplex VisibilityType; + typedef unsigned short NrValidSamplesType; - DH_Visibilities(const DH_Visibilities&); + // Constructor with centerFreq being the center frequency of the subband + explicit DH_Visibilities(const string& name, + const ACC::APS::ParameterSet &pSet); - virtual ~DH_Visibilities(); + DH_Visibilities(const DH_Visibilities&); - DataHolder* clone() const; + virtual ~DH_Visibilities(); - /// Allocate the buffers. - virtual void init(); + DataHolder* clone() const; - static int baseline(int station1, int station2) - { - DBGASSERT(station1 <= station2); - return station2 * (station2 + 1) / 2 + station1; - } + /// Allocate the buffers. + virtual void init(); + + static int baseline(int station1, int station2) + { + DBGASSERT(station1 <= station2); + return station2 * (station2 + 1) / 2 + station1; + } #if 0 - fcomplex (*getChannels(int station1, int station2)) [NR_SUBBAND_CHANNELS][NR_POLARIZATIONS][NR_POLARIZATIONS] - { - return &(*itsVisibilities)[baseline(station1, station2)]; - } + fcomplex (*getChannels(int station1, int station2)) [NR_SUBBAND_CHANNELS][NR_POLARIZATIONS][NR_POLARIZATIONS] + { + return &(*itsVisibilities)[baseline(station1, station2)]; + } #endif #if defined BGL_PROCESSING - typedef VisibilityType AllVisibilitiesType[NR_BASELINES][NR_SUBBAND_CHANNELS][NR_POLARIZATIONS][NR_POLARIZATIONS]; - typedef NrValidSamplesType AllNrValidSamplesType[NR_BASELINES][NR_SUBBAND_CHANNELS]; + typedef VisibilityType AllVisibilitiesType[NR_BASELINES][NR_SUBBAND_CHANNELS][NR_POLARIZATIONS][NR_POLARIZATIONS]; + typedef NrValidSamplesType AllNrValidSamplesType[NR_BASELINES][NR_SUBBAND_CHANNELS]; + + AllVisibilitiesType* getVisibilities() + { + return (AllVisibilitiesType *) itsVisibilities; + } + + const AllVisibilitiesType* getVisibilities() const + { + return (const AllVisibilitiesType *) itsVisibilities; + } + + AllNrValidSamplesType *getNrValidSamples() + { + return (AllNrValidSamplesType *) itsNrValidSamples; + } + + const AllNrValidSamplesType *getNrValidSamples() const + { + return (const AllNrValidSamplesType *) itsNrValidSamples; + } +#endif - AllVisibilitiesType* getVisibilities() - { - return (AllVisibilitiesType *) itsVisibilities; - } + VisibilityType &getVisibility(unsigned baseline, unsigned channel, unsigned pol1, unsigned pol2) + { + return itsVisibilities[NR_POLARIZATIONS * (NR_POLARIZATIONS * (itsNrChannels * baseline + channel) + pol1) + pol2]; + } - const AllVisibilitiesType* getVisibilities() const - { - return (const AllVisibilitiesType *) itsVisibilities; - } + NrValidSamplesType &getNrValidSamples(unsigned baseline, unsigned channel) + { + return itsNrValidSamples[itsNrChannels * baseline + channel]; + } - AllNrValidSamplesType *getNrValidSamples() - { - return (AllNrValidSamplesType *) itsNrValidSamples; - } + const size_t getNrVisibilities() const + { + return itsNrBaselines * itsNrChannels * NR_POLARIZATIONS * NR_POLARIZATIONS; + } - const AllNrValidSamplesType *getNrValidSamples() const - { - return (const AllNrValidSamplesType *) itsNrValidSamples; - } -#endif + // Test pattern for storage section + void setStorageTestPattern(int factor); - VisibilityType &getVisibility(unsigned baseline, unsigned channel, unsigned pol1, unsigned pol2) - { - return itsVisibilities[NR_POLARIZATIONS * (NR_POLARIZATIONS * (itsNrChannels * baseline + channel) + pol1) + pol2]; - } + private: + /// Forbid assignment. + DH_Visibilities& operator= (const DH_Visibilities&); - NrValidSamplesType &getNrValidSamples(unsigned baseline, unsigned channel) - { - return itsNrValidSamples[itsNrChannels * baseline + channel]; - } - - const size_t getNrVisibilities() const - { - return itsNrBaselines * itsNrChannels * NR_POLARIZATIONS * NR_POLARIZATIONS; - } + unsigned itsNrBaselines, itsNrChannels; -private: - /// Forbid assignment. - DH_Visibilities& operator= (const DH_Visibilities&); + VisibilityType *itsVisibilities; + NrValidSamplesType *itsNrValidSamples; - unsigned itsNrBaselines, itsNrChannels; + void fillDataPointers(); + }; - VisibilityType *itsVisibilities; - NrValidSamplesType *itsNrValidSamples; + } // namespace CS1 - void fillDataPointers(); -}; -} // Namespace LOFAR +} // namespace LOFAR #endif diff --git a/Appl/CEP/CS1/CS1_Interface/include/CS1_Interface/RSPTimeStamp.h b/Appl/CEP/CS1/CS1_Interface/include/CS1_Interface/RSPTimeStamp.h index cd4a230c10f083807907c80eb69bcfe91825ce44..e2c3e76ef52ed548426598e635483a5ba7a0f0df 100644 --- a/Appl/CEP/CS1/CS1_Interface/include/CS1_Interface/RSPTimeStamp.h +++ b/Appl/CEP/CS1/CS1_Interface/include/CS1_Interface/RSPTimeStamp.h @@ -20,95 +20,95 @@ //# //# $Id$ -#ifndef LOFAR_APPL_CEP_CS1_CS1_INTERFACE_RSPTIMESTAMP_H -#define LOFAR_APPL_CEP_CS1_CS1_INTERFACE_RSPTIMESTAMP_H - -#include <Common/lofar_iostream.h> -//#include <math.h> +#ifndef LOFAR_CS1_INTERFACE_RSPTIMESTAMP_H +#define LOFAR_CS1_INTERFACE_RSPTIMESTAMP_H +#include <Common/lofar_iosfwd.h> namespace LOFAR { - class TimeStamp { - public: - TimeStamp(const int seqId = 0, const int blockId = 0); - - // set the Stamp - void setStamp(const int seqId, const int blockId); - // get sequence ID - const int getSeqId () const; - // get block ID - const int getBlockId () const; - static int getMaxBlockId() {return theirMaxBlockId; }; - static void setMaxBlockId(int nMBID) {theirMaxBlockId = nMBID; }; - - // the blockId restarts at zero at some point. Check if we are there yet - void checkOverflow(); - - // increase the value of the stamp - void operator+= (const TimeStamp& other); - void operator+= (int increment); - void operator++ (int); - - TimeStamp operator+ (int other) const; - long long operator- (const TimeStamp& other) const; - TimeStamp operator- (int other) const; - bool operator> (const TimeStamp& other) const; - bool operator< (const TimeStamp& other) const; - bool operator>= (const TimeStamp& other) const; - bool operator<= (const TimeStamp& other) const; - bool operator== (const TimeStamp& other) const; - - friend ostream& operator<<(ostream& os, const TimeStamp& ss); - - private: - int itsSeqId; - int itsBlockId; - - static int theirMaxBlockId; - }; - - typedef TimeStamp timestamp_t; - - inline void TimeStamp::setStamp(const int seqId, const int blockId) + namespace CS1 + { + class TimeStamp { + public: + TimeStamp(const int seqId = 0, const int blockId = 0); + + // set the Stamp + void setStamp(const int seqId, const int blockId); + // get sequence ID + const int getSeqId () const; + // get block ID + const int getBlockId () const; + static int getMaxBlockId() {return theirMaxBlockId; }; + static void setMaxBlockId(int nMBID) {theirMaxBlockId = nMBID; }; + + // the blockId restarts at zero at some point. Check if we are there yet + void checkOverflow(); + + // increase the value of the stamp + void operator+= (const TimeStamp& other); + void operator+= (int increment); + void operator++ (int); + + TimeStamp operator+ (int other) const; + long long operator- (const TimeStamp& other) const; + TimeStamp operator- (int other) const; + bool operator> (const TimeStamp& other) const; + bool operator< (const TimeStamp& other) const; + bool operator>= (const TimeStamp& other) const; + bool operator<= (const TimeStamp& other) const; + bool operator== (const TimeStamp& other) const; + + friend ostream& operator<<(ostream& os, const TimeStamp& ss); + + private: + int itsSeqId; + int itsBlockId; + + static int theirMaxBlockId; + }; + + typedef TimeStamp timestamp_t; + + inline void TimeStamp::setStamp(const int seqId, const int blockId) { itsSeqId = seqId; itsBlockId = blockId; checkOverflow(); }; - inline const int TimeStamp::getSeqId () const + inline const int TimeStamp::getSeqId () const { return itsSeqId; } - inline const int TimeStamp::getBlockId () const + inline const int TimeStamp::getBlockId () const { return itsBlockId; } - inline void TimeStamp::operator += (const TimeStamp& other) + inline void TimeStamp::operator += (const TimeStamp& other) { itsBlockId += other.itsBlockId; checkOverflow(); itsSeqId += other.itsSeqId; } - inline void TimeStamp::operator += (int increment) + inline void TimeStamp::operator += (int increment) { itsBlockId += increment; checkOverflow(); } - inline void TimeStamp::operator ++ (int dummy) + inline void TimeStamp::operator ++ (int) { itsBlockId ++; checkOverflow(); } - inline TimeStamp TimeStamp::operator+ (int increment) const + inline TimeStamp TimeStamp::operator+ (int increment) const { // check overflow is done in the constructor return TimeStamp(itsSeqId, itsBlockId + increment); } - inline TimeStamp TimeStamp::operator- (int decrement) const + inline TimeStamp TimeStamp::operator- (int decrement) const { // check overflow is done in the constructor return TimeStamp(itsSeqId, itsBlockId - decrement); } - inline long long TimeStamp::operator- (const TimeStamp& other) const + inline long long TimeStamp::operator- (const TimeStamp& other) const { long long seqdecr = itsSeqId - other.itsSeqId; int blockdecr = itsBlockId - other.itsBlockId; @@ -116,32 +116,34 @@ namespace LOFAR return (seqdecr*theirMaxBlockId) + blockdecr; } - inline bool TimeStamp::operator > (const TimeStamp& other) const + inline bool TimeStamp::operator > (const TimeStamp& other) const { if (itsSeqId > other.itsSeqId) return true; if (itsSeqId < other.itsSeqId) return false; if (itsBlockId > other.itsBlockId) return true; return false; } - inline bool TimeStamp::operator >= (const TimeStamp& other) const + inline bool TimeStamp::operator >= (const TimeStamp& other) const { return !operator<(other); } - inline bool TimeStamp::operator < (const TimeStamp& other) const + inline bool TimeStamp::operator < (const TimeStamp& other) const { if (itsSeqId < other.itsSeqId) return true; if (itsSeqId > other.itsSeqId) return false; if (itsBlockId < other.itsBlockId) return true; return false; } - inline bool TimeStamp::operator <= (const TimeStamp& other) const + inline bool TimeStamp::operator <= (const TimeStamp& other) const { return !operator>(other); } - inline bool TimeStamp::operator == (const TimeStamp& other) const + inline bool TimeStamp::operator == (const TimeStamp& other) const { return ((itsSeqId == other.itsSeqId) && (itsBlockId == other.itsBlockId)); } -} + } // namespace CS1 + +} // namespace LOFAR #endif diff --git a/Appl/CEP/CS1/CS1_Interface/include/CS1_Interface/RectMatrix.h b/Appl/CEP/CS1/CS1_Interface/include/CS1_Interface/RectMatrix.h index 4f1b48d5665f4ff8dfe0a002a54fba192c1336f6..0dfd038d214cca5386a9c78ab3204d611309d8a3 100644 --- a/Appl/CEP/CS1/CS1_Interface/include/CS1_Interface/RectMatrix.h +++ b/Appl/CEP/CS1/CS1_Interface/include/CS1_Interface/RectMatrix.h @@ -21,140 +21,139 @@ //# //# $Id$ -#ifndef LOFAR_APPL_CEP_CS1_CS1_INTERFACE_RECT_MATRIX -#define LOFAR_APPL_CEP_CS1_CS1_INTERFACE_RECT_MATRIX - -#include<Common/LofarLogger.h> -#include<Common/lofar_vector.h> -#include<Common/lofar_map.h> -#include<Common/lofar_string.h> - -using LOFAR::string; -using LOFAR::vector; -using LOFAR::map; - -namespace LOFAR { - -// 3 macros are provided which can be used to construct a for loop: -// -// MATRIX_FOR_LOOP(matrix, dim, cursor) -// loops through 1 full dimension(dim) of matrix from cursor to end -// -// MATRIX_FOR_LOOP_PART(matrix, dim, cursor, noElem) -// loops through from cursor to cursor + noElem in the dimension dim of the matrix -// -// e.g. -// cursor = matrix.getCursor(0) -// MATRIX_FOR_LOOP(matrix, dim, cursor) { -// matrix.setValue(cursor, 0); -// } - - -// the definition of a dimension -// this class is only used when constructing a rectmatrix -class DimDef { - public: - DimDef(const string& newName, const int newSize): - name(newName), - size(newSize) - {}; - string name; - int size; -}; - - -// a dimension of a RectMatrix -class dimType{ - public: - dimType(int ms = 0, int ne = 0) : - memSize(ms), - noElem(ne){total = ms*ne;}; - int memSize; // how many values from this element to the next element in this dimension - int noElem; // how many elements in this dimension - int total; // memSize*noElem, used for for-loops - int operator*(int steps) { - return steps * memSize;}; - friend int operator*(int steps, dimType& dim) { - return steps * dim.memSize;}; -}; - - -// this class holds a matrix -// for example programs using this class see tRectMatrix.cc in the test directory -template <typename valueType> -class RectMatrix { - public: - RectMatrix(vector<DimDef>&); - // ~RectMatrix(); +#ifndef LOFAR_CS1_INTERFACE_RECTMATRIX_H +#define LOFAR_CS1_INTERFACE_RECTMATRIX_H + +#include <Common/LofarLogger.h> +#include <Common/lofar_vector.h> +#include <Common/lofar_map.h> +#include <Common/lofar_string.h> + +namespace LOFAR +{ + namespace CS1 + { + + // 3 macros are provided which can be used to construct a for loop: + // + // MATRIX_FOR_LOOP(matrix, dim, cursor) + // loops through 1 full dimension(dim) of matrix from cursor to end + // + // MATRIX_FOR_LOOP_PART(matrix, dim, cursor, noElem) + // loops through from cursor to cursor + noElem in the dimension dim of the matrix + // + // e.g. + // cursor = matrix.getCursor(0) + // MATRIX_FOR_LOOP(matrix, dim, cursor) { + // matrix.setValue(cursor, 0); + // } + + + // the definition of a dimension + // this class is only used when constructing a rectmatrix + class DimDef { + public: + DimDef(const string& newName, const int newSize): + name(newName), + size(newSize) + {}; + string name; + int size; + }; + + + // a dimension of a RectMatrix + class dimType{ + public: + dimType(int ms = 0, int ne = 0) : + memSize(ms), + noElem(ne){total = ms*ne;}; + int memSize; // how many values from this element to the next element in this dimension + int noElem; // how many elements in this dimension + int total; // memSize*noElem, used for for-loops + int operator*(int steps) { + return steps * memSize;}; + friend int operator*(int steps, dimType& dim) { + return steps * dim.memSize;}; + }; + + + // this class holds a matrix + // for example programs using this class see tRectMatrix.cc in the test directory + template <typename valueType> + class RectMatrix { + public: + RectMatrix(vector<DimDef>&); + // ~RectMatrix(); - typedef int cursorType; // is the offset of the datamember in itsData + typedef int cursorType; // is the offset of the datamember in itsData - // get a dimension identifier by name - dimType& getDim(string dimName); - // get number of elements in this dimension - // don't use this function to much because it uses a map! - int getNElemInDim(const dimType& dim) const; - // get a cursor at a certain position in the matrix - // use this as 4*firstDim + 2* secondDim for element(4,2) - cursorType getCursor(const int pos = 0) const; - // get the value at the position of the cursor - valueType& getValue(const cursorType& cursor) const; - // set the value at the position of the cursor - void setValue(const cursorType& cursor, const valueType& value); - // move the cursor in a dimension - void moveCursor(cursorType* cursor, const dimType& dim) const; - // move the cursor in a dimension a certain number of steps - void moveCursorN(cursorType* cursor, const dimType& dim, const int& steps) const; + // get a dimension identifier by name + dimType& getDim(string dimName); + // get number of elements in this dimension + // don't use this function to much because it uses a map! + int getNElemInDim(const dimType& dim) const; + // get a cursor at a certain position in the matrix + // use this as 4*firstDim + 2* secondDim for element(4,2) + cursorType getCursor(const int pos = 0) const; + // get the value at the position of the cursor + valueType& getValue(const cursorType& cursor) const; + // set the value at the position of the cursor + void setValue(const cursorType& cursor, const valueType& value); + // move the cursor in a dimension + void moveCursor(cursorType* cursor, const dimType& dim) const; + // move the cursor in a dimension a certain number of steps + void moveCursorN(cursorType* cursor, const dimType& dim, const int& steps) const; - // get a block of memory - valueType* getBlock(const cursorType& cursor, const dimType& dim, const int noElem, const int noTotalElem) const; - - // copy a subblock of the matrix - // note that the lower dimensions of both matrixes have to match - // it makes no sense to copy a block of information if it doesn't have the same - // meaning in the other matrix - void cpy2Matrix (cursorType srcCursor, - dimType& srcDim, - RectMatrix& dstMatrix, - cursorType dstCursor, - dimType& dstDim, - int noBlocks); - void cpyFromBlock (valueType* srcPointer, - int blockSize, - cursorType dstCursor, - dimType& dim, - int noBlocks); - void cpy2Block (cursorType srcCursor, - dimType& dim, - valueType* dstPointer, - int blockSize, - int noBlocks); - // point the matrix to the memory it should use - void setBuffer(valueType* buffer, int size); + // get a block of memory + valueType* getBlock(const cursorType& cursor, const dimType& dim, const int noElem, const int noTotalElem) const; + + // copy a subblock of the matrix + // note that the lower dimensions of both matrixes have to match + // it makes no sense to copy a block of information if it doesn't have the same + // meaning in the other matrix + void cpy2Matrix (cursorType srcCursor, + dimType& srcDim, + RectMatrix& dstMatrix, + cursorType dstCursor, + dimType& dstDim, + int noBlocks); + void cpyFromBlock (valueType* srcPointer, + int blockSize, + cursorType dstCursor, + dimType& dim, + int noBlocks); + void cpy2Block (cursorType srcCursor, + dimType& dim, + valueType* dstPointer, + int blockSize, + int noBlocks); + // point the matrix to the memory it should use + void setBuffer(valueType* buffer, int size); #ifdef ENABLE_DBGASSERT - // cursors are only made invalid when DBGASSERT is enabled - bool isCursorValid(const cursorType& cursor) const; + // cursors are only made invalid when DBGASSERT is enabled + bool isCursorValid(const cursorType& cursor) const; #endif - private: - bool areInSameDim(const cursorType& cur1, const cursorType& cur2, const dimType& dim) const; + private: + bool areInSameDim(const cursorType& cur1, const cursorType& cur2, const dimType& dim) const; - friend class DataHolder; + friend class DataHolder; - valueType* itsData; - map<string, dimType*> itsDimMap; - int itsTotalSize; -}; + valueType* itsData; + map<string, dimType*> itsDimMap; + int itsTotalSize; + }; #ifdef ENABLE_DBGASSERT -// Macro for defining a for-loop that walks through all the elements of 1 dimension -// for unoptimized code we can loop until the cursor is invalid + // Macro for defining a for-loop that walks through all the elements of 1 dimension + // for unoptimized code we can loop until the cursor is invalid #define MATRIX_FOR_LOOP(matrix, dim, cursor) \ for (; (matrix).isCursorValid(cursor); (matrix).moveCursor(&cursor, dim)) -// Macro for defining a for-loop that walks through 1 dimension from cursor to cursor + noElem + // Macro for defining a for-loop that walks through 1 dimension from cursor to cursor + noElem #define MATRIX_FOR_LOOP_PART(matrix, dim, cursor, noElem) \ int cursorMax = cursor + (dim).memsize * noElem;\ for (; (matrix).isCursorValid(cursor)&&(cursor < cursorMax); (matrix).moveCursor(&cursor, dim)) @@ -175,5 +174,8 @@ class RectMatrix { #include <CS1_Interface/RectMatrix.tcc> -} + } // namespace CS1 + +} // namespace LOFAR + #endif diff --git a/Appl/CEP/CS1/CS1_Interface/include/CS1_Interface/RectMatrix.tcc b/Appl/CEP/CS1/CS1_Interface/include/CS1_Interface/RectMatrix.tcc index 21802066001e4defd978cf30c9f76d926b501e45..48350a5faaf2f0ca09446b7c7ec41b8497d3d134 100644 --- a/Appl/CEP/CS1/CS1_Interface/include/CS1_Interface/RectMatrix.tcc +++ b/Appl/CEP/CS1/CS1_Interface/include/CS1_Interface/RectMatrix.tcc @@ -19,176 +19,177 @@ //# //# $Id$ +#ifndef LOFAR_CS1_INTERFACE_RECTMATRIX_TCC +#define LOFAR_CS1_INTERFACE_RECTMATRIX_TCC -#ifndef LOFAR_APPL_CEP_CS1_CS1_INTERFACE_RECT_MATRIX_TCC -#define LOFAR_APPL_CEP_CS1_CS1_INTERFACE_RECT_MATRIX_TCC - -#include<Common/LofarLogger.h> -#include<Common/lofar_vector.h> -#include<Common/lofar_map.h> -#include<Common/lofar_string.h> - -using LOFAR::string; -using LOFAR::vector; -using LOFAR::map; +#include <Common/LofarLogger.h> +#include <Common/lofar_vector.h> +#include <Common/lofar_map.h> +#include <Common/lofar_string.h> +namespace LOFAR +{ + namespace CS1 + { #if ENABLE_DBGASSERT -// this function can only be used in debug mode because -// cursor are not checked in optimized mode, so it can be invalid -template <typename valueType> -inline bool RectMatrix<valueType>::isCursorValid(const cursorType& cursor) const { - return (cursor >= 0); -} + // this function can only be used in debug mode because + // cursor are not checked in optimized mode, so it can be invalid + template <typename valueType> + inline bool RectMatrix<valueType>::isCursorValid(const cursorType& cursor) const { + return (cursor >= 0); + } #endif -template <typename valueType> -RectMatrix<valueType>::RectMatrix(vector<DimDef>& dimdefv) : - itsData(0) -{ - vector<DimDef>::reverse_iterator it = dimdefv.rbegin(); - int lastSize = 1; - for (; it<dimdefv.rend(); it++) { - itsDimMap[it->name] = new dimType(lastSize, it->size); - lastSize *= it->size; - } - itsTotalSize = lastSize; -} + template <typename valueType> + RectMatrix<valueType>::RectMatrix(vector<DimDef>& dimdefv) : + itsData(0) + { + vector<DimDef>::reverse_iterator it = dimdefv.rbegin(); + int lastSize = 1; + for (; it<dimdefv.rend(); it++) { + itsDimMap[it->name] = new dimType(lastSize, it->size); + lastSize *= it->size; + } + itsTotalSize = lastSize; + } -template <typename valueType> -inline dimType& RectMatrix<valueType>::getDim(string dimName) { - DBGASSERTSTR(itsDimMap.find(dimName) != itsDimMap.end(), "Cannot find dimension " << dimName << " in this RectMatrix"); - return *itsDimMap[dimName];}; + template <typename valueType> + inline dimType& RectMatrix<valueType>::getDim(string dimName) { + DBGASSERTSTR(itsDimMap.find(dimName) != itsDimMap.end(), "Cannot find dimension " << dimName << " in this RectMatrix"); + return *itsDimMap[dimName];}; -template <typename valueType> -inline int RectMatrix<valueType>::getNElemInDim(const dimType& dim) const { - return dim.noElem;}; + template <typename valueType> + inline int RectMatrix<valueType>::getNElemInDim(const dimType& dim) const { + return dim.noElem;}; -template <typename valueType> -inline typename RectMatrix<valueType>::cursorType RectMatrix<valueType>::getCursor(const int pos) const { - return pos; }; + template <typename valueType> + inline typename RectMatrix<valueType>::cursorType RectMatrix<valueType>::getCursor(const int pos) const { + return pos; }; -template <typename valueType> -inline valueType& RectMatrix<valueType>::getValue(const cursorType& cursor) const { - DBGASSERTSTR(isCursorValid(cursor), "Invalid cursor RectMatrix::getValue()"); - DBGASSERTSTR(cursor<itsTotalSize, "Index out of range in RectMatrix::getValue()"); - return itsData[cursor];}; + template <typename valueType> + inline valueType& RectMatrix<valueType>::getValue(const cursorType& cursor) const { + DBGASSERTSTR(isCursorValid(cursor), "Invalid cursor RectMatrix::getValue()"); + DBGASSERTSTR(cursor<itsTotalSize, "Index out of range in RectMatrix::getValue()"); + return itsData[cursor];}; -template <typename valueType> -inline void RectMatrix<valueType>::setValue(const cursorType& cursor, const valueType& value) { - DBGASSERTSTR(isCursorValid(cursor), "Invalid cursor RectMatrix::setValue()"); - DBGASSERTSTR(cursor<itsTotalSize, "Index out of range in RectMatrix::setValue()"); - itsData[cursor] = value; }; + template <typename valueType> + inline void RectMatrix<valueType>::setValue(const cursorType& cursor, const valueType& value) { + DBGASSERTSTR(isCursorValid(cursor), "Invalid cursor RectMatrix::setValue()"); + DBGASSERTSTR(cursor<itsTotalSize, "Index out of range in RectMatrix::setValue()"); + itsData[cursor] = value; }; -template <typename valueType> -inline void RectMatrix<valueType>::moveCursor(cursorType* cursorp, const dimType& dim) const { - DBGASSERTSTR(isCursorValid(*cursorp), "Invalid cursor RectMatrix::moveCursor()"); + template <typename valueType> + inline void RectMatrix<valueType>::moveCursor(cursorType* cursorp, const dimType& dim) const { + DBGASSERTSTR(isCursorValid(*cursorp), "Invalid cursor RectMatrix::moveCursor()"); #if ENABLE_DBGASSERT - if (!areInSameDim(*cursorp, (*cursorp)+dim.memSize, dim)) - { - *cursorp = -1; - } else { -#else - { + if (!areInSameDim(*cursorp, (*cursorp)+dim.memSize, dim)) + { + *cursorp = -1; + } else #endif - *cursorp += dim.memSize; - } -}; + { + *cursorp += dim.memSize; + } + }; -template <typename valueType> -inline void RectMatrix<valueType>::moveCursorN(cursorType* cursorp, const dimType& dim, const int& steps) const { - DBGASSERTSTR(isCursorValid(*cursorp), "Invalid cursor RectMatrix::moveCursorN()"); + template <typename valueType> + inline void RectMatrix<valueType>::moveCursorN(cursorType* cursorp, const dimType& dim, const int& steps) const { + DBGASSERTSTR(isCursorValid(*cursorp), "Invalid cursor RectMatrix::moveCursorN()"); #if ENABLE_DBGASSERT - if (!areInSameDim(*cursorp, (*cursorp) + dim.memSize * steps, dim)) - { - *cursorp = -1; - } else { -#else - { + if (!areInSameDim(*cursorp, (*cursorp) + dim.memSize * steps, dim)) + { + *cursorp = -1; + } else #endif - *cursorp += dim.memSize*steps; - } -}; - - -template <typename valueType> -inline valueType* RectMatrix<valueType>::getBlock(const cursorType& cursor, const dimType& dim, const int noElemOfDim, const int noTotalElem) const { - DBGASSERTSTR(isCursorValid(cursor), "Invalid cursor RectMatrix::getBlock()"); - DBGASSERTSTR(areInSameDim(cursor, cursor + dim.memSize * (noElemOfDim-1), dim), "Attempted to get block that crosses end of dimension"); - // this assert is only needed if we want to forbid getting pointers to higher dimension blocks - // DBGASSERTSTR(dim.memSize == sizeof(valueType), "Attempted to get block that is not of the lowest dimension"); - DBGASSERTSTR(dim.memSize * noElemOfDim == noTotalElem, "Attempted to get block but noTotalElem, noElemOfDim and dimension do not match"); - return &(itsData[cursor]); }; - - -template <typename valueType> -inline void RectMatrix<valueType>::cpy2Matrix (cursorType srcCursor, - dimType& srcDim, - RectMatrix& dstMatrix, - cursorType dstCursor, - dimType& dstDim, - int noBlocks) { - DBGASSERTSTR(isCursorValid(srcCursor), "Invalid srcCursor RectMatrix::cpy2Matrix()"); - DBGASSERTSTR(isCursorValid(dstCursor), "Invalid dstCursor RectMatrix::cpy2Matrix()"); - DBGASSERTSTR(srcDim.memSize == dstDim.memSize, "Dimension to be copied are not compatible"); - // This assert is not necessary anymore - // DBGASSERTSTR((dstCursor+noBlocks*dstDim.memSize)<=dstMatrix.itsTotalSize, "Index out of range in destination in RectMatrix::cpy2Matrix"); - // DBGASSERTSTR((srcCursor+noBlocks*srcDim.memSize)<=itsTotalSize, "Index out of range in source in RectMatrix::cpy2Matrix"); - DBGASSERTSTR(areInSameDim(dstCursor, dstCursor + dstDim.memSize * (noBlocks-1), dstDim), "Attempted to copy to matrix beyond end of dimension"); - DBGASSERTSTR(areInSameDim(srcCursor, srcCursor + srcDim.memSize * (noBlocks-1), srcDim), "Attempted to copy from matrix beyond end of dimension"); - memcpy(&(dstMatrix.itsData[dstCursor]), &(itsData[srcCursor]), noBlocks * srcDim.memSize * sizeof(valueType)); -}; - - -template <typename valueType> -inline void RectMatrix<valueType>::cpyFromBlock (valueType* srcPointer, - int blockSize, - cursorType dstCursor, - dimType& dstDim, - int noBlocks) { - DBGASSERTSTR(isCursorValid(dstCursor), "Invalid cursor RectMatrix::cpyFromBlock()"); - DBGASSERTSTR(blockSize == dstDim.memSize, "Dimension to be copied are not compatible"); - // DBGASSERTSTR((dstCursor+noBlocks*dstDim.memSize)<=itsTotalSize, "Index out of range in destination in RectMatrix::cpyFromBlock"); - DBGASSERTSTR(areInSameDim(dstCursor, dstCursor + dstDim.memSize * (noBlocks - 1), dstDim), "Attempted to copy to matrix beyond end of dimension"); - memcpy(&(itsData[dstCursor]), srcPointer, noBlocks * blockSize * sizeof(valueType)); -} - - -template <typename valueType> -inline void RectMatrix<valueType>::cpy2Block (cursorType srcCursor, - dimType& srcDim, - valueType* dstPointer, - int blockSize, - int noBlocks) { - DBGASSERTSTR(isCursorValid(srcCursor), "Invalid cursor RectMatrix::cpy2Block()"); - DBGASSERTSTR(srcDim.memSize == blockSize, "Dimension to be copied are not compatible"); - // DBGASSERTSTR((srcCursor+noBlocks*srcDim.memSize)<=itsTotalSize, "Index out of range in source in RectMatrix::cpy2Block"); - DBGASSERTSTR(areInSameDim(srcCursor, srcCursor + srcDim.memSize * (noBlocks - 1), srcDim), "Attempted to copy from matrix beyond end of dimension"); - memcpy((void*)dstPointer, &(itsData[srcCursor]), noBlocks * blockSize * sizeof(valueType)); -} - - -template <typename valueType> -inline void RectMatrix<valueType>::setBuffer(valueType* buffer, int size){ - DBGASSERTSTR(size == itsTotalSize, "cannot set buffer because of size mismatch"); - itsData = buffer; -}; - - -template <typename valueType> -inline bool RectMatrix<valueType>::areInSameDim(const cursorType& cur1, const cursorType& cur2, const dimType& dim) const { - DBGASSERTSTR(isCursorValid(cur1), "Invalid cursor RectMatrix::areInSameDim()"); - DBGASSERTSTR(isCursorValid(cur2), "Invalid cursor RectMatrix::areInSameDim()"); - // check if the cursors have the same position in this dimension - // dim.total is the size of this dimension - return ((cur1/dim.total) == (cur2/dim.total)); }; + { + *cursorp += dim.memSize*steps; + } + }; + + + template <typename valueType> + inline valueType* RectMatrix<valueType>::getBlock(const cursorType& cursor, const dimType& dim, const int noElemOfDim, const int noTotalElem) const { + DBGASSERTSTR(isCursorValid(cursor), "Invalid cursor RectMatrix::getBlock()"); + DBGASSERTSTR(areInSameDim(cursor, cursor + dim.memSize * (noElemOfDim-1), dim), "Attempted to get block that crosses end of dimension"); + // this assert is only needed if we want to forbid getting pointers to higher dimension blocks + // DBGASSERTSTR(dim.memSize == sizeof(valueType), "Attempted to get block that is not of the lowest dimension"); + DBGASSERTSTR(dim.memSize * noElemOfDim == noTotalElem, "Attempted to get block but noTotalElem, noElemOfDim and dimension do not match"); + return &(itsData[cursor]); }; + + + template <typename valueType> + inline void RectMatrix<valueType>::cpy2Matrix (cursorType srcCursor, + dimType& srcDim, + RectMatrix& dstMatrix, + cursorType dstCursor, + dimType& dstDim, + int noBlocks) { + DBGASSERTSTR(isCursorValid(srcCursor), "Invalid srcCursor RectMatrix::cpy2Matrix()"); + DBGASSERTSTR(isCursorValid(dstCursor), "Invalid dstCursor RectMatrix::cpy2Matrix()"); + DBGASSERTSTR(srcDim.memSize == dstDim.memSize, "Dimension to be copied are not compatible"); + // This assert is not necessary anymore + // DBGASSERTSTR((dstCursor+noBlocks*dstDim.memSize)<=dstMatrix.itsTotalSize, "Index out of range in destination in RectMatrix::cpy2Matrix"); + // DBGASSERTSTR((srcCursor+noBlocks*srcDim.memSize)<=itsTotalSize, "Index out of range in source in RectMatrix::cpy2Matrix"); + DBGASSERTSTR(areInSameDim(dstCursor, dstCursor + dstDim.memSize * (noBlocks-1), dstDim), "Attempted to copy to matrix beyond end of dimension"); + DBGASSERTSTR(areInSameDim(srcCursor, srcCursor + srcDim.memSize * (noBlocks-1), srcDim), "Attempted to copy from matrix beyond end of dimension"); + memcpy(&(dstMatrix.itsData[dstCursor]), &(itsData[srcCursor]), noBlocks * srcDim.memSize * sizeof(valueType)); + }; + + + template <typename valueType> + inline void RectMatrix<valueType>::cpyFromBlock (valueType* srcPointer, + int blockSize, + cursorType dstCursor, + dimType& dstDim, + int noBlocks) { + DBGASSERTSTR(isCursorValid(dstCursor), "Invalid cursor RectMatrix::cpyFromBlock()"); + DBGASSERTSTR(blockSize == dstDim.memSize, "Dimension to be copied are not compatible"); + // DBGASSERTSTR((dstCursor+noBlocks*dstDim.memSize)<=itsTotalSize, "Index out of range in destination in RectMatrix::cpyFromBlock"); + DBGASSERTSTR(areInSameDim(dstCursor, dstCursor + dstDim.memSize * (noBlocks - 1), dstDim), "Attempted to copy to matrix beyond end of dimension"); + memcpy(&(itsData[dstCursor]), srcPointer, noBlocks * blockSize * sizeof(valueType)); + } + + + template <typename valueType> + inline void RectMatrix<valueType>::cpy2Block (cursorType srcCursor, + dimType& srcDim, + valueType* dstPointer, + int blockSize, + int noBlocks) { + DBGASSERTSTR(isCursorValid(srcCursor), "Invalid cursor RectMatrix::cpy2Block()"); + DBGASSERTSTR(srcDim.memSize == blockSize, "Dimension to be copied are not compatible"); + // DBGASSERTSTR((srcCursor+noBlocks*srcDim.memSize)<=itsTotalSize, "Index out of range in source in RectMatrix::cpy2Block"); + DBGASSERTSTR(areInSameDim(srcCursor, srcCursor + srcDim.memSize * (noBlocks - 1), srcDim), "Attempted to copy from matrix beyond end of dimension"); + memcpy((void*)dstPointer, &(itsData[srcCursor]), noBlocks * blockSize * sizeof(valueType)); + } + + + template <typename valueType> + inline void RectMatrix<valueType>::setBuffer(valueType* buffer, int size){ + DBGASSERTSTR(size == itsTotalSize, "cannot set buffer because of size mismatch"); + itsData = buffer; + }; + + + template <typename valueType> + inline bool RectMatrix<valueType>::areInSameDim(const cursorType& cur1, const cursorType& cur2, const dimType& dim) const { + DBGASSERTSTR(isCursorValid(cur1), "Invalid cursor RectMatrix::areInSameDim()"); + DBGASSERTSTR(isCursorValid(cur2), "Invalid cursor RectMatrix::areInSameDim()"); + // check if the cursors have the same position in this dimension + // dim.total is the size of this dimension + return ((cur1/dim.total) == (cur2/dim.total)); }; + + } // namespace CS1 + +} // namespace LOFAR #endif diff --git a/Appl/CEP/CS1/CS1_Interface/include/CS1_Interface/Stub_BGL.h b/Appl/CEP/CS1/CS1_Interface/include/CS1_Interface/Stub_BGL.h index cc48df847a68880a0dab537a202eb27ce817a545..ea06b00bbaac5fedebfe3180dea921ec6771a21c 100644 --- a/Appl/CEP/CS1/CS1_Interface/include/CS1_Interface/Stub_BGL.h +++ b/Appl/CEP/CS1/CS1_Interface/include/CS1_Interface/Stub_BGL.h @@ -20,42 +20,46 @@ //# //# $Id$ -#ifndef LOFAR_APPL_CEP_CS1_CS1_INTERFACE_STUB_BGL_H -#define LOFAR_APPL_CEP_CS1_CS1_INTERFACE_STUB_BGL_H +#ifndef LOFAR_CS1_INTERFACE_STUB_BGL_H +#define LOFAR_CS1_INTERFACE_STUB_BGL_H #include <APS/ParameterSet.h> #include <tinyCEP/TinyDataManager.h> #include <Transport/Connection.h> #include <Transport/TransportHolder.h> +namespace LOFAR +{ + namespace CS1 + { -namespace LOFAR { + class Stub_BGL + { + // This is a base class that can be used to make connections from the BGL + // application to the outside world. Details are filled in by derived + // classes that must provide the necessary TransportHolders. -class Stub_BGL -{ - // This is a base class that can be used to make connections from the BGL - // application to the outside world. Details are filled in by derived - // classes that must provide the necessary TransportHolders. + public: + Stub_BGL(bool iAmOnBGL, bool isInput, const ACC::APS::ParameterSet &pSet); + virtual ~Stub_BGL(); -public: - Stub_BGL(bool iAmOnBGL, bool isInput, const ACC::APS::ParameterSet &pSet); - virtual ~Stub_BGL(); + void connect(unsigned subband, unsigned slave, TinyDataManager &dm, + unsigned channel); - void connect(unsigned subband, unsigned slave, TinyDataManager &dm, - unsigned channel); + protected: + virtual TransportHolder *newClientTH(unsigned subband, unsigned slave) = 0; + virtual TransportHolder *newServerTH(unsigned subband, unsigned slave) = 0; -protected: - virtual TransportHolder *newClientTH(unsigned subband, unsigned slave) = 0; - virtual TransportHolder *newServerTH(unsigned subband, unsigned slave) = 0; + bool itsIAmOnBGL, itsIsInput; + TransportHolder **itsTHs; + Connection **itsConnections; - bool itsIAmOnBGL, itsIsInput; - TransportHolder **itsTHs; - Connection **itsConnections; + static unsigned itsNrSubbands, itsNrSlavesPerSubband; + }; - static unsigned itsNrSubbands, itsNrSlavesPerSubband; -}; + } // namespace CS1 -} //namespace +} // namespace LOFAR -#endif //include guard +#endif diff --git a/Appl/CEP/CS1/CS1_Interface/include/CS1_Interface/Stub_BGL_RFI_Mitigation.h b/Appl/CEP/CS1/CS1_Interface/include/CS1_Interface/Stub_BGL_RFI_Mitigation.h index 50c8e2dcad4c2d2ac6457ca8fc9752951ef67f53..dc1c457b08179bd85ac2c58bfe562a9ff198bf4c 100644 --- a/Appl/CEP/CS1/CS1_Interface/include/CS1_Interface/Stub_BGL_RFI_Mitigation.h +++ b/Appl/CEP/CS1/CS1_Interface/include/CS1_Interface/Stub_BGL_RFI_Mitigation.h @@ -20,25 +20,29 @@ //# //# $Id$ -#ifndef LOFAR_APPL_CEP_CS1_CS1_INTERFACE_STUB_BGL_RFI_MITIGATION_H -#define LOFAR_APPL_CEP_CS1_CS1_INTERFACE_STUB_BGL_RFI_MITIGATION_H +#ifndef LOFAR_CS1_INTERFACE_STUB_BGL_RFI_MITIGATION_H +#define LOFAR_CS1_INTERFACE_STUB_BGL_RFI_MITIGATION_H #include <CS1_Interface/Stub_BGL.h> -namespace LOFAR { - -class Stub_BGL_RFI_Mitigation : public Stub_BGL +namespace LOFAR { -public: - Stub_BGL_RFI_Mitigation(bool iAmOnBGL, const ACC::APS::ParameterSet &pSet) - : Stub_BGL(iAmOnBGL, iAmOnBGL, pSet) {} + namespace CS1 + { + + class Stub_BGL_RFI_Mitigation : public Stub_BGL + { + public: + Stub_BGL_RFI_Mitigation(bool iAmOnBGL, const ACC::APS::ParameterSet &pSet) + : Stub_BGL(iAmOnBGL, iAmOnBGL, pSet) {} -protected: - virtual TransportHolder *newClientTH(unsigned subband, unsigned slave); - virtual TransportHolder *newServerTH(unsigned subband, unsigned slave); -}; + protected: + virtual TransportHolder *newClientTH(unsigned subband, unsigned slave); + virtual TransportHolder *newServerTH(unsigned subband, unsigned slave); + }; -} //namespace + } //namespace CS1 -#endif //include guard +} //namespace LOFAR +#endif diff --git a/Appl/CEP/CS1/CS1_Interface/include/CS1_Interface/Stub_BGL_Subband.h b/Appl/CEP/CS1/CS1_Interface/include/CS1_Interface/Stub_BGL_Subband.h index 7e5fea56f4bc8cb6c349377c24471155d063ad1e..0355603f85ed11417fb13729435399eb3f9b1039 100644 --- a/Appl/CEP/CS1/CS1_Interface/include/CS1_Interface/Stub_BGL_Subband.h +++ b/Appl/CEP/CS1/CS1_Interface/include/CS1_Interface/Stub_BGL_Subband.h @@ -20,27 +20,32 @@ //# //# $Id$ -#ifndef LOFAR_APPL_CEP_CS1_CS1_INTERFACE_STUB_BGL_SUBBAND_H -#define LOFAR_APPL_CEP_CS1_CS1_INTERFACE_STUB_BGL_SUBBAND_H +#ifndef LOFAR_CS1_INTERFACE_STUB_BGL_SUBBAND_H +#define LOFAR_CS1_INTERFACE_STUB_BGL_SUBBAND_H #include <CS1_Interface/Stub_BGL.h> -namespace LOFAR { - -class Stub_BGL_Subband : public Stub_BGL +namespace LOFAR { -public: - Stub_BGL_Subband(bool iAmOnBGL, const ACC::APS::ParameterSet &); + namespace CS1 + { + + class Stub_BGL_Subband : public Stub_BGL + { + public: + Stub_BGL_Subband(bool iAmOnBGL, const ACC::APS::ParameterSet &); -protected: - virtual TransportHolder *newClientTH(unsigned subband, unsigned slave); - virtual TransportHolder *newServerTH(unsigned subband, unsigned slave); + protected: + virtual TransportHolder *newClientTH(unsigned subband, unsigned slave); + virtual TransportHolder *newServerTH(unsigned subband, unsigned slave); -private: - vector<string> servers, services; -}; + private: + vector<string> servers, services; + }; + + } // namespace CS1 -} //namespace +} // namespace LOFAR -#endif //include guard +#endif diff --git a/Appl/CEP/CS1/CS1_Interface/include/CS1_Interface/Stub_BGL_Visibilities.h b/Appl/CEP/CS1/CS1_Interface/include/CS1_Interface/Stub_BGL_Visibilities.h index ca92316e2b16b85014ec6ab551a9d5c3c237e454..90e95b5b8f46624e9454acd6eee38aa96e4c1a48 100644 --- a/Appl/CEP/CS1/CS1_Interface/include/CS1_Interface/Stub_BGL_Visibilities.h +++ b/Appl/CEP/CS1/CS1_Interface/include/CS1_Interface/Stub_BGL_Visibilities.h @@ -20,27 +20,32 @@ //# //# $Id$ -#ifndef LOFAR_APPL_CEP_CS1_CS1_INTERFACE_STUB_BGL_VISIBILITIES_H -#define LOFAR_APPL_CEP_CS1_CS1_INTERFACE_STUB_BGL_VISIBILITIES_H +#ifndef LOFAR_CS1_INTERFACE_STUB_BGL_VISIBILITIES_H +#define LOFAR_CS1_INTERFACE_STUB_BGL_VISIBILITIES_H #include <CS1_Interface/Stub_BGL.h> -namespace LOFAR { - -class Stub_BGL_Visibilities : public Stub_BGL +namespace LOFAR { -public: - Stub_BGL_Visibilities(bool iAmOnBGL, const ACC::APS::ParameterSet &); + namespace CS1 + { + + class Stub_BGL_Visibilities : public Stub_BGL + { + public: + Stub_BGL_Visibilities(bool iAmOnBGL, const ACC::APS::ParameterSet &); + + protected: + virtual TransportHolder *newClientTH(unsigned subband, unsigned slave); + virtual TransportHolder *newServerTH(unsigned subband, unsigned slave); -protected: - virtual TransportHolder *newClientTH(unsigned subband, unsigned slave); - virtual TransportHolder *newServerTH(unsigned subband, unsigned slave); + private: + vector<string> servers, services; + }; -private: - vector<string> servers, services; -}; + } //namespace CS1 -} //namespace +} //namespace LOFAR #endif //include guard diff --git a/Appl/CEP/CS1/CS1_Interface/include/CS1_Interface/Stub_Delay.h b/Appl/CEP/CS1/CS1_Interface/include/CS1_Interface/Stub_Delay.h index e5a5e9919c2906ab80b45c005ae357dcded51b63..7583f18584e88d684c2589136749836796bcd235 100644 --- a/Appl/CEP/CS1/CS1_Interface/include/CS1_Interface/Stub_Delay.h +++ b/Appl/CEP/CS1/CS1_Interface/include/CS1_Interface/Stub_Delay.h @@ -20,39 +20,48 @@ //# //# $Id$ -#ifndef LOFAR_APPL_CEP_CS1_CS1_INTERFACE_STUB_DELAY_H -#define LOFAR_APPL_CEP_CS1_CS1_INTERFACE_STUB_DELAY_H +#ifndef LOFAR_CS1_INTERFACE_STUB_DELAY_H +#define LOFAR_CS1_INTERFACE_STUB_DELAY_H #include <APS/ParameterSet.h> #include <tinyCEP/TinyDataManager.h> #include <Common/lofar_vector.h> -namespace LOFAR { +namespace LOFAR +{ -class TH_Socket; -class Connection; + class TH_Socket; + class Connection; -class Stub_Delay -{ -public: - // Create the stub. Get its parameters from the given file name. - explicit Stub_Delay(bool isInput, const ACC::APS::ParameterSet &pSet); + namespace CS1 + { + + class Stub_Delay + { + public: + // Create the stub. Get its parameters from the given file name. + explicit Stub_Delay(bool isInput, const ACC::APS::ParameterSet &pSet); + + ~Stub_Delay(); - ~Stub_Delay(); + // Connect the given objects to the stubs. + void connect(uint RSP_nr, TinyDataManager &dm, uint dhNr); - // Connect the given objects to the stubs. - void connect(uint RSP_nr, TinyDataManager &dm, uint dhNr); + private: + // Is this stub an input for a step + bool itsIsInput; + const ACC::APS::ParameterSet &itsPS; + // total number of RSPinputs + uint itsNRSP; + // ports used to connect to RSPs + vector<uint16> itsPorts; + TH_Socket **itsTHs; + Connection **itsConnections; + ALLOC_TRACER_CONTEXT; + }; -private: - bool itsIsInput; // Is this stub an input for a step - const ACC::APS::ParameterSet &itsPS; - uint itsNRSP; // total number of RSPinputs - vector<uint16> itsPorts; // ports used to connect to RSPs - TH_Socket **itsTHs; - Connection **itsConnections; - ALLOC_TRACER_CONTEXT; -}; + } // namespace CS1 -} //namespace +} // namespace LOFAR -#endif // include guard +#endif diff --git a/Appl/CEP/CS1/CS1_Interface/include/CS1_Interface/Stub_RSP.h b/Appl/CEP/CS1/CS1_Interface/include/CS1_Interface/Stub_RSP.h index 271bbeb69004badfc891944aecdeb5d6fad367a2..f38b3d0421c6262695fc63dd02dab1c64fd5f07e 100644 --- a/Appl/CEP/CS1/CS1_Interface/include/CS1_Interface/Stub_RSP.h +++ b/Appl/CEP/CS1/CS1_Interface/include/CS1_Interface/Stub_RSP.h @@ -20,32 +20,35 @@ //# //# $Id$ -#ifndef LOFAR_APPL_CEP_CS1_CS1_INTERFACE_STUB_RSP_H -#define LOFAR_APPL_CEP_CS1_CS1_INTERFACE_STUB_RSP_H +#ifndef LOFAR_CS1_INTERFACE_STUB_RSP_H +#define LOFAR_CS1_INTERFACE_STUB_RSP_H -#include <string> #include <APS/ParameterSet.h> +namespace LOFAR +{ + namespace CS1 + { -namespace LOFAR { + class Stub_RSP + { + public: + // Create the stub. Get its parameters from the given file name. + explicit Stub_RSP (bool onServer, const ACC::APS::ParameterSet &ps); -class Stub_RSP -{ -public: - // Create the stub. Get its parameters from the given file name. - explicit Stub_RSP (bool onServer, const ACC::APS::ParameterSet &ps); + ~Stub_RSP(); - ~Stub_RSP(); + // Connect the given objects to the stubs. + void connect (); - // Connect the given objects to the stubs. - void connect (); + private: + bool itsStubOnServer; + const ACC::APS::ParameterSet &itsPS; + }; -private: - bool itsStubOnServer; - const ACC::APS::ParameterSet &itsPS; -}; + } // namespace CS1 -} //namespace +} // namespace LOFAR -#endif //include guard +#endif diff --git a/Appl/CEP/CS1/CS1_Interface/include/CS1_Interface/bitset.h b/Appl/CEP/CS1/CS1_Interface/include/CS1_Interface/bitset.h index 8b3f8d734e5e0a5acc99026f44f6fb7e086da8db..20de3bb270ff1ee1ef9e1e423fa70b214cad8021 100644 --- a/Appl/CEP/CS1/CS1_Interface/include/CS1_Interface/bitset.h +++ b/Appl/CEP/CS1/CS1_Interface/include/CS1_Interface/bitset.h @@ -102,19 +102,21 @@ namespace LOFAR { - using namespace std; - - extern const unsigned char _S_bit_count[256]; - extern const unsigned char _S_first_one[256]; - /** - * @if maint - * Base class, general case. It is a class inveriant that _Nw will be - * nonnegative. - * - * See documentation for bitset. - * @endif - */ - template<size_t _Nw> + namespace CS1 + { + using namespace std; + + extern const unsigned char _S_bit_count[256]; + extern const unsigned char _S_first_one[256]; + /** + * @if maint + * Base class, general case. It is a class inveriant that _Nw will be + * nonnegative. + * + * See documentation for bitset. + * @endif + */ + template<size_t _Nw> struct _Base_bitset { typedef uint32 _WordT; @@ -207,10 +209,10 @@ namespace LOFAR _M_is_equal(const _Base_bitset<_Nw>& __x) const { for (size_t __i = 0; __i < _Nw; ++__i) - { - if (_M_w[__i] != __x._M_w[__i]) - return false; - } + { + if (_M_w[__i] != __x._M_w[__i]) + return false; + } return true; } @@ -218,10 +220,10 @@ namespace LOFAR _M_is_any() const { for (size_t __i = 0; __i < _Nw; __i++) - { - if (_M_w[__i] != static_cast<_WordT>(0)) - return true; - } + { + if (_M_w[__i] != static_cast<_WordT>(0)) + return true; + } return false; } @@ -233,10 +235,10 @@ namespace LOFAR const unsigned char* __end_ptr = (const unsigned char*)(_M_w + _Nw); while ( __byte_ptr < __end_ptr ) - { - __result += _S_bit_count[*__byte_ptr]; - __byte_ptr++; - } + { + __result += _S_bit_count[*__byte_ptr]; + __byte_ptr++; + } return __result; } @@ -252,59 +254,59 @@ namespace LOFAR _M_do_find_next(size_t __prev, size_t __not_found) const; }; - // Definitions of non-inline functions from _Base_bitset. - template<size_t _Nw> + // Definitions of non-inline functions from _Base_bitset. + template<size_t _Nw> void _Base_bitset<_Nw>::_M_do_left_shift(size_t __shift) { if (__builtin_expect(__shift != 0, 1)) - { - const size_t __wshift = __shift / _LOFAR_BITSET_BITS_PER_WORD; - const size_t __offset = __shift % _LOFAR_BITSET_BITS_PER_WORD; - - if (__offset == 0) - for (size_t __n = _Nw - 1; __n >= __wshift; --__n) - _M_w[__n] = _M_w[__n - __wshift]; - else - { - const size_t __sub_offset = _LOFAR_BITSET_BITS_PER_WORD - __offset; - for (size_t __n = _Nw - 1; __n > __wshift; --__n) - _M_w[__n] = (_M_w[__n - __wshift] << __offset) | - (_M_w[__n - __wshift - 1] >> __sub_offset); - _M_w[__wshift] = _M_w[0] << __offset; - } - - fill(_M_w + 0, _M_w + __wshift, static_cast<_WordT>(0)); - } + { + const size_t __wshift = __shift / _LOFAR_BITSET_BITS_PER_WORD; + const size_t __offset = __shift % _LOFAR_BITSET_BITS_PER_WORD; + + if (__offset == 0) + for (size_t __n = _Nw - 1; __n >= __wshift; --__n) + _M_w[__n] = _M_w[__n - __wshift]; + else + { + const size_t __sub_offset = _LOFAR_BITSET_BITS_PER_WORD - __offset; + for (size_t __n = _Nw - 1; __n > __wshift; --__n) + _M_w[__n] = (_M_w[__n - __wshift] << __offset) | + (_M_w[__n - __wshift - 1] >> __sub_offset); + _M_w[__wshift] = _M_w[0] << __offset; + } + + fill(_M_w + 0, _M_w + __wshift, static_cast<_WordT>(0)); + } } - template<size_t _Nw> + template<size_t _Nw> void _Base_bitset<_Nw>::_M_do_right_shift(size_t __shift) { if (__builtin_expect(__shift != 0, 1)) - { - const size_t __wshift = __shift / _LOFAR_BITSET_BITS_PER_WORD; - const size_t __offset = __shift % _LOFAR_BITSET_BITS_PER_WORD; - const size_t __limit = _Nw - __wshift - 1; - - if (__offset == 0) - for (size_t __n = 0; __n <= __limit; ++__n) - _M_w[__n] = _M_w[__n + __wshift]; - else - { - const size_t __sub_offset = _LOFAR_BITSET_BITS_PER_WORD - __offset; - for (size_t __n = 0; __n < __limit; ++__n) - _M_w[__n] = (_M_w[__n + __wshift] >> __offset) | - (_M_w[__n + __wshift + 1] << __sub_offset); - _M_w[__limit] = _M_w[_Nw-1] >> __offset; - } - - fill(_M_w + __limit + 1, _M_w + _Nw, static_cast<_WordT>(0)); - } + { + const size_t __wshift = __shift / _LOFAR_BITSET_BITS_PER_WORD; + const size_t __offset = __shift % _LOFAR_BITSET_BITS_PER_WORD; + const size_t __limit = _Nw - __wshift - 1; + + if (__offset == 0) + for (size_t __n = 0; __n <= __limit; ++__n) + _M_w[__n] = _M_w[__n + __wshift]; + else + { + const size_t __sub_offset = _LOFAR_BITSET_BITS_PER_WORD - __offset; + for (size_t __n = 0; __n < __limit; ++__n) + _M_w[__n] = (_M_w[__n + __wshift] >> __offset) | + (_M_w[__n + __wshift + 1] << __sub_offset); + _M_w[__limit] = _M_w[_Nw-1] >> __offset; + } + + fill(_M_w + __limit + 1, _M_w + _Nw, static_cast<_WordT>(0)); + } } - template<size_t _Nw> + template<size_t _Nw> uint32 _Base_bitset<_Nw>::_M_do_to_uint32() const { @@ -314,33 +316,33 @@ namespace LOFAR return _M_w[0]; } - template<size_t _Nw> + template<size_t _Nw> size_t _Base_bitset<_Nw>::_M_do_find_first(size_t __not_found) const { for (size_t __i = 0; __i < _Nw; __i++ ) - { - _WordT __thisword = _M_w[__i]; - if ( __thisword != static_cast<_WordT>(0) ) - { - // find byte within word - for (size_t __j = 0; __j < sizeof(_WordT); __j++ ) - { - unsigned char __this_byte - = static_cast<unsigned char>(__thisword & (~(unsigned char)0)); - if (__this_byte) - return __i*_LOFAR_BITSET_BITS_PER_WORD + __j*CHAR_BIT + - _S_first_one[__this_byte]; - - __thisword >>= CHAR_BIT; - } - } - } + { + _WordT __thisword = _M_w[__i]; + if ( __thisword != static_cast<_WordT>(0) ) + { + // find byte within word + for (size_t __j = 0; __j < sizeof(_WordT); __j++ ) + { + unsigned char __this_byte + = static_cast<unsigned char>(__thisword & (~(unsigned char)0)); + if (__this_byte) + return __i*_LOFAR_BITSET_BITS_PER_WORD + __j*CHAR_BIT + + _S_first_one[__this_byte]; + + __thisword >>= CHAR_BIT; + } + } + } // not found, so return an indication of failure. return __not_found; } - template<size_t _Nw> + template<size_t _Nw> size_t _Base_bitset<_Nw>::_M_do_find_next(size_t __prev, size_t __not_found) const { @@ -359,55 +361,55 @@ namespace LOFAR __thisword &= (~static_cast<_WordT>(0)) << _S_whichbit(__prev); if ( __thisword != static_cast<_WordT>(0) ) - { - // find byte within word - // get first byte into place - __thisword >>= _S_whichbyte(__prev) * CHAR_BIT; - for (size_t __j = _S_whichbyte(__prev); __j < sizeof(_WordT); __j++) - { - unsigned char __this_byte - = static_cast<unsigned char>(__thisword & (~(unsigned char)0)); - if ( __this_byte ) - return __i*_LOFAR_BITSET_BITS_PER_WORD + __j*CHAR_BIT + - _S_first_one[__this_byte]; - - __thisword >>= CHAR_BIT; - } - } + { + // find byte within word + // get first byte into place + __thisword >>= _S_whichbyte(__prev) * CHAR_BIT; + for (size_t __j = _S_whichbyte(__prev); __j < sizeof(_WordT); __j++) + { + unsigned char __this_byte + = static_cast<unsigned char>(__thisword & (~(unsigned char)0)); + if ( __this_byte ) + return __i*_LOFAR_BITSET_BITS_PER_WORD + __j*CHAR_BIT + + _S_first_one[__this_byte]; + + __thisword >>= CHAR_BIT; + } + } // check subsequent words __i++; for ( ; __i < _Nw; __i++ ) - { - __thisword = _M_w[__i]; - if ( __thisword != static_cast<_WordT>(0) ) - { - // find byte within word - for (size_t __j = 0; __j < sizeof(_WordT); __j++ ) - { - unsigned char __this_byte - = static_cast<unsigned char>(__thisword & (~(unsigned char)0)); - if ( __this_byte ) - return __i*_LOFAR_BITSET_BITS_PER_WORD + __j*CHAR_BIT + - _S_first_one[__this_byte]; - - __thisword >>= CHAR_BIT; - } - } - } + { + __thisword = _M_w[__i]; + if ( __thisword != static_cast<_WordT>(0) ) + { + // find byte within word + for (size_t __j = 0; __j < sizeof(_WordT); __j++ ) + { + unsigned char __this_byte + = static_cast<unsigned char>(__thisword & (~(unsigned char)0)); + if ( __this_byte ) + return __i*_LOFAR_BITSET_BITS_PER_WORD + __j*CHAR_BIT + + _S_first_one[__this_byte]; + + __thisword >>= CHAR_BIT; + } + } + } // not found, so return an indication of failure. return __not_found; } // end _M_do_find_next - /** - * @if maint - * Base class, specialization for a single word. - * - * See documentation for bitset. - * @endif - */ - template<> + /** + * @if maint + * Base class, specialization for a single word. + * + * See documentation for bitset. + * @endif + */ + template<> struct _Base_bitset<1> { typedef uint32 _WordT; @@ -483,10 +485,10 @@ namespace LOFAR const unsigned char* __end_ptr = ((const unsigned char*)&_M_w)+sizeof(_M_w); while ( __byte_ptr < __end_ptr ) - { - __result += _S_bit_count[*__byte_ptr]; - __byte_ptr++; - } + { + __result += _S_bit_count[*__byte_ptr]; + __byte_ptr++; + } return __result; } @@ -502,14 +504,14 @@ namespace LOFAR }; - /** - * @if maint - * Base class, specialization for no storage (zero-length %bitset). - * - * See documentation for bitset. - * @endif - */ - template<> + /** + * @if maint + * Base class, specialization for no storage (zero-length %bitset). + * + * See documentation for bitset. + * @endif + */ + template<> struct _Base_bitset<0> { typedef uint32 _WordT; @@ -596,553 +598,553 @@ namespace LOFAR }; - // Helper class to zero out the unused high-order bits in the highest word. - template<size_t _Extrabits> + // Helper class to zero out the unused high-order bits in the highest word. + template<size_t _Extrabits> struct _Sanitize { static void _S_do_sanitize(uint32& __val) { __val &= ~((~static_cast<uint32>(0)) << _Extrabits); } }; - template<> + template<> struct _Sanitize<0> { static void _S_do_sanitize(uint32) { } }; - /** - * @brief The %bitset class represents a @e fixed-size sequence of bits. - * - * @ingroup Containers - * - * (Note that %bitset does @e not meet the formal requirements of a - * <a href="tables.html#65">container</a>. Mainly, it lacks iterators.) - * - * The template argument, @a Nb, may be any non-negative number, - * specifying the number of bits (e.g., "0", "12", "1024*1024"). - * - * In the general unoptimized case, storage is allocated in word-sized - * blocks. Let B be the number of bits in a word, then (Nb+(B-1))/B - * words will be used for storage. B - Nb%B bits are unused. (They are - * the high-order bits in the highest word.) It is a class invariant - * that those unused bits are always zero. - * - * If you think of %bitset as "a simple array of bits," be aware that - * your mental picture is reversed: a %bitset behaves the same way as - * bits in integers do, with the bit at index 0 in the "least significant - * / right-hand" position, and the bit at index Nb-1 in the "most - * significant / left-hand" position. Thus, unlike other containers, a - * %bitset's index "counts from right to left," to put it very loosely. - * - * This behavior is preserved when translating to and from strings. For - * example, the first line of the following program probably prints - * "b('a') is 0001100001" on a modern ASCII system. - * - * @code - * #include <bitset> - * #include <iostream> - * #include <sstream> - * - * using namespace std; - * - * int main() - * { - * uint32 a = 'a'; - * bitset<10> b(a); - * - * cout << "b('a') is " << b << endl; - * - * ostringstream s; - * s << b; - * string str = s.str(); - * cout << "index 3 in the string is " << str[3] << " but\n" - * << "index 3 in the bitset is " << b[3] << endl; - * } - * @endcode - * - * Also see http://gcc.gnu.org/onlinedocs/libstdc++/ext/sgiexts.html#ch23 - * for a description of extensions. - * - * @if maint - * Most of the actual code isn't contained in %bitset<> itself, but in the - * base class _Base_bitset. The base class works with whole words, not with - * individual bits. This allows us to specialize _Base_bitset for the - * important special case where the %bitset is only a single word. - * - * Extra confusion can result due to the fact that the storage for - * _Base_bitset @e is a regular array, and is indexed as such. This is - * carefully encapsulated. - * @endif - */ - template<size_t _Nb> - class bitset : private _Base_bitset<_LOFAR_BITSET_WORDS(_Nb)> - { - private: - typedef _Base_bitset<_LOFAR_BITSET_WORDS(_Nb)> _Base; - typedef uint32 _WordT; - - void - _M_do_sanitize() - { - _Sanitize<_Nb%_LOFAR_BITSET_BITS_PER_WORD>:: - _S_do_sanitize(this->_M_hiword()); - } - - public: /** - * This encapsulates the concept of a single bit. An instance of this - * class is a proxy for an actual bit; this way the individual bit - * operations are done as faster word-size bitwise instructions. + * @brief The %bitset class represents a @e fixed-size sequence of bits. * - * Most users will never need to use this class directly; conversions - * to and from bool are automatic and should be transparent. Overloaded - * operators help to preserve the illusion. + * @ingroup Containers * - * (On a typical system, this "bit %reference" is 64 times the size of - * an actual bit. Ha.) - */ - class reference - { - friend class bitset; - - _WordT *_M_wp; - size_t _M_bpos; - - // left undefined - reference(); - - public: - reference(bitset& __b, size_t __pos) - { - _M_wp = &__b._M_getword(__pos); - _M_bpos = _Base::_S_whichbit(__pos); - } - - ~reference() { } - - // for b[i] = __x; - reference& - operator=(bool __x) - { - if ( __x ) - *_M_wp |= _Base::_S_maskbit(_M_bpos); - else - *_M_wp &= ~_Base::_S_maskbit(_M_bpos); - return *this; - } - - // for b[i] = b[__j]; - reference& - operator=(const reference& __j) - { - if ( (*(__j._M_wp) & _Base::_S_maskbit(__j._M_bpos)) ) - *_M_wp |= _Base::_S_maskbit(_M_bpos); - else - *_M_wp &= ~_Base::_S_maskbit(_M_bpos); - return *this; - } - - // flips the bit - bool - operator~() const - { return (*(_M_wp) & _Base::_S_maskbit(_M_bpos)) == 0; } - - // for __x = b[i]; - operator bool() const - { return (*(_M_wp) & _Base::_S_maskbit(_M_bpos)) != 0; } - - // for b[i].flip(); - reference& - flip() - { - *_M_wp ^= _Base::_S_maskbit(_M_bpos); - return *this; - } - }; - friend class reference; - - // 23.3.5.1 constructors: - /// All bits set to zero. - bitset() { } - - /// Initial bits bitwise-copied from a single word (others set to zero). - bitset(uint32 __val) : _Base(__val) - { _M_do_sanitize(); } - - /** - * @brief Use a subset of a string. - * @param s A string of '0' and '1' characters. - * @param pos Index of the first character in @a s to use; defaults - * to zero. - * @throw std::out_of_range If @a pos is bigger the size of @a s. - * @throw std::invalid_argument If a character appears in the string - * which is neither '0' nor '1'. - */ - template<class _CharT, class _Traits, class _Alloc> - explicit bitset(const basic_string<_CharT, _Traits, _Alloc>& __s, - size_t __pos = 0) : _Base() - { - if (__pos > __s.size()) - __throw_out_of_range("bitset -- initial position is larger than " - "the string itself"); - _M_copy_from_string(__s, __pos, - basic_string<_CharT, _Traits, _Alloc>::npos); - } - - /** - * @brief Use a subset of a string. - * @param s A string of '0' and '1' characters. - * @param pos Index of the first character in @a s to use. - * @param n The number of characters to copy. - * @throw std::out_of_range If @a pos is bigger the size of @a s. - * @throw std::invalid_argument If a character appears in the string - * which is neither '0' nor '1'. - */ - template<class _CharT, class _Traits, class _Alloc> - bitset(const basic_string<_CharT, _Traits, _Alloc>& __s, - size_t __pos, size_t __n) : _Base() - { - if (__pos > __s.size()) - __throw_out_of_range("bitset -- initial position is larger than " - "the string itself"); - _M_copy_from_string(__s, __pos, __n); - } - - // 23.3.5.2 bitset operations: - //@{ - /** - * @brief Operations on bitsets. - * @param rhs A same-sized bitset. + * (Note that %bitset does @e not meet the formal requirements of a + * <a href="tables.html#65">container</a>. Mainly, it lacks iterators.) * - * These should be self-explanatory. - */ - bitset<_Nb>& - operator&=(const bitset<_Nb>& __rhs) - { - this->_M_do_and(__rhs); - return *this; - } - - bitset<_Nb>& - operator|=(const bitset<_Nb>& __rhs) - { - this->_M_do_or(__rhs); - return *this; - } - - bitset<_Nb>& - operator^=(const bitset<_Nb>& __rhs) - { - this->_M_do_xor(__rhs); - return *this; - } - //@} - - //@{ - /** - * @brief Operations on bitsets. - * @param pos The number of places to shift. - * - * These should be self-explanatory. - */ - bitset<_Nb>& - operator<<=(size_t __pos) - { - if (__builtin_expect(__pos < _Nb, 1)) - { - this->_M_do_left_shift(__pos); - this->_M_do_sanitize(); - } - else - this->_M_do_reset(); - return *this; - } - - bitset<_Nb>& - operator>>=(size_t __pos) - { - if (__builtin_expect(__pos < _Nb, 1)) - { - this->_M_do_right_shift(__pos); - this->_M_do_sanitize(); - } - else - this->_M_do_reset(); - return *this; - } - //@} - - //@{ - /** - * These versions of single-bit set, reset, flip, and test are - * extensions from the SGI version. They do no range checking. - * @ingroup SGIextensions - */ - bitset<_Nb>& - _Unchecked_set(size_t __pos) - { - this->_M_getword(__pos) |= _Base::_S_maskbit(__pos); - return *this; - } - - bitset<_Nb>& - _Unchecked_set(size_t __pos, int __val) - { - if (__val) - this->_M_getword(__pos) |= _Base::_S_maskbit(__pos); - else - this->_M_getword(__pos) &= ~_Base::_S_maskbit(__pos); - return *this; - } - - bitset<_Nb>& - _Unchecked_reset(size_t __pos) - { - this->_M_getword(__pos) &= ~_Base::_S_maskbit(__pos); - return *this; - } - - bitset<_Nb>& - _Unchecked_flip(size_t __pos) - { - this->_M_getword(__pos) ^= _Base::_S_maskbit(__pos); - return *this; - } - - bool - _Unchecked_test(size_t __pos) const - { - return (this->_M_getword(__pos) & _Base::_S_maskbit(__pos)) - != static_cast<_WordT>(0); - } - //@} - - // Set, reset, and flip. - /** - * @brief Sets every bit to true. - */ - bitset<_Nb>& - set() - { - this->_M_do_set(); - this->_M_do_sanitize(); - return *this; - } - - /** - * @brief Sets a given bit to a particular value. - * @param pos The index of the bit. - * @param val Either true or false, defaults to true. - * @throw std::out_of_range If @a pos is bigger the size of the %set. - */ - bitset<_Nb>& - set(size_t __pos, bool __val = true) - { - if (__pos >= _Nb) - __throw_out_of_range("bitset -- set() argument too large"); - return _Unchecked_set(__pos, __val); - } - - /** - * @brief Sets every bit to false. - */ - bitset<_Nb>& - reset() - { - this->_M_do_reset(); - return *this; - } - - /** - * @brief Sets a given bit to false. - * @param pos The index of the bit. - * @throw std::out_of_range If @a pos is bigger the size of the %set. + * The template argument, @a Nb, may be any non-negative number, + * specifying the number of bits (e.g., "0", "12", "1024*1024"). * - * Same as writing @c set(pos,false). - */ - bitset<_Nb>& - reset(size_t __pos) - { - if (__pos >= _Nb) - __throw_out_of_range("bitset -- reset() argument too large"); - return _Unchecked_reset(__pos); - } - - /** - * @brief Toggles every bit to its opposite value. - */ - bitset<_Nb>& - flip() - { - this->_M_do_flip(); - this->_M_do_sanitize(); - return *this; - } - - /** - * @brief Toggles a given bit to its opposite value. - * @param pos The index of the bit. - * @throw std::out_of_range If @a pos is bigger the size of the %set. - */ - bitset<_Nb>& - flip(size_t __pos) - { - if (__pos >= _Nb) - __throw_out_of_range("bitset -- flip() argument too large"); - return _Unchecked_flip(__pos); - } - - /// See the no-argument flip(). - bitset<_Nb> - operator~() const { return bitset<_Nb>(*this).flip(); } - - //@{ - /** - * @brief Array-indexing support. - * @param pos Index into the %bitset. - * @return A bool for a 'const %bitset'. For non-const bitsets, an - * instance of the reference proxy class. - * @note These operators do no range checking and throw no exceptions, - * as required by DR 11 to the standard. + * In the general unoptimized case, storage is allocated in word-sized + * blocks. Let B be the number of bits in a word, then (Nb+(B-1))/B + * words will be used for storage. B - Nb%B bits are unused. (They are + * the high-order bits in the highest word.) It is a class invariant + * that those unused bits are always zero. * - * @if maint - * _GLIBCPP_RESOLVE_LIB_DEFECTS Note that this implementation already - * resolves DR 11 (items 1 and 2), but does not do the range-checking - * required by that DR's resolution. -pme - * The DR has since been changed: range-checking is a precondition - * (users' responsibility), and these functions must not throw. -pme - * @endif - */ - reference - operator[](size_t __pos) { return reference(*this,__pos); } - - bool - operator[](size_t __pos) const { return _Unchecked_test(__pos); } - //@} - - /** - * @brief Retuns a numerical interpretation of the %bitset. - * @return The integral equivalent of the bits. - * @throw std::overflow_error If there are too many bits to be - * represented in an @c uint32. - */ - uint32 - to_uint32() const { return this->_M_do_to_uint32(); } - - /** - * @brief Retuns a character interpretation of the %bitset. - * @return The string equivalent of the bits. + * If you think of %bitset as "a simple array of bits," be aware that + * your mental picture is reversed: a %bitset behaves the same way as + * bits in integers do, with the bit at index 0 in the "least significant + * / right-hand" position, and the bit at index Nb-1 in the "most + * significant / left-hand" position. Thus, unlike other containers, a + * %bitset's index "counts from right to left," to put it very loosely. * - * Note the ordering of the bits: decreasing character positions - * correspond to increasing bit positions (see the main class notes for - * an example). + * This behavior is preserved when translating to and from strings. For + * example, the first line of the following program probably prints + * "b('a') is 0001100001" on a modern ASCII system. * - * Also note that you must specify the string's template parameters - * explicitly. Given a bitset @c bs and a string @s: * @code - * s = bs.to_string<char,char_traits<char>,allocator<char> >(); + * #include <bitset> + * #include <iostream> + * #include <sstream> + * + * using namespace std; + * + * int main() + * { + * uint32 a = 'a'; + * bitset<10> b(a); + * + * cout << "b('a') is " << b << endl; + * + * ostringstream s; + * s << b; + * string str = s.str(); + * cout << "index 3 in the string is " << str[3] << " but\n" + * << "index 3 in the bitset is " << b[3] << endl; + * } * @endcode - */ - template<class _CharT, class _Traits, class _Alloc> - basic_string<_CharT, _Traits, _Alloc> - to_string() const - { - basic_string<_CharT, _Traits, _Alloc> __result; - _M_copy_to_string(__result); - return __result; - } + * + * Also see http://gcc.gnu.org/onlinedocs/libstdc++/ext/sgiexts.html#ch23 + * for a description of extensions. + * + * @if maint + * Most of the actual code isn't contained in %bitset<> itself, but in the + * base class _Base_bitset. The base class works with whole words, not with + * individual bits. This allows us to specialize _Base_bitset for the + * important special case where the %bitset is only a single word. + * + * Extra confusion can result due to the fact that the storage for + * _Base_bitset @e is a regular array, and is indexed as such. This is + * carefully encapsulated. + * @endif + */ + template<size_t _Nb> + class bitset : private _Base_bitset<_LOFAR_BITSET_WORDS(_Nb)> + { + private: + typedef _Base_bitset<_LOFAR_BITSET_WORDS(_Nb)> _Base; + typedef uint32 _WordT; - // Helper functions for string operations. - template<class _CharT, class _Traits, class _Alloc> void - _M_copy_from_string(const basic_string<_CharT,_Traits,_Alloc>& __s, - size_t, size_t); + _M_do_sanitize() + { + _Sanitize<_Nb%_LOFAR_BITSET_BITS_PER_WORD>:: + _S_do_sanitize(this->_M_hiword()); + } - template<class _CharT, class _Traits, class _Alloc> - void - _M_copy_to_string(basic_string<_CharT,_Traits,_Alloc>&) const; + public: + /** + * This encapsulates the concept of a single bit. An instance of this + * class is a proxy for an actual bit; this way the individual bit + * operations are done as faster word-size bitwise instructions. + * + * Most users will never need to use this class directly; conversions + * to and from bool are automatic and should be transparent. Overloaded + * operators help to preserve the illusion. + * + * (On a typical system, this "bit %reference" is 64 times the size of + * an actual bit. Ha.) + */ + class reference + { + friend class bitset; - /// Returns the number of bits which are set. - size_t - count() const { return this->_M_do_count(); } + _WordT *_M_wp; + size_t _M_bpos; - /// Returns the total number of bits. - size_t - size() const { return _Nb; } + // left undefined + reference(); - //@{ - /// These comparisons for equality/inequality are, well, @e bitwise. - bool - operator==(const bitset<_Nb>& __rhs) const - { return this->_M_is_equal(__rhs); } - - bool - operator!=(const bitset<_Nb>& __rhs) const - { return !this->_M_is_equal(__rhs); } - //@} + public: + reference(bitset& __b, size_t __pos) + { + _M_wp = &__b._M_getword(__pos); + _M_bpos = _Base::_S_whichbit(__pos); + } - /** - * @brief Tests the value of a bit. - * @param pos The index of a bit. - * @return The value at @a pos. - * @throw std::out_of_range If @a pos is bigger the size of the %set. - */ - bool - test(size_t __pos) const - { - if (__pos >= _Nb) - __throw_out_of_range("bitset -- test() argument too large"); - return _Unchecked_test(__pos); - } + ~reference() { } - /** - * @brief Tests whether any of the bits are on. - * @return True if at least one bit is set. - */ - bool - any() const { return this->_M_is_any(); } + // for b[i] = __x; + reference& + operator=(bool __x) + { + if ( __x ) + *_M_wp |= _Base::_S_maskbit(_M_bpos); + else + *_M_wp &= ~_Base::_S_maskbit(_M_bpos); + return *this; + } - /** - * @brief Tests whether any of the bits are on. - * @return True if none of the bits are set. - */ - bool - none() const { return !this->_M_is_any(); } + // for b[i] = b[__j]; + reference& + operator=(const reference& __j) + { + if ( (*(__j._M_wp) & _Base::_S_maskbit(__j._M_bpos)) ) + *_M_wp |= _Base::_S_maskbit(_M_bpos); + else + *_M_wp &= ~_Base::_S_maskbit(_M_bpos); + return *this; + } - //@{ - /// Self-explanatory. - bitset<_Nb> - operator<<(size_t __pos) const - { return bitset<_Nb>(*this) <<= __pos; } - - bitset<_Nb> - operator>>(size_t __pos) const - { return bitset<_Nb>(*this) >>= __pos; } - //@} + // flips the bit + bool + operator~() const + { return (*(_M_wp) & _Base::_S_maskbit(_M_bpos)) == 0; } - /** - * @brief Finds the index of the first "on" bit. - * @return The index of the first bit set, or size() if not found. - * @ingroup SGIextensions - * @sa _Find_next - */ - size_t - _Find_first() const - { return this->_M_do_find_first(_Nb); } + // for __x = b[i]; + operator bool() const + { return (*(_M_wp) & _Base::_S_maskbit(_M_bpos)) != 0; } - /** - * @brief Finds the index of the next "on" bit after prev. - * @return The index of the next bit set, or size() if not found. - * @param prev Where to start searching. - * @ingroup SGIextensions - * @sa _Find_first - */ - size_t - _Find_next(size_t __prev ) const - { return this->_M_do_find_next(__prev, _Nb); } - }; + // for b[i].flip(); + reference& + flip() + { + *_M_wp ^= _Base::_S_maskbit(_M_bpos); + return *this; + } + }; + friend class reference; + + // 23.3.5.1 constructors: + /// All bits set to zero. + bitset() { } + + /// Initial bits bitwise-copied from a single word (others set to zero). + bitset(uint32 __val) : _Base(__val) + { _M_do_sanitize(); } + + /** + * @brief Use a subset of a string. + * @param s A string of '0' and '1' characters. + * @param pos Index of the first character in @a s to use; defaults + * to zero. + * @throw std::out_of_range If @a pos is bigger the size of @a s. + * @throw std::invalid_argument If a character appears in the string + * which is neither '0' nor '1'. + */ + template<class _CharT, class _Traits, class _Alloc> + explicit bitset(const basic_string<_CharT, _Traits, _Alloc>& __s, + size_t __pos = 0) : _Base() + { + if (__pos > __s.size()) + __throw_out_of_range("bitset -- initial position is larger than " + "the string itself"); + _M_copy_from_string(__s, __pos, + basic_string<_CharT, _Traits, _Alloc>::npos); + } + + /** + * @brief Use a subset of a string. + * @param s A string of '0' and '1' characters. + * @param pos Index of the first character in @a s to use. + * @param n The number of characters to copy. + * @throw std::out_of_range If @a pos is bigger the size of @a s. + * @throw std::invalid_argument If a character appears in the string + * which is neither '0' nor '1'. + */ + template<class _CharT, class _Traits, class _Alloc> + bitset(const basic_string<_CharT, _Traits, _Alloc>& __s, + size_t __pos, size_t __n) : _Base() + { + if (__pos > __s.size()) + __throw_out_of_range("bitset -- initial position is larger than " + "the string itself"); + _M_copy_from_string(__s, __pos, __n); + } + + // 23.3.5.2 bitset operations: + //@{ + /** + * @brief Operations on bitsets. + * @param rhs A same-sized bitset. + * + * These should be self-explanatory. + */ + bitset<_Nb>& + operator&=(const bitset<_Nb>& __rhs) + { + this->_M_do_and(__rhs); + return *this; + } + + bitset<_Nb>& + operator|=(const bitset<_Nb>& __rhs) + { + this->_M_do_or(__rhs); + return *this; + } + + bitset<_Nb>& + operator^=(const bitset<_Nb>& __rhs) + { + this->_M_do_xor(__rhs); + return *this; + } + //@} + + //@{ + /** + * @brief Operations on bitsets. + * @param pos The number of places to shift. + * + * These should be self-explanatory. + */ + bitset<_Nb>& + operator<<=(size_t __pos) + { + if (__builtin_expect(__pos < _Nb, 1)) + { + this->_M_do_left_shift(__pos); + this->_M_do_sanitize(); + } + else + this->_M_do_reset(); + return *this; + } + + bitset<_Nb>& + operator>>=(size_t __pos) + { + if (__builtin_expect(__pos < _Nb, 1)) + { + this->_M_do_right_shift(__pos); + this->_M_do_sanitize(); + } + else + this->_M_do_reset(); + return *this; + } + //@} + + //@{ + /** + * These versions of single-bit set, reset, flip, and test are + * extensions from the SGI version. They do no range checking. + * @ingroup SGIextensions + */ + bitset<_Nb>& + _Unchecked_set(size_t __pos) + { + this->_M_getword(__pos) |= _Base::_S_maskbit(__pos); + return *this; + } + + bitset<_Nb>& + _Unchecked_set(size_t __pos, int __val) + { + if (__val) + this->_M_getword(__pos) |= _Base::_S_maskbit(__pos); + else + this->_M_getword(__pos) &= ~_Base::_S_maskbit(__pos); + return *this; + } + + bitset<_Nb>& + _Unchecked_reset(size_t __pos) + { + this->_M_getword(__pos) &= ~_Base::_S_maskbit(__pos); + return *this; + } + + bitset<_Nb>& + _Unchecked_flip(size_t __pos) + { + this->_M_getword(__pos) ^= _Base::_S_maskbit(__pos); + return *this; + } + + bool + _Unchecked_test(size_t __pos) const + { + return (this->_M_getword(__pos) & _Base::_S_maskbit(__pos)) + != static_cast<_WordT>(0); + } + //@} + + // Set, reset, and flip. + /** + * @brief Sets every bit to true. + */ + bitset<_Nb>& + set() + { + this->_M_do_set(); + this->_M_do_sanitize(); + return *this; + } + + /** + * @brief Sets a given bit to a particular value. + * @param pos The index of the bit. + * @param val Either true or false, defaults to true. + * @throw std::out_of_range If @a pos is bigger the size of the %set. + */ + bitset<_Nb>& + set(size_t __pos, bool __val = true) + { + if (__pos >= _Nb) + __throw_out_of_range("bitset -- set() argument too large"); + return _Unchecked_set(__pos, __val); + } + + /** + * @brief Sets every bit to false. + */ + bitset<_Nb>& + reset() + { + this->_M_do_reset(); + return *this; + } + + /** + * @brief Sets a given bit to false. + * @param pos The index of the bit. + * @throw std::out_of_range If @a pos is bigger the size of the %set. + * + * Same as writing @c set(pos,false). + */ + bitset<_Nb>& + reset(size_t __pos) + { + if (__pos >= _Nb) + __throw_out_of_range("bitset -- reset() argument too large"); + return _Unchecked_reset(__pos); + } + + /** + * @brief Toggles every bit to its opposite value. + */ + bitset<_Nb>& + flip() + { + this->_M_do_flip(); + this->_M_do_sanitize(); + return *this; + } + + /** + * @brief Toggles a given bit to its opposite value. + * @param pos The index of the bit. + * @throw std::out_of_range If @a pos is bigger the size of the %set. + */ + bitset<_Nb>& + flip(size_t __pos) + { + if (__pos >= _Nb) + __throw_out_of_range("bitset -- flip() argument too large"); + return _Unchecked_flip(__pos); + } + + /// See the no-argument flip(). + bitset<_Nb> + operator~() const { return bitset<_Nb>(*this).flip(); } + + //@{ + /** + * @brief Array-indexing support. + * @param pos Index into the %bitset. + * @return A bool for a 'const %bitset'. For non-const bitsets, an + * instance of the reference proxy class. + * @note These operators do no range checking and throw no exceptions, + * as required by DR 11 to the standard. + * + * @if maint + * _GLIBCPP_RESOLVE_LIB_DEFECTS Note that this implementation already + * resolves DR 11 (items 1 and 2), but does not do the range-checking + * required by that DR's resolution. -pme + * The DR has since been changed: range-checking is a precondition + * (users' responsibility), and these functions must not throw. -pme + * @endif + */ + reference + operator[](size_t __pos) { return reference(*this,__pos); } + + bool + operator[](size_t __pos) const { return _Unchecked_test(__pos); } + //@} + + /** + * @brief Retuns a numerical interpretation of the %bitset. + * @return The integral equivalent of the bits. + * @throw std::overflow_error If there are too many bits to be + * represented in an @c uint32. + */ + uint32 + to_uint32() const { return this->_M_do_to_uint32(); } + + /** + * @brief Retuns a character interpretation of the %bitset. + * @return The string equivalent of the bits. + * + * Note the ordering of the bits: decreasing character positions + * correspond to increasing bit positions (see the main class notes for + * an example). + * + * Also note that you must specify the string's template parameters + * explicitly. Given a bitset @c bs and a string @s: + * @code + * s = bs.to_string<char,char_traits<char>,allocator<char> >(); + * @endcode + */ + template<class _CharT, class _Traits, class _Alloc> + basic_string<_CharT, _Traits, _Alloc> + to_string() const + { + basic_string<_CharT, _Traits, _Alloc> __result; + _M_copy_to_string(__result); + return __result; + } + + // Helper functions for string operations. + template<class _CharT, class _Traits, class _Alloc> + void + _M_copy_from_string(const basic_string<_CharT,_Traits,_Alloc>& __s, + size_t, size_t); + + template<class _CharT, class _Traits, class _Alloc> + void + _M_copy_to_string(basic_string<_CharT,_Traits,_Alloc>&) const; + + /// Returns the number of bits which are set. + size_t + count() const { return this->_M_do_count(); } + + /// Returns the total number of bits. + size_t + size() const { return _Nb; } + + //@{ + /// These comparisons for equality/inequality are, well, @e bitwise. + bool + operator==(const bitset<_Nb>& __rhs) const + { return this->_M_is_equal(__rhs); } + + bool + operator!=(const bitset<_Nb>& __rhs) const + { return !this->_M_is_equal(__rhs); } + //@} + + /** + * @brief Tests the value of a bit. + * @param pos The index of a bit. + * @return The value at @a pos. + * @throw std::out_of_range If @a pos is bigger the size of the %set. + */ + bool + test(size_t __pos) const + { + if (__pos >= _Nb) + __throw_out_of_range("bitset -- test() argument too large"); + return _Unchecked_test(__pos); + } + + /** + * @brief Tests whether any of the bits are on. + * @return True if at least one bit is set. + */ + bool + any() const { return this->_M_is_any(); } + + /** + * @brief Tests whether any of the bits are on. + * @return True if none of the bits are set. + */ + bool + none() const { return !this->_M_is_any(); } + + //@{ + /// Self-explanatory. + bitset<_Nb> + operator<<(size_t __pos) const + { return bitset<_Nb>(*this) <<= __pos; } + + bitset<_Nb> + operator>>(size_t __pos) const + { return bitset<_Nb>(*this) >>= __pos; } + //@} + + /** + * @brief Finds the index of the first "on" bit. + * @return The index of the first bit set, or size() if not found. + * @ingroup SGIextensions + * @sa _Find_next + */ + size_t + _Find_first() const + { return this->_M_do_find_first(_Nb); } + + /** + * @brief Finds the index of the next "on" bit after prev. + * @return The index of the next bit set, or size() if not found. + * @param prev Where to start searching. + * @ingroup SGIextensions + * @sa _Find_first + */ + size_t + _Find_next(size_t __prev ) const + { return this->_M_do_find_next(__prev, _Nb); } + }; - // Definitions of non-inline member functions. - template<size_t _Nb> + // Definitions of non-inline member functions. + template<size_t _Nb> template<class _CharT, class _Traits, class _Alloc> void bitset<_Nb>::_M_copy_from_string(const basic_string<_CharT,_Traits,_Alloc>& __s, size_t __pos, size_t __n) @@ -1150,22 +1152,22 @@ namespace LOFAR reset(); const size_t __nbits = min(_Nb, min(__n, __s.size() - __pos)); for (size_t __i = 0; __i < __nbits; ++__i) - { - switch(__s[__pos + __nbits - __i - 1]) - { - case '0': - break; - case '1': - set(__i); - break; - default: - __throw_invalid_argument("bitset -- string contains characters " - "which are neither 0 nor 1"); - } - } + { + switch(__s[__pos + __nbits - __i - 1]) + { + case '0': + break; + case '1': + set(__i); + break; + default: + __throw_invalid_argument("bitset -- string contains characters " + "which are neither 0 nor 1"); + } + } } - template<size_t _Nb> + template<size_t _Nb> template<class _CharT, class _Traits, class _Alloc> void bitset<_Nb>::_M_copy_to_string(basic_string<_CharT, _Traits, _Alloc>& __s) const @@ -1176,17 +1178,17 @@ namespace LOFAR __s[_Nb - 1 - __i] = '1'; } - // 23.3.5.3 bitset operations: - //@{ - /** - * @brief Global bitwise operations on bitsets. - * @param x A bitset. - * @param y A bitset of the same size as @a x. - * @return A new bitset. - * - * These should be self-explanatory. - */ - template<size_t _Nb> + // 23.3.5.3 bitset operations: + //@{ + /** + * @brief Global bitwise operations on bitsets. + * @param x A bitset. + * @param y A bitset of the same size as @a x. + * @return A new bitset. + * + * These should be self-explanatory. + */ + template<size_t _Nb> inline bitset<_Nb> operator&(const bitset<_Nb>& __x, const bitset<_Nb>& __y) { @@ -1195,7 +1197,7 @@ namespace LOFAR return __result; } - template<size_t _Nb> + template<size_t _Nb> inline bitset<_Nb> operator|(const bitset<_Nb>& __x, const bitset<_Nb>& __y) { @@ -1204,7 +1206,7 @@ namespace LOFAR return __result; } - template <size_t _Nb> + template <size_t _Nb> inline bitset<_Nb> operator^(const bitset<_Nb>& __x, const bitset<_Nb>& __y) { @@ -1212,18 +1214,18 @@ namespace LOFAR __result ^= __y; return __result; } - //@} - - //@{ - /** - * @brief Global I/O operators for bitsets. - * - * Direct I/O between streams and bitsets is supported. Output is - * straightforward. Input will skip whitespace, only accept '0' and '1' - * characters, and will only extract as many digits as the %bitset will - * hold. - */ - template<class _CharT, class _Traits, size_t _Nb> + //@} + + //@{ + /** + * @brief Global I/O operators for bitsets. + * + * Direct I/O between streams and bitsets is supported. Output is + * straightforward. Input will skip whitespace, only accept '0' and '1' + * characters, and will only extract as many digits as the %bitset will + * hold. + */ + template<class _CharT, class _Traits, size_t _Nb> basic_istream<_CharT, _Traits>& operator>>(basic_istream<_CharT, _Traits>& __is, bitset<_Nb>& __x) { @@ -1234,47 +1236,47 @@ namespace LOFAR // Skip whitespace typename basic_istream<_CharT, _Traits>::sentry __sentry(__is); if (__sentry) - { - ios_base::iostate __state = ios_base::goodbit; - basic_streambuf<_CharT, _Traits>* __buf = __is.rdbuf(); - for (size_t __i = 0; __i < _Nb; ++__i) - { - static typename _Traits::int_type __eof = _Traits::eof(); - - typename _Traits::int_type __c1 = __buf->sbumpc(); - if (_Traits::eq_int_type(__c1, __eof)) - { - __state |= ios_base::eofbit; - break; - } - else - { - char_type __c2 = _Traits::to_char_type(__c1); - char_type __c = __is.narrow(__c2, '*'); - - if (__c == '0' || __c == '1') - __tmp.push_back(__c); - else if (_Traits::eq_int_type(__buf->sputbackc(__c2), __eof)) - { - __state |= ios_base::failbit; - break; - } - } - } - - if (__tmp.empty() && !_Nb) - __state |= ios_base::failbit; - else - __x._M_copy_from_string(__tmp, static_cast<size_t>(0), _Nb); - - if (__state != ios_base::goodbit) - __is.setstate(__state); // may throw an exception - } + { + ios_base::iostate __state = ios_base::goodbit; + basic_streambuf<_CharT, _Traits>* __buf = __is.rdbuf(); + for (size_t __i = 0; __i < _Nb; ++__i) + { + static typename _Traits::int_type __eof = _Traits::eof(); + + typename _Traits::int_type __c1 = __buf->sbumpc(); + if (_Traits::eq_int_type(__c1, __eof)) + { + __state |= ios_base::eofbit; + break; + } + else + { + char_type __c2 = _Traits::to_char_type(__c1); + char_type __c = __is.narrow(__c2, '*'); + + if (__c == '0' || __c == '1') + __tmp.push_back(__c); + else if (_Traits::eq_int_type(__buf->sputbackc(__c2), __eof)) + { + __state |= ios_base::failbit; + break; + } + } + } + + if (__tmp.empty() && !_Nb) + __state |= ios_base::failbit; + else + __x._M_copy_from_string(__tmp, static_cast<size_t>(0), _Nb); + + if (__state != ios_base::goodbit) + __is.setstate(__state); // may throw an exception + } return __is; } - template <class _CharT, class _Traits, size_t _Nb> + template <class _CharT, class _Traits, size_t _Nb> basic_ostream<_CharT, _Traits>& operator<<(basic_ostream<_CharT, _Traits>& __os, const bitset<_Nb>& __x) { @@ -1282,7 +1284,10 @@ namespace LOFAR __x._M_copy_to_string(__tmp); return __os << __tmp; } - //@} + //@} + + } // namespace CS1 + } // namespace LOFAR #undef _LOFAR_BITSET_WORDS diff --git a/Appl/CEP/CS1/CS1_Interface/src/CS1_Config.h b/Appl/CEP/CS1/CS1_Interface/src/CS1_Config.h index 4cdda627c481a25a62b38604ad30c443c23fcf92..bd1d7a7ca007812422bfe5f0af1c9b77526ddd22 100644 --- a/Appl/CEP/CS1/CS1_Interface/src/CS1_Config.h +++ b/Appl/CEP/CS1/CS1_Interface/src/CS1_Config.h @@ -20,8 +20,8 @@ //# //# $Id$ -#ifndef LOFAR_APPL_CEP_CS1_CS1_INTERFACE_CS1_CONFIG_H -#define LOFAR_APPL_CEP_CS1_CS1_INTERFACE_CS1_CONFIG_H +#ifndef LOFAR_CS1_INTERFACE_CS1_CONFIG_H +#define LOFAR_CS1_INTERFACE_CS1_CONFIG_H /* This is included by C++ and assembly files. Do not put anything but constants here! */ diff --git a/Appl/CEP/CS1/CS1_Interface/src/DH_Delay.cc b/Appl/CEP/CS1/CS1_Interface/src/DH_Delay.cc index 2b40dcb0f168277ef99ad425a63960141f96b397..31e30ad09dfb9fd9f6c51fea84a228e5ff19334d 100644 --- a/Appl/CEP/CS1/CS1_Interface/src/DH_Delay.cc +++ b/Appl/CEP/CS1/CS1_Interface/src/DH_Delay.cc @@ -18,113 +18,116 @@ //# //# $Id$ - #include <lofar_config.h> #include <CS1_Interface/DH_Delay.h> namespace LOFAR { - -DH_Delay::DH_Delay(const string &name, uint nrRSPs) - : DataHolder (name, "DH_Delay"), - itsCoarseDelays(0), - itsFineDelaysAtBegin(0), - itsFineDelaysAfterEnd(0), - itsNrRSPs (nrRSPs) -{ - LOG_TRACE_FLOW(AUTO_FUNCTION_NAME); -} + namespace CS1 + { + + DH_Delay::DH_Delay(const string &name, uint nrRSPs) + : DataHolder (name, "DH_Delay"), + itsCoarseDelays(0), + itsFineDelaysAtBegin(0), + itsFineDelaysAfterEnd(0), + itsNrRSPs (nrRSPs) + { + LOG_TRACE_FLOW(AUTO_FUNCTION_NAME); + } -DH_Delay::DH_Delay(const DH_Delay &that) - : DataHolder (that), - itsCoarseDelays(that.itsCoarseDelays), - itsFineDelaysAtBegin(that.itsFineDelaysAtBegin), - itsFineDelaysAfterEnd(that.itsFineDelaysAfterEnd), - itsNrRSPs (that.itsNrRSPs) -{ - LOG_TRACE_FLOW(AUTO_FUNCTION_NAME); -} - -DH_Delay::~DH_Delay() -{ - LOG_TRACE_FLOW(AUTO_FUNCTION_NAME); -} - -DataHolder *DH_Delay::clone() const -{ - LOG_TRACE_FLOW(AUTO_FUNCTION_NAME); - return new DH_Delay(*this); -} - -void DH_Delay::init() -{ - LOG_TRACE_FLOW(AUTO_FUNCTION_NAME); - - // add the fields to the data definition - addField ("CoarseDelay", BlobField<int>(1, itsNrRSPs)); - addField ("FineDelayAtBegin", BlobField<float>(1, itsNrRSPs)); - addField ("FineDelayAfterEnd", BlobField<float>(1, itsNrRSPs)); + DH_Delay::DH_Delay(const DH_Delay &that) + : DataHolder (that), + itsCoarseDelays(that.itsCoarseDelays), + itsFineDelaysAtBegin(that.itsFineDelaysAtBegin), + itsFineDelaysAfterEnd(that.itsFineDelaysAfterEnd), + itsNrRSPs (that.itsNrRSPs) + { + LOG_TRACE_FLOW(AUTO_FUNCTION_NAME); + } + + DH_Delay::~DH_Delay() + { + LOG_TRACE_FLOW(AUTO_FUNCTION_NAME); + } + + DataHolder *DH_Delay::clone() const + { + LOG_TRACE_FLOW(AUTO_FUNCTION_NAME); + return new DH_Delay(*this); + } + + void DH_Delay::init() + { + LOG_TRACE_FLOW(AUTO_FUNCTION_NAME); + + // add the fields to the data definition + addField ("CoarseDelay", BlobField<int>(1, itsNrRSPs)); + addField ("FineDelayAtBegin", BlobField<float>(1, itsNrRSPs)); + addField ("FineDelayAfterEnd", BlobField<float>(1, itsNrRSPs)); - // create the data blob - createDataBlock(); - - for (uint i=0; i<itsNrRSPs; i++) { - itsCoarseDelays[i] = 0; - itsFineDelaysAtBegin[i] = 0; - itsFineDelaysAfterEnd[i] = 0; - } - -} - -void DH_Delay::fillDataPointers() -{ - LOG_TRACE_FLOW(AUTO_FUNCTION_NAME); - itsCoarseDelays = getData<int> ("CoarseDelay"); - itsFineDelaysAtBegin = getData<float> ("FineDelayAtBegin"); - itsFineDelaysAfterEnd = getData<float> ("FineDelayAfterEnd"); -} - -int DH_Delay::getCoarseDelay(uint station) const -{ - LOG_TRACE_FLOW(AUTO_FUNCTION_NAME); - ASSERTSTR(station < itsNrRSPs, "index is not within range"); - return itsCoarseDelays[station]; -} - -void DH_Delay::setCoarseDelay(uint station, int delay) -{ - LOG_TRACE_FLOW(AUTO_FUNCTION_NAME); - ASSERTSTR(station < itsNrRSPs, "index is not within range"); - itsCoarseDelays[station] = delay; -} - -float DH_Delay::getFineDelayAtBegin(uint station) const -{ - LOG_TRACE_FLOW(AUTO_FUNCTION_NAME); - ASSERTSTR(station < itsNrRSPs, "index is not within range"); - return itsFineDelaysAtBegin[station]; -} - -void DH_Delay::setFineDelayAtBegin(uint station, float delay) -{ - LOG_TRACE_FLOW(AUTO_FUNCTION_NAME); - ASSERTSTR(station < itsNrRSPs, "index is not within range"); - itsFineDelaysAtBegin[station] = delay; -} - -float DH_Delay::getFineDelayAfterEnd(uint station) const -{ - LOG_TRACE_FLOW(AUTO_FUNCTION_NAME); - ASSERTSTR(station < itsNrRSPs, "index is not within range"); - return itsFineDelaysAfterEnd[station]; -} - -void DH_Delay::setFineDelayAfterEnd(uint station, float delay) -{ - LOG_TRACE_FLOW(AUTO_FUNCTION_NAME); - ASSERTSTR(station < itsNrRSPs, "index is not within range"); - itsFineDelaysAfterEnd[station] = delay; -} - -} // end namespace + // create the data blob + createDataBlock(); + + for (uint i=0; i<itsNrRSPs; i++) { + itsCoarseDelays[i] = 0; + itsFineDelaysAtBegin[i] = 0; + itsFineDelaysAfterEnd[i] = 0; + } + + } + + void DH_Delay::fillDataPointers() + { + LOG_TRACE_FLOW(AUTO_FUNCTION_NAME); + itsCoarseDelays = getData<int> ("CoarseDelay"); + itsFineDelaysAtBegin = getData<float> ("FineDelayAtBegin"); + itsFineDelaysAfterEnd = getData<float> ("FineDelayAfterEnd"); + } + + int DH_Delay::getCoarseDelay(uint station) const + { + LOG_TRACE_FLOW(AUTO_FUNCTION_NAME); + ASSERTSTR(station < itsNrRSPs, "index is not within range"); + return itsCoarseDelays[station]; + } + + void DH_Delay::setCoarseDelay(uint station, int delay) + { + LOG_TRACE_FLOW(AUTO_FUNCTION_NAME); + ASSERTSTR(station < itsNrRSPs, "index is not within range"); + itsCoarseDelays[station] = delay; + } + + float DH_Delay::getFineDelayAtBegin(uint station) const + { + LOG_TRACE_FLOW(AUTO_FUNCTION_NAME); + ASSERTSTR(station < itsNrRSPs, "index is not within range"); + return itsFineDelaysAtBegin[station]; + } + + void DH_Delay::setFineDelayAtBegin(uint station, float delay) + { + LOG_TRACE_FLOW(AUTO_FUNCTION_NAME); + ASSERTSTR(station < itsNrRSPs, "index is not within range"); + itsFineDelaysAtBegin[station] = delay; + } + + float DH_Delay::getFineDelayAfterEnd(uint station) const + { + LOG_TRACE_FLOW(AUTO_FUNCTION_NAME); + ASSERTSTR(station < itsNrRSPs, "index is not within range"); + return itsFineDelaysAfterEnd[station]; + } + + void DH_Delay::setFineDelayAfterEnd(uint station, float delay) + { + LOG_TRACE_FLOW(AUTO_FUNCTION_NAME); + ASSERTSTR(station < itsNrRSPs, "index is not within range"); + itsFineDelaysAfterEnd[station] = delay; + } + + } // namespace CS1 + +} // namespace LOFAR diff --git a/Appl/CEP/CS1/CS1_Interface/src/DH_Delay.h b/Appl/CEP/CS1/CS1_Interface/src/DH_Delay.h index 6b5a967a550a549085bd395d77c2085970c6ab90..3d2b4aa6f006c8cf5cbdb1e9fe05a18060c2c354 100644 --- a/Appl/CEP/CS1/CS1_Interface/src/DH_Delay.h +++ b/Appl/CEP/CS1/CS1_Interface/src/DH_Delay.h @@ -20,50 +20,53 @@ //# //# $Id$ -#ifndef LOFAR_APPL_CEP_CS1_CS1_INTERFACE_DELAY_H -#define LOFAR_APPL_CEP_CS1_CS1_INTERFACE_DELAY_H +#ifndef LOFAR_CS1_INTERFACE_DH_DELAY_H +#define LOFAR_CS1_INTERFACE_DH_DELAY_H #include <Transport/DataHolder.h> namespace LOFAR { + namespace CS1 + { + class DH_Delay: public DataHolder + { + public: + explicit DH_Delay (const string &name, uint nrRSPs); -class DH_Delay: public DataHolder -{ -public: - explicit DH_Delay (const string &name, uint nrRSPs); - - DH_Delay(const DH_Delay &); + DH_Delay(const DH_Delay &); - virtual ~DH_Delay(); + virtual ~DH_Delay(); - DataHolder *clone() const; + DataHolder *clone() const; - // Allocate the buffers. - virtual void init(); + // Allocate the buffers. + virtual void init(); - // accessor functions to the blob data - int getCoarseDelay(uint station) const; - void setCoarseDelay(uint station, int delay); - float getFineDelayAtBegin(uint station) const; - void setFineDelayAtBegin(uint station, float delay); - float getFineDelayAfterEnd(uint station) const; - void setFineDelayAfterEnd(uint station, float delay); + // accessor functions to the blob data + int getCoarseDelay(uint station) const; + void setCoarseDelay(uint station, int delay); + float getFineDelayAtBegin(uint station) const; + void setFineDelayAtBegin(uint station, float delay); + float getFineDelayAfterEnd(uint station) const; + void setFineDelayAfterEnd(uint station, float delay); - private: - /// Forbid assignment. - DH_Delay &operator = (const DH_Delay &); + private: + /// Forbid assignment. + DH_Delay &operator = (const DH_Delay &); + + // Fill the pointers (itsBuffer) to the data in the blob. + virtual void fillDataPointers(); - // Fill the pointers (itsBuffer) to the data in the blob. - virtual void fillDataPointers(); + /// pointers to data in the blob + int *itsCoarseDelays; + float *itsFineDelaysAtBegin; + float *itsFineDelaysAfterEnd; + uint itsNrRSPs; + }; - /// pointers to data in the blob - int *itsCoarseDelays; - float *itsFineDelaysAtBegin; - float *itsFineDelaysAfterEnd; - uint itsNrRSPs; -}; + } // namespace CS1 +} // namespace LOFAR -} #endif diff --git a/Appl/CEP/CS1/CS1_Interface/src/DH_RFI_Mitigation.cc b/Appl/CEP/CS1/CS1_Interface/src/DH_RFI_Mitigation.cc index 3ca84ecf5254bb94d41d97ce12f763846b7c0816..6549e1d73f0148945b7a1b82cdf6e91455c58c9b 100644 --- a/Appl/CEP/CS1/CS1_Interface/src/DH_RFI_Mitigation.cc +++ b/Appl/CEP/CS1/CS1_Interface/src/DH_RFI_Mitigation.cc @@ -1,5 +1,5 @@ -// DH_RFI_Mitigation.cc: -// +//# DH_RFI_Mitigation.cc: +//# //# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, seg@astron.nl //# //# This program is free software; you can redistribute it and/or modify @@ -18,48 +18,48 @@ //# //# $Id$ - #include <lofar_config.h> #define BGL_PROCESSING -#include <DH_RFI_Mitigation.h> - -#include <stdlib.h> - +#include <CS1_Interface/DH_RFI_Mitigation.h> namespace LOFAR { + namespace CS1 + { -DH_RFI_Mitigation::DH_RFI_Mitigation(const string &name) -: DataHolder(name, "DH_RFI_Mitigation"), - itsChannelFlags(0) -{ -} + DH_RFI_Mitigation::DH_RFI_Mitigation(const string &name) + : DataHolder(name, "DH_RFI_Mitigation"), + itsChannelFlags(0) + { + } -DH_RFI_Mitigation::DH_RFI_Mitigation(const DH_RFI_Mitigation &that) -: DataHolder(that), - itsChannelFlags(that.itsChannelFlags) -{ -} + DH_RFI_Mitigation::DH_RFI_Mitigation(const DH_RFI_Mitigation &that) + : DataHolder(that), + itsChannelFlags(that.itsChannelFlags) + { + } -DH_RFI_Mitigation::~DH_RFI_Mitigation() -{ -} + DH_RFI_Mitigation::~DH_RFI_Mitigation() + { + } -DataHolder *DH_RFI_Mitigation::clone() const -{ - return new DH_RFI_Mitigation(*this); -} + DataHolder *DH_RFI_Mitigation::clone() const + { + return new DH_RFI_Mitigation(*this); + } -void DH_RFI_Mitigation::init() -{ - addField("ChannelFlags", BlobField<uint32>(1, sizeof(ChannelFlagsType) / sizeof(uint32))); - createDataBlock(); -} + void DH_RFI_Mitigation::init() + { + addField("ChannelFlags", BlobField<uint32>(1, sizeof(ChannelFlagsType) / sizeof(uint32))); + createDataBlock(); + } -void DH_RFI_Mitigation::fillDataPointers() -{ - itsChannelFlags = (ChannelFlagsType *) getData<uint32>("ChannelFlags"); -} + void DH_RFI_Mitigation::fillDataPointers() + { + itsChannelFlags = (ChannelFlagsType *) getData<uint32>("ChannelFlags"); + } + + } // namespace CS1 -} +} // namespace LOFAR diff --git a/Appl/CEP/CS1/CS1_Interface/src/DH_RFI_Mitigation.h b/Appl/CEP/CS1/CS1_Interface/src/DH_RFI_Mitigation.h index ff2f35fb1ded31dae3111c5d48491ba58e1ab734..f4a358a3e6dc3405ba1b6c63d0fc670100b30871 100644 --- a/Appl/CEP/CS1/CS1_Interface/src/DH_RFI_Mitigation.h +++ b/Appl/CEP/CS1/CS1_Interface/src/DH_RFI_Mitigation.h @@ -20,8 +20,8 @@ //# //# $Id$ -#ifndef LOFAR_APPL_CEP_CS1_CS1_INTERFACE_DH_RFI_MITIGATION_H -#define LOFAR_APPL_CEP_CS1_CS1_INTERFACE_DH_RFI_MITIGATION_H +#ifndef LOFAR_CS1_INTERFACE_DH_RFI_MITIGATION_H +#define LOFAR_CS1_INTERFACE_DH_RFI_MITIGATION_H #include <CS1_Interface/CS1_Config.h> #include <CS1_Interface/bitset.h> @@ -31,47 +31,49 @@ namespace LOFAR { + namespace CS1 + { + class DH_RFI_Mitigation: public DataHolder + { + public: + typedef bitset<NR_SUBBAND_CHANNELS> ChannelFlagsType[NR_STATIONS]; -class DH_RFI_Mitigation: public DataHolder -{ -public: - typedef LOFAR::bitset<NR_SUBBAND_CHANNELS> ChannelFlagsType[NR_STATIONS]; + explicit DH_RFI_Mitigation(const string& name); - explicit DH_RFI_Mitigation(const string& name); + DH_RFI_Mitigation(const DH_RFI_Mitigation&); - DH_RFI_Mitigation(const DH_RFI_Mitigation&); + virtual ~DH_RFI_Mitigation(); - virtual ~DH_RFI_Mitigation(); + DataHolder *clone() const; - DataHolder *clone() const; + virtual void init(); - virtual void init(); + ChannelFlagsType *getChannelFlags() + { + return itsChannelFlags; + } - ChannelFlagsType *getChannelFlags() - { - return itsChannelFlags; - } + const ChannelFlagsType *getChannelFlags() const + { + return itsChannelFlags; + } - const ChannelFlagsType *getChannelFlags() const - { - return itsChannelFlags; - } + const size_t nrChannelFlags() const + { + return NR_STATIONS * NR_SUBBAND_CHANNELS; + } - const size_t nrChannelFlags() const - { - return NR_STATIONS * NR_SUBBAND_CHANNELS; - } - -private: - /// Forbid assignment. - DH_RFI_Mitigation &operator = (const DH_RFI_Mitigation&); - - ChannelFlagsType *itsChannelFlags; + private: + /// Forbid assignment. + DH_RFI_Mitigation &operator = (const DH_RFI_Mitigation&); - void fillDataPointers(); -}; + ChannelFlagsType *itsChannelFlags; + void fillDataPointers(); + }; + } } -#endif +#endif /* BGL_PROCESSING */ + #endif diff --git a/Appl/CEP/CS1/CS1_Interface/src/DH_RSP.cc b/Appl/CEP/CS1/CS1_Interface/src/DH_RSP.cc index 710400ef9eedde91739e6e14a936afc2566470a6..1ae483341445c127c3a227201384b4f47e269e6b 100644 --- a/Appl/CEP/CS1/CS1_Interface/src/DH_RSP.cc +++ b/Appl/CEP/CS1/CS1_Interface/src/DH_RSP.cc @@ -19,89 +19,88 @@ //# //# $Id$ - #include <lofar_config.h> -#include <DH_RSP.h> -#include <complex> - -using std::complex; - +#include <CS1_Interface/DH_RSP.h> +#include <Common/lofar_complex.h> namespace LOFAR { - -DH_RSP::DH_RSP (const string& name, - const ACC::APS::ParameterSet &pset) -: DataHolder (name, "DH_RSP"), - itsBuffer (0), - itsPSet (pset) -{ - int resendAmount = (pset.getInt32("BGLProc.NPPFTaps") - 1) * pset.getInt32("Observation.NChannels"); - itsNTimes = pset.getInt32("Observation.NSubbandSamples") + resendAmount; - itsNoPolarisations = pset.getInt32("Observation.NPolarisations"); - itsBufSize = itsNTimes * itsNoPolarisations; -} - -DH_RSP::DH_RSP(const DH_RSP& that) -: DataHolder (that), - itsBuffer (0), - itsNTimes (that.itsNTimes), - itsNoPolarisations (that.itsNoPolarisations), - itsBufSize (that.itsBufSize), - itsPSet (that.itsPSet) -{} - -DH_RSP::~DH_RSP() -{} - -DataHolder* DH_RSP::clone() const -{ - return new DH_RSP(*this); -} - -void DH_RSP::init() -{ - // Add the fields to the data definition. - addField ("Buffer", BlobField<BufferType>(1,itsBufSize)); - addField ("StationID", BlobField<int>(1)); - addField ("InvalidCount", BlobField<int>(1)); - addField ("Delay", BlobField<int>(1)); - addField ("TimeStamp", BlobField<char>(1, sizeof(timestamp_t))); + namespace CS1 + { + + DH_RSP::DH_RSP (const string& name, + const ACC::APS::ParameterSet &pset) + : DataHolder (name, "DH_RSP"), + itsBuffer (0), + itsPSet (pset) + { + int resendAmount = (pset.getInt32("BGLProc.NPPFTaps") - 1) * pset.getInt32("Observation.NChannels"); + itsNTimes = pset.getInt32("Observation.NSubbandSamples") + resendAmount; + itsNoPolarisations = pset.getInt32("Observation.NPolarisations"); + itsBufSize = itsNTimes * itsNoPolarisations; + } + + DH_RSP::DH_RSP(const DH_RSP& that) + : DataHolder (that), + itsBuffer (0), + itsNTimes (that.itsNTimes), + itsNoPolarisations (that.itsNoPolarisations), + itsBufSize (that.itsBufSize), + itsPSet (that.itsPSet) + {} + + DH_RSP::~DH_RSP() + {} + + DataHolder* DH_RSP::clone() const + { + return new DH_RSP(*this); + } + + void DH_RSP::init() + { + // Add the fields to the data definition. + addField ("Buffer", BlobField<BufferType>(1,itsBufSize)); + addField ("StationID", BlobField<int>(1)); + addField ("InvalidCount", BlobField<int>(1)); + addField ("Delay", BlobField<int>(1)); + addField ("TimeStamp", BlobField<char>(1, sizeof(timestamp_t))); - // Create the data blob - createDataBlock(); - - vector<DimDef> vdd; - // there is one station per dataholder - vdd.push_back(DimDef("Stations", 1)); - vdd.push_back(DimDef("Times", itsNTimes)); - vdd.push_back(DimDef("Polarisations", itsNoPolarisations)); + // Create the data blob + createDataBlock(); + + vector<DimDef> vdd; + // there is one station per dataholder + vdd.push_back(DimDef("Stations", 1)); + vdd.push_back(DimDef("Times", itsNTimes)); + vdd.push_back(DimDef("Polarisations", itsNoPolarisations)); - itsMatrix = new RectMatrix<BufferType> (vdd); - itsMatrix->setBuffer(itsBuffer, itsBufSize); -} + itsMatrix = new RectMatrix<BufferType> (vdd); + itsMatrix->setBuffer(itsBuffer, itsBufSize); + } -void DH_RSP::fillDataPointers() -{ - // Fill in the buffer pointer. - itsBuffer = getData<BufferType> ("Buffer"); + void DH_RSP::fillDataPointers() + { + // Fill in the buffer pointer. + itsBuffer = getData<BufferType> ("Buffer"); - // Fill in the StationID pointer - itsStationID = getData<int> ("StationID"); + // Fill in the StationID pointer + itsStationID = getData<int> ("StationID"); - // Fill in the InvalidCount pointer - itsInvalidCount = getData<int> ("InvalidCount"); + // Fill in the InvalidCount pointer + itsInvalidCount = getData<int> ("InvalidCount"); - // Fill in the Delay pointer - itsDelay = getData<int> ("Delay"); + // Fill in the Delay pointer + itsDelay = getData<int> ("Delay"); - // Fill in TimeStamp pointer - itsTimeStamp = (timestamp_t*)getData<char> ("TimeStamp"); + // Fill in TimeStamp pointer + itsTimeStamp = (timestamp_t*)getData<char> ("TimeStamp"); - // use memset to null the buffer - memset(itsBuffer, 0, itsBufSize*sizeof(BufferType)); -} + // use memset to null the buffer + memset(itsBuffer, 0, itsBufSize*sizeof(BufferType)); + } + } // namespace CS1 -} // end namespace +} // end namespace LOFAR diff --git a/Appl/CEP/CS1/CS1_Interface/src/DH_RSP.h b/Appl/CEP/CS1/CS1_Interface/src/DH_RSP.h index 9c0f99c77f4d4fce0c5fbf478a95485edab1cd29..72d616d46a860d2c8f50298509521f494200334e 100644 --- a/Appl/CEP/CS1/CS1_Interface/src/DH_RSP.h +++ b/Appl/CEP/CS1/CS1_Interface/src/DH_RSP.h @@ -21,9 +21,8 @@ //# //# $Id$ -#ifndef LOFAR_APPL_CEP_CS1_CS1_INTERFACE_DH_RSP_H -#define LOFAR_APPL_CEP_CS1_CS1_INTERFACE_DH_RSP_H - +#ifndef LOFAR_CS1_INTERFACE_DH_RSP_H +#define LOFAR_CS1_INTERFACE_DH_RSP_H #include <APS/ParameterSet.h> #include <Transport/DataHolder.h> @@ -32,108 +31,112 @@ namespace LOFAR { + namespace CS1 + { -class DH_RSP: public DataHolder -{ -public: - typedef i16complex BufferType; + class DH_RSP: public DataHolder + { + public: + typedef i16complex BufferType; - explicit DH_RSP (const string &name, - const ACC::APS::ParameterSet &pset); + explicit DH_RSP (const string &name, + const ACC::APS::ParameterSet &pset); - DH_RSP(const DH_RSP&); + DH_RSP(const DH_RSP&); - virtual ~DH_RSP(); + virtual ~DH_RSP(); - DataHolder *clone() const; + DataHolder *clone() const; - /// Allocate the buffers. - virtual void init(); + /// Allocate the buffers. + virtual void init(); - /// Accessor functions - const int getStationID() const; - void setStationID(int); - const int getInvalidCount() const; - void setInvalidCount(int); - const timestamp_t getTimeStamp() const; - void setTimeStamp(timestamp_t); - const int getDelay() const; - void setDelay(int); + /// Accessor functions + const int getStationID() const; + void setStationID(int); + const int getInvalidCount() const; + void setInvalidCount(int); + const timestamp_t getTimeStamp() const; + void setTimeStamp(timestamp_t); + const int getDelay() const; + void setDelay(int); - BufferType* getBuffer(); + BufferType* getBuffer(); - /// Get read access to the Buffer. - const BufferType* getBuffer() const; + /// Get read access to the Buffer. + const BufferType* getBuffer() const; - uint getBufferSize() const; + uint getBufferSize() const; - /// Reset the buffer - void resetBuffer(); + /// Reset the buffer + void resetBuffer(); - RectMatrix<BufferType>& getDataMatrix() const; + RectMatrix<BufferType>& getDataMatrix() const; - private: - /// Forbid assignment. - DH_RSP& operator= (const DH_RSP&); + private: + /// Forbid assignment. + DH_RSP& operator= (const DH_RSP&); - // Fill the pointers (itsBuffer) to the data in the blob. - virtual void fillDataPointers(); + // Fill the pointers (itsBuffer) to the data in the blob. + virtual void fillDataPointers(); - /// pointers to data in the blob - BufferType* itsBuffer; - int* itsStationID; - int* itsInvalidCount; - int* itsDelay; - timestamp_t* itsTimeStamp; + /// pointers to data in the blob + BufferType* itsBuffer; + int* itsStationID; + int* itsInvalidCount; + int* itsDelay; + timestamp_t* itsTimeStamp; - int itsNTimes; - int itsNoPolarisations; - unsigned int itsBufSize; + int itsNTimes; + int itsNoPolarisations; + unsigned int itsBufSize; - const ACC::APS::ParameterSet &itsPSet; + const ACC::APS::ParameterSet &itsPSet; - RectMatrix<BufferType> *itsMatrix; -}; + RectMatrix<BufferType> *itsMatrix; + }; -inline DH_RSP::BufferType *DH_RSP::getBuffer() - { return itsBuffer; } + inline DH_RSP::BufferType *DH_RSP::getBuffer() + { return itsBuffer; } -inline uint DH_RSP::getBufferSize() const - { return itsBufSize; } + inline uint DH_RSP::getBufferSize() const + { return itsBufSize; } -inline const DH_RSP::BufferType *DH_RSP::getBuffer() const - { return itsBuffer; } + inline const DH_RSP::BufferType *DH_RSP::getBuffer() const + { return itsBuffer; } + + inline const int DH_RSP::getStationID() const + { return *itsStationID; } -inline const int DH_RSP::getStationID() const - { return *itsStationID; } + inline void DH_RSP::setStationID(int id) + { *itsStationID = id; } -inline void DH_RSP::setStationID(int id) - { *itsStationID = id; } + inline const int DH_RSP::getInvalidCount() const + { return *itsInvalidCount; } -inline const int DH_RSP::getInvalidCount() const - { return *itsInvalidCount; } + inline void DH_RSP::setInvalidCount(int count) + { *itsInvalidCount = count; } -inline void DH_RSP::setInvalidCount(int count) - { *itsInvalidCount = count; } + inline const timestamp_t DH_RSP::getTimeStamp() const + { return *itsTimeStamp; } -inline const timestamp_t DH_RSP::getTimeStamp() const - { return *itsTimeStamp; } + inline void DH_RSP::setTimeStamp(timestamp_t timestamp) + { *itsTimeStamp = timestamp; } -inline void DH_RSP::setTimeStamp(timestamp_t timestamp) - { *itsTimeStamp = timestamp; } + inline const int DH_RSP::getDelay() const + { return *itsDelay; } -inline const int DH_RSP::getDelay() const - { return *itsDelay; } + inline void DH_RSP::setDelay(int delay) + { *itsDelay = delay; } -inline void DH_RSP::setDelay(int delay) - { *itsDelay = delay; } + inline void DH_RSP::resetBuffer() + { memset(itsBuffer, 0, itsBufSize); } -inline void DH_RSP::resetBuffer() - { memset(itsBuffer, 0, itsBufSize); } + inline RectMatrix<DH_RSP::BufferType> &DH_RSP::getDataMatrix() const + { return *itsMatrix; } -inline RectMatrix<DH_RSP::BufferType> &DH_RSP::getDataMatrix() const - { return *itsMatrix; } + } // namespace CS1 -} +} // namespace LOFAR #endif diff --git a/Appl/CEP/CS1/CS1_Interface/src/DH_RSPSync.cc b/Appl/CEP/CS1/CS1_Interface/src/DH_RSPSync.cc index 6053f63b53cebb0d81ff70ccff51b97781394cf2..b618980d92df50e188df41b6c0e08a9ac408f4ae 100644 --- a/Appl/CEP/CS1/CS1_Interface/src/DH_RSPSync.cc +++ b/Appl/CEP/CS1/CS1_Interface/src/DH_RSPSync.cc @@ -1,5 +1,5 @@ -// DH_RSPSync.cc: DataHolder used to synchronize incoming RSP data -// +//# DH_RSPSync.cc: DataHolder used to synchronize incoming RSP data +//# //# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, seg@astron.nl //# //# This program is free software; you can redistribute it and/or modify @@ -18,46 +18,49 @@ //# //# $Id$ - #include <lofar_config.h> -#include <DH_RSPSync.h> +#include <CS1_Interface/DH_RSPSync.h> #include <Blob/KeyValueMap.h> namespace LOFAR { + namespace CS1 + { -DH_RSPSync::DH_RSPSync (const string& name) - : DataHolder (name, "DH_RSPSync") -{ -} + DH_RSPSync::DH_RSPSync (const string& name) + : DataHolder (name, "DH_RSPSync") + { + } -DH_RSPSync::DH_RSPSync(const DH_RSPSync& that) - : DataHolder(that) -{ -} + DH_RSPSync::DH_RSPSync(const DH_RSPSync& that) + : DataHolder(that) + { + } -DH_RSPSync::~DH_RSPSync() -{ -} + DH_RSPSync::~DH_RSPSync() + { + } -DataHolder* DH_RSPSync::clone() const -{ - return new DH_RSPSync(*this); -} + DataHolder* DH_RSPSync::clone() const + { + return new DH_RSPSync(*this); + } -void DH_RSPSync::init() -{ - // this could be done nicer, but it works for now because SyncStamp doesn't contain - // any pointers - addField("RSPsyncStamp", BlobField<char>(1, sizeof(timestamp_t))); - createDataBlock(); - fillDataPointers(); - itsSyncStamp->setStamp(0, 0); -} - -void DH_RSPSync::fillDataPointers() { - itsSyncStamp = (timestamp_t*)getData<char> ("RSPsyncStamp"); -} - -} + void DH_RSPSync::init() + { + // this could be done nicer, but it works for now because SyncStamp doesn't contain + // any pointers + addField("RSPsyncStamp", BlobField<char>(1, sizeof(timestamp_t))); + createDataBlock(); + fillDataPointers(); + itsSyncStamp->setStamp(0, 0); + } + + void DH_RSPSync::fillDataPointers() { + itsSyncStamp = (timestamp_t*)getData<char> ("RSPsyncStamp"); + } + + } // namespace CS1 + +} // namespace LOFAR diff --git a/Appl/CEP/CS1/CS1_Interface/src/DH_RSPSync.h b/Appl/CEP/CS1/CS1_Interface/src/DH_RSPSync.h index 8188a31547d02e8ba6c26897ff314ded7abb480d..711697db2254a5b62b1824e33067e5d8c8936d9a 100644 --- a/Appl/CEP/CS1/CS1_Interface/src/DH_RSPSync.h +++ b/Appl/CEP/CS1/CS1_Interface/src/DH_RSPSync.h @@ -20,8 +20,8 @@ //# //# $Id$ -#ifndef LOFAR_APPL_CEP_CS1_CS1_INTERFACE_DH_RSPSYNC_H -#define LOFAR_APPL_CEP_CS1_CS1_INTERFACE_DH_RSPSYNC_H +#ifndef LOFAR_CS1_INTERFACE_DH_RSPSYNC_H +#define LOFAR_CS1_INTERFACE_DH_RSPSYNC_H #include <Transport/DataHolder.h> @@ -29,44 +29,51 @@ namespace LOFAR { - class DH_RSPSync: public DataHolder -{ -public: + namespace CS1 + { + + class DH_RSPSync: public DataHolder + { + public: - explicit DH_RSPSync (const string& name); + explicit DH_RSPSync (const string& name); - DH_RSPSync(const DH_RSPSync&); + DH_RSPSync(const DH_RSPSync&); - virtual ~DH_RSPSync(); + virtual ~DH_RSPSync(); - DataHolder* clone() const; + DataHolder* clone() const; - /// Allocate the buffers. - virtual void init(); + /// Allocate the buffers. + virtual void init(); - /// Set the sync stamp - void setSyncStamp(const timestamp_t syncStamp); + /// Set the sync stamp + void setSyncStamp(const timestamp_t syncStamp); - /// Get the sync stamp - const timestamp_t getSyncStamp() const; - void incrementStamp(const int value); + /// Get the sync stamp + const timestamp_t getSyncStamp() const; + void incrementStamp(const int value); -private: - /// Forbid assignment. - DH_RSPSync& operator= (const DH_RSPSync&); + private: + /// Forbid assignment. + DH_RSPSync& operator= (const DH_RSPSync&); - timestamp_t* itsSyncStamp; + timestamp_t* itsSyncStamp; - void fillDataPointers(); -}; + void fillDataPointers(); + }; -inline void DH_RSPSync::setSyncStamp(const timestamp_t syncStamp) - { *itsSyncStamp = syncStamp; } + inline void DH_RSPSync::setSyncStamp(const timestamp_t syncStamp) + { *itsSyncStamp = syncStamp; } -inline const timestamp_t DH_RSPSync::getSyncStamp() const - { return *itsSyncStamp;} + inline const timestamp_t DH_RSPSync::getSyncStamp() const + { return *itsSyncStamp;} + + inline void DH_RSPSync::incrementStamp(const int value) + { *itsSyncStamp += value;} + + } // namespace CS1 + +} // namespace LOFAR -inline void DH_RSPSync::incrementStamp(const int value) - { *itsSyncStamp += value;} -} #endif diff --git a/Appl/CEP/CS1/CS1_Interface/src/DH_Subband.cc b/Appl/CEP/CS1/CS1_Interface/src/DH_Subband.cc index 52c730185fffdf053c446f9bb0959dad68488de4..09c076c6d3e55dd16bd36a9da2920c63863bcb51 100644 --- a/Appl/CEP/CS1/CS1_Interface/src/DH_Subband.cc +++ b/Appl/CEP/CS1/CS1_Interface/src/DH_Subband.cc @@ -1,5 +1,5 @@ -// DH_Subband.cc: -// +//# DH_Subband.cc: +//# //# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, seg@astron.nl //# //# This program is free software; you can redistribute it and/or modify @@ -18,79 +18,81 @@ //# //# $Id$ - #include <lofar_config.h> -#include <DH_Subband.h> +#include <CS1_Interface/DH_Subband.h> #include <Common/DataConvert.h> #include <Common/Timer.h> - namespace LOFAR { - -DH_Subband::DH_Subband(const string &name, const ACC::APS::ParameterSet &pSet) -: DataHolder(name, "DH_Subband"), - itsNrStations(pSet.getUint32("Observation.NStations")), - itsNrInputSamples(pSet.getUint32("Observation.NSubbandSamples") + (pSet.getUint32("BGLProc.NPPFTaps") - 1) * pSet.getUint32("Observation.NChannels")), - itsSamples(0), - itsSamplesMatrix(0), - itsFlags(0), - itsDelays(0) -{ -} - -DH_Subband::DH_Subband(const DH_Subband &that) -: DataHolder(that), - itsNrStations(that.itsNrStations), - itsNrInputSamples(that.itsNrInputSamples), - itsSamples(that.itsSamples), - itsSamplesMatrix(that.itsSamplesMatrix), - itsFlags(that.itsFlags), - itsDelays(that.itsDelays) -{ -} - -DH_Subband::~DH_Subband() -{ - delete itsSamplesMatrix; -} - -DataHolder *DH_Subband::clone() const -{ - return new DH_Subband(*this); -} - -void DH_Subband::init() -{ - addField("Samples", BlobField<uint8>(1, nrSamples() * sizeof(SampleType)), 32); - addField("Flags", BlobField<uint32>(1, nrFlags() / sizeof(uint32))); - addField("Delays", BlobField<float>(1, nrDelays() * sizeof(DelayIntervalType) / sizeof(float))); - - createDataBlock(); - - vector<DimDef> vdd; - vdd.push_back(DimDef("Station", itsNrStations)); - vdd.push_back(DimDef("Time", itsNrInputSamples)); - vdd.push_back(DimDef("Polarisation", NR_POLARIZATIONS)); - - itsSamplesMatrix = new RectMatrix<SampleType> (vdd); - itsSamplesMatrix->setBuffer(itsSamples, nrSamples()); - - memset(itsFlags, 0, sizeof *itsFlags); -} - -void DH_Subband::fillDataPointers() -{ - itsSamples = (SampleType *) getData<uint8> ("Samples"); - itsFlags = (uint32 *) getData<uint32>("Flags"); - itsDelays = (DelayIntervalType *) getData<float> ("Delays"); -} - -void DH_Subband::swapBytes() -{ - // only convert Samples; CEPframe converts Flags and Delays - dataConvert(LittleEndian, itsSamples, nrSamples()); -} - -} + namespace CS1 + { + + DH_Subband::DH_Subband(const string &name, const ACC::APS::ParameterSet &pSet) + : DataHolder(name, "DH_Subband"), + itsNrStations(pSet.getUint32("Observation.NStations")), + itsNrInputSamples(pSet.getUint32("Observation.NSubbandSamples") + (pSet.getUint32("BGLProc.NPPFTaps") - 1) * pSet.getUint32("Observation.NChannels")), + itsSamples(0), + itsSamplesMatrix(0), + itsFlags(0), + itsDelays(0) + { + } + + DH_Subband::DH_Subband(const DH_Subband &that) + : DataHolder(that), + itsNrStations(that.itsNrStations), + itsNrInputSamples(that.itsNrInputSamples), + itsSamples(that.itsSamples), + itsSamplesMatrix(that.itsSamplesMatrix), + itsFlags(that.itsFlags), + itsDelays(that.itsDelays) + { + } + + DH_Subband::~DH_Subband() + { + delete itsSamplesMatrix; + } + + DataHolder *DH_Subband::clone() const + { + return new DH_Subband(*this); + } + + void DH_Subband::init() + { + addField("Samples", BlobField<uint8>(1, nrSamples() * sizeof(SampleType)), 32); + addField("Flags", BlobField<uint32>(1, nrFlags() / sizeof(uint32))); + addField("Delays", BlobField<float>(1, nrDelays() * sizeof(DelayIntervalType) / sizeof(float))); + + createDataBlock(); + + vector<DimDef> vdd; + vdd.push_back(DimDef("Station", itsNrStations)); + vdd.push_back(DimDef("Time", itsNrInputSamples)); + vdd.push_back(DimDef("Polarisation", NR_POLARIZATIONS)); + + itsSamplesMatrix = new RectMatrix<SampleType> (vdd); + itsSamplesMatrix->setBuffer(itsSamples, nrSamples()); + + memset(itsFlags, 0, sizeof *itsFlags); + } + + void DH_Subband::fillDataPointers() + { + itsSamples = (SampleType *) getData<uint8> ("Samples"); + itsFlags = (uint32 *) getData<uint32>("Flags"); + itsDelays = (DelayIntervalType *) getData<float> ("Delays"); + } + + void DH_Subband::swapBytes() + { + // only convert Samples; CEPframe converts Flags and Delays + dataConvert(LittleEndian, itsSamples, nrSamples()); + } + + } // namespace CS1 + +} // namespace LOFAR diff --git a/Appl/CEP/CS1/CS1_Interface/src/DH_Subband.h b/Appl/CEP/CS1/CS1_Interface/src/DH_Subband.h index df6f995062ff91e57a14bb916317433d539bdd67..e274570b13b02f400d63661e778e5065b810c674 100644 --- a/Appl/CEP/CS1/CS1_Interface/src/DH_Subband.h +++ b/Appl/CEP/CS1/CS1_Interface/src/DH_Subband.h @@ -20,8 +20,8 @@ //# //# $Id$ -#ifndef LOFAR_APPL_CEP_CS1_CS1_INTERFACE_DH_SUBBAND_H -#define LOFAR_APPL_CEP_CS1_CS1_INTERFACE_DH_SUBBAND_H +#ifndef LOFAR_CS1_INTERFACE_DH_SUBBAND_H +#define LOFAR_CS1_INTERFACE_DH_SUBBAND_H #include <CS1_Interface/CS1_Config.h> #include <CS1_Interface/RectMatrix.h> @@ -33,124 +33,129 @@ namespace LOFAR { + namespace CS1 + { -class DH_Subband: public DataHolder -{ -public: - // samples are ALWAYS stored in little endian format ! + class DH_Subband: public DataHolder + { + public: + // samples are ALWAYS stored in little endian format ! #if INPUT_TYPE == I4COMPLEX_TYPE - typedef i4complex SampleType; + typedef i4complex SampleType; #elif INPUT_TYPE == I16COMPLEX_TYPE - typedef i16complex SampleType; + typedef i16complex SampleType; #else #error INPUT_TYPE not supported #endif - // Fine-grained delays - typedef struct { - float delayAtBegin, delayAfterEnd; - } DelayIntervalType; + // Fine-grained delays + typedef struct { + float delayAtBegin, delayAfterEnd; + } DelayIntervalType; - explicit DH_Subband(const string &name, - const LOFAR::ACC::APS::ParameterSet &pSet); + explicit DH_Subband(const string &name, + const ACC::APS::ParameterSet &pSet); - DH_Subband(const DH_Subband &); + DH_Subband(const DH_Subband &); - virtual ~DH_Subband(); + virtual ~DH_Subband(); - DataHolder *clone() const; + DataHolder *clone() const; - virtual void init(); + virtual void init(); - RectMatrix<SampleType> &getSamplesMatrix() const - { - return *itsSamplesMatrix; - } + RectMatrix<SampleType> &getSamplesMatrix() const + { + return *itsSamplesMatrix; + } - SampleType &getSample(unsigned station, unsigned time, unsigned pol) - { - return itsSamples[NR_POLARIZATIONS * (itsNrInputSamples * station + time) + pol]; - } + SampleType &getSample(unsigned station, unsigned time, unsigned pol) + { + return itsSamples[NR_POLARIZATIONS * (itsNrInputSamples * station + time) + pol]; + } - const size_t nrSamples() const - { - return itsNrStations * itsNrInputSamples * NR_POLARIZATIONS; - } + const size_t nrSamples() const + { + return itsNrStations * itsNrInputSamples * NR_POLARIZATIONS; + } - DelayIntervalType &getDelay(unsigned station) - { - return itsDelays[station]; - } + DelayIntervalType &getDelay(unsigned station) + { + return itsDelays[station]; + } - const size_t nrFlags() const - { - return itsNrStations * ((itsNrInputSamples + 31) & ~31); - } + const size_t nrFlags() const + { + return itsNrStations * ((itsNrInputSamples + 31) & ~31); + } - const size_t nrDelays() const - { - return itsNrStations; - } + const size_t nrDelays() const + { + return itsNrStations; + } #if defined BGL_PROCESSING - // Samples - typedef SampleType AllSamplesType[NR_STATIONS][NR_INPUT_SAMPLES][NR_POLARIZATIONS]; - - // Flags - typedef LOFAR::bitset<NR_INPUT_SAMPLES> AllFlagsType[NR_STATIONS]; - - // Fine-grained delays - typedef DelayIntervalType AllDelaysType[NR_STATIONS]; - - AllSamplesType *getSamples() - { - return (AllSamplesType *) itsSamples; - } - - const AllSamplesType *getSamples() const - { - return (const AllSamplesType *) itsSamples; - } - - AllFlagsType *getFlags() - { - return (AllFlagsType *) itsFlags; - } - - const AllFlagsType *getFlags() const - { - return (const AllFlagsType *) itsFlags; - } + // Samples + typedef SampleType AllSamplesType[NR_STATIONS][NR_INPUT_SAMPLES][NR_POLARIZATIONS]; + + // Flags + typedef bitset<NR_INPUT_SAMPLES> AllFlagsType[NR_STATIONS]; + + // Fine-grained delays + typedef DelayIntervalType AllDelaysType[NR_STATIONS]; + + AllSamplesType *getSamples() + { + return (AllSamplesType *) itsSamples; + } + + const AllSamplesType *getSamples() const + { + return (const AllSamplesType *) itsSamples; + } + + AllFlagsType *getFlags() + { + return (AllFlagsType *) itsFlags; + } + + const AllFlagsType *getFlags() const + { + return (const AllFlagsType *) itsFlags; + } + + AllDelaysType *getDelays() + { + return (AllDelaysType *) itsDelays; + } + + const AllDelaysType *getDelays() const + { + return (const AllDelaysType *) itsDelays; + } +#endif - AllDelaysType *getDelays() - { - return (AllDelaysType *) itsDelays; - } + void swapBytes(); - const AllDelaysType *getDelays() const - { - return (const AllDelaysType *) itsDelays; - } -#endif + private: + /// Forbid assignment. + DH_Subband &operator = (const DH_Subband &); - void swapBytes(); + unsigned itsNrStations; + unsigned itsNrInputSamples; -private: - /// Forbid assignment. - DH_Subband &operator = (const DH_Subband &); + SampleType *itsSamples; + // RectMatrix cannot be used for bitsets, thus not for flags + RectMatrix<SampleType> *itsSamplesMatrix; + uint32 *itsFlags; + DelayIntervalType *itsDelays; - unsigned itsNrStations; - unsigned itsNrInputSamples; + void fillDataPointers(); + }; - SampleType *itsSamples; - // RectMatrix cannot be used for bitsets, thus not for flags - RectMatrix<SampleType> *itsSamplesMatrix; - uint32 *itsFlags; - DelayIntervalType *itsDelays; + } // namespace CS1 - void fillDataPointers(); -}; +} // namespace LOFAR -} #endif diff --git a/Appl/CEP/CS1/CS1_Interface/src/DH_Visibilities.cc b/Appl/CEP/CS1/CS1_Interface/src/DH_Visibilities.cc index e404ac8be155a3e4b12d9b986682c6f5d37e4dfb..31e10570bff60eb621ae90a4a697bdd96f40d5db 100644 --- a/Appl/CEP/CS1/CS1_Interface/src/DH_Visibilities.cc +++ b/Appl/CEP/CS1/CS1_Interface/src/DH_Visibilities.cc @@ -1,5 +1,5 @@ -// DH_Visibilities.cc: -// +//# DH_Visibilities.cc: +//# //# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, seg@astron.nl //# //# This program is free software; you can redistribute it and/or modify @@ -18,69 +18,71 @@ //# //# $Id$ - #include <lofar_config.h> #include <APS/ParameterSet.h> - -#include <DH_Visibilities.h> +#include <CS1_Interface/DH_Visibilities.h> namespace LOFAR { + namespace CS1 + { -DH_Visibilities::DH_Visibilities (const string &name, const ACC::APS::ParameterSet &pSet) -: DataHolder (name, "DH_Visibilities"), - //itsPS (pSet), - itsVisibilities(0), - itsNrValidSamples(0) -{ + DH_Visibilities::DH_Visibilities (const string &name, const ACC::APS::ParameterSet &pSet) + : DataHolder (name, "DH_Visibilities"), + //itsPS (pSet), + itsVisibilities(0), + itsNrValidSamples(0) + { #if 0 - //todo: support for multiple freq channels - itsNPols = itsPS.getInt32("Observation.NPolarisations"); - itsNCorrs = itsNPols*itsNPols; + //todo: support for multiple freq channels + itsNPols = itsPS.getInt32("Observation.NPolarisations"); + itsNCorrs = itsNPols*itsNPols; #endif - itsNrChannels = pSet.getUint32("Observation.NChannels"); - unsigned nrStations = pSet.getUint32("Observation.NStations"); - itsNrBaselines = nrStations * (nrStations + 1) / 2; -} + itsNrChannels = pSet.getUint32("Observation.NChannels"); + unsigned nrStations = pSet.getUint32("Observation.NStations"); + itsNrBaselines = nrStations * (nrStations + 1) / 2; + } -DH_Visibilities::DH_Visibilities(const DH_Visibilities &that) - : DataHolder (that), - //itsPS (that.itsPS), + DH_Visibilities::DH_Visibilities(const DH_Visibilities &that) + : DataHolder (that), + //itsPS (that.itsPS), - itsNrBaselines(that.itsNrBaselines), - itsNrChannels(that.itsNrChannels), - itsVisibilities(0), - itsNrValidSamples(0) + itsNrBaselines(that.itsNrBaselines), + itsNrChannels(that.itsNrChannels), + itsVisibilities(0), + itsNrValidSamples(0) #if 0 - itsNStations (that.itsNStations), - itsNBaselines (that.itsNBaselines), - itsNPols (that.itsNPols), - itsNCorrs (that.itsNCorrs) + itsNStations (that.itsNStations), + itsNBaselines (that.itsNBaselines), + itsNPols (that.itsNPols), + itsNCorrs (that.itsNCorrs) #endif -{} + {} -DH_Visibilities::~DH_Visibilities() -{} + DH_Visibilities::~DH_Visibilities() + {} -DataHolder* DH_Visibilities::clone() const -{ - return new DH_Visibilities(*this); -} + DataHolder* DH_Visibilities::clone() const + { + return new DH_Visibilities(*this); + } -void DH_Visibilities::init() -{ - addField("Visibilities", BlobField<fcomplex>(1, getNrVisibilities()), 32); - addField("NrValidSamples", BlobField<NrValidSamplesType>(1, itsNrBaselines * itsNrChannels)); + void DH_Visibilities::init() + { + addField("Visibilities", BlobField<fcomplex>(1, getNrVisibilities()), 32); + addField("NrValidSamples", BlobField<NrValidSamplesType>(1, itsNrBaselines * itsNrChannels)); - createDataBlock(); // calls fillDataPointers -} + createDataBlock(); // calls fillDataPointers + } -void DH_Visibilities::fillDataPointers() -{ - itsVisibilities = (VisibilityType *) getData<fcomplex>("Visibilities"); - itsNrValidSamples = (NrValidSamplesType *) getData<NrValidSamplesType>("NrValidSamples"); -} + void DH_Visibilities::fillDataPointers() + { + itsVisibilities = (VisibilityType *) getData<fcomplex>("Visibilities"); + itsNrValidSamples = (NrValidSamplesType *) getData<NrValidSamplesType>("NrValidSamples"); + } -} + } // namespace CS1 + +} // namespace LOFAR diff --git a/Appl/CEP/CS1/CS1_Interface/src/DH_Visibilities.h b/Appl/CEP/CS1/CS1_Interface/src/DH_Visibilities.h index c09d54dab0e81e7b13ebc8f9852ba91fb56c5df4..27decf64dfd2f20b69a92639fa680901ead081be 100644 --- a/Appl/CEP/CS1/CS1_Interface/src/DH_Visibilities.h +++ b/Appl/CEP/CS1/CS1_Interface/src/DH_Visibilities.h @@ -20,8 +20,8 @@ //# //# $Id$ -#ifndef LOFAR_APPL_CEP_CS1_CS1_INTERFACE_DH_VISIBILITIES_H -#define LOFAR_APPL_CEP_CS1_CS1_INTERFACE_DH_VISIBILITIES_H +#ifndef LOFAR_CS1_INTERFACE_DH_VISIBILITIES_H +#define LOFAR_CS1_INTERFACE_DH_VISIBILITIES_H #include <Transport/DataHolder.h> #include <Common/lofar_complex.h> @@ -29,89 +29,98 @@ namespace LOFAR { -class DH_Visibilities: public DataHolder -{ -public: - typedef fcomplex VisibilityType; - typedef unsigned short NrValidSamplesType; + namespace CS1 + { - // Constructor with centerFreq being the center frequency of the subband - explicit DH_Visibilities(const string& name, - const LOFAR::ACC::APS::ParameterSet &pSet); + class DH_Visibilities: public DataHolder + { + public: + typedef fcomplex VisibilityType; + typedef unsigned short NrValidSamplesType; - DH_Visibilities(const DH_Visibilities&); + // Constructor with centerFreq being the center frequency of the subband + explicit DH_Visibilities(const string& name, + const ACC::APS::ParameterSet &pSet); - virtual ~DH_Visibilities(); + DH_Visibilities(const DH_Visibilities&); - DataHolder* clone() const; + virtual ~DH_Visibilities(); - /// Allocate the buffers. - virtual void init(); + DataHolder* clone() const; - static int baseline(int station1, int station2) - { - DBGASSERT(station1 <= station2); - return station2 * (station2 + 1) / 2 + station1; - } + /// Allocate the buffers. + virtual void init(); + + static int baseline(int station1, int station2) + { + DBGASSERT(station1 <= station2); + return station2 * (station2 + 1) / 2 + station1; + } #if 0 - fcomplex (*getChannels(int station1, int station2)) [NR_SUBBAND_CHANNELS][NR_POLARIZATIONS][NR_POLARIZATIONS] - { - return &(*itsVisibilities)[baseline(station1, station2)]; - } + fcomplex (*getChannels(int station1, int station2)) [NR_SUBBAND_CHANNELS][NR_POLARIZATIONS][NR_POLARIZATIONS] + { + return &(*itsVisibilities)[baseline(station1, station2)]; + } #endif #if defined BGL_PROCESSING - typedef VisibilityType AllVisibilitiesType[NR_BASELINES][NR_SUBBAND_CHANNELS][NR_POLARIZATIONS][NR_POLARIZATIONS]; - typedef NrValidSamplesType AllNrValidSamplesType[NR_BASELINES][NR_SUBBAND_CHANNELS]; + typedef VisibilityType AllVisibilitiesType[NR_BASELINES][NR_SUBBAND_CHANNELS][NR_POLARIZATIONS][NR_POLARIZATIONS]; + typedef NrValidSamplesType AllNrValidSamplesType[NR_BASELINES][NR_SUBBAND_CHANNELS]; + + AllVisibilitiesType* getVisibilities() + { + return (AllVisibilitiesType *) itsVisibilities; + } + + const AllVisibilitiesType* getVisibilities() const + { + return (const AllVisibilitiesType *) itsVisibilities; + } + + AllNrValidSamplesType *getNrValidSamples() + { + return (AllNrValidSamplesType *) itsNrValidSamples; + } + + const AllNrValidSamplesType *getNrValidSamples() const + { + return (const AllNrValidSamplesType *) itsNrValidSamples; + } +#endif - AllVisibilitiesType* getVisibilities() - { - return (AllVisibilitiesType *) itsVisibilities; - } + VisibilityType &getVisibility(unsigned baseline, unsigned channel, unsigned pol1, unsigned pol2) + { + return itsVisibilities[NR_POLARIZATIONS * (NR_POLARIZATIONS * (itsNrChannels * baseline + channel) + pol1) + pol2]; + } - const AllVisibilitiesType* getVisibilities() const - { - return (const AllVisibilitiesType *) itsVisibilities; - } + NrValidSamplesType &getNrValidSamples(unsigned baseline, unsigned channel) + { + return itsNrValidSamples[itsNrChannels * baseline + channel]; + } - AllNrValidSamplesType *getNrValidSamples() - { - return (AllNrValidSamplesType *) itsNrValidSamples; - } + const size_t getNrVisibilities() const + { + return itsNrBaselines * itsNrChannels * NR_POLARIZATIONS * NR_POLARIZATIONS; + } - const AllNrValidSamplesType *getNrValidSamples() const - { - return (const AllNrValidSamplesType *) itsNrValidSamples; - } -#endif + // Test pattern for storage section + void setStorageTestPattern(int factor); - VisibilityType &getVisibility(unsigned baseline, unsigned channel, unsigned pol1, unsigned pol2) - { - return itsVisibilities[NR_POLARIZATIONS * (NR_POLARIZATIONS * (itsNrChannels * baseline + channel) + pol1) + pol2]; - } + private: + /// Forbid assignment. + DH_Visibilities& operator= (const DH_Visibilities&); - NrValidSamplesType &getNrValidSamples(unsigned baseline, unsigned channel) - { - return itsNrValidSamples[itsNrChannels * baseline + channel]; - } - - const size_t getNrVisibilities() const - { - return itsNrBaselines * itsNrChannels * NR_POLARIZATIONS * NR_POLARIZATIONS; - } + unsigned itsNrBaselines, itsNrChannels; -private: - /// Forbid assignment. - DH_Visibilities& operator= (const DH_Visibilities&); + VisibilityType *itsVisibilities; + NrValidSamplesType *itsNrValidSamples; - unsigned itsNrBaselines, itsNrChannels; + void fillDataPointers(); + }; - VisibilityType *itsVisibilities; - NrValidSamplesType *itsNrValidSamples; + } // namespace CS1 - void fillDataPointers(); -}; -} // Namespace LOFAR +} // namespace LOFAR #endif diff --git a/Appl/CEP/CS1/CS1_Interface/src/RSPTimeStamp.cc b/Appl/CEP/CS1/CS1_Interface/src/RSPTimeStamp.cc index 32e2a7a30ffeba6c1f2f9b4ec8809ad3cfe499c3..10af7e73c34052c4a76ba03ccee6528b52f4ae1f 100644 --- a/Appl/CEP/CS1/CS1_Interface/src/RSPTimeStamp.cc +++ b/Appl/CEP/CS1/CS1_Interface/src/RSPTimeStamp.cc @@ -18,35 +18,42 @@ //# //# $Id$ - #include <lofar_config.h> -#include <RSPTimeStamp.h> - -namespace LOFAR { - int TimeStamp::theirMaxBlockId = 156250; +#include <CS1_Interface/RSPTimeStamp.h> +#include <Common/lofar_iostream.h> - TimeStamp::TimeStamp(const int seqId, const int blockId) - :itsSeqId(seqId), - itsBlockId(blockId) +namespace LOFAR +{ + namespace CS1 { - checkOverflow(); - } - - void TimeStamp::checkOverflow() { - if (itsBlockId >= theirMaxBlockId) { - int newBlockId = itsBlockId % theirMaxBlockId; - itsSeqId += itsBlockId / theirMaxBlockId; - itsBlockId = newBlockId; - } else if (itsBlockId < 0) { - int newBlockId = (itsBlockId % theirMaxBlockId) + theirMaxBlockId; - itsSeqId += -1 + itsBlockId / theirMaxBlockId; - itsBlockId = newBlockId; - }; - } - - ostream& operator<<(ostream& os, const TimeStamp& ss){ - os<<ss.itsSeqId<<" s: "<<ss.itsBlockId; - return os; - } -} + int TimeStamp::theirMaxBlockId = 156250; + + TimeStamp::TimeStamp(const int seqId, const int blockId) + :itsSeqId(seqId), + itsBlockId(blockId) + { + checkOverflow(); + } + + void TimeStamp::checkOverflow() { + if (itsBlockId >= theirMaxBlockId) { + int newBlockId = itsBlockId % theirMaxBlockId; + itsSeqId += itsBlockId / theirMaxBlockId; + itsBlockId = newBlockId; + } else if (itsBlockId < 0) { + int newBlockId = (itsBlockId % theirMaxBlockId) + theirMaxBlockId; + itsSeqId += -1 + itsBlockId / theirMaxBlockId; + itsBlockId = newBlockId; + }; + } + + ostream& operator<<(ostream& os, const TimeStamp& ss){ + os<<ss.itsSeqId<<" s: "<<ss.itsBlockId; + return os; + } + + } // namespace CS1 + +} // namespace LOFAR + diff --git a/Appl/CEP/CS1/CS1_Interface/src/RSPTimeStamp.h b/Appl/CEP/CS1/CS1_Interface/src/RSPTimeStamp.h index cd4a230c10f083807907c80eb69bcfe91825ce44..e2c3e76ef52ed548426598e635483a5ba7a0f0df 100644 --- a/Appl/CEP/CS1/CS1_Interface/src/RSPTimeStamp.h +++ b/Appl/CEP/CS1/CS1_Interface/src/RSPTimeStamp.h @@ -20,95 +20,95 @@ //# //# $Id$ -#ifndef LOFAR_APPL_CEP_CS1_CS1_INTERFACE_RSPTIMESTAMP_H -#define LOFAR_APPL_CEP_CS1_CS1_INTERFACE_RSPTIMESTAMP_H - -#include <Common/lofar_iostream.h> -//#include <math.h> +#ifndef LOFAR_CS1_INTERFACE_RSPTIMESTAMP_H +#define LOFAR_CS1_INTERFACE_RSPTIMESTAMP_H +#include <Common/lofar_iosfwd.h> namespace LOFAR { - class TimeStamp { - public: - TimeStamp(const int seqId = 0, const int blockId = 0); - - // set the Stamp - void setStamp(const int seqId, const int blockId); - // get sequence ID - const int getSeqId () const; - // get block ID - const int getBlockId () const; - static int getMaxBlockId() {return theirMaxBlockId; }; - static void setMaxBlockId(int nMBID) {theirMaxBlockId = nMBID; }; - - // the blockId restarts at zero at some point. Check if we are there yet - void checkOverflow(); - - // increase the value of the stamp - void operator+= (const TimeStamp& other); - void operator+= (int increment); - void operator++ (int); - - TimeStamp operator+ (int other) const; - long long operator- (const TimeStamp& other) const; - TimeStamp operator- (int other) const; - bool operator> (const TimeStamp& other) const; - bool operator< (const TimeStamp& other) const; - bool operator>= (const TimeStamp& other) const; - bool operator<= (const TimeStamp& other) const; - bool operator== (const TimeStamp& other) const; - - friend ostream& operator<<(ostream& os, const TimeStamp& ss); - - private: - int itsSeqId; - int itsBlockId; - - static int theirMaxBlockId; - }; - - typedef TimeStamp timestamp_t; - - inline void TimeStamp::setStamp(const int seqId, const int blockId) + namespace CS1 + { + class TimeStamp { + public: + TimeStamp(const int seqId = 0, const int blockId = 0); + + // set the Stamp + void setStamp(const int seqId, const int blockId); + // get sequence ID + const int getSeqId () const; + // get block ID + const int getBlockId () const; + static int getMaxBlockId() {return theirMaxBlockId; }; + static void setMaxBlockId(int nMBID) {theirMaxBlockId = nMBID; }; + + // the blockId restarts at zero at some point. Check if we are there yet + void checkOverflow(); + + // increase the value of the stamp + void operator+= (const TimeStamp& other); + void operator+= (int increment); + void operator++ (int); + + TimeStamp operator+ (int other) const; + long long operator- (const TimeStamp& other) const; + TimeStamp operator- (int other) const; + bool operator> (const TimeStamp& other) const; + bool operator< (const TimeStamp& other) const; + bool operator>= (const TimeStamp& other) const; + bool operator<= (const TimeStamp& other) const; + bool operator== (const TimeStamp& other) const; + + friend ostream& operator<<(ostream& os, const TimeStamp& ss); + + private: + int itsSeqId; + int itsBlockId; + + static int theirMaxBlockId; + }; + + typedef TimeStamp timestamp_t; + + inline void TimeStamp::setStamp(const int seqId, const int blockId) { itsSeqId = seqId; itsBlockId = blockId; checkOverflow(); }; - inline const int TimeStamp::getSeqId () const + inline const int TimeStamp::getSeqId () const { return itsSeqId; } - inline const int TimeStamp::getBlockId () const + inline const int TimeStamp::getBlockId () const { return itsBlockId; } - inline void TimeStamp::operator += (const TimeStamp& other) + inline void TimeStamp::operator += (const TimeStamp& other) { itsBlockId += other.itsBlockId; checkOverflow(); itsSeqId += other.itsSeqId; } - inline void TimeStamp::operator += (int increment) + inline void TimeStamp::operator += (int increment) { itsBlockId += increment; checkOverflow(); } - inline void TimeStamp::operator ++ (int dummy) + inline void TimeStamp::operator ++ (int) { itsBlockId ++; checkOverflow(); } - inline TimeStamp TimeStamp::operator+ (int increment) const + inline TimeStamp TimeStamp::operator+ (int increment) const { // check overflow is done in the constructor return TimeStamp(itsSeqId, itsBlockId + increment); } - inline TimeStamp TimeStamp::operator- (int decrement) const + inline TimeStamp TimeStamp::operator- (int decrement) const { // check overflow is done in the constructor return TimeStamp(itsSeqId, itsBlockId - decrement); } - inline long long TimeStamp::operator- (const TimeStamp& other) const + inline long long TimeStamp::operator- (const TimeStamp& other) const { long long seqdecr = itsSeqId - other.itsSeqId; int blockdecr = itsBlockId - other.itsBlockId; @@ -116,32 +116,34 @@ namespace LOFAR return (seqdecr*theirMaxBlockId) + blockdecr; } - inline bool TimeStamp::operator > (const TimeStamp& other) const + inline bool TimeStamp::operator > (const TimeStamp& other) const { if (itsSeqId > other.itsSeqId) return true; if (itsSeqId < other.itsSeqId) return false; if (itsBlockId > other.itsBlockId) return true; return false; } - inline bool TimeStamp::operator >= (const TimeStamp& other) const + inline bool TimeStamp::operator >= (const TimeStamp& other) const { return !operator<(other); } - inline bool TimeStamp::operator < (const TimeStamp& other) const + inline bool TimeStamp::operator < (const TimeStamp& other) const { if (itsSeqId < other.itsSeqId) return true; if (itsSeqId > other.itsSeqId) return false; if (itsBlockId < other.itsBlockId) return true; return false; } - inline bool TimeStamp::operator <= (const TimeStamp& other) const + inline bool TimeStamp::operator <= (const TimeStamp& other) const { return !operator>(other); } - inline bool TimeStamp::operator == (const TimeStamp& other) const + inline bool TimeStamp::operator == (const TimeStamp& other) const { return ((itsSeqId == other.itsSeqId) && (itsBlockId == other.itsBlockId)); } -} + } // namespace CS1 + +} // namespace LOFAR #endif diff --git a/Appl/CEP/CS1/CS1_Interface/src/RectMatrix.h b/Appl/CEP/CS1/CS1_Interface/src/RectMatrix.h index 4f1b48d5665f4ff8dfe0a002a54fba192c1336f6..0dfd038d214cca5386a9c78ab3204d611309d8a3 100644 --- a/Appl/CEP/CS1/CS1_Interface/src/RectMatrix.h +++ b/Appl/CEP/CS1/CS1_Interface/src/RectMatrix.h @@ -21,140 +21,139 @@ //# //# $Id$ -#ifndef LOFAR_APPL_CEP_CS1_CS1_INTERFACE_RECT_MATRIX -#define LOFAR_APPL_CEP_CS1_CS1_INTERFACE_RECT_MATRIX - -#include<Common/LofarLogger.h> -#include<Common/lofar_vector.h> -#include<Common/lofar_map.h> -#include<Common/lofar_string.h> - -using LOFAR::string; -using LOFAR::vector; -using LOFAR::map; - -namespace LOFAR { - -// 3 macros are provided which can be used to construct a for loop: -// -// MATRIX_FOR_LOOP(matrix, dim, cursor) -// loops through 1 full dimension(dim) of matrix from cursor to end -// -// MATRIX_FOR_LOOP_PART(matrix, dim, cursor, noElem) -// loops through from cursor to cursor + noElem in the dimension dim of the matrix -// -// e.g. -// cursor = matrix.getCursor(0) -// MATRIX_FOR_LOOP(matrix, dim, cursor) { -// matrix.setValue(cursor, 0); -// } - - -// the definition of a dimension -// this class is only used when constructing a rectmatrix -class DimDef { - public: - DimDef(const string& newName, const int newSize): - name(newName), - size(newSize) - {}; - string name; - int size; -}; - - -// a dimension of a RectMatrix -class dimType{ - public: - dimType(int ms = 0, int ne = 0) : - memSize(ms), - noElem(ne){total = ms*ne;}; - int memSize; // how many values from this element to the next element in this dimension - int noElem; // how many elements in this dimension - int total; // memSize*noElem, used for for-loops - int operator*(int steps) { - return steps * memSize;}; - friend int operator*(int steps, dimType& dim) { - return steps * dim.memSize;}; -}; - - -// this class holds a matrix -// for example programs using this class see tRectMatrix.cc in the test directory -template <typename valueType> -class RectMatrix { - public: - RectMatrix(vector<DimDef>&); - // ~RectMatrix(); +#ifndef LOFAR_CS1_INTERFACE_RECTMATRIX_H +#define LOFAR_CS1_INTERFACE_RECTMATRIX_H + +#include <Common/LofarLogger.h> +#include <Common/lofar_vector.h> +#include <Common/lofar_map.h> +#include <Common/lofar_string.h> + +namespace LOFAR +{ + namespace CS1 + { + + // 3 macros are provided which can be used to construct a for loop: + // + // MATRIX_FOR_LOOP(matrix, dim, cursor) + // loops through 1 full dimension(dim) of matrix from cursor to end + // + // MATRIX_FOR_LOOP_PART(matrix, dim, cursor, noElem) + // loops through from cursor to cursor + noElem in the dimension dim of the matrix + // + // e.g. + // cursor = matrix.getCursor(0) + // MATRIX_FOR_LOOP(matrix, dim, cursor) { + // matrix.setValue(cursor, 0); + // } + + + // the definition of a dimension + // this class is only used when constructing a rectmatrix + class DimDef { + public: + DimDef(const string& newName, const int newSize): + name(newName), + size(newSize) + {}; + string name; + int size; + }; + + + // a dimension of a RectMatrix + class dimType{ + public: + dimType(int ms = 0, int ne = 0) : + memSize(ms), + noElem(ne){total = ms*ne;}; + int memSize; // how many values from this element to the next element in this dimension + int noElem; // how many elements in this dimension + int total; // memSize*noElem, used for for-loops + int operator*(int steps) { + return steps * memSize;}; + friend int operator*(int steps, dimType& dim) { + return steps * dim.memSize;}; + }; + + + // this class holds a matrix + // for example programs using this class see tRectMatrix.cc in the test directory + template <typename valueType> + class RectMatrix { + public: + RectMatrix(vector<DimDef>&); + // ~RectMatrix(); - typedef int cursorType; // is the offset of the datamember in itsData + typedef int cursorType; // is the offset of the datamember in itsData - // get a dimension identifier by name - dimType& getDim(string dimName); - // get number of elements in this dimension - // don't use this function to much because it uses a map! - int getNElemInDim(const dimType& dim) const; - // get a cursor at a certain position in the matrix - // use this as 4*firstDim + 2* secondDim for element(4,2) - cursorType getCursor(const int pos = 0) const; - // get the value at the position of the cursor - valueType& getValue(const cursorType& cursor) const; - // set the value at the position of the cursor - void setValue(const cursorType& cursor, const valueType& value); - // move the cursor in a dimension - void moveCursor(cursorType* cursor, const dimType& dim) const; - // move the cursor in a dimension a certain number of steps - void moveCursorN(cursorType* cursor, const dimType& dim, const int& steps) const; + // get a dimension identifier by name + dimType& getDim(string dimName); + // get number of elements in this dimension + // don't use this function to much because it uses a map! + int getNElemInDim(const dimType& dim) const; + // get a cursor at a certain position in the matrix + // use this as 4*firstDim + 2* secondDim for element(4,2) + cursorType getCursor(const int pos = 0) const; + // get the value at the position of the cursor + valueType& getValue(const cursorType& cursor) const; + // set the value at the position of the cursor + void setValue(const cursorType& cursor, const valueType& value); + // move the cursor in a dimension + void moveCursor(cursorType* cursor, const dimType& dim) const; + // move the cursor in a dimension a certain number of steps + void moveCursorN(cursorType* cursor, const dimType& dim, const int& steps) const; - // get a block of memory - valueType* getBlock(const cursorType& cursor, const dimType& dim, const int noElem, const int noTotalElem) const; - - // copy a subblock of the matrix - // note that the lower dimensions of both matrixes have to match - // it makes no sense to copy a block of information if it doesn't have the same - // meaning in the other matrix - void cpy2Matrix (cursorType srcCursor, - dimType& srcDim, - RectMatrix& dstMatrix, - cursorType dstCursor, - dimType& dstDim, - int noBlocks); - void cpyFromBlock (valueType* srcPointer, - int blockSize, - cursorType dstCursor, - dimType& dim, - int noBlocks); - void cpy2Block (cursorType srcCursor, - dimType& dim, - valueType* dstPointer, - int blockSize, - int noBlocks); - // point the matrix to the memory it should use - void setBuffer(valueType* buffer, int size); + // get a block of memory + valueType* getBlock(const cursorType& cursor, const dimType& dim, const int noElem, const int noTotalElem) const; + + // copy a subblock of the matrix + // note that the lower dimensions of both matrixes have to match + // it makes no sense to copy a block of information if it doesn't have the same + // meaning in the other matrix + void cpy2Matrix (cursorType srcCursor, + dimType& srcDim, + RectMatrix& dstMatrix, + cursorType dstCursor, + dimType& dstDim, + int noBlocks); + void cpyFromBlock (valueType* srcPointer, + int blockSize, + cursorType dstCursor, + dimType& dim, + int noBlocks); + void cpy2Block (cursorType srcCursor, + dimType& dim, + valueType* dstPointer, + int blockSize, + int noBlocks); + // point the matrix to the memory it should use + void setBuffer(valueType* buffer, int size); #ifdef ENABLE_DBGASSERT - // cursors are only made invalid when DBGASSERT is enabled - bool isCursorValid(const cursorType& cursor) const; + // cursors are only made invalid when DBGASSERT is enabled + bool isCursorValid(const cursorType& cursor) const; #endif - private: - bool areInSameDim(const cursorType& cur1, const cursorType& cur2, const dimType& dim) const; + private: + bool areInSameDim(const cursorType& cur1, const cursorType& cur2, const dimType& dim) const; - friend class DataHolder; + friend class DataHolder; - valueType* itsData; - map<string, dimType*> itsDimMap; - int itsTotalSize; -}; + valueType* itsData; + map<string, dimType*> itsDimMap; + int itsTotalSize; + }; #ifdef ENABLE_DBGASSERT -// Macro for defining a for-loop that walks through all the elements of 1 dimension -// for unoptimized code we can loop until the cursor is invalid + // Macro for defining a for-loop that walks through all the elements of 1 dimension + // for unoptimized code we can loop until the cursor is invalid #define MATRIX_FOR_LOOP(matrix, dim, cursor) \ for (; (matrix).isCursorValid(cursor); (matrix).moveCursor(&cursor, dim)) -// Macro for defining a for-loop that walks through 1 dimension from cursor to cursor + noElem + // Macro for defining a for-loop that walks through 1 dimension from cursor to cursor + noElem #define MATRIX_FOR_LOOP_PART(matrix, dim, cursor, noElem) \ int cursorMax = cursor + (dim).memsize * noElem;\ for (; (matrix).isCursorValid(cursor)&&(cursor < cursorMax); (matrix).moveCursor(&cursor, dim)) @@ -175,5 +174,8 @@ class RectMatrix { #include <CS1_Interface/RectMatrix.tcc> -} + } // namespace CS1 + +} // namespace LOFAR + #endif diff --git a/Appl/CEP/CS1/CS1_Interface/src/RectMatrix.tcc b/Appl/CEP/CS1/CS1_Interface/src/RectMatrix.tcc index 21802066001e4defd978cf30c9f76d926b501e45..48350a5faaf2f0ca09446b7c7ec41b8497d3d134 100644 --- a/Appl/CEP/CS1/CS1_Interface/src/RectMatrix.tcc +++ b/Appl/CEP/CS1/CS1_Interface/src/RectMatrix.tcc @@ -19,176 +19,177 @@ //# //# $Id$ +#ifndef LOFAR_CS1_INTERFACE_RECTMATRIX_TCC +#define LOFAR_CS1_INTERFACE_RECTMATRIX_TCC -#ifndef LOFAR_APPL_CEP_CS1_CS1_INTERFACE_RECT_MATRIX_TCC -#define LOFAR_APPL_CEP_CS1_CS1_INTERFACE_RECT_MATRIX_TCC - -#include<Common/LofarLogger.h> -#include<Common/lofar_vector.h> -#include<Common/lofar_map.h> -#include<Common/lofar_string.h> - -using LOFAR::string; -using LOFAR::vector; -using LOFAR::map; +#include <Common/LofarLogger.h> +#include <Common/lofar_vector.h> +#include <Common/lofar_map.h> +#include <Common/lofar_string.h> +namespace LOFAR +{ + namespace CS1 + { #if ENABLE_DBGASSERT -// this function can only be used in debug mode because -// cursor are not checked in optimized mode, so it can be invalid -template <typename valueType> -inline bool RectMatrix<valueType>::isCursorValid(const cursorType& cursor) const { - return (cursor >= 0); -} + // this function can only be used in debug mode because + // cursor are not checked in optimized mode, so it can be invalid + template <typename valueType> + inline bool RectMatrix<valueType>::isCursorValid(const cursorType& cursor) const { + return (cursor >= 0); + } #endif -template <typename valueType> -RectMatrix<valueType>::RectMatrix(vector<DimDef>& dimdefv) : - itsData(0) -{ - vector<DimDef>::reverse_iterator it = dimdefv.rbegin(); - int lastSize = 1; - for (; it<dimdefv.rend(); it++) { - itsDimMap[it->name] = new dimType(lastSize, it->size); - lastSize *= it->size; - } - itsTotalSize = lastSize; -} + template <typename valueType> + RectMatrix<valueType>::RectMatrix(vector<DimDef>& dimdefv) : + itsData(0) + { + vector<DimDef>::reverse_iterator it = dimdefv.rbegin(); + int lastSize = 1; + for (; it<dimdefv.rend(); it++) { + itsDimMap[it->name] = new dimType(lastSize, it->size); + lastSize *= it->size; + } + itsTotalSize = lastSize; + } -template <typename valueType> -inline dimType& RectMatrix<valueType>::getDim(string dimName) { - DBGASSERTSTR(itsDimMap.find(dimName) != itsDimMap.end(), "Cannot find dimension " << dimName << " in this RectMatrix"); - return *itsDimMap[dimName];}; + template <typename valueType> + inline dimType& RectMatrix<valueType>::getDim(string dimName) { + DBGASSERTSTR(itsDimMap.find(dimName) != itsDimMap.end(), "Cannot find dimension " << dimName << " in this RectMatrix"); + return *itsDimMap[dimName];}; -template <typename valueType> -inline int RectMatrix<valueType>::getNElemInDim(const dimType& dim) const { - return dim.noElem;}; + template <typename valueType> + inline int RectMatrix<valueType>::getNElemInDim(const dimType& dim) const { + return dim.noElem;}; -template <typename valueType> -inline typename RectMatrix<valueType>::cursorType RectMatrix<valueType>::getCursor(const int pos) const { - return pos; }; + template <typename valueType> + inline typename RectMatrix<valueType>::cursorType RectMatrix<valueType>::getCursor(const int pos) const { + return pos; }; -template <typename valueType> -inline valueType& RectMatrix<valueType>::getValue(const cursorType& cursor) const { - DBGASSERTSTR(isCursorValid(cursor), "Invalid cursor RectMatrix::getValue()"); - DBGASSERTSTR(cursor<itsTotalSize, "Index out of range in RectMatrix::getValue()"); - return itsData[cursor];}; + template <typename valueType> + inline valueType& RectMatrix<valueType>::getValue(const cursorType& cursor) const { + DBGASSERTSTR(isCursorValid(cursor), "Invalid cursor RectMatrix::getValue()"); + DBGASSERTSTR(cursor<itsTotalSize, "Index out of range in RectMatrix::getValue()"); + return itsData[cursor];}; -template <typename valueType> -inline void RectMatrix<valueType>::setValue(const cursorType& cursor, const valueType& value) { - DBGASSERTSTR(isCursorValid(cursor), "Invalid cursor RectMatrix::setValue()"); - DBGASSERTSTR(cursor<itsTotalSize, "Index out of range in RectMatrix::setValue()"); - itsData[cursor] = value; }; + template <typename valueType> + inline void RectMatrix<valueType>::setValue(const cursorType& cursor, const valueType& value) { + DBGASSERTSTR(isCursorValid(cursor), "Invalid cursor RectMatrix::setValue()"); + DBGASSERTSTR(cursor<itsTotalSize, "Index out of range in RectMatrix::setValue()"); + itsData[cursor] = value; }; -template <typename valueType> -inline void RectMatrix<valueType>::moveCursor(cursorType* cursorp, const dimType& dim) const { - DBGASSERTSTR(isCursorValid(*cursorp), "Invalid cursor RectMatrix::moveCursor()"); + template <typename valueType> + inline void RectMatrix<valueType>::moveCursor(cursorType* cursorp, const dimType& dim) const { + DBGASSERTSTR(isCursorValid(*cursorp), "Invalid cursor RectMatrix::moveCursor()"); #if ENABLE_DBGASSERT - if (!areInSameDim(*cursorp, (*cursorp)+dim.memSize, dim)) - { - *cursorp = -1; - } else { -#else - { + if (!areInSameDim(*cursorp, (*cursorp)+dim.memSize, dim)) + { + *cursorp = -1; + } else #endif - *cursorp += dim.memSize; - } -}; + { + *cursorp += dim.memSize; + } + }; -template <typename valueType> -inline void RectMatrix<valueType>::moveCursorN(cursorType* cursorp, const dimType& dim, const int& steps) const { - DBGASSERTSTR(isCursorValid(*cursorp), "Invalid cursor RectMatrix::moveCursorN()"); + template <typename valueType> + inline void RectMatrix<valueType>::moveCursorN(cursorType* cursorp, const dimType& dim, const int& steps) const { + DBGASSERTSTR(isCursorValid(*cursorp), "Invalid cursor RectMatrix::moveCursorN()"); #if ENABLE_DBGASSERT - if (!areInSameDim(*cursorp, (*cursorp) + dim.memSize * steps, dim)) - { - *cursorp = -1; - } else { -#else - { + if (!areInSameDim(*cursorp, (*cursorp) + dim.memSize * steps, dim)) + { + *cursorp = -1; + } else #endif - *cursorp += dim.memSize*steps; - } -}; - - -template <typename valueType> -inline valueType* RectMatrix<valueType>::getBlock(const cursorType& cursor, const dimType& dim, const int noElemOfDim, const int noTotalElem) const { - DBGASSERTSTR(isCursorValid(cursor), "Invalid cursor RectMatrix::getBlock()"); - DBGASSERTSTR(areInSameDim(cursor, cursor + dim.memSize * (noElemOfDim-1), dim), "Attempted to get block that crosses end of dimension"); - // this assert is only needed if we want to forbid getting pointers to higher dimension blocks - // DBGASSERTSTR(dim.memSize == sizeof(valueType), "Attempted to get block that is not of the lowest dimension"); - DBGASSERTSTR(dim.memSize * noElemOfDim == noTotalElem, "Attempted to get block but noTotalElem, noElemOfDim and dimension do not match"); - return &(itsData[cursor]); }; - - -template <typename valueType> -inline void RectMatrix<valueType>::cpy2Matrix (cursorType srcCursor, - dimType& srcDim, - RectMatrix& dstMatrix, - cursorType dstCursor, - dimType& dstDim, - int noBlocks) { - DBGASSERTSTR(isCursorValid(srcCursor), "Invalid srcCursor RectMatrix::cpy2Matrix()"); - DBGASSERTSTR(isCursorValid(dstCursor), "Invalid dstCursor RectMatrix::cpy2Matrix()"); - DBGASSERTSTR(srcDim.memSize == dstDim.memSize, "Dimension to be copied are not compatible"); - // This assert is not necessary anymore - // DBGASSERTSTR((dstCursor+noBlocks*dstDim.memSize)<=dstMatrix.itsTotalSize, "Index out of range in destination in RectMatrix::cpy2Matrix"); - // DBGASSERTSTR((srcCursor+noBlocks*srcDim.memSize)<=itsTotalSize, "Index out of range in source in RectMatrix::cpy2Matrix"); - DBGASSERTSTR(areInSameDim(dstCursor, dstCursor + dstDim.memSize * (noBlocks-1), dstDim), "Attempted to copy to matrix beyond end of dimension"); - DBGASSERTSTR(areInSameDim(srcCursor, srcCursor + srcDim.memSize * (noBlocks-1), srcDim), "Attempted to copy from matrix beyond end of dimension"); - memcpy(&(dstMatrix.itsData[dstCursor]), &(itsData[srcCursor]), noBlocks * srcDim.memSize * sizeof(valueType)); -}; - - -template <typename valueType> -inline void RectMatrix<valueType>::cpyFromBlock (valueType* srcPointer, - int blockSize, - cursorType dstCursor, - dimType& dstDim, - int noBlocks) { - DBGASSERTSTR(isCursorValid(dstCursor), "Invalid cursor RectMatrix::cpyFromBlock()"); - DBGASSERTSTR(blockSize == dstDim.memSize, "Dimension to be copied are not compatible"); - // DBGASSERTSTR((dstCursor+noBlocks*dstDim.memSize)<=itsTotalSize, "Index out of range in destination in RectMatrix::cpyFromBlock"); - DBGASSERTSTR(areInSameDim(dstCursor, dstCursor + dstDim.memSize * (noBlocks - 1), dstDim), "Attempted to copy to matrix beyond end of dimension"); - memcpy(&(itsData[dstCursor]), srcPointer, noBlocks * blockSize * sizeof(valueType)); -} - - -template <typename valueType> -inline void RectMatrix<valueType>::cpy2Block (cursorType srcCursor, - dimType& srcDim, - valueType* dstPointer, - int blockSize, - int noBlocks) { - DBGASSERTSTR(isCursorValid(srcCursor), "Invalid cursor RectMatrix::cpy2Block()"); - DBGASSERTSTR(srcDim.memSize == blockSize, "Dimension to be copied are not compatible"); - // DBGASSERTSTR((srcCursor+noBlocks*srcDim.memSize)<=itsTotalSize, "Index out of range in source in RectMatrix::cpy2Block"); - DBGASSERTSTR(areInSameDim(srcCursor, srcCursor + srcDim.memSize * (noBlocks - 1), srcDim), "Attempted to copy from matrix beyond end of dimension"); - memcpy((void*)dstPointer, &(itsData[srcCursor]), noBlocks * blockSize * sizeof(valueType)); -} - - -template <typename valueType> -inline void RectMatrix<valueType>::setBuffer(valueType* buffer, int size){ - DBGASSERTSTR(size == itsTotalSize, "cannot set buffer because of size mismatch"); - itsData = buffer; -}; - - -template <typename valueType> -inline bool RectMatrix<valueType>::areInSameDim(const cursorType& cur1, const cursorType& cur2, const dimType& dim) const { - DBGASSERTSTR(isCursorValid(cur1), "Invalid cursor RectMatrix::areInSameDim()"); - DBGASSERTSTR(isCursorValid(cur2), "Invalid cursor RectMatrix::areInSameDim()"); - // check if the cursors have the same position in this dimension - // dim.total is the size of this dimension - return ((cur1/dim.total) == (cur2/dim.total)); }; + { + *cursorp += dim.memSize*steps; + } + }; + + + template <typename valueType> + inline valueType* RectMatrix<valueType>::getBlock(const cursorType& cursor, const dimType& dim, const int noElemOfDim, const int noTotalElem) const { + DBGASSERTSTR(isCursorValid(cursor), "Invalid cursor RectMatrix::getBlock()"); + DBGASSERTSTR(areInSameDim(cursor, cursor + dim.memSize * (noElemOfDim-1), dim), "Attempted to get block that crosses end of dimension"); + // this assert is only needed if we want to forbid getting pointers to higher dimension blocks + // DBGASSERTSTR(dim.memSize == sizeof(valueType), "Attempted to get block that is not of the lowest dimension"); + DBGASSERTSTR(dim.memSize * noElemOfDim == noTotalElem, "Attempted to get block but noTotalElem, noElemOfDim and dimension do not match"); + return &(itsData[cursor]); }; + + + template <typename valueType> + inline void RectMatrix<valueType>::cpy2Matrix (cursorType srcCursor, + dimType& srcDim, + RectMatrix& dstMatrix, + cursorType dstCursor, + dimType& dstDim, + int noBlocks) { + DBGASSERTSTR(isCursorValid(srcCursor), "Invalid srcCursor RectMatrix::cpy2Matrix()"); + DBGASSERTSTR(isCursorValid(dstCursor), "Invalid dstCursor RectMatrix::cpy2Matrix()"); + DBGASSERTSTR(srcDim.memSize == dstDim.memSize, "Dimension to be copied are not compatible"); + // This assert is not necessary anymore + // DBGASSERTSTR((dstCursor+noBlocks*dstDim.memSize)<=dstMatrix.itsTotalSize, "Index out of range in destination in RectMatrix::cpy2Matrix"); + // DBGASSERTSTR((srcCursor+noBlocks*srcDim.memSize)<=itsTotalSize, "Index out of range in source in RectMatrix::cpy2Matrix"); + DBGASSERTSTR(areInSameDim(dstCursor, dstCursor + dstDim.memSize * (noBlocks-1), dstDim), "Attempted to copy to matrix beyond end of dimension"); + DBGASSERTSTR(areInSameDim(srcCursor, srcCursor + srcDim.memSize * (noBlocks-1), srcDim), "Attempted to copy from matrix beyond end of dimension"); + memcpy(&(dstMatrix.itsData[dstCursor]), &(itsData[srcCursor]), noBlocks * srcDim.memSize * sizeof(valueType)); + }; + + + template <typename valueType> + inline void RectMatrix<valueType>::cpyFromBlock (valueType* srcPointer, + int blockSize, + cursorType dstCursor, + dimType& dstDim, + int noBlocks) { + DBGASSERTSTR(isCursorValid(dstCursor), "Invalid cursor RectMatrix::cpyFromBlock()"); + DBGASSERTSTR(blockSize == dstDim.memSize, "Dimension to be copied are not compatible"); + // DBGASSERTSTR((dstCursor+noBlocks*dstDim.memSize)<=itsTotalSize, "Index out of range in destination in RectMatrix::cpyFromBlock"); + DBGASSERTSTR(areInSameDim(dstCursor, dstCursor + dstDim.memSize * (noBlocks - 1), dstDim), "Attempted to copy to matrix beyond end of dimension"); + memcpy(&(itsData[dstCursor]), srcPointer, noBlocks * blockSize * sizeof(valueType)); + } + + + template <typename valueType> + inline void RectMatrix<valueType>::cpy2Block (cursorType srcCursor, + dimType& srcDim, + valueType* dstPointer, + int blockSize, + int noBlocks) { + DBGASSERTSTR(isCursorValid(srcCursor), "Invalid cursor RectMatrix::cpy2Block()"); + DBGASSERTSTR(srcDim.memSize == blockSize, "Dimension to be copied are not compatible"); + // DBGASSERTSTR((srcCursor+noBlocks*srcDim.memSize)<=itsTotalSize, "Index out of range in source in RectMatrix::cpy2Block"); + DBGASSERTSTR(areInSameDim(srcCursor, srcCursor + srcDim.memSize * (noBlocks - 1), srcDim), "Attempted to copy from matrix beyond end of dimension"); + memcpy((void*)dstPointer, &(itsData[srcCursor]), noBlocks * blockSize * sizeof(valueType)); + } + + + template <typename valueType> + inline void RectMatrix<valueType>::setBuffer(valueType* buffer, int size){ + DBGASSERTSTR(size == itsTotalSize, "cannot set buffer because of size mismatch"); + itsData = buffer; + }; + + + template <typename valueType> + inline bool RectMatrix<valueType>::areInSameDim(const cursorType& cur1, const cursorType& cur2, const dimType& dim) const { + DBGASSERTSTR(isCursorValid(cur1), "Invalid cursor RectMatrix::areInSameDim()"); + DBGASSERTSTR(isCursorValid(cur2), "Invalid cursor RectMatrix::areInSameDim()"); + // check if the cursors have the same position in this dimension + // dim.total is the size of this dimension + return ((cur1/dim.total) == (cur2/dim.total)); }; + + } // namespace CS1 + +} // namespace LOFAR #endif diff --git a/Appl/CEP/CS1/CS1_Interface/src/Stub_BGL.cc b/Appl/CEP/CS1/CS1_Interface/src/Stub_BGL.cc index 2bb704a6dc3ab2cb8b482993e4300a072fc15936..a9685c1b8f35d4c83a7f7eabce226fdaaa9aa0cb 100644 --- a/Appl/CEP/CS1/CS1_Interface/src/Stub_BGL.cc +++ b/Appl/CEP/CS1/CS1_Interface/src/Stub_BGL.cc @@ -18,7 +18,6 @@ //# //# $Id$ - #include <lofar_config.h> #include <CS1_Interface/Stub_BGL.h> @@ -26,69 +25,72 @@ #include <Transport/Connection.h> -using namespace LOFAR; +namespace LOFAR +{ + namespace CS1 + { -namespace LOFAR { + unsigned Stub_BGL::itsNrSubbands, Stub_BGL::itsNrSlavesPerSubband; -unsigned Stub_BGL::itsNrSubbands, Stub_BGL::itsNrSlavesPerSubband; + Stub_BGL::Stub_BGL(bool iAmOnBGL, bool isInput, const ACC::APS::ParameterSet &pSet) + : itsIAmOnBGL(iAmOnBGL), + itsIsInput(isInput), + itsTHs(0), + itsConnections(0) + { + if (itsNrSubbands == 0) { // first time + itsNrSubbands = pSet.getInt32("Observation.NSubbands"); + itsNrSlavesPerSubband = pSet.getInt32("BGLProc.SlavesPerSubband"); + } -Stub_BGL::Stub_BGL(bool iAmOnBGL, bool isInput, const ACC::APS::ParameterSet &pSet) - : itsIAmOnBGL(iAmOnBGL), - itsIsInput(isInput), - itsTHs(0), - itsConnections(0) -{ - if (itsNrSubbands == 0) { // first time - itsNrSubbands = pSet.getInt32("Observation.NSubbands"); - itsNrSlavesPerSubband = pSet.getInt32("BGLProc.SlavesPerSubband"); - } + size_t size = itsNrSubbands * itsNrSlavesPerSubband; - size_t size = itsNrSubbands * itsNrSlavesPerSubband; + itsTHs = new TransportHolder * [size]; + memset(itsTHs, 0, sizeof(TransportHolder * [size])); - itsTHs = new TransportHolder * [size]; - memset(itsTHs, 0, sizeof(TransportHolder * [size])); + itsConnections = new Connection * [size]; + memset(itsConnections, 0, sizeof(TransportHolder * [size])); + } - itsConnections = new Connection * [size]; - memset(itsConnections, 0, sizeof(TransportHolder * [size])); -} + Stub_BGL::~Stub_BGL() + { + if (itsTHs != 0 && itsConnections != 0) { + for (uint i = 0; i < itsNrSubbands * itsNrSlavesPerSubband; i ++) { + delete itsTHs[i]; + delete itsConnections[i]; + } -Stub_BGL::~Stub_BGL() -{ - if (itsTHs != 0 && itsConnections != 0) { - for (uint i = 0; i < itsNrSubbands * itsNrSlavesPerSubband; i ++) { - delete itsTHs[i]; - delete itsConnections[i]; + delete [] itsTHs; + delete [] itsConnections; + } } - delete [] itsTHs; - delete [] itsConnections; - } -} + void Stub_BGL::connect(unsigned subband, unsigned slave, TinyDataManager &dm, + unsigned channel) + { + size_t index = subband * itsNrSlavesPerSubband + slave; -void Stub_BGL::connect(unsigned subband, unsigned slave, TinyDataManager &dm, - unsigned channel) -{ - size_t index = subband * itsNrSlavesPerSubband + slave; + ASSERTSTR(subband < itsNrSubbands, "subband argument out of bounds; " + << subband << " / " << itsNrSubbands); + ASSERTSTR(slave < itsNrSlavesPerSubband, "slave argument out of bounds; " + << slave << " / " << itsNrSlavesPerSubband); + ASSERTSTR(itsTHs[index] == 0, "already connected: subband = " + << subband << ", slave = " << slave << ", channel = " << channel); - ASSERTSTR(subband < itsNrSubbands, "subband argument out of bounds; " - << subband << " / " << itsNrSubbands); - ASSERTSTR(slave < itsNrSlavesPerSubband, "slave argument out of bounds; " - << slave << " / " << itsNrSlavesPerSubband); - ASSERTSTR(itsTHs[index] == 0, "already connected: subband = " - << subband << ", slave = " << slave << ", channel = " << channel); + itsTHs[index] = itsIAmOnBGL ? newClientTH(subband, slave) : newServerTH(subband, slave); - itsTHs[index] = itsIAmOnBGL ? newClientTH(subband, slave) : newServerTH(subband, slave); + if (itsIsInput) { + itsConnections[index] = new Connection("output", 0, dm.getGeneralInHolder(channel), itsTHs[index], false); + dm.setInConnection(channel, itsConnections[index]); + } else { + itsConnections[index] = new Connection("input", dm.getGeneralOutHolder(channel), 0, itsTHs[index], false); + dm.setOutConnection(channel, itsConnections[index]); + } + }; - if (itsIsInput) { - itsConnections[index] = new Connection("output", 0, dm.getGeneralInHolder(channel), itsTHs[index], false); - dm.setInConnection(channel, itsConnections[index]); - } else { - itsConnections[index] = new Connection("input", dm.getGeneralOutHolder(channel), 0, itsTHs[index], false); - dm.setOutConnection(channel, itsConnections[index]); - } -}; + } // namespace CS1 -} //namespace +} // namespace LOFAR diff --git a/Appl/CEP/CS1/CS1_Interface/src/Stub_BGL.h b/Appl/CEP/CS1/CS1_Interface/src/Stub_BGL.h index cc48df847a68880a0dab537a202eb27ce817a545..ea06b00bbaac5fedebfe3180dea921ec6771a21c 100644 --- a/Appl/CEP/CS1/CS1_Interface/src/Stub_BGL.h +++ b/Appl/CEP/CS1/CS1_Interface/src/Stub_BGL.h @@ -20,42 +20,46 @@ //# //# $Id$ -#ifndef LOFAR_APPL_CEP_CS1_CS1_INTERFACE_STUB_BGL_H -#define LOFAR_APPL_CEP_CS1_CS1_INTERFACE_STUB_BGL_H +#ifndef LOFAR_CS1_INTERFACE_STUB_BGL_H +#define LOFAR_CS1_INTERFACE_STUB_BGL_H #include <APS/ParameterSet.h> #include <tinyCEP/TinyDataManager.h> #include <Transport/Connection.h> #include <Transport/TransportHolder.h> +namespace LOFAR +{ + namespace CS1 + { -namespace LOFAR { + class Stub_BGL + { + // This is a base class that can be used to make connections from the BGL + // application to the outside world. Details are filled in by derived + // classes that must provide the necessary TransportHolders. -class Stub_BGL -{ - // This is a base class that can be used to make connections from the BGL - // application to the outside world. Details are filled in by derived - // classes that must provide the necessary TransportHolders. + public: + Stub_BGL(bool iAmOnBGL, bool isInput, const ACC::APS::ParameterSet &pSet); + virtual ~Stub_BGL(); -public: - Stub_BGL(bool iAmOnBGL, bool isInput, const ACC::APS::ParameterSet &pSet); - virtual ~Stub_BGL(); + void connect(unsigned subband, unsigned slave, TinyDataManager &dm, + unsigned channel); - void connect(unsigned subband, unsigned slave, TinyDataManager &dm, - unsigned channel); + protected: + virtual TransportHolder *newClientTH(unsigned subband, unsigned slave) = 0; + virtual TransportHolder *newServerTH(unsigned subband, unsigned slave) = 0; -protected: - virtual TransportHolder *newClientTH(unsigned subband, unsigned slave) = 0; - virtual TransportHolder *newServerTH(unsigned subband, unsigned slave) = 0; + bool itsIAmOnBGL, itsIsInput; + TransportHolder **itsTHs; + Connection **itsConnections; - bool itsIAmOnBGL, itsIsInput; - TransportHolder **itsTHs; - Connection **itsConnections; + static unsigned itsNrSubbands, itsNrSlavesPerSubband; + }; - static unsigned itsNrSubbands, itsNrSlavesPerSubband; -}; + } // namespace CS1 -} //namespace +} // namespace LOFAR -#endif //include guard +#endif diff --git a/Appl/CEP/CS1/CS1_Interface/src/Stub_BGL_RFI_Mitigation.cc b/Appl/CEP/CS1/CS1_Interface/src/Stub_BGL_RFI_Mitigation.cc index de9b0ac7cd25105b9a2941dbe39d1aeae6167081..f8a09eed6cdef0857a90ad6d0142e1e1d31655d4 100644 --- a/Appl/CEP/CS1/CS1_Interface/src/Stub_BGL_RFI_Mitigation.cc +++ b/Appl/CEP/CS1/CS1_Interface/src/Stub_BGL_RFI_Mitigation.cc @@ -18,7 +18,6 @@ //# //# $Id$ - #include <lofar_config.h> #include <CS1_Interface/Stub_BGL_RFI_Mitigation.h> @@ -26,19 +25,22 @@ #include <Transport/Connection.h> -using namespace LOFAR; +namespace LOFAR +{ + namespace CS1 + { -namespace LOFAR { + TransportHolder *Stub_BGL_RFI_Mitigation::newClientTH(unsigned, unsigned) + { + return new TH_Null(); + } -TransportHolder *Stub_BGL_RFI_Mitigation::newClientTH(unsigned, unsigned) -{ - return new TH_Null(); -} + TransportHolder *Stub_BGL_RFI_Mitigation::newServerTH(unsigned, unsigned) + { + return new TH_Null(); + } -TransportHolder *Stub_BGL_RFI_Mitigation::newServerTH(unsigned, unsigned) -{ - return new TH_Null(); -} + } // namespace CS1 -} //namespace +} // namespace LOFAR diff --git a/Appl/CEP/CS1/CS1_Interface/src/Stub_BGL_RFI_Mitigation.h b/Appl/CEP/CS1/CS1_Interface/src/Stub_BGL_RFI_Mitigation.h index 50c8e2dcad4c2d2ac6457ca8fc9752951ef67f53..dc1c457b08179bd85ac2c58bfe562a9ff198bf4c 100644 --- a/Appl/CEP/CS1/CS1_Interface/src/Stub_BGL_RFI_Mitigation.h +++ b/Appl/CEP/CS1/CS1_Interface/src/Stub_BGL_RFI_Mitigation.h @@ -20,25 +20,29 @@ //# //# $Id$ -#ifndef LOFAR_APPL_CEP_CS1_CS1_INTERFACE_STUB_BGL_RFI_MITIGATION_H -#define LOFAR_APPL_CEP_CS1_CS1_INTERFACE_STUB_BGL_RFI_MITIGATION_H +#ifndef LOFAR_CS1_INTERFACE_STUB_BGL_RFI_MITIGATION_H +#define LOFAR_CS1_INTERFACE_STUB_BGL_RFI_MITIGATION_H #include <CS1_Interface/Stub_BGL.h> -namespace LOFAR { - -class Stub_BGL_RFI_Mitigation : public Stub_BGL +namespace LOFAR { -public: - Stub_BGL_RFI_Mitigation(bool iAmOnBGL, const ACC::APS::ParameterSet &pSet) - : Stub_BGL(iAmOnBGL, iAmOnBGL, pSet) {} + namespace CS1 + { + + class Stub_BGL_RFI_Mitigation : public Stub_BGL + { + public: + Stub_BGL_RFI_Mitigation(bool iAmOnBGL, const ACC::APS::ParameterSet &pSet) + : Stub_BGL(iAmOnBGL, iAmOnBGL, pSet) {} -protected: - virtual TransportHolder *newClientTH(unsigned subband, unsigned slave); - virtual TransportHolder *newServerTH(unsigned subband, unsigned slave); -}; + protected: + virtual TransportHolder *newClientTH(unsigned subband, unsigned slave); + virtual TransportHolder *newServerTH(unsigned subband, unsigned slave); + }; -} //namespace + } //namespace CS1 -#endif //include guard +} //namespace LOFAR +#endif diff --git a/Appl/CEP/CS1/CS1_Interface/src/Stub_BGL_Subband.cc b/Appl/CEP/CS1/CS1_Interface/src/Stub_BGL_Subband.cc index da6f379d2ef00dc72619c70e9827e44c22267fb8..05b4d0618aa233f506fceba990b1dd63740d48ed 100644 --- a/Appl/CEP/CS1/CS1_Interface/src/Stub_BGL_Subband.cc +++ b/Appl/CEP/CS1/CS1_Interface/src/Stub_BGL_Subband.cc @@ -18,40 +18,41 @@ //# //# $Id$ - #include <lofar_config.h> #include <CS1_Interface/Stub_BGL_Subband.h> #include <Transport/TH_Socket.h> #include <Transport/Connection.h> -#include <iostream> -using namespace LOFAR; +namespace LOFAR +{ + namespace CS1 + { -namespace LOFAR { + Stub_BGL_Subband::Stub_BGL_Subband(bool iAmOnBGL, const ACC::APS::ParameterSet &pSet) + : Stub_BGL(iAmOnBGL, iAmOnBGL, pSet), + servers(pSet.getStringVector("Connections.Input_BGLProc.ServerHosts")), + services(pSet.getStringVector("Connections.Input_BGLProc.Ports")) + { + ASSERTSTR(itsNrSubbands <= servers.size(), + "Connections.Subband.ServerHosts does not contain enough hosts"); + ASSERTSTR(itsNrSlavesPerSubband <= services.size(), + "Connections.Subband.Ports does not contain enough ports"); + } -Stub_BGL_Subband::Stub_BGL_Subband(bool iAmOnBGL, const ACC::APS::ParameterSet &pSet) -: Stub_BGL(iAmOnBGL, iAmOnBGL, pSet), - servers(pSet.getStringVector("Connections.Input_BGLProc.ServerHosts")), - services(pSet.getStringVector("Connections.Input_BGLProc.Ports")) -{ - ASSERTSTR(itsNrSubbands <= servers.size(), - "Connections.Subband.ServerHosts does not contain enough hosts"); - ASSERTSTR(itsNrSlavesPerSubband <= services.size(), - "Connections.Subband.Ports does not contain enough ports"); -} + TransportHolder *Stub_BGL_Subband::newClientTH(unsigned subband, unsigned slave) + { + return new TH_Socket(servers[subband], services[slave], false, Socket::TCP, false); + } -TransportHolder *Stub_BGL_Subband::newClientTH(unsigned subband, unsigned slave) -{ - return new TH_Socket(servers[subband], services[slave], false, Socket::TCP, false); -} + TransportHolder *Stub_BGL_Subband::newServerTH(unsigned, unsigned slave) + { + return new TH_Socket(services[slave], false, Socket::TCP, 5, false); + } -TransportHolder *Stub_BGL_Subband::newServerTH(unsigned, unsigned slave) -{ - return new TH_Socket(services[slave], false, Socket::TCP, 5, false); -} + } //namespace CS1 -} //namespace +} //namespace LOFAR diff --git a/Appl/CEP/CS1/CS1_Interface/src/Stub_BGL_Subband.h b/Appl/CEP/CS1/CS1_Interface/src/Stub_BGL_Subband.h index 7e5fea56f4bc8cb6c349377c24471155d063ad1e..0355603f85ed11417fb13729435399eb3f9b1039 100644 --- a/Appl/CEP/CS1/CS1_Interface/src/Stub_BGL_Subband.h +++ b/Appl/CEP/CS1/CS1_Interface/src/Stub_BGL_Subband.h @@ -20,27 +20,32 @@ //# //# $Id$ -#ifndef LOFAR_APPL_CEP_CS1_CS1_INTERFACE_STUB_BGL_SUBBAND_H -#define LOFAR_APPL_CEP_CS1_CS1_INTERFACE_STUB_BGL_SUBBAND_H +#ifndef LOFAR_CS1_INTERFACE_STUB_BGL_SUBBAND_H +#define LOFAR_CS1_INTERFACE_STUB_BGL_SUBBAND_H #include <CS1_Interface/Stub_BGL.h> -namespace LOFAR { - -class Stub_BGL_Subband : public Stub_BGL +namespace LOFAR { -public: - Stub_BGL_Subband(bool iAmOnBGL, const ACC::APS::ParameterSet &); + namespace CS1 + { + + class Stub_BGL_Subband : public Stub_BGL + { + public: + Stub_BGL_Subband(bool iAmOnBGL, const ACC::APS::ParameterSet &); -protected: - virtual TransportHolder *newClientTH(unsigned subband, unsigned slave); - virtual TransportHolder *newServerTH(unsigned subband, unsigned slave); + protected: + virtual TransportHolder *newClientTH(unsigned subband, unsigned slave); + virtual TransportHolder *newServerTH(unsigned subband, unsigned slave); -private: - vector<string> servers, services; -}; + private: + vector<string> servers, services; + }; + + } // namespace CS1 -} //namespace +} // namespace LOFAR -#endif //include guard +#endif diff --git a/Appl/CEP/CS1/CS1_Interface/src/Stub_BGL_Visibilities.cc b/Appl/CEP/CS1/CS1_Interface/src/Stub_BGL_Visibilities.cc index 373f511a98593a56147d4f4f2056e87bc8a96d2d..920855be4fb3304e45f27cb3fb38ac5129028c5f 100644 --- a/Appl/CEP/CS1/CS1_Interface/src/Stub_BGL_Visibilities.cc +++ b/Appl/CEP/CS1/CS1_Interface/src/Stub_BGL_Visibilities.cc @@ -18,7 +18,6 @@ //# //# $Id$ - #include <lofar_config.h> #include <CS1_Interface/Stub_BGL_Visibilities.h> @@ -26,31 +25,34 @@ #include <Transport/Connection.h> -using namespace LOFAR; +namespace LOFAR +{ + namespace CS1 + { -namespace LOFAR { + Stub_BGL_Visibilities::Stub_BGL_Visibilities(bool iAmOnBGL, const ACC::APS::ParameterSet &pSet) + : Stub_BGL(iAmOnBGL, !iAmOnBGL, pSet), + servers(pSet.getStringVector("Connections.BGLProc_Storage.ServerHosts")), + services(pSet.getStringVector("Connections.BGLProc_Storage.Ports")) + { + ASSERTSTR(itsNrSubbands <= servers.size(), + "Connections.BGLProc_Storage.ServerHosts does not contain enough hosts"); + ASSERTSTR(itsNrSlavesPerSubband <= services.size(), + "Connections.BGLProc_Storage.Ports does not contain enough ports"); + } -Stub_BGL_Visibilities::Stub_BGL_Visibilities(bool iAmOnBGL, const ACC::APS::ParameterSet &pSet) -: Stub_BGL(iAmOnBGL, !iAmOnBGL, pSet), - servers(pSet.getStringVector("Connections.BGLProc_Storage.ServerHosts")), - services(pSet.getStringVector("Connections.BGLProc_Storage.Ports")) -{ - ASSERTSTR(itsNrSubbands <= servers.size(), - "Connections.BGLProc_Storage.ServerHosts does not contain enough hosts"); - ASSERTSTR(itsNrSlavesPerSubband <= services.size(), - "Connections.BGLProc_Storage.Ports does not contain enough ports"); -} + TransportHolder *Stub_BGL_Visibilities::newClientTH(unsigned subband, unsigned slave) + { + return new TH_Socket(servers[subband], services[slave], true, Socket::TCP, false); + } -TransportHolder *Stub_BGL_Visibilities::newClientTH(unsigned subband, unsigned slave) -{ - return new TH_Socket(servers[subband], services[slave], true, Socket::TCP, false); -} + TransportHolder *Stub_BGL_Visibilities::newServerTH(unsigned, unsigned slave) + { + return new TH_Socket(services[slave], true, Socket::TCP, 5, false); + } -TransportHolder *Stub_BGL_Visibilities::newServerTH(unsigned, unsigned slave) -{ - return new TH_Socket(services[slave], true, Socket::TCP, 5, false); -} + } //namespace CS1 -} //namespace +} //namespace LOFAR diff --git a/Appl/CEP/CS1/CS1_Interface/src/Stub_BGL_Visibilities.h b/Appl/CEP/CS1/CS1_Interface/src/Stub_BGL_Visibilities.h index ca92316e2b16b85014ec6ab551a9d5c3c237e454..90e95b5b8f46624e9454acd6eee38aa96e4c1a48 100644 --- a/Appl/CEP/CS1/CS1_Interface/src/Stub_BGL_Visibilities.h +++ b/Appl/CEP/CS1/CS1_Interface/src/Stub_BGL_Visibilities.h @@ -20,27 +20,32 @@ //# //# $Id$ -#ifndef LOFAR_APPL_CEP_CS1_CS1_INTERFACE_STUB_BGL_VISIBILITIES_H -#define LOFAR_APPL_CEP_CS1_CS1_INTERFACE_STUB_BGL_VISIBILITIES_H +#ifndef LOFAR_CS1_INTERFACE_STUB_BGL_VISIBILITIES_H +#define LOFAR_CS1_INTERFACE_STUB_BGL_VISIBILITIES_H #include <CS1_Interface/Stub_BGL.h> -namespace LOFAR { - -class Stub_BGL_Visibilities : public Stub_BGL +namespace LOFAR { -public: - Stub_BGL_Visibilities(bool iAmOnBGL, const ACC::APS::ParameterSet &); + namespace CS1 + { + + class Stub_BGL_Visibilities : public Stub_BGL + { + public: + Stub_BGL_Visibilities(bool iAmOnBGL, const ACC::APS::ParameterSet &); + + protected: + virtual TransportHolder *newClientTH(unsigned subband, unsigned slave); + virtual TransportHolder *newServerTH(unsigned subband, unsigned slave); -protected: - virtual TransportHolder *newClientTH(unsigned subband, unsigned slave); - virtual TransportHolder *newServerTH(unsigned subband, unsigned slave); + private: + vector<string> servers, services; + }; -private: - vector<string> servers, services; -}; + } //namespace CS1 -} //namespace +} //namespace LOFAR #endif //include guard diff --git a/Appl/CEP/CS1/CS1_Interface/src/Stub_Delay.cc b/Appl/CEP/CS1/CS1_Interface/src/Stub_Delay.cc index 451548c23e00505cff56029a5252698e2fa1a695..534f8eb6c10ca44f231d79a5673881add6aa087c 100644 --- a/Appl/CEP/CS1/CS1_Interface/src/Stub_Delay.cc +++ b/Appl/CEP/CS1/CS1_Interface/src/Stub_Delay.cc @@ -25,89 +25,94 @@ #include <Transport/Connection.h> #include <APS/ParameterSet.h> -namespace LOFAR { +namespace LOFAR +{ + namespace CS1 + { - INIT_TRACER_CONTEXT(Stub_Delay, LOFARLOGGER_PACKAGE); + INIT_TRACER_CONTEXT(Stub_Delay, LOFARLOGGER_PACKAGE); - Stub_Delay::Stub_Delay(bool isInput, const ACC::APS::ParameterSet &pSet) - : itsIsInput (isInput), - itsPS (pSet), - itsTHs (0), - itsConnections(0) - { - LOG_TRACE_FLOW(AUTO_FUNCTION_NAME); + Stub_Delay::Stub_Delay(bool isInput, const ACC::APS::ParameterSet &pSet) + : itsIsInput (isInput), + itsPS (pSet), + itsTHs (0), + itsConnections(0) + { + LOG_TRACE_FLOW(AUTO_FUNCTION_NAME); - itsNRSP = itsPS.getUint32("Input.NRSPBoards"); - LOG_TRACE_VAR_STR("Input.NRSPBoards = " << itsNRSP); + itsNRSP = itsPS.getUint32("Input.NRSPBoards"); + LOG_TRACE_VAR_STR("Input.NRSPBoards = " << itsNRSP); - itsPorts = itsPS.getUint16Vector("Connections.Input_Delay.Ports"); - ASSERTSTR(itsPorts.size() >= itsNRSP, - itsPorts.size() << " >= " << itsNRSP); + itsPorts = itsPS.getUint16Vector("Connections.Input_Delay.Ports"); + ASSERTSTR(itsPorts.size() >= itsNRSP, + itsPorts.size() << " >= " << itsNRSP); - itsTHs = new TH_Socket*[itsNRSP]; - itsConnections = new Connection*[itsNRSP]; + itsTHs = new TH_Socket*[itsNRSP]; + itsConnections = new Connection*[itsNRSP]; - for (uint i=0; i<itsNRSP; i++) { - itsTHs[i] = 0; - itsConnections[i] = 0; - } + for (uint i=0; i<itsNRSP; i++) { + itsTHs[i] = 0; + itsConnections[i] = 0; + } - } + } - Stub_Delay::~Stub_Delay() - { - LOG_TRACE_FLOW(AUTO_FUNCTION_NAME); - for (uint i=0; i<itsNRSP; i++) + Stub_Delay::~Stub_Delay() { - delete itsTHs[i]; - delete itsConnections[i]; + LOG_TRACE_FLOW(AUTO_FUNCTION_NAME); + for (uint i=0; i<itsNRSP; i++) + { + delete itsTHs[i]; + delete itsConnections[i]; + } + delete [] itsTHs; + delete [] itsConnections; } - delete [] itsTHs; - delete [] itsConnections; - } - void Stub_Delay::connect(uint RSP_nr, TinyDataManager &dm, uint dhNr) - { - LOG_TRACE_FLOW(AUTO_FUNCTION_NAME); - - ASSERTSTR(RSP_nr < itsNRSP, RSP_nr << " < " << itsNRSP); - string service = toString(itsPorts[RSP_nr]); - - if (itsIsInput) // on the input side, start client socket + void Stub_Delay::connect(uint RSP_nr, TinyDataManager &dm, uint dhNr) { - ASSERTSTR(itsTHs[RSP_nr] == 0, "Stub input " << RSP_nr << - " has already been connected."); - // Create a client socket - string server = itsPS.getString("Connections.Input_Delay.ServerHost"); + LOG_TRACE_FLOW(AUTO_FUNCTION_NAME); + + ASSERTSTR(RSP_nr < itsNRSP, RSP_nr << " < " << itsNRSP); string service = toString(itsPorts[RSP_nr]); - itsTHs[RSP_nr] = new TH_Socket(server, - service, - true, - Socket::TCP, - false); - itsConnections[RSP_nr] = new Connection("toDelayCompensation", 0, - dm.getGeneralInHolder(dhNr), - itsTHs[RSP_nr], true); - dm.setInConnection(dhNr, itsConnections[RSP_nr]); - } - else // on the delay compensation side, start a server socket - { - ASSERTSTR(itsTHs[RSP_nr] == 0, "Stub output " << RSP_nr << - " has already been connected."); - // Create a server socket - itsTHs[RSP_nr] = new TH_Socket(service, - true, - Socket::TCP, - 5, - false); - itsConnections[RSP_nr] = new Connection("fromInpSection", - dm.getGeneralOutHolder(dhNr), - 0, itsTHs[RSP_nr], true); - dm.setOutConnection(dhNr, itsConnections[RSP_nr]); + if (itsIsInput) // on the input side, start client socket + { + ASSERTSTR(itsTHs[RSP_nr] == 0, "Stub input " << RSP_nr << + " has already been connected."); + // Create a client socket + string server = itsPS.getString("Connections.Input_Delay.ServerHost"); + string service = toString(itsPorts[RSP_nr]); + itsTHs[RSP_nr] = new TH_Socket(server, + service, + true, + Socket::TCP, + false); + + itsConnections[RSP_nr] = new Connection("toDelayCompensation", 0, + dm.getGeneralInHolder(dhNr), + itsTHs[RSP_nr], true); + dm.setInConnection(dhNr, itsConnections[RSP_nr]); + } + else // on the delay compensation side, start a server socket + { + ASSERTSTR(itsTHs[RSP_nr] == 0, "Stub output " << RSP_nr << + " has already been connected."); + // Create a server socket + itsTHs[RSP_nr] = new TH_Socket(service, + true, + Socket::TCP, + 5, + false); + itsConnections[RSP_nr] = new Connection("fromInpSection", + dm.getGeneralOutHolder(dhNr), + 0, itsTHs[RSP_nr], true); + dm.setOutConnection(dhNr, itsConnections[RSP_nr]); + } } - } -} //namespace + } // namespace CS1 + +} //namespace LOFAR diff --git a/Appl/CEP/CS1/CS1_Interface/src/Stub_Delay.h b/Appl/CEP/CS1/CS1_Interface/src/Stub_Delay.h index e5a5e9919c2906ab80b45c005ae357dcded51b63..7583f18584e88d684c2589136749836796bcd235 100644 --- a/Appl/CEP/CS1/CS1_Interface/src/Stub_Delay.h +++ b/Appl/CEP/CS1/CS1_Interface/src/Stub_Delay.h @@ -20,39 +20,48 @@ //# //# $Id$ -#ifndef LOFAR_APPL_CEP_CS1_CS1_INTERFACE_STUB_DELAY_H -#define LOFAR_APPL_CEP_CS1_CS1_INTERFACE_STUB_DELAY_H +#ifndef LOFAR_CS1_INTERFACE_STUB_DELAY_H +#define LOFAR_CS1_INTERFACE_STUB_DELAY_H #include <APS/ParameterSet.h> #include <tinyCEP/TinyDataManager.h> #include <Common/lofar_vector.h> -namespace LOFAR { +namespace LOFAR +{ -class TH_Socket; -class Connection; + class TH_Socket; + class Connection; -class Stub_Delay -{ -public: - // Create the stub. Get its parameters from the given file name. - explicit Stub_Delay(bool isInput, const ACC::APS::ParameterSet &pSet); + namespace CS1 + { + + class Stub_Delay + { + public: + // Create the stub. Get its parameters from the given file name. + explicit Stub_Delay(bool isInput, const ACC::APS::ParameterSet &pSet); + + ~Stub_Delay(); - ~Stub_Delay(); + // Connect the given objects to the stubs. + void connect(uint RSP_nr, TinyDataManager &dm, uint dhNr); - // Connect the given objects to the stubs. - void connect(uint RSP_nr, TinyDataManager &dm, uint dhNr); + private: + // Is this stub an input for a step + bool itsIsInput; + const ACC::APS::ParameterSet &itsPS; + // total number of RSPinputs + uint itsNRSP; + // ports used to connect to RSPs + vector<uint16> itsPorts; + TH_Socket **itsTHs; + Connection **itsConnections; + ALLOC_TRACER_CONTEXT; + }; -private: - bool itsIsInput; // Is this stub an input for a step - const ACC::APS::ParameterSet &itsPS; - uint itsNRSP; // total number of RSPinputs - vector<uint16> itsPorts; // ports used to connect to RSPs - TH_Socket **itsTHs; - Connection **itsConnections; - ALLOC_TRACER_CONTEXT; -}; + } // namespace CS1 -} //namespace +} // namespace LOFAR -#endif // include guard +#endif diff --git a/Appl/CEP/CS1/CS1_Interface/src/Stub_RSP.cc b/Appl/CEP/CS1/CS1_Interface/src/Stub_RSP.cc index 857b8a5730b7807294b102caadd11d32eadabdb8..4c3960ba931942a2bd51a6f84bbb5d8fc348c02c 100644 --- a/Appl/CEP/CS1/CS1_Interface/src/Stub_RSP.cc +++ b/Appl/CEP/CS1/CS1_Interface/src/Stub_RSP.cc @@ -18,36 +18,36 @@ //# //# $Id$ - #include <lofar_config.h> #include <CS1_Interface/Stub_RSP.h> #include <Transport/TH_Socket.h> - -using namespace LOFAR; -using namespace LOFAR::ACC::APS; - -namespace LOFAR { - - Stub_RSP::Stub_RSP (bool stubOnServer, const ACC::APS::ParameterSet& ps) - : itsStubOnServer (stubOnServer), - itsPS(ps) +namespace LOFAR +{ + namespace CS1 { - // todo: add DH_?? for pre-correlation correction factors - // for (int i=0; i<itsNSBF; i++) { + Stub_RSP::Stub_RSP (bool stubOnServer, const ACC::APS::ParameterSet& ps) + : itsStubOnServer (stubOnServer), + itsPS(ps) + { + // todo: add DH_?? for pre-correlation correction factors + // for (int i=0; i<itsNSBF; i++) { // itsSB.push_back(new DH_SubBand("noname",1)); //todo: get correct SubbandID - // } - } + // } + } - Stub_RSP::~Stub_RSP() - {} + Stub_RSP::~Stub_RSP() + {} - void Stub_RSP::connect () - { - }; + void Stub_RSP::connect () + { + }; + + //todo: add connections for pre-correlation correction DH_?? + + } // namespace CS1 - //todo: add connections for pre-correlation correction DH_?? +} // namespace LOFAR -} //namespace diff --git a/Appl/CEP/CS1/CS1_Interface/src/Stub_RSP.h b/Appl/CEP/CS1/CS1_Interface/src/Stub_RSP.h index 271bbeb69004badfc891944aecdeb5d6fad367a2..f38b3d0421c6262695fc63dd02dab1c64fd5f07e 100644 --- a/Appl/CEP/CS1/CS1_Interface/src/Stub_RSP.h +++ b/Appl/CEP/CS1/CS1_Interface/src/Stub_RSP.h @@ -20,32 +20,35 @@ //# //# $Id$ -#ifndef LOFAR_APPL_CEP_CS1_CS1_INTERFACE_STUB_RSP_H -#define LOFAR_APPL_CEP_CS1_CS1_INTERFACE_STUB_RSP_H +#ifndef LOFAR_CS1_INTERFACE_STUB_RSP_H +#define LOFAR_CS1_INTERFACE_STUB_RSP_H -#include <string> #include <APS/ParameterSet.h> +namespace LOFAR +{ + namespace CS1 + { -namespace LOFAR { + class Stub_RSP + { + public: + // Create the stub. Get its parameters from the given file name. + explicit Stub_RSP (bool onServer, const ACC::APS::ParameterSet &ps); -class Stub_RSP -{ -public: - // Create the stub. Get its parameters from the given file name. - explicit Stub_RSP (bool onServer, const ACC::APS::ParameterSet &ps); + ~Stub_RSP(); - ~Stub_RSP(); + // Connect the given objects to the stubs. + void connect (); - // Connect the given objects to the stubs. - void connect (); + private: + bool itsStubOnServer; + const ACC::APS::ParameterSet &itsPS; + }; -private: - bool itsStubOnServer; - const ACC::APS::ParameterSet &itsPS; -}; + } // namespace CS1 -} //namespace +} // namespace LOFAR -#endif //include guard +#endif diff --git a/Appl/CEP/CS1/CS1_Interface/src/bitset.cc b/Appl/CEP/CS1/CS1_Interface/src/bitset.cc index c52746641aa3690a6aa669eea4c588663c220621..a134d37f30217ff6a48b15bb16c12af34d831907 100644 --- a/Appl/CEP/CS1/CS1_Interface/src/bitset.cc +++ b/Appl/CEP/CS1/CS1_Interface/src/bitset.cc @@ -25,41 +25,46 @@ namespace LOFAR { - const unsigned char _S_bit_count[256] = { - 0, 1, 1, 2, 1, 2, 2, 3, 1, 2, 2, 3, 2, 3, 3, 4, - 1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5, - 1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5, - 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, - 1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5, - 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, - 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, - 3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7, - 1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5, - 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, - 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, - 3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7, - 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, - 3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7, - 3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7, - 4, 5, 5, 6, 5, 6, 6, 7, 5, 6, 6, 7, 6, 7, 7, 8, - }; + namespace CS1 + { + const unsigned char _S_bit_count[256] = { + 0, 1, 1, 2, 1, 2, 2, 3, 1, 2, 2, 3, 2, 3, 3, 4, + 1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5, + 1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5, + 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, + 1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5, + 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, + 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, + 3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7, + 1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5, + 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, + 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, + 3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7, + 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, + 3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7, + 3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7, + 4, 5, 5, 6, 5, 6, 6, 7, 5, 6, 6, 7, 6, 7, 7, 8, + }; - const unsigned char _S_first_one[256] = { - 0, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, - 4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, - 5, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, - 4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, - 6, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, - 4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, - 5, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, - 4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, - 7, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, - 4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, - 5, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, - 4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, - 6, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, - 4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, - 5, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, - 4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, - }; -} + const unsigned char _S_first_one[256] = { + 0, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, + 4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, + 5, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, + 4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, + 6, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, + 4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, + 5, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, + 4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, + 7, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, + 4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, + 5, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, + 4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, + 6, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, + 4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, + 5, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, + 4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, + }; + + } // namespace CS1 + +} // namespace LOFAR diff --git a/Appl/CEP/CS1/CS1_Interface/src/bitset.h b/Appl/CEP/CS1/CS1_Interface/src/bitset.h index 8b3f8d734e5e0a5acc99026f44f6fb7e086da8db..20de3bb270ff1ee1ef9e1e423fa70b214cad8021 100644 --- a/Appl/CEP/CS1/CS1_Interface/src/bitset.h +++ b/Appl/CEP/CS1/CS1_Interface/src/bitset.h @@ -102,19 +102,21 @@ namespace LOFAR { - using namespace std; - - extern const unsigned char _S_bit_count[256]; - extern const unsigned char _S_first_one[256]; - /** - * @if maint - * Base class, general case. It is a class inveriant that _Nw will be - * nonnegative. - * - * See documentation for bitset. - * @endif - */ - template<size_t _Nw> + namespace CS1 + { + using namespace std; + + extern const unsigned char _S_bit_count[256]; + extern const unsigned char _S_first_one[256]; + /** + * @if maint + * Base class, general case. It is a class inveriant that _Nw will be + * nonnegative. + * + * See documentation for bitset. + * @endif + */ + template<size_t _Nw> struct _Base_bitset { typedef uint32 _WordT; @@ -207,10 +209,10 @@ namespace LOFAR _M_is_equal(const _Base_bitset<_Nw>& __x) const { for (size_t __i = 0; __i < _Nw; ++__i) - { - if (_M_w[__i] != __x._M_w[__i]) - return false; - } + { + if (_M_w[__i] != __x._M_w[__i]) + return false; + } return true; } @@ -218,10 +220,10 @@ namespace LOFAR _M_is_any() const { for (size_t __i = 0; __i < _Nw; __i++) - { - if (_M_w[__i] != static_cast<_WordT>(0)) - return true; - } + { + if (_M_w[__i] != static_cast<_WordT>(0)) + return true; + } return false; } @@ -233,10 +235,10 @@ namespace LOFAR const unsigned char* __end_ptr = (const unsigned char*)(_M_w + _Nw); while ( __byte_ptr < __end_ptr ) - { - __result += _S_bit_count[*__byte_ptr]; - __byte_ptr++; - } + { + __result += _S_bit_count[*__byte_ptr]; + __byte_ptr++; + } return __result; } @@ -252,59 +254,59 @@ namespace LOFAR _M_do_find_next(size_t __prev, size_t __not_found) const; }; - // Definitions of non-inline functions from _Base_bitset. - template<size_t _Nw> + // Definitions of non-inline functions from _Base_bitset. + template<size_t _Nw> void _Base_bitset<_Nw>::_M_do_left_shift(size_t __shift) { if (__builtin_expect(__shift != 0, 1)) - { - const size_t __wshift = __shift / _LOFAR_BITSET_BITS_PER_WORD; - const size_t __offset = __shift % _LOFAR_BITSET_BITS_PER_WORD; - - if (__offset == 0) - for (size_t __n = _Nw - 1; __n >= __wshift; --__n) - _M_w[__n] = _M_w[__n - __wshift]; - else - { - const size_t __sub_offset = _LOFAR_BITSET_BITS_PER_WORD - __offset; - for (size_t __n = _Nw - 1; __n > __wshift; --__n) - _M_w[__n] = (_M_w[__n - __wshift] << __offset) | - (_M_w[__n - __wshift - 1] >> __sub_offset); - _M_w[__wshift] = _M_w[0] << __offset; - } - - fill(_M_w + 0, _M_w + __wshift, static_cast<_WordT>(0)); - } + { + const size_t __wshift = __shift / _LOFAR_BITSET_BITS_PER_WORD; + const size_t __offset = __shift % _LOFAR_BITSET_BITS_PER_WORD; + + if (__offset == 0) + for (size_t __n = _Nw - 1; __n >= __wshift; --__n) + _M_w[__n] = _M_w[__n - __wshift]; + else + { + const size_t __sub_offset = _LOFAR_BITSET_BITS_PER_WORD - __offset; + for (size_t __n = _Nw - 1; __n > __wshift; --__n) + _M_w[__n] = (_M_w[__n - __wshift] << __offset) | + (_M_w[__n - __wshift - 1] >> __sub_offset); + _M_w[__wshift] = _M_w[0] << __offset; + } + + fill(_M_w + 0, _M_w + __wshift, static_cast<_WordT>(0)); + } } - template<size_t _Nw> + template<size_t _Nw> void _Base_bitset<_Nw>::_M_do_right_shift(size_t __shift) { if (__builtin_expect(__shift != 0, 1)) - { - const size_t __wshift = __shift / _LOFAR_BITSET_BITS_PER_WORD; - const size_t __offset = __shift % _LOFAR_BITSET_BITS_PER_WORD; - const size_t __limit = _Nw - __wshift - 1; - - if (__offset == 0) - for (size_t __n = 0; __n <= __limit; ++__n) - _M_w[__n] = _M_w[__n + __wshift]; - else - { - const size_t __sub_offset = _LOFAR_BITSET_BITS_PER_WORD - __offset; - for (size_t __n = 0; __n < __limit; ++__n) - _M_w[__n] = (_M_w[__n + __wshift] >> __offset) | - (_M_w[__n + __wshift + 1] << __sub_offset); - _M_w[__limit] = _M_w[_Nw-1] >> __offset; - } - - fill(_M_w + __limit + 1, _M_w + _Nw, static_cast<_WordT>(0)); - } + { + const size_t __wshift = __shift / _LOFAR_BITSET_BITS_PER_WORD; + const size_t __offset = __shift % _LOFAR_BITSET_BITS_PER_WORD; + const size_t __limit = _Nw - __wshift - 1; + + if (__offset == 0) + for (size_t __n = 0; __n <= __limit; ++__n) + _M_w[__n] = _M_w[__n + __wshift]; + else + { + const size_t __sub_offset = _LOFAR_BITSET_BITS_PER_WORD - __offset; + for (size_t __n = 0; __n < __limit; ++__n) + _M_w[__n] = (_M_w[__n + __wshift] >> __offset) | + (_M_w[__n + __wshift + 1] << __sub_offset); + _M_w[__limit] = _M_w[_Nw-1] >> __offset; + } + + fill(_M_w + __limit + 1, _M_w + _Nw, static_cast<_WordT>(0)); + } } - template<size_t _Nw> + template<size_t _Nw> uint32 _Base_bitset<_Nw>::_M_do_to_uint32() const { @@ -314,33 +316,33 @@ namespace LOFAR return _M_w[0]; } - template<size_t _Nw> + template<size_t _Nw> size_t _Base_bitset<_Nw>::_M_do_find_first(size_t __not_found) const { for (size_t __i = 0; __i < _Nw; __i++ ) - { - _WordT __thisword = _M_w[__i]; - if ( __thisword != static_cast<_WordT>(0) ) - { - // find byte within word - for (size_t __j = 0; __j < sizeof(_WordT); __j++ ) - { - unsigned char __this_byte - = static_cast<unsigned char>(__thisword & (~(unsigned char)0)); - if (__this_byte) - return __i*_LOFAR_BITSET_BITS_PER_WORD + __j*CHAR_BIT + - _S_first_one[__this_byte]; - - __thisword >>= CHAR_BIT; - } - } - } + { + _WordT __thisword = _M_w[__i]; + if ( __thisword != static_cast<_WordT>(0) ) + { + // find byte within word + for (size_t __j = 0; __j < sizeof(_WordT); __j++ ) + { + unsigned char __this_byte + = static_cast<unsigned char>(__thisword & (~(unsigned char)0)); + if (__this_byte) + return __i*_LOFAR_BITSET_BITS_PER_WORD + __j*CHAR_BIT + + _S_first_one[__this_byte]; + + __thisword >>= CHAR_BIT; + } + } + } // not found, so return an indication of failure. return __not_found; } - template<size_t _Nw> + template<size_t _Nw> size_t _Base_bitset<_Nw>::_M_do_find_next(size_t __prev, size_t __not_found) const { @@ -359,55 +361,55 @@ namespace LOFAR __thisword &= (~static_cast<_WordT>(0)) << _S_whichbit(__prev); if ( __thisword != static_cast<_WordT>(0) ) - { - // find byte within word - // get first byte into place - __thisword >>= _S_whichbyte(__prev) * CHAR_BIT; - for (size_t __j = _S_whichbyte(__prev); __j < sizeof(_WordT); __j++) - { - unsigned char __this_byte - = static_cast<unsigned char>(__thisword & (~(unsigned char)0)); - if ( __this_byte ) - return __i*_LOFAR_BITSET_BITS_PER_WORD + __j*CHAR_BIT + - _S_first_one[__this_byte]; - - __thisword >>= CHAR_BIT; - } - } + { + // find byte within word + // get first byte into place + __thisword >>= _S_whichbyte(__prev) * CHAR_BIT; + for (size_t __j = _S_whichbyte(__prev); __j < sizeof(_WordT); __j++) + { + unsigned char __this_byte + = static_cast<unsigned char>(__thisword & (~(unsigned char)0)); + if ( __this_byte ) + return __i*_LOFAR_BITSET_BITS_PER_WORD + __j*CHAR_BIT + + _S_first_one[__this_byte]; + + __thisword >>= CHAR_BIT; + } + } // check subsequent words __i++; for ( ; __i < _Nw; __i++ ) - { - __thisword = _M_w[__i]; - if ( __thisword != static_cast<_WordT>(0) ) - { - // find byte within word - for (size_t __j = 0; __j < sizeof(_WordT); __j++ ) - { - unsigned char __this_byte - = static_cast<unsigned char>(__thisword & (~(unsigned char)0)); - if ( __this_byte ) - return __i*_LOFAR_BITSET_BITS_PER_WORD + __j*CHAR_BIT + - _S_first_one[__this_byte]; - - __thisword >>= CHAR_BIT; - } - } - } + { + __thisword = _M_w[__i]; + if ( __thisword != static_cast<_WordT>(0) ) + { + // find byte within word + for (size_t __j = 0; __j < sizeof(_WordT); __j++ ) + { + unsigned char __this_byte + = static_cast<unsigned char>(__thisword & (~(unsigned char)0)); + if ( __this_byte ) + return __i*_LOFAR_BITSET_BITS_PER_WORD + __j*CHAR_BIT + + _S_first_one[__this_byte]; + + __thisword >>= CHAR_BIT; + } + } + } // not found, so return an indication of failure. return __not_found; } // end _M_do_find_next - /** - * @if maint - * Base class, specialization for a single word. - * - * See documentation for bitset. - * @endif - */ - template<> + /** + * @if maint + * Base class, specialization for a single word. + * + * See documentation for bitset. + * @endif + */ + template<> struct _Base_bitset<1> { typedef uint32 _WordT; @@ -483,10 +485,10 @@ namespace LOFAR const unsigned char* __end_ptr = ((const unsigned char*)&_M_w)+sizeof(_M_w); while ( __byte_ptr < __end_ptr ) - { - __result += _S_bit_count[*__byte_ptr]; - __byte_ptr++; - } + { + __result += _S_bit_count[*__byte_ptr]; + __byte_ptr++; + } return __result; } @@ -502,14 +504,14 @@ namespace LOFAR }; - /** - * @if maint - * Base class, specialization for no storage (zero-length %bitset). - * - * See documentation for bitset. - * @endif - */ - template<> + /** + * @if maint + * Base class, specialization for no storage (zero-length %bitset). + * + * See documentation for bitset. + * @endif + */ + template<> struct _Base_bitset<0> { typedef uint32 _WordT; @@ -596,553 +598,553 @@ namespace LOFAR }; - // Helper class to zero out the unused high-order bits in the highest word. - template<size_t _Extrabits> + // Helper class to zero out the unused high-order bits in the highest word. + template<size_t _Extrabits> struct _Sanitize { static void _S_do_sanitize(uint32& __val) { __val &= ~((~static_cast<uint32>(0)) << _Extrabits); } }; - template<> + template<> struct _Sanitize<0> { static void _S_do_sanitize(uint32) { } }; - /** - * @brief The %bitset class represents a @e fixed-size sequence of bits. - * - * @ingroup Containers - * - * (Note that %bitset does @e not meet the formal requirements of a - * <a href="tables.html#65">container</a>. Mainly, it lacks iterators.) - * - * The template argument, @a Nb, may be any non-negative number, - * specifying the number of bits (e.g., "0", "12", "1024*1024"). - * - * In the general unoptimized case, storage is allocated in word-sized - * blocks. Let B be the number of bits in a word, then (Nb+(B-1))/B - * words will be used for storage. B - Nb%B bits are unused. (They are - * the high-order bits in the highest word.) It is a class invariant - * that those unused bits are always zero. - * - * If you think of %bitset as "a simple array of bits," be aware that - * your mental picture is reversed: a %bitset behaves the same way as - * bits in integers do, with the bit at index 0 in the "least significant - * / right-hand" position, and the bit at index Nb-1 in the "most - * significant / left-hand" position. Thus, unlike other containers, a - * %bitset's index "counts from right to left," to put it very loosely. - * - * This behavior is preserved when translating to and from strings. For - * example, the first line of the following program probably prints - * "b('a') is 0001100001" on a modern ASCII system. - * - * @code - * #include <bitset> - * #include <iostream> - * #include <sstream> - * - * using namespace std; - * - * int main() - * { - * uint32 a = 'a'; - * bitset<10> b(a); - * - * cout << "b('a') is " << b << endl; - * - * ostringstream s; - * s << b; - * string str = s.str(); - * cout << "index 3 in the string is " << str[3] << " but\n" - * << "index 3 in the bitset is " << b[3] << endl; - * } - * @endcode - * - * Also see http://gcc.gnu.org/onlinedocs/libstdc++/ext/sgiexts.html#ch23 - * for a description of extensions. - * - * @if maint - * Most of the actual code isn't contained in %bitset<> itself, but in the - * base class _Base_bitset. The base class works with whole words, not with - * individual bits. This allows us to specialize _Base_bitset for the - * important special case where the %bitset is only a single word. - * - * Extra confusion can result due to the fact that the storage for - * _Base_bitset @e is a regular array, and is indexed as such. This is - * carefully encapsulated. - * @endif - */ - template<size_t _Nb> - class bitset : private _Base_bitset<_LOFAR_BITSET_WORDS(_Nb)> - { - private: - typedef _Base_bitset<_LOFAR_BITSET_WORDS(_Nb)> _Base; - typedef uint32 _WordT; - - void - _M_do_sanitize() - { - _Sanitize<_Nb%_LOFAR_BITSET_BITS_PER_WORD>:: - _S_do_sanitize(this->_M_hiword()); - } - - public: /** - * This encapsulates the concept of a single bit. An instance of this - * class is a proxy for an actual bit; this way the individual bit - * operations are done as faster word-size bitwise instructions. + * @brief The %bitset class represents a @e fixed-size sequence of bits. * - * Most users will never need to use this class directly; conversions - * to and from bool are automatic and should be transparent. Overloaded - * operators help to preserve the illusion. + * @ingroup Containers * - * (On a typical system, this "bit %reference" is 64 times the size of - * an actual bit. Ha.) - */ - class reference - { - friend class bitset; - - _WordT *_M_wp; - size_t _M_bpos; - - // left undefined - reference(); - - public: - reference(bitset& __b, size_t __pos) - { - _M_wp = &__b._M_getword(__pos); - _M_bpos = _Base::_S_whichbit(__pos); - } - - ~reference() { } - - // for b[i] = __x; - reference& - operator=(bool __x) - { - if ( __x ) - *_M_wp |= _Base::_S_maskbit(_M_bpos); - else - *_M_wp &= ~_Base::_S_maskbit(_M_bpos); - return *this; - } - - // for b[i] = b[__j]; - reference& - operator=(const reference& __j) - { - if ( (*(__j._M_wp) & _Base::_S_maskbit(__j._M_bpos)) ) - *_M_wp |= _Base::_S_maskbit(_M_bpos); - else - *_M_wp &= ~_Base::_S_maskbit(_M_bpos); - return *this; - } - - // flips the bit - bool - operator~() const - { return (*(_M_wp) & _Base::_S_maskbit(_M_bpos)) == 0; } - - // for __x = b[i]; - operator bool() const - { return (*(_M_wp) & _Base::_S_maskbit(_M_bpos)) != 0; } - - // for b[i].flip(); - reference& - flip() - { - *_M_wp ^= _Base::_S_maskbit(_M_bpos); - return *this; - } - }; - friend class reference; - - // 23.3.5.1 constructors: - /// All bits set to zero. - bitset() { } - - /// Initial bits bitwise-copied from a single word (others set to zero). - bitset(uint32 __val) : _Base(__val) - { _M_do_sanitize(); } - - /** - * @brief Use a subset of a string. - * @param s A string of '0' and '1' characters. - * @param pos Index of the first character in @a s to use; defaults - * to zero. - * @throw std::out_of_range If @a pos is bigger the size of @a s. - * @throw std::invalid_argument If a character appears in the string - * which is neither '0' nor '1'. - */ - template<class _CharT, class _Traits, class _Alloc> - explicit bitset(const basic_string<_CharT, _Traits, _Alloc>& __s, - size_t __pos = 0) : _Base() - { - if (__pos > __s.size()) - __throw_out_of_range("bitset -- initial position is larger than " - "the string itself"); - _M_copy_from_string(__s, __pos, - basic_string<_CharT, _Traits, _Alloc>::npos); - } - - /** - * @brief Use a subset of a string. - * @param s A string of '0' and '1' characters. - * @param pos Index of the first character in @a s to use. - * @param n The number of characters to copy. - * @throw std::out_of_range If @a pos is bigger the size of @a s. - * @throw std::invalid_argument If a character appears in the string - * which is neither '0' nor '1'. - */ - template<class _CharT, class _Traits, class _Alloc> - bitset(const basic_string<_CharT, _Traits, _Alloc>& __s, - size_t __pos, size_t __n) : _Base() - { - if (__pos > __s.size()) - __throw_out_of_range("bitset -- initial position is larger than " - "the string itself"); - _M_copy_from_string(__s, __pos, __n); - } - - // 23.3.5.2 bitset operations: - //@{ - /** - * @brief Operations on bitsets. - * @param rhs A same-sized bitset. + * (Note that %bitset does @e not meet the formal requirements of a + * <a href="tables.html#65">container</a>. Mainly, it lacks iterators.) * - * These should be self-explanatory. - */ - bitset<_Nb>& - operator&=(const bitset<_Nb>& __rhs) - { - this->_M_do_and(__rhs); - return *this; - } - - bitset<_Nb>& - operator|=(const bitset<_Nb>& __rhs) - { - this->_M_do_or(__rhs); - return *this; - } - - bitset<_Nb>& - operator^=(const bitset<_Nb>& __rhs) - { - this->_M_do_xor(__rhs); - return *this; - } - //@} - - //@{ - /** - * @brief Operations on bitsets. - * @param pos The number of places to shift. - * - * These should be self-explanatory. - */ - bitset<_Nb>& - operator<<=(size_t __pos) - { - if (__builtin_expect(__pos < _Nb, 1)) - { - this->_M_do_left_shift(__pos); - this->_M_do_sanitize(); - } - else - this->_M_do_reset(); - return *this; - } - - bitset<_Nb>& - operator>>=(size_t __pos) - { - if (__builtin_expect(__pos < _Nb, 1)) - { - this->_M_do_right_shift(__pos); - this->_M_do_sanitize(); - } - else - this->_M_do_reset(); - return *this; - } - //@} - - //@{ - /** - * These versions of single-bit set, reset, flip, and test are - * extensions from the SGI version. They do no range checking. - * @ingroup SGIextensions - */ - bitset<_Nb>& - _Unchecked_set(size_t __pos) - { - this->_M_getword(__pos) |= _Base::_S_maskbit(__pos); - return *this; - } - - bitset<_Nb>& - _Unchecked_set(size_t __pos, int __val) - { - if (__val) - this->_M_getword(__pos) |= _Base::_S_maskbit(__pos); - else - this->_M_getword(__pos) &= ~_Base::_S_maskbit(__pos); - return *this; - } - - bitset<_Nb>& - _Unchecked_reset(size_t __pos) - { - this->_M_getword(__pos) &= ~_Base::_S_maskbit(__pos); - return *this; - } - - bitset<_Nb>& - _Unchecked_flip(size_t __pos) - { - this->_M_getword(__pos) ^= _Base::_S_maskbit(__pos); - return *this; - } - - bool - _Unchecked_test(size_t __pos) const - { - return (this->_M_getword(__pos) & _Base::_S_maskbit(__pos)) - != static_cast<_WordT>(0); - } - //@} - - // Set, reset, and flip. - /** - * @brief Sets every bit to true. - */ - bitset<_Nb>& - set() - { - this->_M_do_set(); - this->_M_do_sanitize(); - return *this; - } - - /** - * @brief Sets a given bit to a particular value. - * @param pos The index of the bit. - * @param val Either true or false, defaults to true. - * @throw std::out_of_range If @a pos is bigger the size of the %set. - */ - bitset<_Nb>& - set(size_t __pos, bool __val = true) - { - if (__pos >= _Nb) - __throw_out_of_range("bitset -- set() argument too large"); - return _Unchecked_set(__pos, __val); - } - - /** - * @brief Sets every bit to false. - */ - bitset<_Nb>& - reset() - { - this->_M_do_reset(); - return *this; - } - - /** - * @brief Sets a given bit to false. - * @param pos The index of the bit. - * @throw std::out_of_range If @a pos is bigger the size of the %set. + * The template argument, @a Nb, may be any non-negative number, + * specifying the number of bits (e.g., "0", "12", "1024*1024"). * - * Same as writing @c set(pos,false). - */ - bitset<_Nb>& - reset(size_t __pos) - { - if (__pos >= _Nb) - __throw_out_of_range("bitset -- reset() argument too large"); - return _Unchecked_reset(__pos); - } - - /** - * @brief Toggles every bit to its opposite value. - */ - bitset<_Nb>& - flip() - { - this->_M_do_flip(); - this->_M_do_sanitize(); - return *this; - } - - /** - * @brief Toggles a given bit to its opposite value. - * @param pos The index of the bit. - * @throw std::out_of_range If @a pos is bigger the size of the %set. - */ - bitset<_Nb>& - flip(size_t __pos) - { - if (__pos >= _Nb) - __throw_out_of_range("bitset -- flip() argument too large"); - return _Unchecked_flip(__pos); - } - - /// See the no-argument flip(). - bitset<_Nb> - operator~() const { return bitset<_Nb>(*this).flip(); } - - //@{ - /** - * @brief Array-indexing support. - * @param pos Index into the %bitset. - * @return A bool for a 'const %bitset'. For non-const bitsets, an - * instance of the reference proxy class. - * @note These operators do no range checking and throw no exceptions, - * as required by DR 11 to the standard. + * In the general unoptimized case, storage is allocated in word-sized + * blocks. Let B be the number of bits in a word, then (Nb+(B-1))/B + * words will be used for storage. B - Nb%B bits are unused. (They are + * the high-order bits in the highest word.) It is a class invariant + * that those unused bits are always zero. * - * @if maint - * _GLIBCPP_RESOLVE_LIB_DEFECTS Note that this implementation already - * resolves DR 11 (items 1 and 2), but does not do the range-checking - * required by that DR's resolution. -pme - * The DR has since been changed: range-checking is a precondition - * (users' responsibility), and these functions must not throw. -pme - * @endif - */ - reference - operator[](size_t __pos) { return reference(*this,__pos); } - - bool - operator[](size_t __pos) const { return _Unchecked_test(__pos); } - //@} - - /** - * @brief Retuns a numerical interpretation of the %bitset. - * @return The integral equivalent of the bits. - * @throw std::overflow_error If there are too many bits to be - * represented in an @c uint32. - */ - uint32 - to_uint32() const { return this->_M_do_to_uint32(); } - - /** - * @brief Retuns a character interpretation of the %bitset. - * @return The string equivalent of the bits. + * If you think of %bitset as "a simple array of bits," be aware that + * your mental picture is reversed: a %bitset behaves the same way as + * bits in integers do, with the bit at index 0 in the "least significant + * / right-hand" position, and the bit at index Nb-1 in the "most + * significant / left-hand" position. Thus, unlike other containers, a + * %bitset's index "counts from right to left," to put it very loosely. * - * Note the ordering of the bits: decreasing character positions - * correspond to increasing bit positions (see the main class notes for - * an example). + * This behavior is preserved when translating to and from strings. For + * example, the first line of the following program probably prints + * "b('a') is 0001100001" on a modern ASCII system. * - * Also note that you must specify the string's template parameters - * explicitly. Given a bitset @c bs and a string @s: * @code - * s = bs.to_string<char,char_traits<char>,allocator<char> >(); + * #include <bitset> + * #include <iostream> + * #include <sstream> + * + * using namespace std; + * + * int main() + * { + * uint32 a = 'a'; + * bitset<10> b(a); + * + * cout << "b('a') is " << b << endl; + * + * ostringstream s; + * s << b; + * string str = s.str(); + * cout << "index 3 in the string is " << str[3] << " but\n" + * << "index 3 in the bitset is " << b[3] << endl; + * } * @endcode - */ - template<class _CharT, class _Traits, class _Alloc> - basic_string<_CharT, _Traits, _Alloc> - to_string() const - { - basic_string<_CharT, _Traits, _Alloc> __result; - _M_copy_to_string(__result); - return __result; - } + * + * Also see http://gcc.gnu.org/onlinedocs/libstdc++/ext/sgiexts.html#ch23 + * for a description of extensions. + * + * @if maint + * Most of the actual code isn't contained in %bitset<> itself, but in the + * base class _Base_bitset. The base class works with whole words, not with + * individual bits. This allows us to specialize _Base_bitset for the + * important special case where the %bitset is only a single word. + * + * Extra confusion can result due to the fact that the storage for + * _Base_bitset @e is a regular array, and is indexed as such. This is + * carefully encapsulated. + * @endif + */ + template<size_t _Nb> + class bitset : private _Base_bitset<_LOFAR_BITSET_WORDS(_Nb)> + { + private: + typedef _Base_bitset<_LOFAR_BITSET_WORDS(_Nb)> _Base; + typedef uint32 _WordT; - // Helper functions for string operations. - template<class _CharT, class _Traits, class _Alloc> void - _M_copy_from_string(const basic_string<_CharT,_Traits,_Alloc>& __s, - size_t, size_t); + _M_do_sanitize() + { + _Sanitize<_Nb%_LOFAR_BITSET_BITS_PER_WORD>:: + _S_do_sanitize(this->_M_hiword()); + } - template<class _CharT, class _Traits, class _Alloc> - void - _M_copy_to_string(basic_string<_CharT,_Traits,_Alloc>&) const; + public: + /** + * This encapsulates the concept of a single bit. An instance of this + * class is a proxy for an actual bit; this way the individual bit + * operations are done as faster word-size bitwise instructions. + * + * Most users will never need to use this class directly; conversions + * to and from bool are automatic and should be transparent. Overloaded + * operators help to preserve the illusion. + * + * (On a typical system, this "bit %reference" is 64 times the size of + * an actual bit. Ha.) + */ + class reference + { + friend class bitset; - /// Returns the number of bits which are set. - size_t - count() const { return this->_M_do_count(); } + _WordT *_M_wp; + size_t _M_bpos; - /// Returns the total number of bits. - size_t - size() const { return _Nb; } + // left undefined + reference(); - //@{ - /// These comparisons for equality/inequality are, well, @e bitwise. - bool - operator==(const bitset<_Nb>& __rhs) const - { return this->_M_is_equal(__rhs); } - - bool - operator!=(const bitset<_Nb>& __rhs) const - { return !this->_M_is_equal(__rhs); } - //@} + public: + reference(bitset& __b, size_t __pos) + { + _M_wp = &__b._M_getword(__pos); + _M_bpos = _Base::_S_whichbit(__pos); + } - /** - * @brief Tests the value of a bit. - * @param pos The index of a bit. - * @return The value at @a pos. - * @throw std::out_of_range If @a pos is bigger the size of the %set. - */ - bool - test(size_t __pos) const - { - if (__pos >= _Nb) - __throw_out_of_range("bitset -- test() argument too large"); - return _Unchecked_test(__pos); - } + ~reference() { } - /** - * @brief Tests whether any of the bits are on. - * @return True if at least one bit is set. - */ - bool - any() const { return this->_M_is_any(); } + // for b[i] = __x; + reference& + operator=(bool __x) + { + if ( __x ) + *_M_wp |= _Base::_S_maskbit(_M_bpos); + else + *_M_wp &= ~_Base::_S_maskbit(_M_bpos); + return *this; + } - /** - * @brief Tests whether any of the bits are on. - * @return True if none of the bits are set. - */ - bool - none() const { return !this->_M_is_any(); } + // for b[i] = b[__j]; + reference& + operator=(const reference& __j) + { + if ( (*(__j._M_wp) & _Base::_S_maskbit(__j._M_bpos)) ) + *_M_wp |= _Base::_S_maskbit(_M_bpos); + else + *_M_wp &= ~_Base::_S_maskbit(_M_bpos); + return *this; + } - //@{ - /// Self-explanatory. - bitset<_Nb> - operator<<(size_t __pos) const - { return bitset<_Nb>(*this) <<= __pos; } - - bitset<_Nb> - operator>>(size_t __pos) const - { return bitset<_Nb>(*this) >>= __pos; } - //@} + // flips the bit + bool + operator~() const + { return (*(_M_wp) & _Base::_S_maskbit(_M_bpos)) == 0; } - /** - * @brief Finds the index of the first "on" bit. - * @return The index of the first bit set, or size() if not found. - * @ingroup SGIextensions - * @sa _Find_next - */ - size_t - _Find_first() const - { return this->_M_do_find_first(_Nb); } + // for __x = b[i]; + operator bool() const + { return (*(_M_wp) & _Base::_S_maskbit(_M_bpos)) != 0; } - /** - * @brief Finds the index of the next "on" bit after prev. - * @return The index of the next bit set, or size() if not found. - * @param prev Where to start searching. - * @ingroup SGIextensions - * @sa _Find_first - */ - size_t - _Find_next(size_t __prev ) const - { return this->_M_do_find_next(__prev, _Nb); } - }; + // for b[i].flip(); + reference& + flip() + { + *_M_wp ^= _Base::_S_maskbit(_M_bpos); + return *this; + } + }; + friend class reference; + + // 23.3.5.1 constructors: + /// All bits set to zero. + bitset() { } + + /// Initial bits bitwise-copied from a single word (others set to zero). + bitset(uint32 __val) : _Base(__val) + { _M_do_sanitize(); } + + /** + * @brief Use a subset of a string. + * @param s A string of '0' and '1' characters. + * @param pos Index of the first character in @a s to use; defaults + * to zero. + * @throw std::out_of_range If @a pos is bigger the size of @a s. + * @throw std::invalid_argument If a character appears in the string + * which is neither '0' nor '1'. + */ + template<class _CharT, class _Traits, class _Alloc> + explicit bitset(const basic_string<_CharT, _Traits, _Alloc>& __s, + size_t __pos = 0) : _Base() + { + if (__pos > __s.size()) + __throw_out_of_range("bitset -- initial position is larger than " + "the string itself"); + _M_copy_from_string(__s, __pos, + basic_string<_CharT, _Traits, _Alloc>::npos); + } + + /** + * @brief Use a subset of a string. + * @param s A string of '0' and '1' characters. + * @param pos Index of the first character in @a s to use. + * @param n The number of characters to copy. + * @throw std::out_of_range If @a pos is bigger the size of @a s. + * @throw std::invalid_argument If a character appears in the string + * which is neither '0' nor '1'. + */ + template<class _CharT, class _Traits, class _Alloc> + bitset(const basic_string<_CharT, _Traits, _Alloc>& __s, + size_t __pos, size_t __n) : _Base() + { + if (__pos > __s.size()) + __throw_out_of_range("bitset -- initial position is larger than " + "the string itself"); + _M_copy_from_string(__s, __pos, __n); + } + + // 23.3.5.2 bitset operations: + //@{ + /** + * @brief Operations on bitsets. + * @param rhs A same-sized bitset. + * + * These should be self-explanatory. + */ + bitset<_Nb>& + operator&=(const bitset<_Nb>& __rhs) + { + this->_M_do_and(__rhs); + return *this; + } + + bitset<_Nb>& + operator|=(const bitset<_Nb>& __rhs) + { + this->_M_do_or(__rhs); + return *this; + } + + bitset<_Nb>& + operator^=(const bitset<_Nb>& __rhs) + { + this->_M_do_xor(__rhs); + return *this; + } + //@} + + //@{ + /** + * @brief Operations on bitsets. + * @param pos The number of places to shift. + * + * These should be self-explanatory. + */ + bitset<_Nb>& + operator<<=(size_t __pos) + { + if (__builtin_expect(__pos < _Nb, 1)) + { + this->_M_do_left_shift(__pos); + this->_M_do_sanitize(); + } + else + this->_M_do_reset(); + return *this; + } + + bitset<_Nb>& + operator>>=(size_t __pos) + { + if (__builtin_expect(__pos < _Nb, 1)) + { + this->_M_do_right_shift(__pos); + this->_M_do_sanitize(); + } + else + this->_M_do_reset(); + return *this; + } + //@} + + //@{ + /** + * These versions of single-bit set, reset, flip, and test are + * extensions from the SGI version. They do no range checking. + * @ingroup SGIextensions + */ + bitset<_Nb>& + _Unchecked_set(size_t __pos) + { + this->_M_getword(__pos) |= _Base::_S_maskbit(__pos); + return *this; + } + + bitset<_Nb>& + _Unchecked_set(size_t __pos, int __val) + { + if (__val) + this->_M_getword(__pos) |= _Base::_S_maskbit(__pos); + else + this->_M_getword(__pos) &= ~_Base::_S_maskbit(__pos); + return *this; + } + + bitset<_Nb>& + _Unchecked_reset(size_t __pos) + { + this->_M_getword(__pos) &= ~_Base::_S_maskbit(__pos); + return *this; + } + + bitset<_Nb>& + _Unchecked_flip(size_t __pos) + { + this->_M_getword(__pos) ^= _Base::_S_maskbit(__pos); + return *this; + } + + bool + _Unchecked_test(size_t __pos) const + { + return (this->_M_getword(__pos) & _Base::_S_maskbit(__pos)) + != static_cast<_WordT>(0); + } + //@} + + // Set, reset, and flip. + /** + * @brief Sets every bit to true. + */ + bitset<_Nb>& + set() + { + this->_M_do_set(); + this->_M_do_sanitize(); + return *this; + } + + /** + * @brief Sets a given bit to a particular value. + * @param pos The index of the bit. + * @param val Either true or false, defaults to true. + * @throw std::out_of_range If @a pos is bigger the size of the %set. + */ + bitset<_Nb>& + set(size_t __pos, bool __val = true) + { + if (__pos >= _Nb) + __throw_out_of_range("bitset -- set() argument too large"); + return _Unchecked_set(__pos, __val); + } + + /** + * @brief Sets every bit to false. + */ + bitset<_Nb>& + reset() + { + this->_M_do_reset(); + return *this; + } + + /** + * @brief Sets a given bit to false. + * @param pos The index of the bit. + * @throw std::out_of_range If @a pos is bigger the size of the %set. + * + * Same as writing @c set(pos,false). + */ + bitset<_Nb>& + reset(size_t __pos) + { + if (__pos >= _Nb) + __throw_out_of_range("bitset -- reset() argument too large"); + return _Unchecked_reset(__pos); + } + + /** + * @brief Toggles every bit to its opposite value. + */ + bitset<_Nb>& + flip() + { + this->_M_do_flip(); + this->_M_do_sanitize(); + return *this; + } + + /** + * @brief Toggles a given bit to its opposite value. + * @param pos The index of the bit. + * @throw std::out_of_range If @a pos is bigger the size of the %set. + */ + bitset<_Nb>& + flip(size_t __pos) + { + if (__pos >= _Nb) + __throw_out_of_range("bitset -- flip() argument too large"); + return _Unchecked_flip(__pos); + } + + /// See the no-argument flip(). + bitset<_Nb> + operator~() const { return bitset<_Nb>(*this).flip(); } + + //@{ + /** + * @brief Array-indexing support. + * @param pos Index into the %bitset. + * @return A bool for a 'const %bitset'. For non-const bitsets, an + * instance of the reference proxy class. + * @note These operators do no range checking and throw no exceptions, + * as required by DR 11 to the standard. + * + * @if maint + * _GLIBCPP_RESOLVE_LIB_DEFECTS Note that this implementation already + * resolves DR 11 (items 1 and 2), but does not do the range-checking + * required by that DR's resolution. -pme + * The DR has since been changed: range-checking is a precondition + * (users' responsibility), and these functions must not throw. -pme + * @endif + */ + reference + operator[](size_t __pos) { return reference(*this,__pos); } + + bool + operator[](size_t __pos) const { return _Unchecked_test(__pos); } + //@} + + /** + * @brief Retuns a numerical interpretation of the %bitset. + * @return The integral equivalent of the bits. + * @throw std::overflow_error If there are too many bits to be + * represented in an @c uint32. + */ + uint32 + to_uint32() const { return this->_M_do_to_uint32(); } + + /** + * @brief Retuns a character interpretation of the %bitset. + * @return The string equivalent of the bits. + * + * Note the ordering of the bits: decreasing character positions + * correspond to increasing bit positions (see the main class notes for + * an example). + * + * Also note that you must specify the string's template parameters + * explicitly. Given a bitset @c bs and a string @s: + * @code + * s = bs.to_string<char,char_traits<char>,allocator<char> >(); + * @endcode + */ + template<class _CharT, class _Traits, class _Alloc> + basic_string<_CharT, _Traits, _Alloc> + to_string() const + { + basic_string<_CharT, _Traits, _Alloc> __result; + _M_copy_to_string(__result); + return __result; + } + + // Helper functions for string operations. + template<class _CharT, class _Traits, class _Alloc> + void + _M_copy_from_string(const basic_string<_CharT,_Traits,_Alloc>& __s, + size_t, size_t); + + template<class _CharT, class _Traits, class _Alloc> + void + _M_copy_to_string(basic_string<_CharT,_Traits,_Alloc>&) const; + + /// Returns the number of bits which are set. + size_t + count() const { return this->_M_do_count(); } + + /// Returns the total number of bits. + size_t + size() const { return _Nb; } + + //@{ + /// These comparisons for equality/inequality are, well, @e bitwise. + bool + operator==(const bitset<_Nb>& __rhs) const + { return this->_M_is_equal(__rhs); } + + bool + operator!=(const bitset<_Nb>& __rhs) const + { return !this->_M_is_equal(__rhs); } + //@} + + /** + * @brief Tests the value of a bit. + * @param pos The index of a bit. + * @return The value at @a pos. + * @throw std::out_of_range If @a pos is bigger the size of the %set. + */ + bool + test(size_t __pos) const + { + if (__pos >= _Nb) + __throw_out_of_range("bitset -- test() argument too large"); + return _Unchecked_test(__pos); + } + + /** + * @brief Tests whether any of the bits are on. + * @return True if at least one bit is set. + */ + bool + any() const { return this->_M_is_any(); } + + /** + * @brief Tests whether any of the bits are on. + * @return True if none of the bits are set. + */ + bool + none() const { return !this->_M_is_any(); } + + //@{ + /// Self-explanatory. + bitset<_Nb> + operator<<(size_t __pos) const + { return bitset<_Nb>(*this) <<= __pos; } + + bitset<_Nb> + operator>>(size_t __pos) const + { return bitset<_Nb>(*this) >>= __pos; } + //@} + + /** + * @brief Finds the index of the first "on" bit. + * @return The index of the first bit set, or size() if not found. + * @ingroup SGIextensions + * @sa _Find_next + */ + size_t + _Find_first() const + { return this->_M_do_find_first(_Nb); } + + /** + * @brief Finds the index of the next "on" bit after prev. + * @return The index of the next bit set, or size() if not found. + * @param prev Where to start searching. + * @ingroup SGIextensions + * @sa _Find_first + */ + size_t + _Find_next(size_t __prev ) const + { return this->_M_do_find_next(__prev, _Nb); } + }; - // Definitions of non-inline member functions. - template<size_t _Nb> + // Definitions of non-inline member functions. + template<size_t _Nb> template<class _CharT, class _Traits, class _Alloc> void bitset<_Nb>::_M_copy_from_string(const basic_string<_CharT,_Traits,_Alloc>& __s, size_t __pos, size_t __n) @@ -1150,22 +1152,22 @@ namespace LOFAR reset(); const size_t __nbits = min(_Nb, min(__n, __s.size() - __pos)); for (size_t __i = 0; __i < __nbits; ++__i) - { - switch(__s[__pos + __nbits - __i - 1]) - { - case '0': - break; - case '1': - set(__i); - break; - default: - __throw_invalid_argument("bitset -- string contains characters " - "which are neither 0 nor 1"); - } - } + { + switch(__s[__pos + __nbits - __i - 1]) + { + case '0': + break; + case '1': + set(__i); + break; + default: + __throw_invalid_argument("bitset -- string contains characters " + "which are neither 0 nor 1"); + } + } } - template<size_t _Nb> + template<size_t _Nb> template<class _CharT, class _Traits, class _Alloc> void bitset<_Nb>::_M_copy_to_string(basic_string<_CharT, _Traits, _Alloc>& __s) const @@ -1176,17 +1178,17 @@ namespace LOFAR __s[_Nb - 1 - __i] = '1'; } - // 23.3.5.3 bitset operations: - //@{ - /** - * @brief Global bitwise operations on bitsets. - * @param x A bitset. - * @param y A bitset of the same size as @a x. - * @return A new bitset. - * - * These should be self-explanatory. - */ - template<size_t _Nb> + // 23.3.5.3 bitset operations: + //@{ + /** + * @brief Global bitwise operations on bitsets. + * @param x A bitset. + * @param y A bitset of the same size as @a x. + * @return A new bitset. + * + * These should be self-explanatory. + */ + template<size_t _Nb> inline bitset<_Nb> operator&(const bitset<_Nb>& __x, const bitset<_Nb>& __y) { @@ -1195,7 +1197,7 @@ namespace LOFAR return __result; } - template<size_t _Nb> + template<size_t _Nb> inline bitset<_Nb> operator|(const bitset<_Nb>& __x, const bitset<_Nb>& __y) { @@ -1204,7 +1206,7 @@ namespace LOFAR return __result; } - template <size_t _Nb> + template <size_t _Nb> inline bitset<_Nb> operator^(const bitset<_Nb>& __x, const bitset<_Nb>& __y) { @@ -1212,18 +1214,18 @@ namespace LOFAR __result ^= __y; return __result; } - //@} - - //@{ - /** - * @brief Global I/O operators for bitsets. - * - * Direct I/O between streams and bitsets is supported. Output is - * straightforward. Input will skip whitespace, only accept '0' and '1' - * characters, and will only extract as many digits as the %bitset will - * hold. - */ - template<class _CharT, class _Traits, size_t _Nb> + //@} + + //@{ + /** + * @brief Global I/O operators for bitsets. + * + * Direct I/O between streams and bitsets is supported. Output is + * straightforward. Input will skip whitespace, only accept '0' and '1' + * characters, and will only extract as many digits as the %bitset will + * hold. + */ + template<class _CharT, class _Traits, size_t _Nb> basic_istream<_CharT, _Traits>& operator>>(basic_istream<_CharT, _Traits>& __is, bitset<_Nb>& __x) { @@ -1234,47 +1236,47 @@ namespace LOFAR // Skip whitespace typename basic_istream<_CharT, _Traits>::sentry __sentry(__is); if (__sentry) - { - ios_base::iostate __state = ios_base::goodbit; - basic_streambuf<_CharT, _Traits>* __buf = __is.rdbuf(); - for (size_t __i = 0; __i < _Nb; ++__i) - { - static typename _Traits::int_type __eof = _Traits::eof(); - - typename _Traits::int_type __c1 = __buf->sbumpc(); - if (_Traits::eq_int_type(__c1, __eof)) - { - __state |= ios_base::eofbit; - break; - } - else - { - char_type __c2 = _Traits::to_char_type(__c1); - char_type __c = __is.narrow(__c2, '*'); - - if (__c == '0' || __c == '1') - __tmp.push_back(__c); - else if (_Traits::eq_int_type(__buf->sputbackc(__c2), __eof)) - { - __state |= ios_base::failbit; - break; - } - } - } - - if (__tmp.empty() && !_Nb) - __state |= ios_base::failbit; - else - __x._M_copy_from_string(__tmp, static_cast<size_t>(0), _Nb); - - if (__state != ios_base::goodbit) - __is.setstate(__state); // may throw an exception - } + { + ios_base::iostate __state = ios_base::goodbit; + basic_streambuf<_CharT, _Traits>* __buf = __is.rdbuf(); + for (size_t __i = 0; __i < _Nb; ++__i) + { + static typename _Traits::int_type __eof = _Traits::eof(); + + typename _Traits::int_type __c1 = __buf->sbumpc(); + if (_Traits::eq_int_type(__c1, __eof)) + { + __state |= ios_base::eofbit; + break; + } + else + { + char_type __c2 = _Traits::to_char_type(__c1); + char_type __c = __is.narrow(__c2, '*'); + + if (__c == '0' || __c == '1') + __tmp.push_back(__c); + else if (_Traits::eq_int_type(__buf->sputbackc(__c2), __eof)) + { + __state |= ios_base::failbit; + break; + } + } + } + + if (__tmp.empty() && !_Nb) + __state |= ios_base::failbit; + else + __x._M_copy_from_string(__tmp, static_cast<size_t>(0), _Nb); + + if (__state != ios_base::goodbit) + __is.setstate(__state); // may throw an exception + } return __is; } - template <class _CharT, class _Traits, size_t _Nb> + template <class _CharT, class _Traits, size_t _Nb> basic_ostream<_CharT, _Traits>& operator<<(basic_ostream<_CharT, _Traits>& __os, const bitset<_Nb>& __x) { @@ -1282,7 +1284,10 @@ namespace LOFAR __x._M_copy_to_string(__tmp); return __os << __tmp; } - //@} + //@} + + } // namespace CS1 + } // namespace LOFAR #undef _LOFAR_BITSET_WORDS diff --git a/Appl/CEP/CS1/CS1_Storage/include/CS1_Storage/AH_Storage.h b/Appl/CEP/CS1/CS1_Storage/include/CS1_Storage/AH_Storage.h index f45ef01b1d523255cac3651dc86200b958e09ad5..51e31d6dde6789fde4d9e34b773fefb2bb206dae 100644 --- a/Appl/CEP/CS1/CS1_Storage/include/CS1_Storage/AH_Storage.h +++ b/Appl/CEP/CS1/CS1_Storage/include/CS1_Storage/AH_Storage.h @@ -13,31 +13,37 @@ #include <CEPFrame/ApplicationHolder.h> -namespace LOFAR { +namespace LOFAR +{ + class Step; + namespace CS1 + { -// This is the ApplicationHolder for the storage section of the CS1 application -// This applicationholder uses the CEPFrame library and is supposed to -// connect to the BGLProcessing application Holder (using only tinyCEP). -// The interface between these is defined in the Corr_Stub class. -// + class Stub_BGL_Visibilities; -class Step; -class Stub_BGL_Visibilities; + // This is the ApplicationHolder for the storage section of the CS1 application + // This applicationholder uses the CEPFrame library and is supposed to + // connect to the BGLProcessing application Holder (using only tinyCEP). + // The interface between these is defined in the Corr_Stub class. + // + class AH_Storage: public LOFAR::ApplicationHolder + { + public: + AH_Storage(); + virtual ~AH_Storage(); + virtual void define (const LOFAR::KeyValueMap&); + virtual void prerun (); + virtual void run (int nsteps); + virtual void dump () const; + virtual void quit (); + private: + + Stub_BGL_Visibilities* itsStub; + + }; + + } // namespace CS1 + +} // namespace LOFAR -class AH_Storage: public LOFAR::ApplicationHolder -{ - public: - AH_Storage(); - virtual ~AH_Storage(); - virtual void define (const LOFAR::KeyValueMap&); - virtual void prerun (); - virtual void run (int nsteps); - virtual void dump () const; - virtual void quit (); - private: - - Stub_BGL_Visibilities* itsStub; - -}; -} #endif diff --git a/Appl/CEP/CS1/CS1_Storage/include/CS1_Storage/MSWriter.h b/Appl/CEP/CS1/CS1_Storage/include/CS1_Storage/MSWriter.h index de9fb9761c3b4e9dc5a887c743e13f82803fc8ea..d5606651b763ce4315d226064f71a2c30a77194c 100644 --- a/Appl/CEP/CS1/CS1_Storage/include/CS1_Storage/MSWriter.h +++ b/Appl/CEP/CS1/CS1_Storage/include/CS1_Storage/MSWriter.h @@ -20,8 +20,8 @@ //# //# $Id$ -#ifndef CS1_CS1_STORAGE_MSWRITER_H -#define CS1_CS1_STORAGE_MSWRITER_H +#ifndef LOFAR_CS1_STORAGE_MSWRITER_H +#define LOFAR_CS1_STORAGE_MSWRITER_H //# Includes #include <Common/LofarTypes.h> @@ -29,97 +29,100 @@ namespace LOFAR { - -//# Forward Declarations -class MSWriterImpl; - -// \ingroup CS1_Storage -// Class for filling a MeasurementSet -class MSWriter -{ -public: - // Construct the MS with a given name. - // The timeStep is used by the write function - // to calculate the time from the starting time and the timeCounter. - // The antenna positions have to be given as xpos,ypos (in meters). - // The WSRT is taken as the center of the array. - // Thus antPos must have shape [2,nantennas]. - MSWriter (const char* msName, double startTime, double timeStep, - int nChan, int nPol, uint nantennas, - const vector<double>& antPos); - - // Destructor - ~MSWriter(); - - // Add the definition of the next frequency band. - // 1, 2 or 4 polarizations can be given. - // 1 is always XX; 2 is XX,YY; 4 is XX,XY,YX,YY. - // The frequencies have to be given in Hz. - // The first version assumes that all channels are adjacent and that the - // the reference frequency is the center of the entire band. From that - // it calculates the center frequency for each channel. - // The second version can be used to specify the center frequency and width - // for each channel. So both arrays must have nchannels entries. - // Note that the total bandwidth is calculated from the minimum and - // maximum channel frequency. Thus it is not the sum of all widths. - // <br>It returns the id (0-relative seqnr) of the band. - // <group> - int addBand (int npolarizations, int nchannels, - double refFreq, double chanWidth); - int addBand (int npolarizations, int nchannels, - double refFreq, const double* chanFreqs, - const double* chanWidths); - // </group> - - // Add the definition of the next field (i.e. beam). - // The angles have to be given in radians. - // <br>It returns the id (0-relative seqnr) of the field. - int addField (double RA, double DEC); - - // Write a data array for the given band, field and frequency channel. - // The data array is a (3D complex) array with axes polarization, - // antenna1, antenna2 (polarization is the most rapidly varying axis). - // Also: antenna1>antenna2. - // The flag array has the same shape as the data array. Flag==True - // means that the corresponding data point is flagged as invalid. - // The flag array is optional. If not given, all flags are False. - // All data will be written with sigma=0 - // <br>The number of data points (nrdata) given should match the - // number of antennas, bands, and polarizations for this bandId. - void write (int bandId, int fieldId, int channelId, - int nrChannels, int timeCounter, int nrdata, - const fcomplex* data, const bool* flags, - const float* weights); - - // Get the number of antennas. - int nrAntennas() const; - - // Get the number of bands. - int nrBands() const; - - // Get the number of fields. - int nrFields() const; - - // Get the number of different polarization setups. - int nrPolarizations() const; - - // Get the number of exposures. - int nrTimes() const; - - -private: - // Forbid copy constructor and assignment by making them private. - // <group> - MSWriter (const MSWriter&); - MSWriter& operator= (const MSWriter&); - // </group> - - - //# Define the data. - //# Note we use pointers to an MSWriterImpl class, so MSWriter - //# does not need any AIPS++ include file. - MSWriterImpl* itsWriter; -}; + namespace CS1 + { + //# Forward Declarations + class MSWriterImpl; + + // \ingroup CS1_Storage + // Class for filling a MeasurementSet + class MSWriter + { + public: + // Construct the MS with a given name. + // The timeStep is used by the write function + // to calculate the time from the starting time and the timeCounter. + // The antenna positions have to be given as xpos,ypos (in meters). + // The WSRT is taken as the center of the array. + // Thus antPos must have shape [2,nantennas]. + MSWriter (const char* msName, double startTime, double timeStep, + int nChan, int nPol, uint nantennas, + const vector<double>& antPos); + + // Destructor + ~MSWriter(); + + // Add the definition of the next frequency band. + // 1, 2 or 4 polarizations can be given. + // 1 is always XX; 2 is XX,YY; 4 is XX,XY,YX,YY. + // The frequencies have to be given in Hz. + // The first version assumes that all channels are adjacent and that the + // the reference frequency is the center of the entire band. From that + // it calculates the center frequency for each channel. + // The second version can be used to specify the center frequency and width + // for each channel. So both arrays must have nchannels entries. + // Note that the total bandwidth is calculated from the minimum and + // maximum channel frequency. Thus it is not the sum of all widths. + // <br>It returns the id (0-relative seqnr) of the band. + // <group> + int addBand (int npolarizations, int nchannels, + double refFreq, double chanWidth); + int addBand (int npolarizations, int nchannels, + double refFreq, const double* chanFreqs, + const double* chanWidths); + // </group> + + // Add the definition of the next field (i.e. beam). + // The angles have to be given in radians. + // <br>It returns the id (0-relative seqnr) of the field. + int addField (double RA, double DEC); + + // Write a data array for the given band, field and frequency channel. + // The data array is a (3D complex) array with axes polarization, + // antenna1, antenna2 (polarization is the most rapidly varying axis). + // Also: antenna1>antenna2. + // The flag array has the same shape as the data array. Flag==True + // means that the corresponding data point is flagged as invalid. + // The flag array is optional. If not given, all flags are False. + // All data will be written with sigma=0 + // <br>The number of data points (nrdata) given should match the + // number of antennas, bands, and polarizations for this bandId. + void write (int bandId, int fieldId, int channelId, + int nrChannels, int timeCounter, int nrdata, + const fcomplex* data, const bool* flags, + const float* weights); + + // Get the number of antennas. + int nrAntennas() const; + + // Get the number of bands. + int nrBands() const; + + // Get the number of fields. + int nrFields() const; + + // Get the number of different polarization setups. + int nrPolarizations() const; + + // Get the number of exposures. + int nrTimes() const; + + + private: + // Forbid copy constructor and assignment by making them private. + // <group> + MSWriter (const MSWriter&); + MSWriter& operator= (const MSWriter&); + // </group> + + + //# Define the data. + //# Note we use pointers to an MSWriterImpl class, so MSWriter + //# does not need any AIPS++ include file. + MSWriterImpl* itsWriter; + }; + + } // namespace CS1 } // namespace LOFAR diff --git a/Appl/CEP/CS1/CS1_Storage/include/CS1_Storage/MSWriterImpl.h b/Appl/CEP/CS1/CS1_Storage/include/CS1_Storage/MSWriterImpl.h index 607251ae9c433fde1d31a97e3dad75ffe076f92d..7467a510a661484d5f79e14e6f304134d3f58189 100644 --- a/Appl/CEP/CS1/CS1_Storage/include/CS1_Storage/MSWriterImpl.h +++ b/Appl/CEP/CS1/CS1_Storage/include/CS1_Storage/MSWriterImpl.h @@ -33,135 +33,138 @@ //# Forward Declarations namespace casa { -class MPosition; -class MeasFrame; -class MeasurementSet; -class MSMainColumns; -template<class T> class Block; -template<class T> class Vector; -template<class T> class Cube; + class MPosition; + class MeasFrame; + class MeasurementSet; + class MSMainColumns; + template<class T> class Block; + template<class T> class Vector; + template<class T> class Cube; } namespace LOFAR { - -// Class for filling a MeasurementSet. -// It is a wrapper class to hide the AIPS++ intricacies from -// the LOFAR environment which uses STL. - -class MSWriterImpl -{ -public: - // Construct the MS with a given name. - // The time of construction is used as the starting time of - // the observation. The timeStep (in sec) is used by the write function - // to calculate the time from the starting time and the timeCounter. - // The antenna positions have to be given in meters (x,y,z) - // relative to the center (which is set to Westerbork). So antPos - // must have shape [3,nantennas]. - MSWriterImpl (const char* msName, double startTime, double timeStep, - int nfreq, int ncorr, - int nantennas, const vector<double>& antPos); - - // Destructor - ~MSWriterImpl(); - - // Add the definition of the next frequency band. - // 1, 2 or 4 polarizations can be given. - // 1 is always XX; 2 is XX,YY; 4 is XX,XY,YX,YY. - // The frequencies have to be given in Hz. - // <group> - int addBand (int npolarizations, int nchannels, - double refFreq, double chanWidth); - int addBand (int npolarizations, int nchannels, - double refFreq, const double* chanFreqs, - const double* chanWidths); - // </group> - - // Add the definition of the next field (i.e. beam). - // The angles have to be given in radians. - int addField (double RA, double DEC); - - // Write a data array for the given band, field and frequency channel. - // The flag array has the same shape as the data array. Flag==True - // means the the corresponding data point is flagged as invalid. - // The flag array is optional. If not given, all flags are False. - // All data will be written with sigma=0 and weight=1. - void write (int bandId, int fieldId, int channelId, - int nrChannels, int timeCounter, int nrdata, - const fcomplex* data, const bool* flags, - const float* weights); - - // Get the number of antennas. - int nrAntennas() const - { return itsNrAnt; } - - // Get the number of bands. - int nrBands() const - { return itsNrBand; } - - // Get the number of fields. - int nrFields() const - { return itsNrField; } - - // Get the number of different polarization setups. - int nrPolarizations() const; - - // Get the number of exposures. - int nrTimes() const - { return itsNrTimes; } - -private: - // Forbid copy constructor and assignment by making them private. - // <group> - MSWriterImpl (const MSWriterImpl&); - MSWriterImpl& operator= (const MSWriterImpl&); - // </group> - - // Create the MS and fill its subtables as much as possible. - void createMS (const char* msName, - const casa::Block<casa::MPosition>& antPos); - - // Add a band. - int addBand (int npolarizations, int nchannels, - double refFreq, const casa::Vector<double>& chanFreqs, - const casa::Vector<double>& chanWidths); - - // Add a polarization to the subtable. - // Return the row number where it is added. - int addPolarization (int npolarizations); - - // Fill the various subtables (at the end). - // <group> - void fillAntenna (const casa::Block<casa::MPosition>& antPos); - void fillFeed(); - void fillObservation(); - void fillProcessor(); - void fillState(); - // </group> - - // Update the times in various subtables at the end of the observation. - void updateTimes(); - - //# Define the data. - int itsNrBand; //# nr of bands - int itsNrField; //# nr of fields (beams) - int itsNrAnt; //# nr of antennas (stations) - int itsNrFreq; //# Fixed nr of frequencies (channels) - int itsNrCorr; //# Fixed nr of correlations (polar.) - int itsNrTimes; //# nr of exposures - double itsTimeStep; //# duration of each exposure (sec) - double itsStartTime; //# start time of observation (sec) - casa::Block<casa::Int>* itsNrPol; //# nr of polarizations for each band - casa::Block<casa::Int>* itsNrChan; //# nr of channels for each band - casa::Block<casa::Int>* itsPolnr; //# rownr in POL subtable for each band - casa::Cube<casa::Double>* itsBaselines; //# XYZ (in m) of each baseline - double itsArrayLon; //# longitude of array center - casa::MPosition* itsArrayPos; //# Position of array center - casa::MeasFrame* itsFrame; //# Frame to convert to apparent coordinates - casa::MeasurementSet* itsMS; - casa::MSMainColumns* itsMSCol; -}; + namespace CS1 + { + // Class for filling a MeasurementSet. + // It is a wrapper class to hide the AIPS++ intricacies from + // the LOFAR environment which uses STL. + + class MSWriterImpl + { + public: + // Construct the MS with a given name. + // The time of construction is used as the starting time of + // the observation. The timeStep (in sec) is used by the write function + // to calculate the time from the starting time and the timeCounter. + // The antenna positions have to be given in meters (x,y,z) + // relative to the center (which is set to Westerbork). So antPos + // must have shape [3,nantennas]. + MSWriterImpl (const char* msName, double startTime, double timeStep, + int nfreq, int ncorr, + int nantennas, const vector<double>& antPos); + + // Destructor + ~MSWriterImpl(); + + // Add the definition of the next frequency band. + // 1, 2 or 4 polarizations can be given. + // 1 is always XX; 2 is XX,YY; 4 is XX,XY,YX,YY. + // The frequencies have to be given in Hz. + // <group> + int addBand (int npolarizations, int nchannels, + double refFreq, double chanWidth); + int addBand (int npolarizations, int nchannels, + double refFreq, const double* chanFreqs, + const double* chanWidths); + // </group> + + // Add the definition of the next field (i.e. beam). + // The angles have to be given in radians. + int addField (double RA, double DEC); + + // Write a data array for the given band, field and frequency channel. + // The flag array has the same shape as the data array. Flag==True + // means the the corresponding data point is flagged as invalid. + // The flag array is optional. If not given, all flags are False. + // All data will be written with sigma=0 and weight=1. + void write (int bandId, int fieldId, int channelId, + int nrChannels, int timeCounter, int nrdata, + const fcomplex* data, const bool* flags, + const float* weights); + + // Get the number of antennas. + int nrAntennas() const + { return itsNrAnt; } + + // Get the number of bands. + int nrBands() const + { return itsNrBand; } + + // Get the number of fields. + int nrFields() const + { return itsNrField; } + + // Get the number of different polarization setups. + int nrPolarizations() const; + + // Get the number of exposures. + int nrTimes() const + { return itsNrTimes; } + + private: + // Forbid copy constructor and assignment by making them private. + // <group> + MSWriterImpl (const MSWriterImpl&); + MSWriterImpl& operator= (const MSWriterImpl&); + // </group> + + // Create the MS and fill its subtables as much as possible. + void createMS (const char* msName, + const casa::Block<casa::MPosition>& antPos); + + // Add a band. + int addBand (int npolarizations, int nchannels, + double refFreq, const casa::Vector<double>& chanFreqs, + const casa::Vector<double>& chanWidths); + + // Add a polarization to the subtable. + // Return the row number where it is added. + int addPolarization (int npolarizations); + + // Fill the various subtables (at the end). + // <group> + void fillAntenna (const casa::Block<casa::MPosition>& antPos); + void fillFeed(); + void fillObservation(); + void fillProcessor(); + void fillState(); + // </group> + + // Update the times in various subtables at the end of the observation. + void updateTimes(); + + //# Define the data. + int itsNrBand; ///< nr of bands + int itsNrField; ///< nr of fields (beams) + int itsNrAnt; ///< nr of antennas (stations) + int itsNrFreq; ///< Fixed nr of frequencies (channels) + int itsNrCorr; ///< Fixed nr of correlations (polar.) + int itsNrTimes; ///< nr of exposures + double itsTimeStep; ///< duration of each exposure (sec) + double itsStartTime; ///< start time of observation (sec) + casa::Block<casa::Int>* itsNrPol; ///< nr of polarizations for each band + casa::Block<casa::Int>* itsNrChan; ///< nr of channels for each band + casa::Block<casa::Int>* itsPolnr; ///< rownr in POL subtable for each band + casa::Cube<casa::Double>* itsBaselines; ///< XYZ (in m) of each baseline + double itsArrayLon; ///< longitude of array center + casa::MPosition* itsArrayPos; ///< Position of array center + casa::MeasFrame* itsFrame; ///< Frame to convert to apparent coordinates + casa::MeasurementSet* itsMS; + casa::MSMainColumns* itsMSCol; + }; + + } // namespace CS1 } // namespace LOFAR diff --git a/Appl/CEP/CS1/CS1_Storage/include/CS1_Storage/WH_SubbandWriter.h b/Appl/CEP/CS1/CS1_Storage/include/CS1_Storage/WH_SubbandWriter.h index 58eeba480fd718c1f4395df8dcaa8ff5090d15af..96c94feca9402e2bd6c4b3e33fcb7e8212e4a704 100644 --- a/Appl/CEP/CS1/CS1_Storage/include/CS1_Storage/WH_SubbandWriter.h +++ b/Appl/CEP/CS1/CS1_Storage/include/CS1_Storage/WH_SubbandWriter.h @@ -23,6 +23,7 @@ #ifndef CS1_STORAGE_WH_SUBBANDWRITER_H #define CS1_STORAGE_WH_SUBBANDWRITER_H +// \file // (Optionally) Writes one subband in a AIPS++ Measurement Set #include <Blob/KeyValueMap.h> @@ -36,59 +37,65 @@ namespace LOFAR { + namespace CS1 + { + //# Forward declaration + class MSWriter; -class MSWriter; + class WH_SubbandWriter: public WorkHolder + { + public: -class WH_SubbandWriter: public WorkHolder - { - public: + WH_SubbandWriter(const string& name, int subbandID, + const ACC::APS::ParameterSet& pset); - explicit WH_SubbandWriter(const string& name, int subbandID, - const ACC::APS::ParameterSet& pset); - virtual ~WH_SubbandWriter(); + virtual ~WH_SubbandWriter(); - static WorkHolder* construct(const string& name, int subbandID, - const ACC::APS::ParameterSet& pset); - virtual WH_SubbandWriter* make(const string& name); + static WorkHolder* construct(const string& name, int subbandID, + const ACC::APS::ParameterSet& pset); + virtual WH_SubbandWriter* make(const string& name); - void preprocess(); + void preprocess(); - virtual void process(); + virtual void process(); - void postprocess(); - private: - /// forbid copy constructor - WH_SubbandWriter (const WH_SubbandWriter&); - /// forbid assignment - WH_SubbandWriter& operator= (const WH_SubbandWriter&); + void postprocess(); + private: + /// forbid copy constructor + WH_SubbandWriter (const WH_SubbandWriter&); + /// forbid assignment + WH_SubbandWriter& operator= (const WH_SubbandWriter&); - int itsSubbandID; // ID of this subband - const ACC::APS::ParameterSet itsPS; - int itsNStations; - int itsNBaselines; - int itsNInputsPerSubband; - int itsNChannels; - int itsNPolSquared; - int itsNVisibilities; + int itsSubbandID; // ID of this subband + const ACC::APS::ParameterSet itsPS; + int itsNStations; + int itsNBaselines; + int itsNInputsPerSubband; + int itsNChannels; + int itsNPolSquared; + int itsNVisibilities; - MSWriter* itsWriter; + MSWriter* itsWriter; - int itsBandId; // MS ID of frequency band - int itsFieldId; - int itsTimeCounter; // Counts the time - bool *itsFlagsBuffer; //[NR_BASELINES][NR_SUBBAND_CHANNELS][NR_POLARIZATIONS][NR_POLARIZATIONS]; - float *itsWeightsBuffer; //[NR_BASELINES][NR_SUBBAND_CHANNELS]; + int itsBandId; // MS ID of frequency band + int itsFieldId; + int itsTimeCounter; // Counts the time + bool *itsFlagsBuffer; //[NR_BASELINES][NR_SUBBAND_CHANNELS][NR_POLARIZATIONS][NR_POLARIZATIONS]; + float *itsWeightsBuffer; //[NR_BASELINES][NR_SUBBAND_CHANNELS]; - float itsWeightFactor; + float itsWeightFactor; - NSTimer itsWriteTimer; + NSTimer itsWriteTimer; #ifdef USE_MAC_PI - bool itsWriteToMAC; - GCF::CEPPMLlight::CEPPropertySet* itsPropertySet; - GCF::Common::GCFPValueArray itsVArray; + bool itsWriteToMAC; + GCF::CEPPMLlight::CEPPropertySet* itsPropertySet; + GCF::Common::GCFPValueArray itsVArray; #endif - }; + }; + + } // namespace CS1 + } // namespace LOFAR #endif diff --git a/Appl/CEP/CS1/CS1_Storage/src/AH_Storage.cc b/Appl/CEP/CS1/CS1_Storage/src/AH_Storage.cc index a1ee18d3b0b17c404659d864a824936420d6c820..9676d02c23c240a2fbe7e626ee07986896d08752 100644 --- a/Appl/CEP/CS1/CS1_Storage/src/AH_Storage.cc +++ b/Appl/CEP/CS1/CS1_Storage/src/AH_Storage.cc @@ -19,71 +19,76 @@ #include <CS1_Storage/WH_SubbandWriter.h> #include <CEPFrame/Step.h> -using namespace LOFAR; - -AH_Storage::AH_Storage() - : itsStub (0) +namespace LOFAR { -} + namespace CS1 + { -AH_Storage::~AH_Storage() { -} + AH_Storage::AH_Storage() + : itsStub (0) + { + } -void AH_Storage::define(const LOFAR::KeyValueMap&) { + AH_Storage::~AH_Storage() { + } - LOG_TRACE_FLOW_STR("Start of AH_Storage::define()"); + void AH_Storage::define(const LOFAR::KeyValueMap&) { - LOG_TRACE_FLOW_STR("Create the top-level composite"); - Composite comp(0, 0, "topComposite"); - setComposite(comp); // tell the ApplicationHolder this is the top-level composite + LOG_TRACE_FLOW_STR("Start of AH_Storage::define()"); - itsStub = new Stub_BGL_Visibilities(false, itsParamSet); + LOG_TRACE_FLOW_STR("Create the top-level composite"); + Composite comp(0, 0, "topComposite"); + setComposite(comp); // tell the ApplicationHolder this is the top-level composite - int nrSubbands = itsParamSet.getInt32("Observation.NSubbands"); + itsStub = new Stub_BGL_Visibilities(false, itsParamSet); - for (int subb=0; subb< nrSubbands; subb++) - { - WH_SubbandWriter wh("storage1", subb, itsParamSet); - Step step(wh); - comp.addBlock(step); + int nrSubbands = itsParamSet.getInt32("Observation.NSubbands"); - step.runOnNode(subb); // Note: only 1 subband is written on a node + for (int subb=0; subb< nrSubbands; subb++) + { + WH_SubbandWriter wh("storage1", subb, itsParamSet); + Step step(wh); + comp.addBlock(step); - // Connect to BG output - for (int nr=0; nr<step.getNrInputs(); nr++) - { - itsStub->connect(subb, nr, step.getInDataManager(nr), nr); - } + step.runOnNode(subb); // Note: only 1 subband is written on a node + + // Connect to BG output + for (int nr=0; nr<step.getNrInputs(); nr++) + { + itsStub->connect(subb, nr, step.getInDataManager(nr), nr); + } - } - LOG_TRACE_FLOW_STR("Finished define()"); + } + LOG_TRACE_FLOW_STR("Finished define()"); #ifdef HAVE_MPI - ASSERTSTR (TH_MPI::getNumberOfNodes() == 1, "CS1_Storage should be started on just one node"); + ASSERTSTR (TH_MPI::getNumberOfNodes() == 1, "CS1_Storage should be started on just one node"); #endif -} + } -void AH_Storage::prerun() { - getComposite().preprocess(); -} + void AH_Storage::prerun() { + getComposite().preprocess(); + } -void AH_Storage::run(int steps) { - LOG_TRACE_FLOW_STR("Start AH_Storage::run() " ); - for (int i = 0; i < steps; i++) { - LOG_TRACE_LOOP_STR("processing run " << i ); - cout<<"run "<<i+1<<" of "<<steps<<endl; - getComposite().process(); - } - LOG_TRACE_FLOW_STR("Finished AH_Storage::run() " ); -} + void AH_Storage::run(int steps) { + LOG_TRACE_FLOW_STR("Start AH_Storage::run() " ); + for (int i = 0; i < steps; i++) { + LOG_TRACE_LOOP_STR("processing run " << i ); + cout<<"run "<<i+1<<" of "<<steps<<endl; + getComposite().process(); + } + LOG_TRACE_FLOW_STR("Finished AH_Storage::run() " ); + } -void AH_Storage::dump() const { - LOG_TRACE_FLOW_STR("AH_Storage::dump() not implemented" ); -} + void AH_Storage::dump() const { + LOG_TRACE_FLOW_STR("AH_Storage::dump() not implemented" ); + } -void AH_Storage::quit() { + void AH_Storage::quit() { -} + } + } // namespace CS1 +} // namespace LOFAR diff --git a/Appl/CEP/CS1/CS1_Storage/src/CS1_Storage_main.cc b/Appl/CEP/CS1/CS1_Storage/src/CS1_Storage_main.cc index 0690c186ecb8b5f340aff18c1b261a611f5a94c6..efadb31486aaf35ef8762468ddad807916f42246 100644 --- a/Appl/CEP/CS1/CS1_Storage/src/CS1_Storage_main.cc +++ b/Appl/CEP/CS1/CS1_Storage/src/CS1_Storage_main.cc @@ -19,19 +19,20 @@ #include <CS1_Storage/AH_Storage.h> using namespace LOFAR; +using namespace LOFAR::CS1; #if 1 -#include<PLC/ACCmain.h> +#include <PLC/ACCmain.h> int main(int argc, char* argv[]) { INIT_LOGGER("CS1_Storage"); // This shouldn't be done here - LOFAR::ACC::APS::ParameterSet ps("CS1.parset"); + ACC::APS::ParameterSet ps("CS1.parset"); int nrSeconds = ps.getInt32("General.NRuns"); AH_Storage myAH; ApplicationHolderController myAHC(myAH, nrSeconds); - return LOFAR::ACC::PLC::ACCmain(argc, argv, &myAHC); + return ACC::PLC::ACCmain(argc, argv, &myAHC); } #else diff --git a/Appl/CEP/CS1/CS1_Storage/src/MSWriter.cc b/Appl/CEP/CS1/CS1_Storage/src/MSWriter.cc index 524a76899edf50307045b0aa2e72ca769a589575..5ad73b1d755ee0a2010bbbd86df35ec3cf616479 100644 --- a/Appl/CEP/CS1/CS1_Storage/src/MSWriter.cc +++ b/Appl/CEP/CS1/CS1_Storage/src/MSWriter.cc @@ -30,111 +30,119 @@ #include <Common/lofar_iostream.h> #include <Common/LofarLogger.h> -using namespace LOFAR; -using namespace casa; - -MSWriter::MSWriter (const char* msName, double startTime, double timeStep, - int nChan, int nPol, - uint nantennas, const vector<double>& antPos) -: itsWriter (0) -{ - ASSERTSTR(antPos.size() == 3*nantennas, antPos.size() << " == " << 3*nantennas << - "Antenna position vector does not have the right size!"); - try { - itsWriter = new MSWriterImpl (msName, startTime, timeStep, nChan, nPol, - nantennas, - antPos); - } catch (AipsError x) { - cerr << "MSWriter exception: " << x.getMesg() << endl; - exit(0); - } catch (...) { - cerr << "Unexpected MSWriter exception while creating MSWriterImpl" << endl; - exit(0); - } -} - -MSWriter::~MSWriter() +namespace LOFAR { - delete itsWriter; -} + namespace CS1 + { + using namespace casa; -int MSWriter::addBand (int npolarizations, int nchannels, - double refFreq, double chanWidth) -{ - int res; - try { - res = itsWriter->addBand (npolarizations, nchannels, refFreq, chanWidth); - } catch (AipsError x) { - cerr << "AIPS exception in MSWriterImpl: " << x.getMesg() << endl; - exit(0); - } catch (...) { - cerr << "Unexpected MSWriter exception during addBand" << endl; - exit(0); - } - return res; -} - -int MSWriter::addBand (int npolarizations, int nchannels, - double refFreq, const double* chanFreqs, - const double* chanWidths) -{ - int res; - try { - res = itsWriter->addBand (npolarizations, nchannels, refFreq, - chanFreqs, chanWidths); - } catch (AipsError x) { - cerr << "AIPS exception in MSWriterImpl: " << x.getMesg() << endl; - exit(0); - } catch (...) { - cerr << "Unexpected MSWriter exception during addBand" << endl; - exit(0); - } - return res; -} - -int MSWriter::addField (double RA, double DEC) -{ - int res; - try { - res = itsWriter->addField (RA, DEC); - } catch (AipsError x) { - cerr << "AIPS exception in MSWriterImpl: " << x.getMesg() << endl; - exit(0); - } catch (...) { - cerr << "Unexpected MSWriter exception during addField" << endl; - exit(0); - } - return res; -} - -void MSWriter::write (int bandId, int fieldId, int channelId, - int nrChannels, int timeCounter, int nrdata, - const fcomplex* data, const bool* flags, - const float* weights) -{ - try { - itsWriter->write (bandId, fieldId, channelId, nrChannels, timeCounter, - nrdata, data, flags, weights); - } catch (AipsError x) { - cerr << "AIPS exception in MSWriterImpl: " << x.getMesg() << endl; - exit(0); - } catch (...) { - cerr << "Unexpected MSWriter exception during write" << endl; - exit(0); - } -} - -int MSWriter::nrAntennas() const - { return itsWriter->nrAntennas(); } - -int MSWriter::nrBands() const - { return itsWriter->nrBands(); } - -int MSWriter::nrFields() const - { return itsWriter->nrFields(); } - -int MSWriter::nrPolarizations() const - { return itsWriter->nrPolarizations(); } - -int MSWriter::nrTimes() const - { return itsWriter->nrTimes(); } + MSWriter::MSWriter (const char* msName, double startTime, double timeStep, + int nChan, int nPol, + uint nantennas, const vector<double>& antPos) + : itsWriter (0) + { + ASSERTSTR(antPos.size() == 3*nantennas, antPos.size() << " == " << 3*nantennas << + "Antenna position vector does not have the right size!"); + try { + itsWriter = new MSWriterImpl (msName, startTime, timeStep, nChan, nPol, + nantennas, + antPos); + } catch (AipsError x) { + cerr << "MSWriter exception: " << x.getMesg() << endl; + exit(0); + } catch (...) { + cerr << "Unexpected MSWriter exception while creating MSWriterImpl" << endl; + exit(0); + } + } + + MSWriter::~MSWriter() + { + delete itsWriter; + } + + int MSWriter::addBand (int npolarizations, int nchannels, + double refFreq, double chanWidth) + { + int res; + try { + res = itsWriter->addBand (npolarizations, nchannels, refFreq, chanWidth); + } catch (AipsError x) { + cerr << "AIPS exception in MSWriterImpl: " << x.getMesg() << endl; + exit(0); + } catch (...) { + cerr << "Unexpected MSWriter exception during addBand" << endl; + exit(0); + } + return res; + } + + int MSWriter::addBand (int npolarizations, int nchannels, + double refFreq, const double* chanFreqs, + const double* chanWidths) + { + int res; + try { + res = itsWriter->addBand (npolarizations, nchannels, refFreq, + chanFreqs, chanWidths); + } catch (AipsError x) { + cerr << "AIPS exception in MSWriterImpl: " << x.getMesg() << endl; + exit(0); + } catch (...) { + cerr << "Unexpected MSWriter exception during addBand" << endl; + exit(0); + } + return res; + } + + int MSWriter::addField (double RA, double DEC) + { + int res; + try { + res = itsWriter->addField (RA, DEC); + } catch (AipsError x) { + cerr << "AIPS exception in MSWriterImpl: " << x.getMesg() << endl; + exit(0); + } catch (...) { + cerr << "Unexpected MSWriter exception during addField" << endl; + exit(0); + } + return res; + } + + void MSWriter::write (int bandId, int fieldId, int channelId, + int nrChannels, int timeCounter, int nrdata, + const fcomplex* data, const bool* flags, + const float* weights) + { + try { + itsWriter->write (bandId, fieldId, channelId, nrChannels, timeCounter, + nrdata, data, flags, weights); + } catch (AipsError x) { + cerr << "AIPS exception in MSWriterImpl: " << x.getMesg() << endl; + exit(0); + } catch (...) { + cerr << "Unexpected MSWriter exception during write" << endl; + exit(0); + } + } + + int MSWriter::nrAntennas() const + { return itsWriter->nrAntennas(); } + + int MSWriter::nrBands() const + { return itsWriter->nrBands(); } + + int MSWriter::nrFields() const + { return itsWriter->nrFields(); } + + int MSWriter::nrPolarizations() const + { return itsWriter->nrPolarizations(); } + + int MSWriter::nrTimes() const + { return itsWriter->nrTimes(); } + + + } // namespace CS1 + +} // namespace LOFAR diff --git a/Appl/CEP/CS1/CS1_Storage/src/MSWriterImpl.cc b/Appl/CEP/CS1/CS1_Storage/src/MSWriterImpl.cc index a0a1ef9055c8963a85a2af2cb5aff3d09d89d988..a8a3b043c04d83eb2c40c8112a7bb38d09e6c6ec 100644 --- a/Appl/CEP/CS1/CS1_Storage/src/MSWriterImpl.cc +++ b/Appl/CEP/CS1/CS1_Storage/src/MSWriterImpl.cc @@ -1,26 +1,27 @@ -// MSWriterImpl.cc: implementation for filling a MeasurementSet -// -// Copyright (C) 2001 -// ASTRON (Netherlands Foundation for Research in Astronomy) -// P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, seg@astron.nl -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program 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 General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// $Id$ -// -////////////////////////////////////////////////////////////////////// +//# MSWriterImpl.cc: implementation for filling a MeasurementSet +//# +//# Copyright (C) 2001 +//# ASTRON (Netherlands Foundation for Research in Astronomy) +//# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, seg@astron.nl +//# +//# This program is free software; you can redistribute it and/or modify +//# it under the terms of the GNU General Public License as published by +//# the Free Software Foundation; either version 2 of the License, or +//# (at your option) any later version. +//# +//# This program 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 General Public License for more details. +//# +//# You should have received a copy of the GNU General Public License +//# along with this program; if not, write to the Free Software +//# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +//# +//# $Id$ + +// \file +// Implementation for filling a MeasurementSet #include <lofar_config.h> @@ -58,633 +59,633 @@ #include <casa/Arrays/Slicer.h> #include <Common/LofarLogger.h> -using namespace LOFAR; -using namespace casa; - -MSWriterImpl::MSWriterImpl (const char* msName, double startTime, double timeStep, - int nfreq, int ncorr, - int nantennas, const vector<double>& antPos) -: itsNrBand (0), - itsNrField (0), - itsNrAnt (nantennas), - itsNrFreq (nfreq), - itsNrCorr (ncorr), - itsNrTimes (0), - itsTimeStep (timeStep), - itsStartTime(MVEpoch(startTime).getTime().getValue("s")), - itsNrPol (0), - itsNrChan (0), - itsPolnr (0), - itsBaselines(0), - itsFrame (0), - itsMS (0), - itsMSCol (0) +namespace LOFAR { - AlwaysAssert (nantennas >= 0, AipsError); - // Get the position of Westerbork in WGS84. - MPosition arrayPosTmp; - AlwaysAssert (MeasTable::Observatory(arrayPosTmp, "WSRT"), AipsError); - itsArrayPos = new MPosition; - *itsArrayPos = MPosition::Convert (arrayPosTmp, MPosition::WGS84) (); - const MVPosition& arrayMVPos = itsArrayPos->getValue(); - itsArrayLon = arrayMVPos.getLong(); - double arrayLat = arrayMVPos.getLat(); - double arrayAlt = arrayMVPos.getLength("m").getValue(); - // Convert the relative antenna distances (in m) to long/lat. - // Note that 4.e7 meters = 360 degrees. - // Keep the antenna positions in ITRF coordinates. - Block<MPosition> antMPos(nantennas); - for (int i=0; i<nantennas; i++) { - double lat = arrayLat + antPos[3*i] / 4.e7 * 2 * C::pi; - double lon = itsArrayLon + antPos[3*i+1] / (std::cos(lat)*4.e7) * 2 * C::pi; - double alt = arrayAlt + antPos[3*i+2]; - MPosition mpos (MVPosition(alt, lon, lat), MPosition::WGS84); - antMPos[i] = MPosition::Convert (mpos, MPosition::ITRF) (); - } - // Create the MS. - createMS (msName, antMPos); - itsNrPol = new Block<Int>; - itsNrChan = new Block<Int>; - itsPolnr = new Block<Int>; - // Find the baselines in X,Y,Z. - itsBaselines = new Cube<double> (3, nantennas, nantennas); - Cube<double>& basel = *itsBaselines; - for (int i=0; i<nantennas; i++) { - const Vector<Double>& pos1 = antMPos[i].getValue().getValue(); - for (int j=0; j<nantennas; j++) { - const Vector<Double>& pos2 = antMPos[j].getValue().getValue(); - basel(0,i,j) = pos2(0) - pos1(0); - basel(1,i,j) = pos2(1) - pos1(1); - basel(2,i,j) = pos2(2) - pos1(2); + namespace CS1 + { + using namespace casa; + + MSWriterImpl::MSWriterImpl (const char* msName, double startTime, double timeStep, + int nfreq, int ncorr, + int nantennas, const vector<double>& antPos) + : itsNrBand (0), + itsNrField (0), + itsNrAnt (nantennas), + itsNrFreq (nfreq), + itsNrCorr (ncorr), + itsNrTimes (0), + itsTimeStep (timeStep), + itsStartTime(MVEpoch(startTime).getTime().getValue("s")), + itsNrPol (0), + itsNrChan (0), + itsPolnr (0), + itsBaselines(0), + itsFrame (0), + itsMS (0), + itsMSCol (0) + { + AlwaysAssert (nantennas >= 0, AipsError); + // Get the position of Westerbork in WGS84. + MPosition arrayPosTmp; + AlwaysAssert (MeasTable::Observatory(arrayPosTmp, "WSRT"), AipsError); + itsArrayPos = new MPosition; + *itsArrayPos = MPosition::Convert (arrayPosTmp, MPosition::WGS84) (); + const MVPosition& arrayMVPos = itsArrayPos->getValue(); + itsArrayLon = arrayMVPos.getLong(); + double arrayLat = arrayMVPos.getLat(); + double arrayAlt = arrayMVPos.getLength("m").getValue(); + // Convert the relative antenna distances (in m) to long/lat. + // Note that 4.e7 meters = 360 degrees. + // Keep the antenna positions in ITRF coordinates. + Block<MPosition> antMPos(nantennas); + for (int i=0; i<nantennas; i++) { + double lat = arrayLat + antPos[3*i] / 4.e7 * 2 * C::pi; + double lon = itsArrayLon + antPos[3*i+1] / (std::cos(lat)*4.e7) * 2 * C::pi; + double alt = arrayAlt + antPos[3*i+2]; + MPosition mpos (MVPosition(alt, lon, lat), MPosition::WGS84); + antMPos[i] = MPosition::Convert (mpos, MPosition::ITRF) (); + } + // Create the MS. + createMS (msName, antMPos); + itsNrPol = new Block<Int>; + itsNrChan = new Block<Int>; + itsPolnr = new Block<Int>; + // Find the baselines in X,Y,Z. + itsBaselines = new Cube<double> (3, nantennas, nantennas); + Cube<double>& basel = *itsBaselines; + for (int i=0; i<nantennas; i++) { + const Vector<Double>& pos1 = antMPos[i].getValue().getValue(); + for (int j=0; j<nantennas; j++) { + const Vector<Double>& pos2 = antMPos[j].getValue().getValue(); + basel(0,i,j) = pos2(0) - pos1(0); + basel(1,i,j) = pos2(1) - pos1(1); + basel(2,i,j) = pos2(2) - pos1(2); + } + } + // Make a frame for the calculation of apparent coordinates. + // Store position of array center in it. + itsFrame = new MeasFrame(*itsArrayPos); } - } - // Make a frame for the calculation of apparent coordinates. - // Store position of array center in it. - itsFrame = new MeasFrame(*itsArrayPos); -} - -MSWriterImpl::~MSWriterImpl() -{ - if (itsMS != 0) { - updateTimes(); - } - delete itsNrPol; - delete itsNrChan; - delete itsPolnr; - delete itsBaselines; - delete itsArrayPos; - delete itsFrame; - delete itsMSCol; - delete itsMS; -} - -int MSWriterImpl::nrPolarizations() const -{ - return itsMS->polarization().nrow(); -} - -void MSWriterImpl::createMS (const char* msName, - const Block<MPosition>& antPos) -{ - // Get the MS main default table description.. - TableDesc td = MS::requiredTableDesc(); - // Add the data column and its unit. - MS::addColumnToDesc(td, MS::DATA, 2); - td.rwColumnDesc(MS::columnName(MS::DATA)).rwKeywordSet(). - define("UNIT","Jy"); - MS::addColumnToDesc(td, MS::WEIGHT_SPECTRUM, 1); - -// // Store the data and flags using the TiledStMan. -// Vector<String> tsmNames(2); -// tsmNames(0) = MS::columnName(MS::DATA); -// tsmNames(1) = MS::columnName(MS::FLAG); -// td.defineHypercolumn("TiledData", 3, tsmNames); - - // Store the data and flags in two separate files using TiledColumnStMan. - // Also store UVW with TiledColumnStMan. - Vector<String> tsmNames(1); - tsmNames[0] = MS::columnName(MS::DATA); - td.rwColumnDesc(tsmNames[0]).setShape (IPosition(2,itsNrCorr,itsNrFreq)); - td.defineHypercolumn("TiledData", 3, tsmNames); - tsmNames[0] = MS::columnName(MS::FLAG); - td.rwColumnDesc(tsmNames[0]).setShape (IPosition(2,itsNrCorr,itsNrFreq)); - td.defineHypercolumn("TiledFlag", 3, tsmNames); - tsmNames[0] = MS::columnName(MS::UVW); - td.defineHypercolumn("TiledUVW", 2, tsmNames); - - - // Setup the new table. - // Most columns use the IncrStMan; some use others. - SetupNewTable newTab(msName, td, Table::New); - IncrementalStMan incrStMan("ISMData"); - StandardStMan stanStMan; - - -// TiledShapeStMan tiledStMan("TiledData", IPosition(3,4,16,512)); -// newTab.bindAll (incrStMan); -// newTab.bindColumn(MS::columnName(MS::ANTENNA1),stanStMan); -// newTab.bindColumn(MS::columnName(MS::ANTENNA2),stanStMan); -// newTab.bindColumn(MS::columnName(MS::DATA),tiledStMan); -// newTab.bindColumn(MS::columnName(MS::FLAG),tiledStMan); -// newTab.bindColumn(MS::columnName(MS::UVW),stanStMan); - - // Use a TiledColumnStMan for the data, flags and UVW. - // Store all pol and freq in a single tile. - // In this way the data appear in separate files that can be mmapped. - // Flags are stored as bits, so take care each tile has multiple of 8 flags. - TiledColumnStMan tiledData("TiledData", IPosition(3,itsNrCorr,itsNrFreq,1)); - TiledColumnStMan tiledFlag("TiledFlag", IPosition(3,itsNrCorr,itsNrFreq,8)); - TiledColumnStMan tiledUVW("TiledUVW", IPosition(3,128)); - newTab.bindAll (incrStMan); - newTab.bindColumn(MS::columnName(MS::ANTENNA1),stanStMan); - newTab.bindColumn(MS::columnName(MS::ANTENNA2),stanStMan); - newTab.bindColumn(MS::columnName(MS::DATA),tiledData); - newTab.bindColumn(MS::columnName(MS::FLAG),tiledFlag); - newTab.bindColumn(MS::columnName(MS::UVW),tiledUVW); - - - // Create the MS and its subtables. - // Get access to its columns. - itsMS = new MeasurementSet(newTab); - itsMSCol = new MSMainColumns(*itsMS); - // Create all subtables. - // Do this after the creation of optional subtables, - // so the MS will know about those optional sutables. - itsMS->createDefaultSubtables (Table::New); - // Fill various subtables. - fillAntenna (antPos); - fillFeed(); - fillProcessor(); - fillObservation(); - fillState(); - - // Find out which datamanagers contain DATA, FLAG and UVW. - // Create symlinks for them. - Record dminfo = itsMS->dataManagerInfo(); - for (uint i=0; i<dminfo.nfields(); ++i) { - const Record& dm = dminfo.subRecord(i); - String slname; - if (dm.asString("NAME") == "TiledData") { - slname = "/vis.dat"; - } else if (dm.asString("NAME") == "TiledFlag") { - slname = "/vis.flg"; - } else if (dm.asString("NAME") == "TiledUVW") { - slname = "/vis.uvw"; + MSWriterImpl::~MSWriterImpl() + { + if (itsMS != 0) { + updateTimes(); + } + delete itsNrPol; + delete itsNrChan; + delete itsPolnr; + delete itsBaselines; + delete itsArrayPos; + delete itsFrame; + delete itsMSCol; + delete itsMS; } - if (! slname.empty()) { - ostringstream ostr; - ostr << "table.f" << i << "_TSM0"; - SymLink sl(msName+slname); - sl.create (ostr.str()); + + int MSWriterImpl::nrPolarizations() const + { + return itsMS->polarization().nrow(); } - } - // Add weight_spectrum description -} + void MSWriterImpl::createMS (const char* msName, + const Block<MPosition>& antPos) + { + // Get the MS main default table description.. + TableDesc td = MS::requiredTableDesc(); + // Add the data column and its unit. + MS::addColumnToDesc(td, MS::DATA, 2); + td.rwColumnDesc(MS::columnName(MS::DATA)).rwKeywordSet(). + define("UNIT","Jy"); + MS::addColumnToDesc(td, MS::WEIGHT_SPECTRUM, 1); + + // // Store the data and flags using the TiledStMan. + // Vector<String> tsmNames(2); + // tsmNames(0) = MS::columnName(MS::DATA); + // tsmNames(1) = MS::columnName(MS::FLAG); + // td.defineHypercolumn("TiledData", 3, tsmNames); + + // Store the data and flags in two separate files using TiledColumnStMan. + // Also store UVW with TiledColumnStMan. + Vector<String> tsmNames(1); + tsmNames[0] = MS::columnName(MS::DATA); + td.rwColumnDesc(tsmNames[0]).setShape (IPosition(2,itsNrCorr,itsNrFreq)); + td.defineHypercolumn("TiledData", 3, tsmNames); + tsmNames[0] = MS::columnName(MS::FLAG); + td.rwColumnDesc(tsmNames[0]).setShape (IPosition(2,itsNrCorr,itsNrFreq)); + td.defineHypercolumn("TiledFlag", 3, tsmNames); + tsmNames[0] = MS::columnName(MS::UVW); + td.defineHypercolumn("TiledUVW", 2, tsmNames); + + + // Setup the new table. + // Most columns use the IncrStMan; some use others. + SetupNewTable newTab(msName, td, Table::New); + IncrementalStMan incrStMan("ISMData"); + StandardStMan stanStMan; + + + // TiledShapeStMan tiledStMan("TiledData", IPosition(3,4,16,512)); + // newTab.bindAll (incrStMan); + // newTab.bindColumn(MS::columnName(MS::ANTENNA1),stanStMan); + // newTab.bindColumn(MS::columnName(MS::ANTENNA2),stanStMan); + // newTab.bindColumn(MS::columnName(MS::DATA),tiledStMan); + // newTab.bindColumn(MS::columnName(MS::FLAG),tiledStMan); + // newTab.bindColumn(MS::columnName(MS::UVW),stanStMan); + + // Use a TiledColumnStMan for the data, flags and UVW. + // Store all pol and freq in a single tile. + // In this way the data appear in separate files that can be mmapped. + // Flags are stored as bits, so take care each tile has multiple of 8 flags. + TiledColumnStMan tiledData("TiledData", IPosition(3,itsNrCorr,itsNrFreq,1)); + TiledColumnStMan tiledFlag("TiledFlag", IPosition(3,itsNrCorr,itsNrFreq,8)); + TiledColumnStMan tiledUVW("TiledUVW", IPosition(3,128)); + newTab.bindAll (incrStMan); + newTab.bindColumn(MS::columnName(MS::ANTENNA1),stanStMan); + newTab.bindColumn(MS::columnName(MS::ANTENNA2),stanStMan); + newTab.bindColumn(MS::columnName(MS::DATA),tiledData); + newTab.bindColumn(MS::columnName(MS::FLAG),tiledFlag); + newTab.bindColumn(MS::columnName(MS::UVW),tiledUVW); + + + // Create the MS and its subtables. + // Get access to its columns. + itsMS = new MeasurementSet(newTab); + itsMSCol = new MSMainColumns(*itsMS); + // Create all subtables. + // Do this after the creation of optional subtables, + // so the MS will know about those optional sutables. + itsMS->createDefaultSubtables (Table::New); + // Fill various subtables. + fillAntenna (antPos); + fillFeed(); + fillProcessor(); + fillObservation(); + fillState(); + + // Find out which datamanagers contain DATA, FLAG and UVW. + // Create symlinks for them. + Record dminfo = itsMS->dataManagerInfo(); + for (uint i=0; i<dminfo.nfields(); ++i) { + const Record& dm = dminfo.subRecord(i); + String slname; + if (dm.asString("NAME") == "TiledData") { + slname = "/vis.dat"; + } else if (dm.asString("NAME") == "TiledFlag") { + slname = "/vis.flg"; + } else if (dm.asString("NAME") == "TiledUVW") { + slname = "/vis.uvw"; + } + if (! slname.empty()) { + ostringstream ostr; + ostr << "table.f" << i << "_TSM0"; + SymLink sl(msName+slname); + sl.create (ostr.str()); + } + } + + // Add weight_spectrum description -int MSWriterImpl::addBand (int npolarizations, int nchannels, - double refFreq, double chanWidth) -{ - AlwaysAssert (nchannels > 0, AipsError); - Vector<double> chanWidths(nchannels); - chanWidths = chanWidth; - Vector<double> chanFreqs(nchannels); - indgen (chanFreqs, refFreq - (nchannels-1)*chanWidth/2., chanWidth); - return addBand (npolarizations, nchannels, refFreq, chanFreqs, chanWidths); -} - -int MSWriterImpl::addBand (int npolarizations, int nchannels, - double refFreq, const double* chanFreqs, - const double* chanWidths) -{ - AlwaysAssert (nchannels > 0, AipsError); - IPosition shape(1, nchannels); - Vector<double> freqs (shape, const_cast<double*>(chanFreqs), SHARE); - Vector<double> widths(shape, const_cast<double*>(chanWidths), SHARE); - return addBand (npolarizations, nchannels, refFreq, freqs, widths); -} - -int MSWriterImpl::addBand (int npolarizations, int nchannels, - double refFreq, const Vector<double>& chanFreqs, - const Vector<double>& chanWidths) -{ - AlwaysAssert (npolarizations==1 || npolarizations==2 || npolarizations==4, - AipsError); - AlwaysAssert (nchannels > 0, AipsError); - // Find out if this nr of polarizations has already been given. - Int polnr = -1; - for (Int i=0; i<itsNrBand; i++) { - if (npolarizations == (*itsNrPol)[i]) { - polnr = (*itsPolnr)[i]; - break; } - } - // If not, add an entry to the POLARIZATION subtable. - if (polnr < 0) { - polnr = addPolarization (npolarizations); - } - // Add a row to the DATADESCRIPTION subtable. - MSDataDescription msdd = itsMS->dataDescription(); - MSDataDescColumns msddCol(msdd); - uInt rownr = msdd.nrow(); - msdd.addRow(); - msddCol.spectralWindowId().put (rownr, rownr); - msddCol.polarizationId().put (rownr, polnr); - msddCol.flagRow().put (rownr, False); - // Add a row to the SPECTRALWINDOW subtable. - // Find the total bandwidth from the minimum and maximum. - Vector<double> stFreqs = chanFreqs - chanWidths/2.; - Vector<double> endFreqs = chanFreqs + chanWidths/2.; - double totalBW = max(endFreqs) - min(stFreqs); - MSSpectralWindow msspw = itsMS->spectralWindow(); - MSSpWindowColumns msspwCol(msspw); - msspw.addRow(); - msspwCol.numChan().put (rownr, nchannels); - msspwCol.name().put (rownr, ""); - msspwCol.refFrequency().put (rownr, refFreq); - msspwCol.chanFreq().put (rownr, chanFreqs); - msspwCol.chanWidth().put (rownr, chanWidths); - msspwCol.measFreqRef().put (rownr, MFrequency::TOPO); - msspwCol.effectiveBW().put (rownr, chanWidths); - msspwCol.resolution().put (rownr, chanWidths); - msspwCol.totalBandwidth().put (rownr, totalBW); - msspwCol.netSideband().put (rownr, 0); - msspwCol.ifConvChain().put (rownr, 0); - msspwCol.freqGroup().put (rownr, 0); - msspwCol.freqGroupName().put (rownr, ""); - msspwCol.flagRow().put (rownr, False); - // Now add the band to the internal blocks. - itsNrBand++; - itsNrPol->resize (itsNrBand); - itsNrChan->resize (itsNrBand); - itsPolnr->resize (itsNrBand); - (*itsNrPol)[itsNrBand-1] = npolarizations; - (*itsNrChan)[itsNrBand-1] = nchannels; - (*itsPolnr)[itsNrBand-1] = polnr; - msspw.flush(); - msdd.flush(); - return itsNrBand-1; -} - -int MSWriterImpl::addPolarization (int npolarizations) -{ - MSPolarization mspol = itsMS->polarization(); - MSPolarizationColumns mspolCol(mspol); - uInt rownr = mspol.nrow(); - Vector<Int> corrType(npolarizations); - corrType(0) = Stokes::XX; - if (npolarizations == 2) { - corrType(1) = Stokes::YY; - } else if (npolarizations == 4) { - corrType(1) = Stokes::XY; - corrType(2) = Stokes::YX; - corrType(3) = Stokes::YY; - } - Matrix<Int> corrProduct(2, npolarizations); - for (Int i=0; i<npolarizations; i++) { - corrProduct(0,i) = Stokes::receptor1(Stokes::type(corrType(i))); - corrProduct(1,i) = Stokes::receptor2(Stokes::type(corrType(i))); - } - // Fill the columns. - mspol.addRow(); - mspolCol.numCorr().put (rownr, npolarizations); - mspolCol.corrType().put (rownr, corrType); - mspolCol.corrProduct().put (rownr, corrProduct); - mspolCol.flagRow().put (rownr, False); - mspol.flush(); - return rownr; -} - -int MSWriterImpl::addField (double RA, double DEC) -{ - MVDirection radec (Quantity(RA,"rad"), Quantity(DEC,"rad")); - MDirection indir(radec, MDirection::J2000); - Vector<MDirection> outdir(1); - outdir(0) = indir; - // Put the direction into the FIELD subtable. - { - MSField msfield = itsMS->field(); - MSFieldColumns msfieldCol(msfield); - uInt rownr = msfield.nrow(); - msfield.addRow(); - msfieldCol.name().put (rownr, "BEAM_" + String::toString(rownr)); - msfieldCol.code().put (rownr, ""); - msfieldCol.time().put (rownr, itsStartTime); - msfieldCol.numPoly().put (rownr, 1); - msfieldCol.delayDirMeasCol().put (rownr, outdir); - msfieldCol.phaseDirMeasCol().put (rownr, outdir); - msfieldCol.referenceDirMeasCol().put (rownr, outdir); - msfieldCol.sourceId().put (rownr, -1); - msfieldCol.flagRow().put (rownr, False); - } - // Put the direction for each antenna into the POINTING subtable. - { - MSPointing mspointing = itsMS->pointing(); - MSPointingColumns mspointingCol(mspointing); - uInt rownr = mspointing.nrow(); - mspointing.addRow(itsNrAnt); - for (Int i=0; i<itsNrAnt; i++) { - mspointingCol.antennaId().put (rownr, i); - mspointingCol.time().put (rownr, itsStartTime); - mspointingCol.interval().put (rownr, 0.); - mspointingCol.name().put (rownr, ""); - mspointingCol.numPoly().put (rownr, 1); - mspointingCol.timeOrigin().put (rownr, itsStartTime); - mspointingCol.directionMeasCol().put (rownr, outdir); - mspointingCol.targetMeasCol().put (rownr, outdir); - mspointingCol.tracking().put (rownr, True); - rownr++; + + int MSWriterImpl::addBand (int npolarizations, int nchannels, + double refFreq, double chanWidth) + { + AlwaysAssert (nchannels > 0, AipsError); + Vector<double> chanWidths(nchannels); + chanWidths = chanWidth; + Vector<double> chanFreqs(nchannels); + indgen (chanFreqs, refFreq - (nchannels-1)*chanWidth/2., chanWidth); + return addBand (npolarizations, nchannels, refFreq, chanFreqs, chanWidths); } - } - itsNrField++; - return itsNrField-1; -} -void MSWriterImpl::fillAntenna (const Block<MPosition>& antPos) -{ - // Determine constants for the ANTENNA subtable. - Vector<Double> antOffset(3); - antOffset = 0; - // Fill the ANTENNA subtable. - MSAntenna msant = itsMS->antenna(); - MSAntennaColumns msantCol(msant); - msant.addRow (itsNrAnt); - for (Int i=0; i<itsNrAnt; i++) { - msantCol.name().put (i, "ST_" + String::toString(i)); - msantCol.station().put (i, "LOFAR"); - msantCol.type().put (i, "GROUND-BASED"); - msantCol.mount().put (i, "ALT-AZ"); - msantCol.positionMeas().put (i, antPos[i]); - msantCol.offset().put (i, antOffset); - msantCol.dishDiameter().put (i, 150); - msantCol.flagRow().put (i, False); - } - msant.flush(); -} - -void MSWriterImpl::fillFeed() -{ - // Determine constants for the FEED subtable. - Int nRec = 2; - Matrix<Double> feedOffset(2,nRec); - feedOffset = 0; - Matrix<Complex> feedResponse(nRec,nRec); - feedResponse = Complex(0.0,0.0); - for (Int rec=0; rec<nRec; rec++) { - feedResponse(rec,rec) = Complex(1.0,0.0); - } - Vector<String> feedType(nRec); - feedType(0) = "X"; - feedType(1) = "Y"; - Vector<Double> feedPos(3); - feedPos = 0.0; - Vector<Double> feedAngle(nRec); - feedAngle = -C::pi_4; // 0 for parallel dipoles - // Fill the FEED subtable. - MSFeed msfeed = itsMS->feed(); - MSFeedColumns msfeedCol(msfeed); - msfeed.addRow (itsNrAnt); - for (Int i=0; i<itsNrAnt; i++) { - msfeedCol.antennaId().put (i, i); - msfeedCol.feedId().put (i, 0); - msfeedCol.spectralWindowId().put (i, -1); - msfeedCol.time().put (i, itsStartTime + itsNrTimes*itsTimeStep/2.); - msfeedCol.interval().put (i, itsNrTimes*itsTimeStep); - msfeedCol.beamId().put (i, -1); - msfeedCol.beamOffset().put (i, feedOffset); - msfeedCol.polarizationType().put (i, feedType); - msfeedCol.polResponse().put (i, feedResponse); - msfeedCol.position().put (i, feedPos); - msfeedCol.receptorAngle().put (i, feedAngle); - msfeedCol.numReceptors().put (i, 2); - } - msfeed.flush(); -} - -void MSWriterImpl::fillObservation() -{ - MSObservation msobs = itsMS->observation(); - MSObservationColumns msobsCol(msobs); - Vector<String> corrSchedule(1); - corrSchedule = "corrSchedule"; - Vector<Double> timeRange(2); - timeRange(0) = itsStartTime; - timeRange(1) = itsStartTime + itsNrTimes*itsTimeStep; - // Data is public one year after end of observation. - Double releaseDate = timeRange(1) + 365.25*24*60*60; - // Fill the columns - msobs.addRow(); - msobsCol.telescopeName().put (0, "LOFAR"); - msobsCol.timeRange().put (0, timeRange); - msobsCol.observer().put (0, "LofarSim"); - msobsCol.scheduleType().put (0, "LOFAR"); - msobsCol.schedule().put (0, corrSchedule); - msobsCol.project().put (0, "LofarSim"); - msobsCol.releaseDate().put (0, releaseDate); - msobsCol.flagRow().put (0, False); - msobs.flush(); -} - -void MSWriterImpl::fillProcessor() -{ - MSProcessor msproc = itsMS->processor(); - MSProcessorColumns msprocCol(msproc); - // Fill the columns - msproc.addRow(); - msprocCol.type().put (0, "CORRELATOR"); - msprocCol.subType().put (0, ""); - msprocCol.typeId().put (0, -1); - msprocCol.modeId().put (0, -1); - msprocCol.flagRow().put (0, False); - msproc.flush(); -} - -void MSWriterImpl::fillState() -{ - MSState msstate = itsMS->state(); - MSStateColumns msstateCol(msstate); - // Fill the columns - msstate.addRow(); - msstateCol.sig().put (0, True); - msstateCol.ref().put (0, False); - msstateCol.cal().put (0, 0.); - msstateCol.load().put (0, 0.); - msstateCol.subScan().put (0, 0); - msstateCol.obsMode().put (0, ""); - msstateCol.flagRow().put (0, False); - msstate.flush(); -} - -void MSWriterImpl::updateTimes() -{ - // Calculate the interval, end, and central time. - Double interval = itsNrTimes*itsTimeStep; - Double endTime = itsStartTime + interval; - Double midTime = (itsStartTime + endTime) / 2; - // Update all rows in FEED subtable. - { - MSFeed mssub = itsMS->feed(); - MSFeedColumns mssubCol(mssub); - Vector<Double> val(mssub.nrow()); - val = midTime; - mssubCol.time().putColumn (val); - val = interval; - mssubCol.interval().putColumn (val); - } - // Update all rows in POINTING subtable. - { - MSPointing mssub = itsMS->pointing(); - MSPointingColumns mssubCol(mssub); - Vector<Double> val(mssub.nrow()); - val = midTime; - mssubCol.time().putColumn (val); - val = interval; - mssubCol.interval().putColumn (val); - } - // Update all rows in OBSERVATION subtable. - { - MSObservation msobs = itsMS->observation(); - MSObservationColumns msobsCol(msobs); - Vector<Double> timeRange(2); - timeRange(0) = itsStartTime; - timeRange(1) = itsStartTime + itsNrTimes*itsTimeStep; - for (uInt i=0; i<msobs.nrow(); i++) { - msobsCol.timeRange().put (i, timeRange); + int MSWriterImpl::addBand (int npolarizations, int nchannels, + double refFreq, const double* chanFreqs, + const double* chanWidths) + { + AlwaysAssert (nchannels > 0, AipsError); + IPosition shape(1, nchannels); + Vector<double> freqs (shape, const_cast<double*>(chanFreqs), SHARE); + Vector<double> widths(shape, const_cast<double*>(chanWidths), SHARE); + return addBand (npolarizations, nchannels, refFreq, freqs, widths); } - } -} -void MSWriterImpl::write (int bandId, int fieldId, int channelId, - int nrChannels, int timeCounter, int nrdata, - const fcomplex* data, const bool* flags, - const float* weights) -{ - ASSERT(bandId >= 0 && bandId < itsNrBand); - ASSERT(fieldId >= 0 && fieldId < itsNrField); - ASSERT(data != 0); - if (timeCounter >= itsNrTimes) { - itsNrTimes = timeCounter+1; - } - // Find the shape of the data array in each table row. - IPosition shape(2, (*itsNrPol)[bandId], (*itsNrChan)[bandId]); - Int nrel = shape[0]; // == number of polarisations/correlations - ASSERTSTR (nrdata == nrel*nrChannels*itsNrAnt*(itsNrAnt+1)/2, - "incorrect nr of data points for this band; should be " + - String::toString(nrel*nrChannels*itsNrAnt*(itsNrAnt+1)/2)); - Array<Bool> defFlags(shape); - - int nrbasel = itsNrAnt*(itsNrAnt+1)/2; - - // Add the number of rows needed. - int rowNumber = itsMS->nrow(); - itsMS->addRow (nrbasel); - - // If first time, set the cache size for the tiled data and flags. - ROTiledStManAccessor accData(*itsMS, "TiledData"); - accData.setCacheSize (0, itsNrAnt*(itsNrAnt+1)/2); - //// accData.setCacheSize (0, 1); - ROTiledStManAccessor accFlag(*itsMS, "TiledFlag"); - accFlag.setCacheSize (0, itsNrAnt*(itsNrAnt+1)/2); - //// accFlag.setCacheSize (0, 1); - - defFlags = False; - Array<Float> sigma(IPosition(1, shape(0))); - sigma = 0; -// Array<Float> weight(IPosition(1, shape(0))); -// weight = 1; - Double time = itsStartTime + timeCounter*itsTimeStep; - // Calculate the apparent HA and DEC for the array center. - // First store time in frame. - Quantity qtime(time, "s"); - itsFrame->set (MEpoch(qtime, MEpoch::UTC)); - MDirection::Ref outref(MDirection::HADEC, *itsFrame); - MDirection outdir = MDirection::Convert (*itsArrayPos, outref) (); - Double ha = outdir.getAngle().getValue()(0); - Double dec = outdir.getAngle().getValue()(1); - Double sinha = std::sin(ha); - Double cosha = std::cos(ha); - Double sindec = std::sin(dec); - Double cosdec = std::cos(dec); - Vector<Double> uvw(3); - const Cube<Double>& basel = *itsBaselines; - - IPosition dShape(2, shape[0], nrChannels); // Shape of data field - IPosition wShape(1, nrChannels); // Shape of weight_spectrum field - - for (int i=0; i<itsNrAnt; i++) { - for (int j=0; j<=i; j++) { - uvw(0) = sinha*basel(0,i,j) + cosha*basel(1,i,j); - uvw(1) = -sindec*cosha*basel(0,i,j) + sindec*sinha*basel(1,i,j) + - cosdec*basel(2,i,j); - uvw(2) = cosdec*cosha*basel(0,i,j) - cosdec*sinha*basel(1,i,j) + - sindec*basel(2,i,j); - - itsMSCol->data().setShape(rowNumber, shape); - - itsMSCol->flagRow().put (rowNumber, False); - itsMSCol->time().put (rowNumber, time); - itsMSCol->antenna1().put (rowNumber, i); - itsMSCol->antenna2().put (rowNumber, j); - itsMSCol->feed1().put (rowNumber, 0); - itsMSCol->feed2().put (rowNumber, 0); - itsMSCol->dataDescId().put (rowNumber, bandId); - itsMSCol->processorId().put (rowNumber, 0); - itsMSCol->fieldId().put (rowNumber, fieldId); - itsMSCol->interval().put (rowNumber, itsTimeStep); - itsMSCol->exposure().put (rowNumber, itsTimeStep); - itsMSCol->timeCentroid().put (rowNumber, time); - itsMSCol->scanNumber().put (rowNumber, 0); - itsMSCol->arrayId().put (rowNumber, 0); - itsMSCol->observationId().put (rowNumber, 0); - itsMSCol->stateId().put (rowNumber, 0); - itsMSCol->uvw().put (rowNumber, uvw); - // itsMSCol->weight().put (rowNumber, weight); - itsMSCol->sigma().put (rowNumber, sigma); - - try - { - // Write all polarisations and nrChannels for each baseline. - // The input data array has shape nrant,nrant,nchan(subs),npol. - // So we can form an AIPS++ array for each baseline. - Array<Complex> dataArray(dShape, (Complex*)data, SHARE); - IPosition start(2, 0, channelId); - IPosition leng(2, shape[0], nrChannels); - itsMSCol->data().putSlice(rowNumber, Slicer(start, leng), dataArray); + int MSWriterImpl::addBand (int npolarizations, int nchannels, + double refFreq, const Vector<double>& chanFreqs, + const Vector<double>& chanWidths) + { + AlwaysAssert (npolarizations==1 || npolarizations==2 || npolarizations==4, + AipsError); + AlwaysAssert (nchannels > 0, AipsError); + // Find out if this nr of polarizations has already been given. + Int polnr = -1; + for (Int i=0; i<itsNrBand; i++) { + if (npolarizations == (*itsNrPol)[i]) { + polnr = (*itsPolnr)[i]; + break; + } } - catch (AipsError& e) - { - cout << "AipsError in writing data: " << e.what() << endl; + // If not, add an entry to the POLARIZATION subtable. + if (polnr < 0) { + polnr = addPolarization (npolarizations); } - // Write flags - if (flags == 0) { - itsMSCol->flag().put(rowNumber, defFlags); - } else { - Array<Bool> flagArray(dShape, const_cast<Bool*>(flags), SHARE); - IPosition start(2, 0, channelId); // Start position - IPosition leng(2, shape[0], nrChannels); // Length: ncorr, nchan - itsMSCol->flag().putSlice(rowNumber, Slicer(start, leng), flagArray); + // Add a row to the DATADESCRIPTION subtable. + MSDataDescription msdd = itsMS->dataDescription(); + MSDataDescColumns msddCol(msdd); + uInt rownr = msdd.nrow(); + msdd.addRow(); + msddCol.spectralWindowId().put (rownr, rownr); + msddCol.polarizationId().put (rownr, polnr); + msddCol.flagRow().put (rownr, False); + // Add a row to the SPECTRALWINDOW subtable. + // Find the total bandwidth from the minimum and maximum. + Vector<double> stFreqs = chanFreqs - chanWidths/2.; + Vector<double> endFreqs = chanFreqs + chanWidths/2.; + double totalBW = max(endFreqs) - min(stFreqs); + MSSpectralWindow msspw = itsMS->spectralWindow(); + MSSpWindowColumns msspwCol(msspw); + msspw.addRow(); + msspwCol.numChan().put (rownr, nchannels); + msspwCol.name().put (rownr, ""); + msspwCol.refFrequency().put (rownr, refFreq); + msspwCol.chanFreq().put (rownr, chanFreqs); + msspwCol.chanWidth().put (rownr, chanWidths); + msspwCol.measFreqRef().put (rownr, MFrequency::TOPO); + msspwCol.effectiveBW().put (rownr, chanWidths); + msspwCol.resolution().put (rownr, chanWidths); + msspwCol.totalBandwidth().put (rownr, totalBW); + msspwCol.netSideband().put (rownr, 0); + msspwCol.ifConvChain().put (rownr, 0); + msspwCol.freqGroup().put (rownr, 0); + msspwCol.freqGroupName().put (rownr, ""); + msspwCol.flagRow().put (rownr, False); + // Now add the band to the internal blocks. + itsNrBand++; + itsNrPol->resize (itsNrBand); + itsNrChan->resize (itsNrBand); + itsPolnr->resize (itsNrBand); + (*itsNrPol)[itsNrBand-1] = npolarizations; + (*itsNrChan)[itsNrBand-1] = nchannels; + (*itsPolnr)[itsNrBand-1] = polnr; + msspw.flush(); + msdd.flush(); + return itsNrBand-1; + } + + int MSWriterImpl::addPolarization (int npolarizations) + { + MSPolarization mspol = itsMS->polarization(); + MSPolarizationColumns mspolCol(mspol); + uInt rownr = mspol.nrow(); + Vector<Int> corrType(npolarizations); + corrType(0) = Stokes::XX; + if (npolarizations == 2) { + corrType(1) = Stokes::YY; + } else if (npolarizations == 4) { + corrType(1) = Stokes::XY; + corrType(2) = Stokes::YX; + corrType(3) = Stokes::YY; } - data += nrel*nrChannels; // Go to next baseline data - if (flags != 0) { - flags += nrel*nrChannels; + Matrix<Int> corrProduct(2, npolarizations); + for (Int i=0; i<npolarizations; i++) { + corrProduct(0,i) = Stokes::receptor1(Stokes::type(corrType(i))); + corrProduct(1,i) = Stokes::receptor2(Stokes::type(corrType(i))); } + // Fill the columns. + mspol.addRow(); + mspolCol.numCorr().put (rownr, npolarizations); + mspolCol.corrType().put (rownr, corrType); + mspolCol.corrProduct().put (rownr, corrProduct); + mspolCol.flagRow().put (rownr, False); + mspol.flush(); + return rownr; + } - // Write weights - Array<float> weightArray(wShape, (Float*)weights, SHARE); - itsMSCol->weightSpectrum().put(rowNumber, weightArray); + int MSWriterImpl::addField (double RA, double DEC) + { + MVDirection radec (Quantity(RA,"rad"), Quantity(DEC,"rad")); + MDirection indir(radec, MDirection::J2000); + Vector<MDirection> outdir(1); + outdir(0) = indir; + // Put the direction into the FIELD subtable. + { + MSField msfield = itsMS->field(); + MSFieldColumns msfieldCol(msfield); + uInt rownr = msfield.nrow(); + msfield.addRow(); + msfieldCol.name().put (rownr, "BEAM_" + String::toString(rownr)); + msfieldCol.code().put (rownr, ""); + msfieldCol.time().put (rownr, itsStartTime); + msfieldCol.numPoly().put (rownr, 1); + msfieldCol.delayDirMeasCol().put (rownr, outdir); + msfieldCol.phaseDirMeasCol().put (rownr, outdir); + msfieldCol.referenceDirMeasCol().put (rownr, outdir); + msfieldCol.sourceId().put (rownr, -1); + msfieldCol.flagRow().put (rownr, False); + } + // Put the direction for each antenna into the POINTING subtable. + { + MSPointing mspointing = itsMS->pointing(); + MSPointingColumns mspointingCol(mspointing); + uInt rownr = mspointing.nrow(); + mspointing.addRow(itsNrAnt); + for (Int i=0; i<itsNrAnt; i++) { + mspointingCol.antennaId().put (rownr, i); + mspointingCol.time().put (rownr, itsStartTime); + mspointingCol.interval().put (rownr, 0.); + mspointingCol.name().put (rownr, ""); + mspointingCol.numPoly().put (rownr, 1); + mspointingCol.timeOrigin().put (rownr, itsStartTime); + mspointingCol.directionMeasCol().put (rownr, outdir); + mspointingCol.targetMeasCol().put (rownr, outdir); + mspointingCol.tracking().put (rownr, True); + rownr++; + } + } + itsNrField++; + return itsNrField-1; + } - weights += nrChannels; + void MSWriterImpl::fillAntenna (const Block<MPosition>& antPos) + { + // Determine constants for the ANTENNA subtable. + Vector<Double> antOffset(3); + antOffset = 0; + // Fill the ANTENNA subtable. + MSAntenna msant = itsMS->antenna(); + MSAntennaColumns msantCol(msant); + msant.addRow (itsNrAnt); + for (Int i=0; i<itsNrAnt; i++) { + msantCol.name().put (i, "ST_" + String::toString(i)); + msantCol.station().put (i, "LOFAR"); + msantCol.type().put (i, "GROUND-BASED"); + msantCol.mount().put (i, "ALT-AZ"); + msantCol.positionMeas().put (i, antPos[i]); + msantCol.offset().put (i, antOffset); + msantCol.dishDiameter().put (i, 150); + msantCol.flagRow().put (i, False); + } + msant.flush(); + } - rowNumber++; + void MSWriterImpl::fillFeed() + { + // Determine constants for the FEED subtable. + Int nRec = 2; + Matrix<Double> feedOffset(2,nRec); + feedOffset = 0; + Matrix<Complex> feedResponse(nRec,nRec); + feedResponse = Complex(0.0,0.0); + for (Int rec=0; rec<nRec; rec++) { + feedResponse(rec,rec) = Complex(1.0,0.0); + } + Vector<String> feedType(nRec); + feedType(0) = "X"; + feedType(1) = "Y"; + Vector<Double> feedPos(3); + feedPos = 0.0; + Vector<Double> feedAngle(nRec); + feedAngle = -C::pi_4; // 0 for parallel dipoles + // Fill the FEED subtable. + MSFeed msfeed = itsMS->feed(); + MSFeedColumns msfeedCol(msfeed); + msfeed.addRow (itsNrAnt); + for (Int i=0; i<itsNrAnt; i++) { + msfeedCol.antennaId().put (i, i); + msfeedCol.feedId().put (i, 0); + msfeedCol.spectralWindowId().put (i, -1); + msfeedCol.time().put (i, itsStartTime + itsNrTimes*itsTimeStep/2.); + msfeedCol.interval().put (i, itsNrTimes*itsTimeStep); + msfeedCol.beamId().put (i, -1); + msfeedCol.beamOffset().put (i, feedOffset); + msfeedCol.polarizationType().put (i, feedType); + msfeedCol.polResponse().put (i, feedResponse); + msfeedCol.position().put (i, feedPos); + msfeedCol.receptorAngle().put (i, feedAngle); + msfeedCol.numReceptors().put (i, 2); + } + msfeed.flush(); } - } + void MSWriterImpl::fillObservation() + { + MSObservation msobs = itsMS->observation(); + MSObservationColumns msobsCol(msobs); + Vector<String> corrSchedule(1); + corrSchedule = "corrSchedule"; + Vector<Double> timeRange(2); + timeRange(0) = itsStartTime; + timeRange(1) = itsStartTime + itsNrTimes*itsTimeStep; + // Data is public one year after end of observation. + Double releaseDate = timeRange(1) + 365.25*24*60*60; + // Fill the columns + msobs.addRow(); + msobsCol.telescopeName().put (0, "LOFAR"); + msobsCol.timeRange().put (0, timeRange); + msobsCol.observer().put (0, "LofarSim"); + msobsCol.scheduleType().put (0, "LOFAR"); + msobsCol.schedule().put (0, corrSchedule); + msobsCol.project().put (0, "LofarSim"); + msobsCol.releaseDate().put (0, releaseDate); + msobsCol.flagRow().put (0, False); + msobs.flush(); + } + void MSWriterImpl::fillProcessor() + { + MSProcessor msproc = itsMS->processor(); + MSProcessorColumns msprocCol(msproc); + // Fill the columns + msproc.addRow(); + msprocCol.type().put (0, "CORRELATOR"); + msprocCol.subType().put (0, ""); + msprocCol.typeId().put (0, -1); + msprocCol.modeId().put (0, -1); + msprocCol.flagRow().put (0, False); + msproc.flush(); + } + void MSWriterImpl::fillState() + { + MSState msstate = itsMS->state(); + MSStateColumns msstateCol(msstate); + // Fill the columns + msstate.addRow(); + msstateCol.sig().put (0, True); + msstateCol.ref().put (0, False); + msstateCol.cal().put (0, 0.); + msstateCol.load().put (0, 0.); + msstateCol.subScan().put (0, 0); + msstateCol.obsMode().put (0, ""); + msstateCol.flagRow().put (0, False); + msstate.flush(); + } -} + void MSWriterImpl::updateTimes() + { + // Calculate the interval, end, and central time. + Double interval = itsNrTimes*itsTimeStep; + Double endTime = itsStartTime + interval; + Double midTime = (itsStartTime + endTime) / 2; + // Update all rows in FEED subtable. + { + MSFeed mssub = itsMS->feed(); + MSFeedColumns mssubCol(mssub); + Vector<Double> val(mssub.nrow()); + val = midTime; + mssubCol.time().putColumn (val); + val = interval; + mssubCol.interval().putColumn (val); + } + // Update all rows in POINTING subtable. + { + MSPointing mssub = itsMS->pointing(); + MSPointingColumns mssubCol(mssub); + Vector<Double> val(mssub.nrow()); + val = midTime; + mssubCol.time().putColumn (val); + val = interval; + mssubCol.interval().putColumn (val); + } + // Update all rows in OBSERVATION subtable. + { + MSObservation msobs = itsMS->observation(); + MSObservationColumns msobsCol(msobs); + Vector<Double> timeRange(2); + timeRange(0) = itsStartTime; + timeRange(1) = itsStartTime + itsNrTimes*itsTimeStep; + for (uInt i=0; i<msobs.nrow(); i++) { + msobsCol.timeRange().put (i, timeRange); + } + } + } + void MSWriterImpl::write (int bandId, int fieldId, int channelId, + int nrChannels, int timeCounter, int nrdata, + const fcomplex* data, const bool* flags, + const float* weights) + { + ASSERT(bandId >= 0 && bandId < itsNrBand); + ASSERT(fieldId >= 0 && fieldId < itsNrField); + ASSERT(data != 0); + if (timeCounter >= itsNrTimes) { + itsNrTimes = timeCounter+1; + } + // Find the shape of the data array in each table row. + IPosition shape(2, (*itsNrPol)[bandId], (*itsNrChan)[bandId]); + Int nrel = shape[0]; // == number of polarisations/correlations + ASSERTSTR (nrdata == nrel*nrChannels*itsNrAnt*(itsNrAnt+1)/2, + "incorrect nr of data points for this band; should be " + + String::toString(nrel*nrChannels*itsNrAnt*(itsNrAnt+1)/2)); + Array<Bool> defFlags(shape); + + int nrbasel = itsNrAnt*(itsNrAnt+1)/2; + + // Add the number of rows needed. + int rowNumber = itsMS->nrow(); + itsMS->addRow (nrbasel); + + // If first time, set the cache size for the tiled data and flags. + ROTiledStManAccessor accData(*itsMS, "TiledData"); + accData.setCacheSize (0, itsNrAnt*(itsNrAnt+1)/2); + //// accData.setCacheSize (0, 1); + ROTiledStManAccessor accFlag(*itsMS, "TiledFlag"); + accFlag.setCacheSize (0, itsNrAnt*(itsNrAnt+1)/2); + //// accFlag.setCacheSize (0, 1); + + defFlags = False; + Array<Float> sigma(IPosition(1, shape(0))); + sigma = 0; + // Array<Float> weight(IPosition(1, shape(0))); + // weight = 1; + Double time = itsStartTime + timeCounter*itsTimeStep; + // Calculate the apparent HA and DEC for the array center. + // First store time in frame. + Quantity qtime(time, "s"); + itsFrame->set (MEpoch(qtime, MEpoch::UTC)); + MDirection::Ref outref(MDirection::HADEC, *itsFrame); + MDirection outdir = MDirection::Convert (*itsArrayPos, outref) (); + Double ha = outdir.getAngle().getValue()(0); + Double dec = outdir.getAngle().getValue()(1); + Double sinha = std::sin(ha); + Double cosha = std::cos(ha); + Double sindec = std::sin(dec); + Double cosdec = std::cos(dec); + Vector<Double> uvw(3); + const Cube<Double>& basel = *itsBaselines; + + IPosition dShape(2, shape[0], nrChannels); // Shape of data field + IPosition wShape(1, nrChannels); // Shape of weight_spectrum field + + for (int i=0; i<itsNrAnt; i++) { + for (int j=0; j<=i; j++) { + uvw(0) = sinha*basel(0,i,j) + cosha*basel(1,i,j); + uvw(1) = -sindec*cosha*basel(0,i,j) + sindec*sinha*basel(1,i,j) + + cosdec*basel(2,i,j); + uvw(2) = cosdec*cosha*basel(0,i,j) - cosdec*sinha*basel(1,i,j) + + sindec*basel(2,i,j); + + itsMSCol->data().setShape(rowNumber, shape); + + itsMSCol->flagRow().put (rowNumber, False); + itsMSCol->time().put (rowNumber, time); + itsMSCol->antenna1().put (rowNumber, i); + itsMSCol->antenna2().put (rowNumber, j); + itsMSCol->feed1().put (rowNumber, 0); + itsMSCol->feed2().put (rowNumber, 0); + itsMSCol->dataDescId().put (rowNumber, bandId); + itsMSCol->processorId().put (rowNumber, 0); + itsMSCol->fieldId().put (rowNumber, fieldId); + itsMSCol->interval().put (rowNumber, itsTimeStep); + itsMSCol->exposure().put (rowNumber, itsTimeStep); + itsMSCol->timeCentroid().put (rowNumber, time); + itsMSCol->scanNumber().put (rowNumber, 0); + itsMSCol->arrayId().put (rowNumber, 0); + itsMSCol->observationId().put (rowNumber, 0); + itsMSCol->stateId().put (rowNumber, 0); + itsMSCol->uvw().put (rowNumber, uvw); + // itsMSCol->weight().put (rowNumber, weight); + itsMSCol->sigma().put (rowNumber, sigma); + + try + { + // Write all polarisations and nrChannels for each baseline. + // The input data array has shape nrant,nrant,nchan(subs),npol. + // So we can form an AIPS++ array for each baseline. + Array<Complex> dataArray(dShape, (Complex*)data, SHARE); + IPosition start(2, 0, channelId); + IPosition leng(2, shape[0], nrChannels); + itsMSCol->data().putSlice(rowNumber, Slicer(start, leng), dataArray); + } + catch (AipsError& e) + { + cout << "AipsError in writing data: " << e.what() << endl; + } + // Write flags + if (flags == 0) { + itsMSCol->flag().put(rowNumber, defFlags); + } else { + Array<Bool> flagArray(dShape, const_cast<Bool*>(flags), SHARE); + IPosition start(2, 0, channelId); // Start position + IPosition leng(2, shape[0], nrChannels); // Length: ncorr, nchan + itsMSCol->flag().putSlice(rowNumber, Slicer(start, leng), flagArray); + } + data += nrel*nrChannels; // Go to next baseline data + if (flags != 0) { + flags += nrel*nrChannels; + } + + // Write weights + Array<float> weightArray(wShape, (Float*)weights, SHARE); + itsMSCol->weightSpectrum().put(rowNumber, weightArray); + + weights += nrChannels; + + rowNumber++; + } + } + } + } // namespace CS1 +} // namespace LOFAR diff --git a/Appl/CEP/CS1/CS1_Storage/src/Makefile.am b/Appl/CEP/CS1/CS1_Storage/src/Makefile.am index dc5a6c19c19c036146d71870a14adfa269a67334..ba8639345860c89d7d3e8412a13840301628c8a1 100644 --- a/Appl/CEP/CS1/CS1_Storage/src/Makefile.am +++ b/Appl/CEP/CS1/CS1_Storage/src/Makefile.am @@ -1,47 +1,20 @@ -# if HAVE_SHMEM -# SUBDIRS = shmem . -# endif +lib_LTLIBRARIES = libcs1_storage.la -lib_LTLIBRARIES = libcs1_storage.la +libcs1_storage_la_SOURCES = AH_Storage.cc \ + WH_SubbandWriter.cc \ + MSWriter.cc \ + MSWriterImpl.cc -libcs1_storage_la_SOURCES = +bin_PROGRAMS = CS1_Storage -# AM_YFLAGS = -d -p KeyParse -# AM_LFLAGS = -PKeyTokenize -# LEX_OUTPUT_ROOT = lex.KeyTokenize +CS1_Storage_SOURCES = CS1_Storage_main.cc +CS1_Storage_LDADD = ../src/libcs1_storage.la +CS1_Storage_DEPENDENCIES = ../src/libcs1_storage.la $(LOFAR_DEPEND) -# if HAVE_SHMEM -# libcs1_storage_la_LIBADD = shmem/libshmem.la -# endif - -bin_PROGRAMS = CS1_Storage - -# Lines to build a program prg -#prg_SOURCES = prg.cc -#prg_LDADD = libcs1_storage.la -#prg_DEPENDENCIES = libcs1_storage.la $(LOFAR_DEPEND) - -CS1_Storage_SOURCES = \ -CS1_Storage_main.cc \ -AH_Storage.cc \ -WH_SubbandWriter.cc \ -MSWriter.cc \ -MSWriterImpl.cc - -glishdir = $(libexecdir)/glish -dist_glish_SCRIPTS = - -pythondir = $(bindir) -dist_python_SCRIPTS = - -scriptdir = $(bindir) -dist_script_SCRIPTS = - -configfilesdir=$(bindir) -configfiles_DATA = \ -CS1_Storage.machinefile \ -CS1_Storage.log_prop \ -typeStruct_TTeraFlopCorrelator.dpl \ -PropertyInterface.conf +configfilesdir = $(bindir) +configfiles_DATA = CS1_Storage.machinefile \ + CS1_Storage.log_prop \ + typeStruct_TTeraFlopCorrelator.dpl \ + PropertyInterface.conf include $(top_srcdir)/Makefile.common diff --git a/Appl/CEP/CS1/CS1_Storage/src/WH_SubbandWriter.cc b/Appl/CEP/CS1/CS1_Storage/src/WH_SubbandWriter.cc index 8c81b16312e2bc17ba302be6cef94be829c0a63e..2fce1a382df6b6480691b49c5b1801eb786dbc0d 100644 --- a/Appl/CEP/CS1/CS1_Storage/src/WH_SubbandWriter.cc +++ b/Appl/CEP/CS1/CS1_Storage/src/WH_SubbandWriter.cc @@ -37,197 +37,204 @@ #include <GCF/GCF_PVString.h> #endif -using namespace LOFAR; - -WH_SubbandWriter::WH_SubbandWriter(const string& name, int subbandID, - const ACC::APS::ParameterSet& pset) - : WorkHolder (pset.getInt32("BGLProc.SlavesPerSubband"), - 0, - name, - "WH_SubbandWriter"), - itsSubbandID (subbandID), - itsPS (pset), - itsWriter (0), - itsBandId (-1), - itsTimeCounter(0), - itsFlagsBuffer(0), - itsWeightsBuffer(0), - itsWriteTimer ("writing-MS") -#ifdef USE_MAC_PI - ,itsPropertySet(0) -#endif +namespace LOFAR { + namespace CS1 + { + WH_SubbandWriter::WH_SubbandWriter(const string& name, int subbandID, + const ACC::APS::ParameterSet& pset) + : WorkHolder (pset.getInt32("BGLProc.SlavesPerSubband"), + 0, + name, + "WH_SubbandWriter"), + itsSubbandID (subbandID), + itsPS (pset), + itsWriter (0), + itsBandId (-1), + itsTimeCounter(0), + itsFlagsBuffer(0), + itsWeightsBuffer(0), + itsWriteTimer ("writing-MS") #ifdef USE_MAC_PI - itsWriteToMAC = itsPS.getBool("Storage.WriteToMAC"); + ,itsPropertySet(0) #endif - itsNStations = itsPS.getInt32("Observation.NStations"); - itsNBaselines = itsNStations * (itsNStations +1)/2; - itsNChannels = itsPS.getInt32("Observation.NChannels"); - itsNInputsPerSubband = itsNinputs; - int pols = itsPS.getInt32("Observation.NPolarisations"); - itsNPolSquared = pols*pols; - - int nrSamples = itsPS.getInt32("Observation.NSubbandSamples"); - itsWeightFactor = (float)itsNChannels/(float)nrSamples; // The inverse of maximum number of valid samples - - vector<double> refFreqs= itsPS.getDoubleVector("Observation.RefFreqs"); - unsigned nrSubbands = itsPS.getUint32("Observation.NSubbands"); - ASSERTSTR(refFreqs.size() >= nrSubbands, "Wrong number of refFreqs specified!"); + { - itsNVisibilities = itsNBaselines * itsNChannels * itsNPolSquared; - - char str[32]; - for (int i=0; i<itsNinputs; i++) { - sprintf(str, "DH_in_%d", i); - getDataManager().addInDataHolder(i, new DH_Visibilities(str, pset)); - } - - // Set a round robin input selector - getDataManager().setInputSelector(new Sel_RoundRobin(itsNinputs)); - } - -WH_SubbandWriter::~WH_SubbandWriter() -{ - delete itsWriter; #ifdef USE_MAC_PI - delete itsPropertySet; + itsWriteToMAC = itsPS.getBool("Storage.WriteToMAC"); +#endif + itsNStations = itsPS.getInt32("Observation.NStations"); + itsNBaselines = itsNStations * (itsNStations +1)/2; + itsNChannels = itsPS.getInt32("Observation.NChannels"); + itsNInputsPerSubband = itsNinputs; + int pols = itsPS.getInt32("Observation.NPolarisations"); + itsNPolSquared = pols*pols; + + int nrSamples = itsPS.getInt32("Observation.NSubbandSamples"); + itsWeightFactor = (float)itsNChannels/(float)nrSamples; // The inverse of maximum number of valid samples + + vector<double> refFreqs= itsPS.getDoubleVector("Observation.RefFreqs"); + unsigned nrSubbands = itsPS.getUint32("Observation.NSubbands"); + ASSERTSTR(refFreqs.size() >= nrSubbands, "Wrong number of refFreqs specified!"); + + itsNVisibilities = itsNBaselines * itsNChannels * itsNPolSquared; + + char str[32]; + for (int i=0; i<itsNinputs; i++) { + sprintf(str, "DH_in_%d", i); + getDataManager().addInDataHolder(i, new DH_Visibilities(str, pset)); + } + + // Set a round robin input selector + getDataManager().setInputSelector(new Sel_RoundRobin(itsNinputs)); + } + + WH_SubbandWriter::~WH_SubbandWriter() + { + delete itsWriter; +#ifdef USE_MAC_PI + delete itsPropertySet; - GCF::Common::GCFPValueArray::iterator it; - for (it = itsVArray.begin(); it != itsVArray.end(); it++){ - delete *it; - } - itsVArray.clear(); + GCF::Common::GCFPValueArray::iterator it; + for (it = itsVArray.begin(); it != itsVArray.end(); it++){ + delete *it; + } + itsVArray.clear(); #endif -} + } -WorkHolder* WH_SubbandWriter::construct(const string& name, int subbandID, - const ACC::APS::ParameterSet& pset) -{ - return new WH_SubbandWriter(name, subbandID, pset); -} + WorkHolder* WH_SubbandWriter::construct(const string& name, int subbandID, + const ACC::APS::ParameterSet& pset) + { + return new WH_SubbandWriter(name, subbandID, pset); + } -WH_SubbandWriter* WH_SubbandWriter::make(const string& name) -{ - return new WH_SubbandWriter(name, itsSubbandID, itsPS); -} + WH_SubbandWriter* WH_SubbandWriter::make(const string& name) + { + return new WH_SubbandWriter(name, itsSubbandID, itsPS); + } -void WH_SubbandWriter::preprocess() { - LOG_TRACE_FLOW("WH_SubbandWriter enabling PropertySet"); + void WH_SubbandWriter::preprocess() { + LOG_TRACE_FLOW("WH_SubbandWriter enabling PropertySet"); #ifdef USE_MAC_PI - if (itsWriteToMAC) { - itsPropertySet = new GCF::CEPPMLlight::CEPPropertySet("CEP_TFCD", "TTeraFlopCorrelator", GCF::Common::PS_CAT_PERMANENT); - itsPropertySet->enable(); - LOG_TRACE_FLOW("WH_SubbandWriter PropertySet enabled"); - } else { - LOG_TRACE_FLOW("WH_SubbandWriter PropertySet not enabled"); - }; + if (itsWriteToMAC) { + itsPropertySet = new GCF::CEPPMLlight::CEPPropertySet("CEP_TFCD", "TTeraFlopCorrelator", GCF::Common::PS_CAT_PERMANENT); + itsPropertySet->enable(); + LOG_TRACE_FLOW("WH_SubbandWriter PropertySet enabled"); + } else { + LOG_TRACE_FLOW("WH_SubbandWriter PropertySet not enabled"); + }; #endif - // create MSWriter object - string msName = itsPS.getString("Storage.MSName"); - double startTime = itsPS.getDouble("Observation.StartTime"); - double timeStep = itsPS.getDouble("Observation.SampleRate") * itsPS.getDouble("Observation.NSubbandSamples"); - vector<double> antPos = itsPS.getDoubleVector("Observation.StationPositions"); - - for (int i = antPos.size(); i < 3 * itsNStations; i++) { - antPos.push_back(1); - } - - itsWriter = new MSWriter(msName.c_str(), startTime, timeStep, itsNChannels, - itsNPolSquared, itsNStations, antPos); - - double chanWidth = itsPS.getDouble("Observation.ChanWidth"); - vector<double> refFreqs= itsPS.getDoubleVector("Observation.RefFreqs"); - // Add the subband - itsBandId = itsWriter->addBand (itsNPolSquared, itsNChannels, - refFreqs[itsSubbandID], chanWidth); - vector<double> beamDirections = itsPS.getDoubleVector("Observation.BeamDirections"); - double RA = beamDirections[0]; - double DEC = beamDirections[1]; - // For nr of beams - itsFieldId = itsWriter->addField (RA, DEC); - - // Allocate buffers - itsFlagsBuffer = new bool[itsNVisibilities]; - itsWeightsBuffer = new float[itsNBaselines * itsNChannels]; + // create MSWriter object + string msName = itsPS.getString("Storage.MSName"); + double startTime = itsPS.getDouble("Observation.StartTime"); + double timeStep = itsPS.getDouble("Observation.SampleRate") * itsPS.getDouble("Observation.NSubbandSamples"); + vector<double> antPos = itsPS.getDoubleVector("Observation.StationPositions"); + + for (int i = antPos.size(); i < 3 * itsNStations; i++) { + antPos.push_back(1); + } + + itsWriter = new MSWriter(msName.c_str(), startTime, timeStep, itsNChannels, + itsNPolSquared, itsNStations, antPos); + + double chanWidth = itsPS.getDouble("Observation.ChanWidth"); + vector<double> refFreqs= itsPS.getDoubleVector("Observation.RefFreqs"); + // Add the subband + itsBandId = itsWriter->addBand (itsNPolSquared, itsNChannels, + refFreqs[itsSubbandID], chanWidth); + vector<double> beamDirections = itsPS.getDoubleVector("Observation.BeamDirections"); + double RA = beamDirections[0]; + double DEC = beamDirections[1]; + // For nr of beams + itsFieldId = itsWriter->addField (RA, DEC); + + // Allocate buffers + itsFlagsBuffer = new bool[itsNVisibilities]; + itsWeightsBuffer = new float[itsNBaselines * itsNChannels]; #if 0 - memset(itsFlagsBuffer, 0, itsNVisibilities * sizeof(bool)); - for (int j=0; j < itsNBaselines*itsNChannels; j++) - { - itsWeightsBuffer[j] = 1; - } + memset(itsFlagsBuffer, 0, itsNVisibilities * sizeof(bool)); + for (int j=0; j < itsNBaselines*itsNChannels; j++) + { + itsWeightsBuffer[j] = 1; + } #endif -} + } -void WH_SubbandWriter::process() -{ - // Select the next input - DH_Visibilities* inputDH = (DH_Visibilities*)getDataManager().selectInHolder(); + void WH_SubbandWriter::process() + { + // Select the next input + DH_Visibilities* inputDH = (DH_Visibilities*)getDataManager().selectInHolder(); - // Write 1 DH_Visibilities of size fcomplex[nbaselines][nsubbandchannesl][npol][npol] - itsWriteTimer.start(); + // Write 1 DH_Visibilities of size fcomplex[nbaselines][nsubbandchannesl][npol][npol] + itsWriteTimer.start(); - DH_Visibilities::NrValidSamplesType *valSamples = &inputDH->getNrValidSamples(0, 0); - - for (int i = 0; i < itsNBaselines * itsNChannels; i ++) { - itsWeightsBuffer[i] = itsWeightFactor * valSamples[i]; - bool flagged = valSamples[i] == 0; - itsFlagsBuffer[4 * i ] = flagged; - itsFlagsBuffer[4 * i + 1] = flagged; - itsFlagsBuffer[4 * i + 2] = flagged; - itsFlagsBuffer[4 * i + 3] = flagged; - } + DH_Visibilities::NrValidSamplesType *valSamples = &inputDH->getNrValidSamples(0, 0); + + for (int i = 0; i < itsNBaselines * itsNChannels; i ++) { + itsWeightsBuffer[i] = itsWeightFactor * valSamples[i]; + bool flagged = valSamples[i] == 0; + itsFlagsBuffer[4 * i ] = flagged; + itsFlagsBuffer[4 * i + 1] = flagged; + itsFlagsBuffer[4 * i + 2] = flagged; + itsFlagsBuffer[4 * i + 3] = flagged; + } - itsWriter->write (itsBandId, itsFieldId, 0, itsNChannels, - itsTimeCounter, itsNVisibilities, - &inputDH->getVisibility(0, 0, 0, 0), - itsFlagsBuffer, itsWeightsBuffer); + itsWriter->write (itsBandId, itsFieldId, 0, itsNChannels, + itsTimeCounter, itsNVisibilities, + &inputDH->getVisibility(0, 0, 0, 0), + itsFlagsBuffer, itsWeightsBuffer); - itsWriteTimer.stop(); + itsWriteTimer.stop(); - itsTimeCounter++; + itsTimeCounter++; #ifdef USE_MAC_PI -// if (itsWriteToMAC) { -// DBGASSERTSTR(itsPropertySet != 0, "no propertySet constructed yet"); -// LOG_TRACE_FLOW("WH_SubbandWriter setting properties"); -// GCF::Common::GCFPValueArray::iterator it; -// for (it = itsVArray.begin(); it != itsVArray.end(); it++){ -// delete *it; -// } -// itsVArray.clear(); + // if (itsWriteToMAC) { + // DBGASSERTSTR(itsPropertySet != 0, "no propertySet constructed yet"); + // LOG_TRACE_FLOW("WH_SubbandWriter setting properties"); + // GCF::Common::GCFPValueArray::iterator it; + // for (it = itsVArray.begin(); it != itsVArray.end(); it++){ + // delete *it; + // } + // itsVArray.clear(); -// // loop over values -// for (int i=0; i<itsNinputs; i++) { -// inputDH = (DH_VisArray*)getDataManager().getInHolder(i); -// // loop over channels -// for (uint ch = 0; ch < inputDH->getNumVis(); ch++) -// { -// // loop over baselines -// for (int s1 = 0; s1 < itsNstations; s1++) { -// for (int s2 = 0; s2 <= s1; s2++) { -// for (int p = 0; p < itsNpolSquared; p++) { -// itsVArray.push_back(new GCF::Common::GCFPVDouble((double)*inputDH->getBufferElement(ch, s1, s2, p))); -// } -// } -// } -// } -// } - -// (*itsPropertySet)["data"].setValue(GCF::Common::GCFPVDynArr(GCF::Common::LPT_DOUBLE, itsVArray)); -// (*itsPropertySet)["subband"].setValue(GCF::Common::GCFPVString("1")); -// LOG_TRACE_FLOW("WH_SubbandWriter properties set"); -// }; + // // loop over values + // for (int i=0; i<itsNinputs; i++) { + // inputDH = (DH_VisArray*)getDataManager().getInHolder(i); + // // loop over channels + // for (uint ch = 0; ch < inputDH->getNumVis(); ch++) + // { + // // loop over baselines + // for (int s1 = 0; s1 < itsNstations; s1++) { + // for (int s2 = 0; s2 <= s1; s2++) { + // for (int p = 0; p < itsNpolSquared; p++) { + // itsVArray.push_back(new GCF::Common::GCFPVDouble((double)*inputDH->getBufferElement(ch, s1, s2, p))); + // } + // } + // } + // } + // } + + // (*itsPropertySet)["data"].setValue(GCF::Common::GCFPVDynArr(GCF::Common::LPT_DOUBLE, itsVArray)); + // (*itsPropertySet)["subband"].setValue(GCF::Common::GCFPVString("1")); + // LOG_TRACE_FLOW("WH_SubbandWriter properties set"); + // }; #endif -} + } + + void WH_SubbandWriter::postprocess() { + delete [] itsFlagsBuffer; + delete [] itsWeightsBuffer; + itsFlagsBuffer = 0; + itsWeightsBuffer = 0; + cout<<itsWriteTimer<<endl; + } + + } // namespace CS1 -void WH_SubbandWriter::postprocess() { - delete [] itsFlagsBuffer; - delete [] itsWeightsBuffer; - itsFlagsBuffer = 0; - itsWeightsBuffer = 0; - cout<<itsWriteTimer<<endl; -} +} // namespace LOFAR diff --git a/Appl/CEP/CS1/CS1_Storage/test/AH_TestStorage.cc b/Appl/CEP/CS1/CS1_Storage/test/AH_TestStorage.cc new file mode 100644 index 0000000000000000000000000000000000000000..d2e214fc8b6919d065190b81f7f369601f6636a5 --- /dev/null +++ b/Appl/CEP/CS1/CS1_Storage/test/AH_TestStorage.cc @@ -0,0 +1,152 @@ +//# tAH_TestStorage.cc: +//# +//# Copyright (C) 2002-2005 +//# ASTRON (Netherlands Foundation for Research in Astronomy) +//# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, seg@astron.nl +//# +//# This program is free software; you can redistribute it and/or modify +//# it under the terms of the GNU General Public License as published by +//# the Free Software Foundation; either version 2 of the License, or +//# (at your option) any later version. +//# +//# This program 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 General Public License for more details. +//# +//# You should have received a copy of the GNU General Public License +//# along with this program; if not, write to the Free Software +//# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +//# +//# $Id$ + +//# Always #include <lofar_config.h> first! +#include <lofar_config.h> + +#include "AH_TestStorage.h" +#include <Common/LofarLogger.h> +#include <CEPFrame/Step.h> +#include <Transport/TH_Mem.h> +#include <CS1_Storage/WH_SubbandWriter.h> +#include <CS1_Interface/DH_Visibilities.h> + +namespace LOFAR +{ + namespace CS1 + { + + AH_TestStorage::AH_TestStorage() + { + } + + AH_TestStorage::~AH_TestStorage() { + undefine(); + } + + void AH_TestStorage::define(const KeyValueMap&) { + + LOG_TRACE_FLOW_STR("Start of tAH_Storage::define()"); + + LOG_TRACE_FLOW_STR("Create the top-level composite"); + Composite comp(0, 0, "topComposite"); + setComposite(comp); // tell the ApplicationHolder this is the top-level composite + + int nrSubbands = itsParamSet.getInt32("Observation.NSubbands"); + + for (int subb=0; subb< nrSubbands; subb++) + { + WH_SubbandWriter wh("storage1", subb, itsParamSet); + Step step(wh); + comp.addBlock(step); + + for (int nr=0; nr < step.getNrInputs(); nr++) + { + DH_Visibilities* inDH = new DH_Visibilities("in_"+nr, itsParamSet); + itsInDHs.push_back(inDH); + + Connection* inConn = new Connection("in_"+nr, + inDH, + step.getInDataManager(nr).getGeneralInHolder(nr), + new TH_Mem(), + false); + itsInConns.push_back(inConn); + step.getInDataManager(nr).setInConnection(nr, inConn); + } + + } + + LOG_TRACE_FLOW_STR("Finished define()"); + + } + + void AH_TestStorage::setTestPattern(DH_Visibilities &dh, int factor) { + unsigned nrPolarizations = itsParamSet.getUint32("Observation.NPolarisations"); + unsigned nrChannels = itsParamSet.getUint32("Observation.NChannels"); + unsigned nrStations = itsParamSet.getUint32("Observation.NStations"); + unsigned nrBaselines = (nrStations + 1) * nrStations / 2; + + for (unsigned bl = 0; bl < nrBaselines; bl++) { + for (unsigned ch = 0; ch < nrChannels; ch++) { + // Set number of valid samples + dh.getNrValidSamples(bl, ch) = bl * ch; + + // Set visibilities + for (unsigned pol1 = 0; pol1 < nrPolarizations; pol1 ++) { + for (unsigned pol2 = 0; pol2 < nrPolarizations; pol2 ++) { + dh.getVisibility(bl, ch, pol1, pol2) = makefcomplex(bl + ch, factor * (pol1 + pol2)); + } + } + } + } + } + + void AH_TestStorage::prerun() { + getComposite().preprocess(); + + // Fill inDHs here + for (uint i = 0; i < itsInDHs.size(); i++) + { + itsInDHs[i]->init(); + setTestPattern(*itsInDHs[i], i); + } + } + + void AH_TestStorage::run(int nsteps) { + + for (int i = 0; i < nsteps; i++) { + for (uint nrInp = 0; nrInp < itsInConns.size(); nrInp++) + { + itsInConns[nrInp]->write(); + } + + LOG_TRACE_LOOP_STR("processing run " << i ); + cout<<"run "<<i+1<<" of "<<nsteps<<endl; + getComposite().process(); + + } + } + + void AH_TestStorage::postrun() { + // check outresult here + // do an assert or exit(1) if results are not correct + + } + + void AH_TestStorage::undefine() { + for (uint i = 0; i < itsInDHs.size(); i++) + { + delete itsInDHs[i]; + delete itsInConns[i]; + } + itsInDHs.clear(); + itsInConns.clear(); + } + + void AH_TestStorage::quit() { + } + + } // namespace CS1 + +} // namespace LOFAR + + diff --git a/Appl/CEP/CS1/CS1_Storage/test/tAH_TestStorage.h b/Appl/CEP/CS1/CS1_Storage/test/AH_TestStorage.h similarity index 60% rename from Appl/CEP/CS1/CS1_Storage/test/tAH_TestStorage.h rename to Appl/CEP/CS1/CS1_Storage/test/AH_TestStorage.h index 92a6d64b3d3fe48b2ae54787ecdc8194df273aa1..0f3bc3471df46de031a10684a94bedf46714a990 100644 --- a/Appl/CEP/CS1/CS1_Storage/test/tAH_TestStorage.h +++ b/Appl/CEP/CS1/CS1_Storage/test/AH_TestStorage.h @@ -20,39 +20,43 @@ //# //# $Id$ -#ifndef CS1_TAH_TESTSTORAGE_H -#define CS1_TAH_TESTSTORAGE_H +#ifndef LOFAR_CS1_AH_TESTSTORAGE_H +#define LOFAR_CS1_AH_TESTSTORAGE_H #include <CEPFrame/ApplicationHolder.h> -#include <tinyCEP/WorkHolder.h> -#include <Blob/KeyValueMap.h> -#include <Transport/Connection.h> -#include <Transport/TransportHolder.h> -#include <Transport/DataHolder.h> namespace LOFAR { - class DH_Visibilities; + //# Forward declarations + class KeyValueMap; + class Connection; - class AH_TestStorage: public LOFAR::ApplicationHolder { + namespace CS1 + { + class DH_Visibilities; - public: - AH_TestStorage(); - virtual ~AH_TestStorage(); + class AH_TestStorage: public LOFAR::ApplicationHolder + { + public: + AH_TestStorage(); + virtual ~AH_TestStorage(); - virtual void define (const KeyValueMap& kvm); - void undefine(); - virtual void prerun(); - virtual void run(int nsteps); - virtual void postrun(); - virtual void quit(); + virtual void define (const KeyValueMap& kvm); + void undefine(); + virtual void prerun(); + virtual void run(int nsteps); + virtual void postrun(); + virtual void quit(); - private: - void setTestPattern(DH_Visibilities &, int factor); + private: + void setTestPattern(DH_Visibilities &, int factor); + + vector<DH_Visibilities*> itsInDHs; + vector<Connection*> itsInConns; + }; + + } // namespace CS1 - vector<DH_Visibilities*> itsInDHs; - vector<Connection*> itsInConns; - }; } // namespace LOFAR #endif diff --git a/Appl/CEP/CS1/CS1_Storage/test/Makefile.am b/Appl/CEP/CS1/CS1_Storage/test/Makefile.am index 35debc93386b504a0ad13af38231e134c556e755..5db448b2825c3874ca66896644a19bf137a60255 100644 --- a/Appl/CEP/CS1/CS1_Storage/test/Makefile.am +++ b/Appl/CEP/CS1/CS1_Storage/test/Makefile.am @@ -15,16 +15,10 @@ XFAIL_TESTS = # all files (.run, .stdout, .in, .log_prop, etc.) needed to run tests EXTRA_DIST = $(TESTSCRIPTS) -# Lines to build a test program testprg -#testprg_SOURCES = testprg.cc -#testprg_LDADD = ../src/libcs1_storage.la -#testprg_DEPENDENCIES = ../src/libcs1_storage.la $(LOFAR_DEPEND) - -tAH_TestStorage_SOURCES = \ -tAH_TestStorage.cc \ -../src/WH_SubbandWriter.cc \ -../src/MSWriter.cc \ -../src/MSWriterImpl.cc +tAH_TestStorage_SOURCES = tAH_TestStorage.cc \ + AH_TestStorage.h AH_TestStorage.cc +tAH_TestStorage_LDADD = ../src/libcs1_storage.la +tAH_TestStorage_DEPENDENCIES = ../src/libcs1_storage.la $(LOFAR_DEPEND) TESTS_ENVIRONMENT = lofar_sharedir=$(lofar_sharedir) \ srcdir=$(srcdir) \ diff --git a/Appl/CEP/CS1/CS1_Storage/test/tAH_TestStorage.cc b/Appl/CEP/CS1/CS1_Storage/test/tAH_TestStorage.cc index a7137e776fa70cb77f692a18c4ad2ccb2898c883..7d74ab5c4b62abf1845b48bd68c46635fa20e01e 100644 --- a/Appl/CEP/CS1/CS1_Storage/test/tAH_TestStorage.cc +++ b/Appl/CEP/CS1/CS1_Storage/test/tAH_TestStorage.cc @@ -23,130 +23,16 @@ //# Always #include <lofar_config.h> first! #include <lofar_config.h> +#include "AH_TestStorage.h" #include <Common/LofarLogger.h> #include <APS/ParameterSet.h> -#include <tAH_TestStorage.h> #include <CEPFrame/Step.h> #include <Transport/TH_Mem.h> #include <CS1_Storage/WH_SubbandWriter.h> #include <CS1_Interface/DH_Visibilities.h> -namespace LOFAR -{ - - AH_TestStorage::AH_TestStorage() - { - } - - AH_TestStorage::~AH_TestStorage() { - undefine(); - } - - void AH_TestStorage::define(const KeyValueMap&) { - - LOG_TRACE_FLOW_STR("Start of tAH_Storage::define()"); - - LOG_TRACE_FLOW_STR("Create the top-level composite"); - Composite comp(0, 0, "topComposite"); - setComposite(comp); // tell the ApplicationHolder this is the top-level composite - - int nrSubbands = itsParamSet.getInt32("Observation.NSubbands"); - - for (int subb=0; subb< nrSubbands; subb++) - { - WH_SubbandWriter wh("storage1", subb, itsParamSet); - Step step(wh); - comp.addBlock(step); - - for (int nr=0; nr < step.getNrInputs(); nr++) - { - DH_Visibilities* inDH = new DH_Visibilities("in_"+nr, itsParamSet); - itsInDHs.push_back(inDH); - - Connection* inConn = new Connection("in_"+nr, - inDH, - step.getInDataManager(nr).getGeneralInHolder(nr), - new TH_Mem(), - false); - itsInConns.push_back(inConn); - step.getInDataManager(nr).setInConnection(nr, inConn); - } - - } - - LOG_TRACE_FLOW_STR("Finished define()"); - - } - - void AH_TestStorage::setTestPattern(DH_Visibilities &dh, int factor) { - unsigned nrPolarizations = itsParamSet.getUint32("Observation.NPolarisations"); - unsigned nrChannels = itsParamSet.getUint32("Observation.NChannels"); - unsigned nrStations = itsParamSet.getUint32("Observation.NStations"); - unsigned nrBaselines = (nrStations + 1) * nrStations / 2; - - for (unsigned bl = 0; bl < nrBaselines; bl++) { - for (unsigned ch = 0; ch < nrChannels; ch++) { - // Set number of valid samples - dh.getNrValidSamples(bl, ch) = bl * ch; - - // Set visibilities - for (unsigned pol1 = 0; pol1 < nrPolarizations; pol1 ++) { - for (unsigned pol2 = 0; pol2 < nrPolarizations; pol2 ++) { - dh.getVisibility(bl, ch, pol1, pol2) = makefcomplex(bl + ch, factor * (pol1 + pol2)); - } - } - } - } - } - - void AH_TestStorage::prerun() { - getComposite().preprocess(); - - // Fill inDHs here - for (uint i = 0; i < itsInDHs.size(); i++) - { - itsInDHs[i]->init(); - setTestPattern(*itsInDHs[i], i); - } - } - - void AH_TestStorage::run(int nsteps) { - - for (int i = 0; i < nsteps; i++) { - for (uint nrInp = 0; nrInp < itsInConns.size(); nrInp++) - { - itsInConns[nrInp]->write(); - } - - LOG_TRACE_LOOP_STR("processing run " << i ); - cout<<"run "<<i+1<<" of "<<nsteps<<endl; - getComposite().process(); - - } - } - - void AH_TestStorage::postrun() { - // check outresult here - // do an assert or exit(1) if results are not correct - - } - - void AH_TestStorage::undefine() { - for (uint i = 0; i < itsInDHs.size(); i++) - { - delete itsInDHs[i]; - delete itsInConns[i]; - } - itsInDHs.clear(); - itsInConns.clear(); - } - - void AH_TestStorage::quit() { - } - -} // namespace LOFAR - using namespace LOFAR; +using namespace LOFAR::CS1; int main (int argc, const char** argv){ INIT_LOGGER("TestStorage"); @@ -163,7 +49,7 @@ int main (int argc, const char** argv){ test.basePostrun(); test.baseQuit(); - } catch (LOFAR::Exception e) { + } catch (LOFAR::Exception& e) { cerr << "Caught exception: "<< e.what() << endl; exit(1); } catch (...) {