LCOV - code coverage report
Current view: top level - synthesis/TransformMachines - CFStore2.h (source / functions) Hit Total Coverage
Test: casacpp_coverage.info Lines: 0 23 0.0 %
Date: 2024-12-11 20:54:31 Functions: 0 15 0.0 %

          Line data    Source code
       1             : // -*- C++ -*-
       2             : //# CFStore2.h: Definition of the CFStore2 class
       3             : //# Copyright (C) 1997,1998,1999,2000,2001,2002,2003
       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: casa-feedback@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             : //# $Id$
      28             : #ifndef SYNTHESIS_CFSTORE2_H
      29             : #define SYNTHESIS_CFSTORE2_H
      30             : #include <synthesis/TransformMachines/CFDefs.h>
      31             : #include <synthesis/TransformMachines/CFBuffer.h>
      32             : #include <synthesis/TransformMachines/CFCell.h>
      33             : #include <synthesis/TransformMachines/VBStore.h>
      34             : #include <synthesis/TransformMachines/SynthesisError.h>
      35             : #include <casacore/coordinates/Coordinates/CoordinateSystem.h>
      36             : #include <casacore/casa/Logging/LogIO.h>
      37             : #include <casacore/casa/Logging/LogSink.h>
      38             : #include <casacore/casa/Logging/LogOrigin.h>
      39             : #include <casacore/casa/Utilities/CountedPtr.h>
      40             : #include <casacore/images/Images/ImageInterface.h>
      41             : #include <msvis/MSVis/VisBuffer.h>
      42             : namespace casa { //# NAMESPACE CASA - BEGIN
      43             :   using namespace CFDefs;
      44             : 
      45             :   typedef casacore::Cube<casacore::CountedPtr<CFCell > > VBRow2CFMapType;
      46             :   typedef casacore::Vector<casacore::CountedPtr<CFBuffer > > VBRow2CFBMapType;
      47             :   class CFStore2
      48             :   {
      49             :   public:
      50           0 :     CFStore2():storage_p(), pa_p(), lazyFillOn_p(False), mosPointingPos_p(0), currentSPWID_p(-1), cfCacheDir_p("") {};
      51             : 
      52             :     // CFStore2(CFBuffer<casacore::Complex> *dataPtr, casacore::Quantity PA, casacore::Int mosPointing):
      53             :     //   storage_p(), pa_p(PA), mosPointingPos_p(mosPointing)
      54             :     // {storage_p = new CFBuffer<casacore::Complex>(*dataPtr);};
      55             : 
      56           0 :     virtual ~CFStore2() {};
      57             : 
      58             :     CFStore2& operator=(const CFStore2& other);
      59             :     //-------------------------------------------------------------------------
      60             :     void show(const char *Mesg=NULL,ostream &os=cerr, const casacore::Bool verbose=false);
      61             :     //-------------------------------------------------------------------------
      62             :     // This version saves the entire CFStore
      63             :     void makePersistent(const char *dir,const char *name="", const char *qualifier="");
      64             :     // This version saves only those pixels of CFStore that correspond
      65             :     // to [PA,(Ant1,Ant2)] co-ordiantes ([PA, BaselineType]
      66             :     // co-ordinate).
      67             :     void makePersistent(const char *dir,
      68             :                         const char *cfName,
      69             :                         const char *qualifier,
      70             :                         const casacore::Quantity &pa, const casacore::Quantity& dPA,
      71             :                         const casacore::Int& ant1, const casacore::Int& ant2);
      72             :     //-------------------------------------------------------------------------
      73             :     void primeTheCFB();
      74             :     //-------------------------------------------------------------------------
      75             :     void initMaps(const VisBuffer& vb, const casacore::Matrix<casacore::Double>& freqSelection, 
      76             :                   const casacore::Double& imRefFreq);
      77             :     //-------------------------------------------------------------------------
      78             :     void initPolMaps(PolMapType& polMap, PolMapType& conjPolMap);
      79             :     //-------------------------------------------------------------------------
      80           0 :     casacore::Bool null() {return (storage_p.size() == 0);};
      81             :     //-------------------------------------------------------------------------
      82             :     casacore::Double memUsage();
      83             :     //-------------------------------------------------------------------------
      84             :     void clear();
      85             :     //-------------------------------------------------------------------------
      86             :     void set(const CFStore2& other)
      87             :     {
      88             :       pa_p.assign(other.pa_p);
      89             :       ant1_p.assign(other.ant1_p);
      90             :       ant2_p.assign(other.ant2_p);
      91             :     }
      92             :     //-------------------------------------------------------------------------
      93             :     void setCFBuffer(CFBuffer *dataPtr, casacore::Quantity pa, 
      94             :                      const casacore::Int& ant1, const casacore::Int& ant2);
      95             :     //-------------------------------------------------------------------------
      96             :     casacore::CountedPtr<CFBuffer>& getCFBuffer(const casacore::Quantity& pa, 
      97             :                                       const casacore::Quantity& paTol, 
      98             :                                       const casacore::Int& ant1, const casacore::Int& ant2);
      99             :     //-------------------------------------------------------------------------
     100             :     void setCFCacheDir(const String& dir);
     101             :     casacore::String getCFCacheDir() {return cfCacheDir_p;};
     102           0 :     void setLazyFill(const Bool& val) {lazyFillOn_p=val;}
     103           0 :     casacore::Bool isLazyFillOn() {return lazyFillOn_p;}
     104             :     void invokeGC(const casacore::Int& spwID);
     105             :     //-------------------------------------------------------------------------
     106             :     // Get CFBuffer by directly indexing in the list of CFBuffers
     107             :     casacore::CountedPtr<CFBuffer>& getCFBuffer(const casacore::Int& paNdx, const casacore::Int& antNdx);
     108           0 :     CFBuffer& operator()(const casacore::Int& paNdx, const casacore::Int& antNdx) {return *storage_p(paNdx, antNdx);}
     109             :     void getParams(casacore::Quantity& pa, 
     110             :                    casacore::Int& ant1, casacore::Int& ant2, 
     111             :                    const casacore::Int& paNdx, const casacore::Int& antNdx);
     112             :     //-------------------------------------------------------------------------
     113             :     //
     114             :     // Generate a map for the given frequency and Mueller element list
     115             :     // to the index in the internal list of CFs.  This can be used in
     116             :     // tight loops to get get direct access to the required CF.
     117             :     //
     118             :     /*
     119             :     void makeVBRow2CFMap(VBRow2CFMapType& vbRow2CFMap,
     120             :                          const VisBuffer& vb, 
     121             :                          const casacore::Quantity& paTol,
     122             :                          const casacore::Vector<casacore::Int>& dataChan2ImChanMap,
     123             :                          const casacore::Vector<casacore::Int>& dataPol2ImPolMap);
     124             :     */
     125             :     //-------------------------------------------------------------------------
     126             :     casacore::Vector<casacore::Int> resize(const casacore::Quantity& pa, const casacore::Quantity& paTol, 
     127             :                        const casacore::Int& ant1,const casacore::Int& ant2, casacore::Bool retainValues=true);
     128             :     // void rememberATerm(casacore::CountedPtr<ATerm>& aTerm) {theATermUsed_p = aTerm;}
     129             : 
     130             :     // casacore::Int mapAntIDToAntType(const casacore::Int& ant) {return theATermUsed_p->mapAntIDToAntType(ant);};
     131           0 :     casacore::Matrix<casacore::CountedPtr<CFBuffer> >& getStorage() {return storage_p;}
     132           0 :     casacore::Vector<casacore::Int>& getAnt1List() {return ant1_p;};
     133           0 :     casacore::Vector<casacore::Int>& getAnt2List() {return ant2_p;};
     134           0 :     casacore::Vector<casacore::Quantity> getPAList() {return pa_p;};
     135           0 :     casacore::IPosition getShape() {return storage_p.shape();}
     136             : 
     137             : 
     138             :   protected:
     139             : 
     140             :     casacore::Matrix<casacore::CountedPtr<CFBuffer > > storage_p;
     141             :     casacore::Vector<casacore::Int> ant1_p, ant2_p;
     142             :     casacore::Vector<casacore::Quantity> pa_p;
     143             :     casacore::Bool lazyFillOn_p;
     144             :     casacore::Int mosPointingPos_p, currentSPWID_p;
     145             :     casacore::String cfCacheDir_p;
     146             : 
     147           0 :     virtual void getIndex(const casacore::Quantity& pa, 
     148             :                           const casacore::Quantity& paTol, 
     149             :                           const casacore::Int& ant1, const casacore::Int& ant2,
     150             :                           casacore::Int& paNdx, casacore::Int& antNdx)
     151             :     {
     152           0 :       paNdx  = paHashFunction(pa,paTol);
     153           0 :       antNdx = antHashFunction(ant1,ant2);
     154           0 :     }
     155             : 
     156             :     // virtual casacore::Int wHashFunction(const casacore::Double& wValue)
     157             :     // {
     158             :     //   casacore::Int ndx=-1;
     159             :     //   for(casacore::uInt i=0;i<wValue_p.nelements(); i++)
     160             :     //  if (wValue_p[i] == wValue)
     161             :     //    {ndx=i;break;}
     162             :     //   return ndx;
     163             :     // }
     164           0 :     virtual casacore::Int antHashFunction(const casacore::Int& ant1, const casacore::Int& ant2)
     165             :     {
     166           0 :       casacore::Int ndx=-1;
     167           0 :       for (casacore::uInt i=0;i<ant1_p.nelements(); i++)
     168           0 :         if ((ant1_p[i]==ant1) && (ant2_p[i]==ant2))
     169           0 :           {ndx=i;break;}
     170           0 :       return ndx;
     171             :     };
     172             : 
     173           0 :     virtual casacore::Int paHashFunction(const casacore::Quantity& pa,const casacore::Quantity& paTol)
     174             :     {
     175             :       // for (casacore::uInt i=0; i<pa_p.nelements(); i++)
     176             :       //        if ( pa_p[i] == pa)
     177             :       //          {ndx=i;break;}
     178           0 :       return nearestPA(pa, paTol);
     179             :     }
     180             : 
     181             :     virtual casacore::Int nearestPA(const casacore::Quantity& pa, const casacore::Quantity& paTol);
     182             :   };
     183             : } //# NAMESPACE CASA - END
     184             : 
     185             : #endif

Generated by: LCOV version 1.16