LCOV - code coverage report
Current view: top level - synthesis/TransformMachines - CFCell.h (source / functions) Hit Total Coverage
Test: casacpp_coverage.info Lines: 30 30 100.0 %
Date: 2024-12-11 20:54:31 Functions: 7 7 100.0 %

          Line data    Source code
       1             : // -*- C++ -*-
       2             : //# CFCell.h: Definition of the CFCell 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_CFCELL_H
      29             : #define SYNTHESIS_CFCELL_H
      30             : #include <synthesis/TransformMachines/CFDefs.h>
      31             : #include <synthesis/TransformMachines/SynthesisError.h>
      32             : #include <casacore/coordinates/Coordinates/CoordinateSystem.h>
      33             : #include <casacore/casa/Logging/LogIO.h>
      34             : #include <casacore/casa/Logging/LogSink.h>
      35             : #include <casacore/casa/Logging/LogOrigin.h>
      36             : #include <casacore/casa/Utilities/CountedPtr.h>
      37             : #include <casacore/images/Images/ImageInterface.h>
      38             : #include <msvis/MSVis/VisBuffer.h>
      39             : //
      40             : // <summary> 
      41             : //
      42             : // A light-weight container to carray all the information required for
      43             : // a single convolution function plan.
      44             : //
      45             : //</summary>
      46             : 
      47             : // <prerequisite>
      48             : // </prerequisite>
      49             : //
      50             : // <etymology> 
      51             : //
      52             : //  CFCell is basic in-memory representation of a single
      53             : //  monochromatic, single polarization cross-product and single
      54             : //  w-plane convoluion function .
      55             : //
      56             : //</etymology>
      57             : //
      58             : // <synopsis> 
      59             : //
      60             : // Mostly a conveniance class to pass around related information.  
      61             : //
      62             : //</synopsis>
      63             : //
      64             : // <example>
      65             : // </example>
      66             : //
      67             : // <motivation>
      68             : //
      69             : // To avoid parameter-bloat to passing around a number of related objects seperately.
      70             : //
      71             : // </motivation>
      72             : //
      73             : 
      74             : namespace casa { //# NAMESPACE CASA - BEGIN
      75             :   typedef casacore::Complex TT;
      76             : 
      77             :   struct  CFCStruct{
      78             :     casacore::CoordinateSystem coordSys;
      79             :     TT * CFCStorage;
      80             :     casacore::Int shape[2];
      81             :     casacore::Float sampling,diameter;
      82             :     casacore::Int xSupport, ySupport;
      83             :     casacore::Double wValue, wIncr, freqValue,freqIncr, conjFreq;    
      84             :     casacore::Int muellerElement, conjPoln;
      85             :     casacore::String fileName, telescopeName, bandName;
      86             :     bool isRotationallySymmetric;
      87             :   };
      88             : 
      89             :   using namespace CFDefs;
      90             :   using namespace std;
      91             :   //  template <class T>
      92             :   class CFCell
      93             :   {
      94             :   void initCFCStruct(CFCStruct& cfcSt) 
      95             :   {
      96             :     cfcSt.CFCStorage=NULL;
      97             :     cfcSt.xSupport = cfcSt.ySupport=0;
      98             :     cfcSt.sampling=0.0;
      99             :     cfcSt.shape[0]=cfcSt.shape[1]=0;
     100             :   }
     101             : 
     102             :   public:
     103             :     //
     104             :     //========================= Administrative Parts ==========================
     105             :     //------------------------------------------------------------------
     106             :     //
     107        1244 :     CFCell():cfShape_p(),isRotationallySymmetric_p(false){};
     108             : 
     109             :     CFCell(casacore::Array<TT> &dataPtr, casacore::CoordinateSystem& cs, casacore::Float& /*samp*/):
     110             :       isRotationallySymmetric_p(false)
     111             :     {
     112             :       if (storage_p.null()) storage_p = new casacore::Array<TT>(dataPtr);
     113             :       coordSys_p = cs;
     114             :       cfShape_p.assign(storage_p->shape().asVector());
     115             :     };
     116             : 
     117        1244 :     ~CFCell() 
     118             :     {
     119        1244 :       if (!storage_p.null()) 
     120             :         {
     121             :           //cerr << "############### " << "~CFCell() called " << storage_p->shape() << endl;
     122        1244 :           storage_p->resize();
     123             :         }
     124        1244 :     };
     125             : 
     126          42 :     void getAsStruct(CFCStruct& cfst) 
     127             :     {
     128             :       casacore::Bool dummy;
     129          42 :       cfst.CFCStorage = getStorage()->getStorage(dummy);
     130          42 :       cfst.coordSys = coordSys_p;
     131          42 :       cfst.shape[0]=cfShape_p[0];
     132          42 :       cfst.shape[1]=cfShape_p[1];
     133          42 :       cfst.sampling=sampling_p;
     134          42 :       cfst.xSupport=xSupport_p;
     135          42 :       cfst.ySupport=ySupport_p;
     136          42 :       cfst.wValue=wValue_p;
     137          42 :       cfst.wIncr=wIncr_p;
     138          42 :       cfst.freqValue=freqValue_p;
     139          42 :       cfst.freqIncr=freqIncr_p;
     140          42 :       cfst.muellerElement=muellerElement_p;
     141          42 :       cfst.conjFreq = conjFreq_p;
     142          42 :       cfst.conjPoln = conjPoln_p;
     143          42 :       cfst.diameter=diameter_p;
     144          42 :       cfst.fileName = fileName_p;
     145          42 :       cfst.telescopeName=telescopeName_p;
     146          42 :       cfst.bandName = bandName_p;
     147          42 :       cfst.isRotationallySymmetric=isRotationallySymmetric_p;
     148          42 :     }
     149     7653934 :     casacore::CountedPtr<casacore::Array<TT> >& getStorage() {return storage_p;}
     150         968 :     void setStorage(casacore::Array<TT>& val) {getStorage()->assign(val); cfShape_p=val.shape().asVector();};
     151             :     void clear();
     152             :     void makePersistent(const char *dir, const char *cfName="");
     153             :     casacore::CountedPtr<CFCell> clone();
     154             :     void setParams(const CFCell& other);
     155        1412 :     void initCache(const casacore::Bool& releaseSpace=false) {shape_p=getShape(); cfShape_p.assign(shape_p.asVector());casacore::IPosition tt=shape_p;tt=0;tt[0]=tt[1]=0;if (releaseSpace) storage_p->resize(tt);};
     156        1412 :     casacore::IPosition getShape() {return storage_p->shape();}
     157             :     //
     158             :     //============================= casacore::Functional Parts ============================
     159             :     //------------------------------------------------------------------
     160             :     //
     161             :     void show(const char *Mesg,ostream &os);
     162             : 
     163             :     casacore::IPosition shape_p;
     164             :     casacore::CountedPtr<casacore::Array<TT> > storage_p; // Nx x Ny
     165             :     casacore::CoordinateSystem coordSys_p;
     166             :     casacore::Float sampling_p, diameter_p;
     167             :     casacore::Int xSupport_p,ySupport_p, conjPoln_p;
     168             :     casacore::Double wValue_p, wIncr_p, freqValue_p,freqIncr_p, conjFreq_p;
     169             :     //    MuellerElementType muellerElement_p;
     170             :     casacore::Int muellerElement_p;
     171             :     casacore::Quantity pa_p;
     172             :     casacore::Vector<casacore::Int> cfShape_p;
     173             :     casacore::String fileName_p,telescopeName_p, bandName_p;
     174             :     bool isRotationallySymmetric_p;
     175             :   };
     176             : } //# NAMESPACE CASA - END
     177             : #endif

Generated by: LCOV version 1.16