LCOV - code coverage report
Current view: top level - msvis/MSVis - GroupProcessor.cc (source / functions) Hit Total Coverage
Test: casacpp_coverage.info Lines: 0 39 0.0 %
Date: 2024-10-10 15:00:01 Functions: 0 4 0.0 %

          Line data    Source code
       1             : //# GroupProcessor.cc: Step through the Measurement Set by groups of VisBuffers.
       2             : //# Copyright (C) 2011
       3             : //# Associated Universities, Inc. Washington DC, USA.
       4             : //#
       5             : //# This library is free software; you can redistribute it and/or modify it
       6             : //# under the terms of the GNU Library General Public License as published by
       7             : //# the Free Software Foundation; either version 2 of the License, or (at your
       8             : //# option) any later version.
       9             : //#
      10             : //# This library is distributed in the hope that it will be useful, but WITHOUT
      11             : //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
      12             : //# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public
      13             : //# License for more details.
      14             : //#
      15             : //# You should have received a copy of the GNU Library General Public License
      16             : //# along with this library; if not, write to the Free Software Foundation,
      17             : //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
      18             : //#
      19             : //# Correspondence concerning AIPS++ should be addressed as follows:
      20             : //#        Internet email: casa-feedback@nrao.edu.
      21             : //#        Postal address: AIPS++ Project Office
      22             : //#                        National Radio Astronomy Observatory
      23             : //#                        520 Edgemont Road
      24             : //#                        Charlottesville, VA 22903-2475 USA
      25             : 
      26             : #include <msvis/MSVis/GroupProcessor.h>
      27             : #include <msvis/MSVis/VisBuffGroup.h>
      28             : #include <casacore/casa/Exceptions/Error.h>
      29             : #include <casacore/casa/Logging/LogIO.h>
      30             : #include <casacore/casa/System/ProgressMeter.h>
      31             : 
      32             : using namespace casacore;
      33             : namespace casa {
      34             : 
      35           0 : GroupProcessor::GroupProcessor(ROVisibilityIterator& vi, GroupWorkerBase *gw,
      36           0 :                                Double groupInterval) :
      37           0 :   vi_p(vi),
      38           0 :   gw_p(gw),
      39           0 :   groupInterval_p(groupInterval),
      40           0 :   tvi_debug(False)
      41             : {
      42           0 : }
      43             : 
      44             : // GroupProcessor& GroupProcessor::operator=(const GroupProcessor &other)
      45             : // {
      46             : //   // trivial so far.
      47             : //   vi_p = other.vi_p;
      48             : //   return *this;
      49             : // }
      50             : 
      51           0 : void GroupProcessor::setGroupOrigin()
      52             : {
      53             :   // cerr << "Starting new group" << endl;
      54           0 :   vi_p.origin();
      55           0 :   vi_p.time(timev_p);
      56           0 :   groupStart_p = timev_p[0];
      57           0 : }
      58             : 
      59           0 : Bool GroupProcessor::groupHasMore()
      60             : {
      61           0 :   Bool answer = false;
      62           0 :   if(vi_p.moreChunks()){
      63           0 :     vi_p.time(timev_p);
      64           0 :     answer = abs(timev_p[0] - groupStart_p) <= groupInterval_p;
      65             :   }
      66           0 :   return answer;
      67             : }
      68             : 
      69           0 : Bool GroupProcessor::go()
      70             : {
      71           0 :   VisBuffer vb(vi_p);
      72             : 
      73             :   // Process the MS(es) chunk by chunk.
      74           0 :   uInt ninrows = vi_p.numberCoh();      // Apparently this accounts for selection.
      75             :   ProgressMeter meter(0.0, ninrows * 1.0, "GroupProcessor", "rows processed", "", "",
      76           0 :                       true, 1);
      77           0 :   uInt inrowsdone = 0;  // only for the meter.
      78           0 :   vi_p.originChunks();
      79           0 :   while(vi_p.moreChunks()){
      80           0 :     VisBuffGroup vbg;
      81             : 
      82           0 :     for(setGroupOrigin(); groupHasMore(); vi_p.nextChunk()){
      83           0 :       for(vi_p.origin(); vi_p.more(); ++vi_p){
      84           0 :         vb.fetch(gw_p->prefetchColumns());
      85             :         // cerr << "     " << vb.rowIds()[0] << "          " << (vb.time()[0] - 4.65136e9)
      86             :         //     << "         " << vb.spectralWindow() << endl;
      87             : 
      88             :         // jagonzal: Without this call the baselines corresponding to the
      89             :         // first time stamp of each chunk are skipped.
      90             :         // This does not happen with VI/VB2 which is used by the TVI framework
      91             :         // Also VisibilityIteratorReadImpl::update_rowIds seems to be extremely slow (see CAS-8882)
      92           0 :         if (tvi_debug) vb.rowIds();
      93             : 
      94           0 :         vbg.store(vb);
      95             :       }
      96           0 :       vbg.endChunk();                   // Record the end of a chunk.
      97           0 :       inrowsdone += vi_p.nRowChunk();
      98             :     }
      99           0 :     if(!gw_p->process(vbg))
     100           0 :       return false;
     101           0 :     meter.update(inrowsdone);
     102           0 :   }
     103           0 :   return true;
     104           0 : }
     105             : 
     106             : using namespace casacore;
     107             : } // end namespace casa

Generated by: LCOV version 1.16