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

Generated by: LCOV version 1.16