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_CFSTORE2_H
29 #define SYNTHESIS_CFSTORE2_H
36 #include <casa/Logging/LogIO.h>
37 #include <casa/Logging/LogSink.h>
38 #include <casa/Logging/LogOrigin.h>
41 #include <msvis/MSVis/VisBuffer.h>
42 namespace casa { //# NAMESPACE CASA - BEGIN
43  using namespace CFDefs;
44 
47  class CFStore2
48  {
49  public:
50  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  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  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  //-------------------------------------------------------------------------
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  void setLazyFill(const Bool& val) {lazyFillOn_p=val;}
103  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  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  //-------------------------------------------------------------------------
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);};
135  casacore::IPosition getShape() {return storage_p.shape();}
136 
137 
138  protected:
139 
146 
147  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  paNdx = paHashFunction(pa,paTol);
153  antNdx = antHashFunction(ant1,ant2);
154  }
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  virtual casacore::Int antHashFunction(const casacore::Int& ant1, const casacore::Int& ant2)
165  {
166  casacore::Int ndx=-1;
167  for (casacore::uInt i=0;i<ant1_p.nelements(); i++)
168  if ((ant1_p[i]==ant1) && (ant2_p[i]==ant2))
169  {ndx=i;break;}
170  return ndx;
171  };
172 
174  {
175  // for (casacore::uInt i=0; i<pa_p.nelements(); i++)
176  // if ( pa_p[i] == pa)
177  // {ndx=i;break;}
178  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
A Vector of integers, for indexing into Array&lt;T&gt; objects.
Definition: IPosition.h:119
A 1-D Specialization of the Array class.
int Int
Definition: aipstype.h:50
casacore::Vector< casacore::Quantity > pa_p
Definition: CFStore2.h:142
CFBuffer & operator()(const casacore::Int &paNdx, const casacore::Int &antNdx)
Definition: CFStore2.h:108
casacore::Bool null()
Definition: CFStore2.h:80
casacore::Vector< casacore::Quantity > getPAList()
Definition: CFStore2.h:134
casacore::Matrix< casacore::CountedPtr< CFBuffer > > storage_p
Definition: CFStore2.h:140
PtrHolder< T > & operator=(const PtrHolder< T > &other)
A 3-D Specialization of the Array class.
void setLazyFill(const Bool &val)
Definition: CFStore2.h:102
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
casacore::Bool isLazyFillOn()
Definition: CFStore2.h:103
void show(const variant &v)
casacore::Matrix< casacore::CountedPtr< CFBuffer > > & getStorage()
void rememberATerm(casacore::CountedPtr&lt;ATerm&gt;&amp; aTerm) {theATermUsed_p = aTerm;}
Definition: CFStore2.h:131
virtual casacore::Int paHashFunction(const casacore::Quantity &pa, const casacore::Quantity &paTol)
Definition: CFStore2.h:173
casacore::Vector< casacore::Int > & getAnt1List()
Definition: CFStore2.h:132
casacore::String cfCacheDir_p
Definition: CFStore2.h:145
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
casacore::Int mosPointingPos_p
Definition: CFStore2.h:144
double Double
Definition: aipstype.h:55
virtual ~CFStore2()
CFStore2(CFBuffer&lt;casacore::Complex&gt; *dataPtr, casacore::Quantity PA, casacore::Int mosPointing): sto...
Definition: CFStore2.h:56
casacore::Vector< casacore::CountedPtr< CFBuffer > > VBRow2CFBMapType
Definition: CFStore2.h:46
casacore::Vector< casacore::Int > & getAnt2List()
Definition: CFStore2.h:133
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:147
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:164
casacore::Cube< casacore::CountedPtr< CFCell > > VBRow2CFMapType
Definition: CFStore2.h:45
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42
const Bool False
Definition: aipstype.h:44
casacore::Vector< casacore::Int > ant1_p
Definition: CFStore2.h:141
casacore::Vector< casacore::Int > ant2_p
Definition: CFStore2.h:141
String: the storage and methods of handling collections of characters.
Definition: String.h:223
casacore::String getCFCacheDir()
Definition: CFStore2.h:101
VisBuffers encapsulate one chunk of visibility data for processing.
Definition: VisBuffer.h:153
void set(const CFStore2 &other)
Definition: CFStore2.h:86
casacore::IPosition getShape()
Definition: CFStore2.h:135
unsigned int uInt
Definition: aipstype.h:51
casacore::Bool lazyFillOn_p
Definition: CFStore2.h:143