LCOV - code coverage report
Current view: top level - msvis/MSVis - VisBuffGroup.h (source / functions) Hit Total Coverage
Test: casacpp_coverage.info Lines: 0 2 0.0 %
Date: 2024-12-11 20:54:31 Functions: 0 2 0.0 %

          Line data    Source code
       1             : //# VisBuffGroup.h: class to store a group 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             : 
      27             : #ifndef MSVIS_VISBUFFGROUP_H
      28             : #define MSVIS_VISBUFFGROUP_H
      29             : 
      30             : #include <casacore/casa/aips.h>
      31             : #include <msvis/MSVis/VisBuffer.h>
      32             : #include <casacore/casa/Arrays/Vector.h>
      33             : 
      34             : namespace casa { //# NAMESPACE CASA - BEGIN
      35             : 
      36             : // <summary>
      37             : // A class to store a group of VisBuffers.
      38             : // </summary>
      39             : //
      40             : // <use visibility=export>
      41             : //
      42             : // <reviewed reviewer="" date="yyyy/mm/dd" tests="" demos="">
      43             : // </reviewed>
      44             : 
      45             : // <prerequisite>
      46             : //   <li> VisBuffer
      47             : // </prerequisite>
      48             : //
      49             : // <etymology>
      50             : //   It is a group of VisBuffers
      51             : // </etymology>
      52             : //
      53             : // <synopsis>
      54             : // This class stores a group of VisBuffers.  Unlike VisBuffGroupAcc or
      55             : // VisBuffAccumulator, the VisBuffers are copied and stored in a nearly
      56             : // pristine state so that their individual contents can be accessed later
      57             : // (i.e. without any averaging).  The only difference between a normal (or
      58             : // "fresh") VisBuffer and one retrieved from a VisBuffGroup is that
      59             : // VisBuffGroup detaches its VisBuffers from any underlying VisIter.
      60             : // </synopsis>
      61             : //
      62             : // <example>
      63             : // </example>
      64             : //
      65             : // <motivation>
      66             : // Some calculations or applications need more than one VisBuffer.  For
      67             : // example, one might want to estimate and subtract the continuum from the
      68             : // visibilities of an casacore::MS that has a broad line completely spanning spw 1, but
      69             : // spws 0 and 2 line-free, so the spws should be combined (combine='spw') for
      70             : // the continuum estimation.
      71             : //
      72             : // It is much more efficient if the group of necessary data can be read only
      73             : // once, worked on, and then written.  The CalTable approach is more flexible
      74             : // in that a CalTable can be applied to an casacore::MS with a different number or
      75             : // arrangement of rows from the input casacore::MS, but per chunk it requires two more
      76             : // reads (the CalTable and the _output_ casacore::MS) and an extra write (the CalTable).
      77             : // </motivation>
      78             : //
      79             : // <todo asof="2011/11/07">
      80             : //   <li> Allow retrieval by timestamp.
      81             : // </todo>
      82             : 
      83             : class VisBuffGroup
      84             : {
      85             : public:
      86             :   VisBuffGroup();
      87             : 
      88             :   // Null destructor
      89             :   ~VisBuffGroup();
      90             : 
      91             :   // Add a VisBuffer.  Returns true on success and false on failure.
      92             :   casacore::Bool store(const VisBuffer& vb);
      93             : 
      94             :   // casacore::Record the end of a chunk.
      95             :   // Doing so marks that if "playing back" a VisIter vi matching the order that
      96             :   // the VBs were stored in, vi.nextChunk() will be needed at this point
      97             :   // instead of ++vi.
      98             :   void endChunk();
      99             : 
     100             :   // (See endChunk())  Returns whether or not vi.nextChunk() should be used
     101             :   // when advancing past buffer number buf.
     102           0 :   casacore::Bool chunkEnd(const casacore::Int buf) const {return endChunk_p[buf];}
     103             : 
     104             :   // Replace the VisBuffer in slot buf with vb.
     105             :   // Returns true on success and false on failure.
     106             :   // casacore::Bool replace(const VisBuffer& vb, const casacore::uInt buf);
     107             : 
     108             :   // How many VisBuffers are contained herein?
     109           0 :   casacore::uInt nBuf() const {return nBuf_p;}
     110             : 
     111             :   // casacore::uInt nDDID() const {return nDDID_p;}
     112             :   // casacore::uInt nFld()  const {return nFld_p;}
     113             : 
     114             :   // Return a reference to the indexed VisBuffer.
     115             :   // Throws an exception if buf > nBuf().
     116             :   VisBuffer& operator()(const casacore::Int buf);
     117             : 
     118             :   // // Returns the buffer index corresponding to data description ID ddid and
     119             :   // // field ID fld.
     120             :   // //
     121             :   // // Returns -1 if there is no such buffer.
     122             :   // //
     123             :   // // Returns -(# of matching buffers) if there is > 1 match (use bufInds).
     124             :   // casacore::Int bufInd(const casacore::Int ddid, const casacore::Int fld);
     125             : 
     126             :   // // Returns the buffer indices corresponding to data description ID ddid and
     127             :   // // field ID fld.
     128             :   // casacore::Vector<casacore::Int> bufInds(const casacore::Int ddid, const casacore::Int fld)
     129             : 
     130             :   // The flagging approach to channel selection.
     131             :   // Sets chanmaskedflags to true wherever the channels in chanmask or flags in
     132             :   // vb.flagCube() are true, resizing if necessary.
     133             :   // Returns true/false on success/error (i.e. chanmask having a different # of
     134             :   // channels from vb.flagCube()).
     135             :   static casacore::Bool applyChanMask(casacore::Cube<casacore::Bool>& chanmaskedflags,
     136             :                             const casacore::Vector<casacore::Bool> *chanmask, const VisBuffer& vb);
     137             : 
     138             : private:
     139             :   // Prohibit public copying and assignment.
     140             :   VisBuffGroup(const VisBuffGroup&);
     141             :   VisBuffGroup& operator=(const VisBuffGroup&);
     142             : 
     143             :   // // Numbers of data description ids and fields
     144             :   // casacore::uInt nDDID_p, nFld_p, nBuf_p;
     145             : 
     146             :   // Number of buffers.
     147             :   casacore::uInt nBuf_p;
     148             : 
     149             :   // The list of buffers.
     150             :   casacore::PtrBlock<VisBuffer*> VB_p;
     151             :   
     152             :   casacore::Vector<casacore::Bool> endChunk_p;
     153             : 
     154             :   // // casacore::Map spw,fld to the buffer id
     155             :   // casacore::Matrix<casacore::Int> spwfldids_p;
     156             : };
     157             : 
     158             : 
     159             : } //# NAMESPACE CASA - END
     160             : 
     161             : #endif
     162             : 
     163             : 

Generated by: LCOV version 1.16