LCOV - code coverage report
Current view: top level - synthesis/MeasurementComponents - CalibratingVi2Factory.cc (source / functions) Hit Total Coverage
Test: casacpp_coverage.info Lines: 0 73 0.0 %
Date: 2024-10-10 11:40:37 Functions: 0 12 0.0 %

          Line data    Source code
       1             : //# CalibratingVi2Factory.cc: Implementation of the CalibratingVi2Factory class.
       2             : //#
       3             : //#  CASA - Common Astronomy Software Applications (http://casa.nrao.edu/)
       4             : //#  Copyright (C) Associated Universities, Inc. Washington DC, USA 2011, All rights reserved.
       5             : //#  Copyright (C) European Southern Observatory, 2011, All rights reserved.
       6             : //#
       7             : //#  This library is free software; you can redistribute it and/or
       8             : //#  modify it under the terms of the GNU Lesser General Public
       9             : //#  License as published by the Free software Foundation; either
      10             : //#  version 2.1 of the License, or (at your option) any later version.
      11             : //#
      12             : //#  This library is distributed in the hope that it will be useful,
      13             : //#  but WITHOUT ANY WARRANTY, without even the implied warranty of
      14             : //#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
      15             : //#  Lesser General Public License for more details.
      16             : //#
      17             : //#  You should have received a copy of the GNU Lesser General Public
      18             : //#  License along with this library; if not, write to the Free Software
      19             : //#  Foundation, Inc., 59 Temple Place, Suite 330, Boston,
      20             : //#  MA 02111-1307  USA
      21             : //# $Id: $
      22             : 
      23             : #include <synthesis/MeasurementComponents/CalibratingVi2Factory.h>
      24             : #include <msvis/MSVis/VisibilityIterator2.h>
      25             : #include <msvis/MSVis/VisibilityIteratorImpl2.h>
      26             : #include <msvis/MSVis/VisBuffer2.h>
      27             : 
      28             : 
      29             : namespace {
      30           0 :   casa::vi::CalibratingVi2FactoryI* generateCViFac() {
      31           0 :     return new casa::vi::CalibratingVi2Factory();  // A concrete one from the synthesis side
      32             :   }
      33           0 :   casa::vi::CalibratingVi2FactoryI* generateCViFac_byRec(casacore::MeasurementSet* ms,
      34             :                                                          const casacore::Record& calrec,
      35             :                                                          const casa::vi::IteratingParameters& iterpar) {
      36           0 :     return new casa::vi::CalibratingVi2Factory(ms,calrec,iterpar);  // A concrete one from the synthesis side
      37             :   }
      38             :   
      39             :   // FIXME each of the next two lines produces compiler warnings re: unused variables 
      40             :   // initCViFacGenerator and initCViFac_byRec_Generator
      41             :   bool initCViFacGenerator = casa::vi::CalibratingVi2FactoryI::setGenerator(generateCViFac);
      42             :   bool initCViFac_byRec_Generator = casa::vi::CalibratingVi2FactoryI::set_byRec_Generator(generateCViFac_byRec);
      43             : }
      44             : 
      45             : using namespace casacore;
      46             : namespace casa { //# NAMESPACE CASA - BEGIN
      47             : namespace vi { //# NAMESPACE VI - BEGIN
      48             : 
      49             : 
      50             : // -----------------------------------------------------------------------
      51           0 : CalibratingVi2Factory::CalibratingVi2Factory(MeasurementSet* ms,
      52             :                                              const CalibratingParameters& calpar, 
      53           0 :                                              const IteratingParameters& iterpar) :
      54           0 :   valid_p(true),
      55           0 :   ms_p(ms),
      56           0 :   calpar_p(calpar),
      57           0 :   iterpar_p(iterpar)
      58           0 : {}
      59             : 
      60             : 
      61             : // -----------------------------------------------------------------------
      62           0 : CalibratingVi2Factory::CalibratingVi2Factory() :
      63           0 :   valid_p(false),
      64           0 :   ms_p(0),
      65           0 :   calpar_p(),
      66           0 :   iterpar_p(IteratingParameters())
      67           0 : {}
      68             : 
      69             : // -----------------------------------------------------------------------
      70           0 : CalibratingVi2Factory::CalibratingVi2Factory(MeasurementSet* ms,
      71             :                                              const Record& calrec,
      72           0 :                                              const IteratingParameters& iterpar) :
      73           0 :   valid_p(true),
      74           0 :   ms_p(ms),
      75           0 :   calpar_p(calrec),
      76           0 :   iterpar_p(iterpar)
      77           0 : {}
      78             : 
      79             : // -----------------------------------------------------------------------
      80           0 : CalibratingVi2Factory::CalibratingVi2Factory(MeasurementSet* ms,
      81             :                                              const String& callib,
      82           0 :                                              const IteratingParameters& iterpar) :
      83           0 :   valid_p(true),
      84           0 :   ms_p(ms),
      85           0 :   calpar_p(callib),
      86           0 :   iterpar_p(iterpar)
      87           0 : {}
      88             : 
      89             : 
      90             : // -----------------------------------------------------------------------
      91           0 : CalibratingVi2Factory::~CalibratingVi2Factory()
      92           0 : {}
      93             : 
      94             : // -----------------------------------------------------------------------
      95           0 : void CalibratingVi2Factory::initialize(MeasurementSet* ms,
      96             :                                        const Record& callibrec,
      97             :                                        const IteratingParameters& iterpar) {
      98             : 
      99           0 :   if (valid_p)
     100           0 :     throw(AipsError("Cannot initialize already-initialized CalibratingVi2Factory"));
     101             : 
     102           0 :   ms_p=ms;
     103           0 :   calpar_p=CalibratingParameters(callibrec);
     104           0 :   iterpar_p=iterpar;
     105           0 :   valid_p=true;
     106           0 : }
     107             : 
     108             : // -----------------------------------------------------------------------
     109           0 : void CalibratingVi2Factory::initialize(MeasurementSet* ms,
     110             :                                        const String& callib,
     111             :                                        const IteratingParameters& iterpar) {
     112             : 
     113           0 :   if (valid_p)
     114           0 :     throw(AipsError("Cannot initialize already-initialized CalibratingVi2Factory"));
     115             : 
     116           0 :   ms_p=ms;
     117           0 :   calpar_p=CalibratingParameters(callib);
     118           0 :   iterpar_p=iterpar;
     119           0 :   valid_p=true;
     120           0 : }
     121             : 
     122             : 
     123             : // -----------------------------------------------------------------------
     124           0 : vi::ViImplementation2 * CalibratingVi2Factory::createVi () const
     125             : {
     126             : 
     127           0 :   if (!valid_p)
     128           0 :     throw(AipsError("CalibratingVi2Factor not initialized!"));
     129             : 
     130             :   //cout << "Making plain ViImpl2 for the user." << endl;
     131           0 :   vi::ViImplementation2 * plainViI(NULL);  // generic
     132             :   // Create a simple VI implementation to perform the reading.
     133           0 :   plainViI = new vi::VisibilityIteratorImpl2 (Block<const MeasurementSet*>(1,ms_p),
     134           0 :                                               iterpar_p.getSortColumns(),
     135           0 :                                               iterpar_p.getChunkInterval(),
     136           0 :                                               true); // writable!
     137             :   
     138           0 :   return this->createVi(plainViI);
     139             : 
     140             : }
     141             : 
     142             : 
     143             : 
     144             : // -----------------------------------------------------------------------
     145           0 : vi::ViImplementation2 * CalibratingVi2Factory::createVi (vi::ViImplementation2 * vii) const
     146             : {
     147             : 
     148           0 :   if (!valid_p)
     149           0 :     throw(AipsError("CalibratingVi2Factor not initialized!"));
     150             : 
     151             : 
     152           0 :   vi::ViImplementation2 * vii2(NULL);  // generic
     153           0 :   if (vii) {
     154             :     //    cout << "Using user-supplied underlying ViImpl2!" << endl;
     155             :     // Use user-supplied ivii
     156           0 :     vii2=vii;
     157             :   }
     158             :   else
     159             :     // Create a simple VI implementation to perform the reading.
     160           0 :     vii2 = new vi::VisibilityIteratorImpl2 (Block<const MeasurementSet*>(1,ms_p),
     161           0 :                                             iterpar_p.getSortColumns(),
     162           0 :                                             iterpar_p.getChunkInterval(),
     163           0 :                                             true); // writable!
     164             :     
     165             :   // Create output VisibilityIterator
     166             :   //   (Get base MS name cleverly, because ms_p might be a reference table)
     167           0 :   String msantname=ms_p->antenna().tableName();
     168           0 :   String msname=msantname.before("/ANTENNA");
     169           0 :   CalibratingVi2 *calVI = new CalibratingVi2(vii2,calpar_p,msname);
     170             :   
     171           0 :   return calVI;
     172           0 : }
     173             : 
     174             : } //# NAMESPACE VI - END
     175             : } //# NAMESPACE CASA - END
     176             : 
     177             : 

Generated by: LCOV version 1.16