LCOV - code coverage report
Current view: top level - msvis/MSVis - GroupWorker.cc (source / functions) Hit Total Coverage
Test: ctest_coverage.info Lines: 0 55 0.0 %
Date: 2023-11-06 10:06:49 Functions: 0 4 0.0 %

          Line data    Source code
       1             : //# GroupWorker.cc: Partial implementation for base classes of objects that
       2             : //# process VisBuffGroups as fed to them by GroupProcessor.
       3             : //# Copyright (C) 2011
       4             : //# Associated Universities, Inc. Washington DC, USA.
       5             : //#
       6             : //# This library is free software; you can redistribute it and/or modify it
       7             : //# under the terms of the GNU Library General Public License as published by
       8             : //# the Free Software Foundation; either version 2 of the License, or (at your
       9             : //# option) any later version.
      10             : //#
      11             : //# This library is distributed in the hope that it will be useful, but WITHOUT
      12             : //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
      13             : //# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public
      14             : //# License for more details.
      15             : //#
      16             : //# You should have received a copy of the GNU Library General Public License
      17             : //# along with this library; if not, write to the Free Software Foundation,
      18             : //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
      19             : //#
      20             : //# Correspondence concerning AIPS++ should be addressed as follows:
      21             : //#        Internet email: aips2-request@nrao.edu.
      22             : //#        Postal address: AIPS++ Project Office
      23             : //#                        National Radio Astronomy Observatory
      24             : //#                        520 Edgemont Road
      25             : //#                        Charlottesville, VA 22903-2475 USA
      26             : //#
      27             : 
      28             : #include <msvis/MSVis/GroupWorker.h>
      29             : #include <msvis/MSVis/VisBufferComponents.h>
      30             : #include <msvis/MSVis/VisBuffer.h>
      31             : #include <msvis/MSVis/VBRemapper.h>
      32             : #include <casacore/ms/MeasurementSets/MSColumns.h>
      33             : //#include <casa/Exceptions/Error.h>
      34             : //#include <casa/Logging/LogIO.h>
      35             : 
      36             : using namespace casacore;
      37             : namespace casa {
      38             : 
      39           0 : const asyncio::PrefetchColumns *GroupWorkerBase::prefetchColumns() const
      40             : {
      41           0 :   return &prefetchColumns_p;
      42             : }
      43             : 
      44           0 : GroupWorker::GroupWorker(const ROVisibilityIterator& invi) :
      45           0 :   invi_p(invi)
      46             : {
      47             :   // Necessary (or at least a good idea) before the invi calls while
      48             :   // initializing outvi_p.
      49           0 :   invi_p.originChunks();
      50           0 :   invi_p.origin();
      51             : 
      52           0 :   outvi_p = VisibilityIterator(const_cast<MeasurementSet&>(invi.ms()),
      53             :                                invi.getSortColumns(), false,
      54           0 :                                invi.getInterval());
      55             : 
      56             :   // Consistency.
      57           0 :   outvi_p.originChunks();
      58           0 :   outvi_p.origin();
      59           0 : }
      60             : 
      61             : // GroupWorker& GroupWorker::operator=(const GroupWorker &other)
      62             : // {
      63             : //   // trivial so far.
      64             : //   vi_p = other.vi_p;
      65             : //   return *this;
      66             : // }
      67             : 
      68           0 : GroupWriteToNewMS::GroupWriteToNewMS(MeasurementSet& outms, MSColumns *msc,
      69           0 :                                      const VBRemapper& remapper) :
      70             :   outms_p(outms),
      71             :   msc_p(msc),
      72             :   remapper_p(remapper),
      73           0 :   rowsdone_p(0)
      74             : {
      75           0 : }
      76             : 
      77           0 : uInt GroupWriteToNewMS::write(MeasurementSet& outms, MSColumns *msc, VisBuffer& vb,
      78             :                               uInt rowsdone, const VBRemapper& remapper, const Bool doFC,
      79             :                               const Bool doFloat, const Bool doSpWeight)
      80             : {
      81           0 :   uInt rowsnow = vb.nRow();
      82           0 :   RefRows rowstoadd(rowsdone, rowsdone + rowsnow - 1);
      83             : 
      84           0 :   outms.addRow(rowsnow);
      85           0 :   remapper.remap(vb, rowsdone == 0);
      86             : 
      87           0 :   msc->antenna1().putColumnCells(rowstoadd, vb.antenna1());
      88           0 :   msc->antenna2().putColumnCells(rowstoadd, vb.antenna2());
      89           0 :   Vector<Int> arrID(rowsnow);
      90           0 :   arrID.set(vb.arrayId());
      91           0 :   msc->arrayId().putColumnCells(rowstoadd, arrID);
      92           0 :   msc->data().putColumnCells(rowstoadd, vb.visCube());
      93           0 :   if(doFloat)
      94           0 :     msc->floatData().putColumnCells(rowstoadd, vb.floatDataCube());
      95             : 
      96           0 :   Vector<Int> ddID(rowsnow);
      97           0 :   ddID.set(vb.dataDescriptionId());
      98           0 :   msc->dataDescId().putColumnCells(rowstoadd, ddID);
      99             : 
     100           0 :   msc->exposure().putColumnCells(rowstoadd, vb.exposure());
     101           0 :   msc->feed1().putColumnCells(rowstoadd, vb.feed1());
     102           0 :   msc->feed2().putColumnCells(rowstoadd, vb.feed2());
     103             : 
     104           0 :   Vector<Int> fieldID(rowsnow);
     105           0 :   fieldID.set(vb.fieldId());
     106           0 :   msc->fieldId().putColumnCells(rowstoadd, fieldID);
     107             : 
     108           0 :   msc->flagRow().putColumnCells(rowstoadd, vb.flagRow()); 
     109           0 :   msc->flag().putColumnCells(rowstoadd, vb.flagCube());
     110             : 
     111           0 :   if(doFC)
     112           0 :     msc->flagCategory().putColumnCells(rowstoadd, vb.flagCategory());
     113             : 
     114           0 :   msc->interval().putColumnCells(rowstoadd, vb.timeInterval());
     115           0 :   msc->observationId().putColumnCells(rowstoadd, vb.observationId());
     116           0 :   msc->processorId().putColumnCells(rowstoadd, vb.processorId());
     117           0 :   msc->scanNumber().putColumnCells(rowstoadd, vb.scan());   // Don't remap!
     118             : 
     119           0 :   if(doSpWeight)
     120           0 :     msc->weightSpectrum().putColumnCells(rowstoadd, vb.weightSpectrum());
     121           0 :   msc->weight().putColumnCells(rowstoadd, vb.weightMat());
     122           0 :   msc->sigma().putColumnCells(rowstoadd, vb.sigmaMat());
     123             : 
     124           0 :   msc->stateId().putColumnCells(rowstoadd, vb.stateId());
     125           0 :   msc->time().putColumnCells(rowstoadd, vb.time());
     126           0 :   msc->timeCentroid().putColumnCells(rowstoadd, vb.timeCentroid());
     127           0 :   msc->uvw().putColumnCells(rowstoadd, vb.uvwMat());
     128             :       
     129           0 :   rowsdone += rowsnow;
     130             : 
     131           0 :   return rowsdone;
     132             : }
     133             : 
     134             : using namespace casacore;
     135             : } // end namespace casa

Generated by: LCOV version 1.16