casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
CFStore2.h
Go to the documentation of this file.
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: aips2-request@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
36 #include <casa/Logging/LogIO.h>
37 #include <casa/Logging/LogSink.h>
38 #include <casa/Logging/LogOrigin.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;
48  class CFStore2
49  {
50  public:
51  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  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  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  //-------------------------------------------------------------------------
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  void setLazyFill(const casacore::Bool& val) {lazyFillOn_p=val;}
105  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  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  //-------------------------------------------------------------------------
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);};
138  casacore::IPosition getShape() {return storage_p.shape();}
139 
140 
141  protected:
142 
149 
150  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  paNdx = paHashFunction(pa,paTol);
156  antNdx = antHashFunction(ant1,ant2);
157  }
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  virtual casacore::Int antHashFunction(const casacore::Int& ant1, const casacore::Int& ant2)
168  {
169  casacore::Int ndx=-1;
170  for (casacore::uInt i=0;i<ant1_p.nelements(); i++)
171  if ((ant1_p[i]==ant1) && (ant2_p[i]==ant2))
172  {ndx=i;break;}
173  return ndx;
174  };
175 
177  {
178  // for (casacore::uInt i=0; i<pa_p.nelements(); i++)
179  // if ( pa_p[i] == pa)
180  // {ndx=i;break;}
181  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
A Vector of integers, for indexing into Array&lt;T&gt; objects.
Definition: IPosition.h:119
A 1-D Specialization of the Array class.
casacore::Vector< casacore::Quantity > getPAList()
Definition: CFStore2.h:137
int Int
Definition: aipstype.h:50
casacore::String getCFCacheDir()
Definition: CFStore2.h:103
casacore::Vector< casacore::Quantity > pa_p
Definition: CFStore2.h:145
casacore::Vector< casacore::Int > & getAnt2List()
Definition: CFStore2.h:136
casacore::Vector< casacore::Int > ant1_p
Definition: CFStore2.h:144
PtrHolder< T > & operator=(const PtrHolder< T > &other)
virtual casacore::Int paHashFunction(const casacore::Quantity &pa, const casacore::Quantity &paTol)
Definition: CFStore2.h:176
casacore::Bool null()
Definition: CFStore2.h:81
casacore::Bool lazyFillOn_p
Definition: CFStore2.h:146
ABSTRACT CLASSES Abstract class for colors Any implementation of color should be able to provide a hexadecimal form of the if a human readable name(i.e."black").In many places throughout the plotter
void show(const variant &v)
casacore::Vector< casacore::Int > ant2_p
Definition: CFStore2.h:144
LatticeExprNode pa(const LatticeExprNode &left, const LatticeExprNode &right)
This function finds 180/pi*atan2(left,right)/2.
Referenced counted pointer for constant data.
Definition: VisModelData.h:42
virtual casacore::Int antHashFunction(const casacore::Int &ant1, const casacore::Int &ant2)
virtual casacore::Int wHashFunction(const casacore::Double&amp; wValue) { casacore::Int ndx=-1; for(casac...
Definition: CFStore2.h:167
double Double
Definition: aipstype.h:55
casacore::Vector< casacore::CountedPtr< CFBuffer > > VBRow2CFBMapType
Definition: CFStore2.h:46
casacore::Bool isLazyFillOn()
Definition: CFStore2.h:105
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42
virtual void getIndex(const casacore::Quantity &pa, const casacore::Quantity &paTol, const casacore::Int &ant1, const casacore::Int &ant2, casacore::Int &paNdx, casacore::Int &antNdx)
Definition: CFStore2.h:150
const Bool False
Definition: aipstype.h:44
casacore::Vector< casacore::Int > & getAnt1List()
Definition: CFStore2.h:135
casacore::IPosition getShape()
Definition: CFStore2.h:138
VisBuffer2s encapsulate one chunk of visibility data for processing.
Definition: VisBuffer2.h:141
void set(const CFStore2 &other)
Definition: CFStore2.h:88
void setLazyFill(const casacore::Bool &val)
Definition: CFStore2.h:104
virtual ~CFStore2()
CFStore2(CFBuffer&lt;casacore::Complex&gt; *dataPtr, casacore::Quantity PA, casacore::Int mosPointing): sto...
Definition: CFStore2.h:57
String: the storage and methods of handling collections of characters.
Definition: String.h:223
casacore::Matrix< casacore::CountedPtr< CFBuffer > > & getStorage()
void rememberATerm(casacore::CountedPtr&lt;ATerm&gt;&amp; aTerm) {theATermUsed_p = aTerm;}
Definition: CFStore2.h:134
CFBuffer & operator()(const casacore::Int &paNdx, const casacore::Int &antNdx)
Definition: CFStore2.h:111
casacore::String cfCacheDir_p
Definition: CFStore2.h:148
casacore::Matrix< casacore::CountedPtr< CFBuffer > > storage_p
Definition: CFStore2.h:143
casacore::Int mosPointingPos_p
Definition: CFStore2.h:147
unsigned int uInt
Definition: aipstype.h:51
#define casacore
&lt;X11/Intrinsic.h&gt; #defines true, false, casacore::Bool, and String.
Definition: X11Intrinsic.h:42