CFCell.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 //# CFCell.h: Definition of the CFCell class
00003 //# Copyright (C) 1997,1998,1999,2000,2001,2002,2003
00004 //# Associated Universities, Inc. Washington DC, USA.
00005 //#
00006 //# This library is free software; you can redistribute it and/or modify it
00007 //# under the terms of the GNU Library General Public License as published by
00008 //# the Free Software Foundation; either version 2 of the License, or (at your
00009 //# option) any later version.
00010 //#
00011 //# This library is distributed in the hope that it will be useful, but WITHOUT
00012 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00013 //# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public
00014 //# License for more details.
00015 //#
00016 //# You should have received a copy of the GNU Library General Public License
00017 //# along with this library; if not, write to the Free Software Foundation,
00018 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
00019 //#
00020 //# Correspondence concerning AIPS++ should be addressed as follows:
00021 //#        Internet email: aips2-request@nrao.edu.
00022 //#        Postal address: AIPS++ Project Office
00023 //#                        National Radio Astronomy Observatory
00024 //#                        520 Edgemont Road
00025 //#                        Charlottesville, VA 22903-2475 USA
00026 //#
00027 //# $Id$
00028 #ifndef SYNTHESIS_CFCELL_H
00029 #define SYNTHESIS_CFCELL_H
00030 #include <synthesis/TransformMachines/CFDefs.h>
00031 #include <synthesis/TransformMachines/SynthesisError.h>
00032 #include <coordinates/Coordinates/CoordinateSystem.h>
00033 #include <casa/Logging/LogIO.h>
00034 #include <casa/Logging/LogSink.h>
00035 #include <casa/Logging/LogOrigin.h>
00036 #include <casa/Utilities/CountedPtr.h>
00037 #include <images/Images/ImageInterface.h>
00038 #include <msvis/MSVis/VisBuffer.h>
00039 //
00040 // <summary> 
00041 //
00042 // A light-weight container to carray all the information required for
00043 // a single convolution function plan.
00044 //
00045 //</summary>
00046 
00047 // <prerequisite>
00048 // </prerequisite>
00049 //
00050 // <etymology> 
00051 //
00052 //  CFCell is basic in-memory representation of a single
00053 //  monochromatic, single polarization cross-product and single
00054 //  w-plane convoluion function .
00055 //
00056 //</etymology>
00057 //
00058 // <synopsis> 
00059 //
00060 // Mostly a conveniance class to pass around related information.  
00061 //
00062 //</synopsis>
00063 //
00064 // <example>
00065 // </example>
00066 //
00067 // <motivation>
00068 //
00069 // To avoid parameter-bloat to passing around a number of related objects seperately.
00070 //
00071 // </motivation>
00072 //
00073 
00074 namespace casa { //# NAMESPACE CASA - BEGIN
00075   typedef Complex TT;
00076 
00077   struct  CFCStruct{
00078     CoordinateSystem coordSys;
00079     TT * CFCStorage;
00080     Int shape[2];
00081     Float sampling,diameter;
00082     Int xSupport, ySupport;
00083     Double wValue, wIncr, freqValue,freqIncr, conjFreq;    
00084     Int muellerElement, conjPoln;
00085     String fileName, telescopeName;
00086   };
00087 
00088   using namespace CFDefs;
00089   using namespace std;
00090   //  template <class T>
00091   class CFCell
00092   {
00093   void initCFCStruct(CFCStruct& cfcSt) 
00094   {
00095     cfcSt.CFCStorage=NULL;
00096     cfcSt.xSupport = cfcSt.ySupport=0;
00097     cfcSt.sampling=0.0;
00098     cfcSt.shape[0]=cfcSt.shape[1]=0;
00099   }
00100 
00101   public:
00102     //
00103     //========================= Administrative Parts ==========================
00104     //------------------------------------------------------------------
00105     //
00106     CFCell():cfShape_p(){};
00107 
00108     CFCell(Array<TT> &dataPtr, CoordinateSystem& cs, Float& /*samp*/)
00109     {
00110       if (storage_p.null()) storage_p = new Array<TT>(dataPtr);
00111       coordSys_p = cs;
00112       cfShape_p.assign(storage_p->shape().asVector());
00113     };
00114 
00115     ~CFCell() 
00116     {
00117       if (!storage_p.null()) 
00118         {
00119           //cerr << "############### " << "~CFCell() called " << storage_p->shape() << endl;
00120           storage_p->resize();
00121         }
00122     };
00123 
00124     void getAsStruct(CFCStruct& cfst) 
00125     {
00126       Bool dummy;
00127       cfst.CFCStorage = getStorage()->getStorage(dummy);
00128       cfst.coordSys = coordSys_p;
00129       cfst.shape[0]=cfShape_p[0];
00130       cfst.shape[1]=cfShape_p[1];
00131       cfst.sampling=sampling_p;
00132       cfst.xSupport=xSupport_p;
00133       cfst.ySupport=ySupport_p;
00134       cfst.wValue=wValue_p;
00135       cfst.wIncr=wIncr_p;
00136       cfst.freqValue=freqValue_p;
00137       cfst.freqIncr=freqIncr_p;
00138       cfst.muellerElement=muellerElement_p;
00139       cfst.conjFreq = conjFreq_p;
00140       cfst.conjPoln = conjPoln_p;
00141       cfst.diameter=diameter_p;
00142       cfst.fileName = fileName_p;
00143       cfst.telescopeName=telescopeName_p;
00144     }
00145     CountedPtr<Array<TT> >& getStorage() {return storage_p;}
00146     void makePersistent(const char *dir, const char *cfName="");
00147     CountedPtr<CFCell> clone();
00148     void setParams(const CFCell& other);
00149     void initCache(const Bool& releaseSpace=False) {shape_p=getShape(); cfShape_p.assign(shape_p.asVector());IPosition tt=shape_p;tt=0;tt[0]=tt[1]=0;if (releaseSpace) storage_p->resize(tt);};
00150     IPosition getShape() {return storage_p->shape();}
00151     //
00152     //============================= Functional Parts ============================
00153     //------------------------------------------------------------------
00154     //
00155     void show(const char *Mesg,ostream &os);
00156 
00157     IPosition shape_p;
00158     CountedPtr<Array<TT> > storage_p; // Nx x Ny
00159     CoordinateSystem coordSys_p;
00160     Float sampling_p, diameter_p;
00161     Int xSupport_p,ySupport_p, conjPoln_p;
00162     Double wValue_p, wIncr_p, freqValue_p,freqIncr_p, conjFreq_p;
00163     //    MuellerElementType muellerElement_p;
00164     Int muellerElement_p;
00165     Quantity pa_p;
00166     Vector<Int> cfShape_p;
00167     String fileName_p,telescopeName_p;
00168   };
00169 } //# NAMESPACE CASA - END
00170 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on 31 Aug 2016 for casa by  doxygen 1.6.1