casa
$Rev:20696$
|
00001 //# CalCache.h: CalTable-specific Data cache for plotms. 00002 //# Copyright (C) 2009 00003 //# Associated Universities, Inc. Washington DC, USA. 00004 //# 00005 //# This library is free software; you can redistribute it and/or modify it 00006 //# under the terms of the GNU Library General Public License as published by 00007 //# the Free Software Foundation; either version 2 of the License, or (at your 00008 //# option) any later version. 00009 //# 00010 //# This library is distributed in the hope that it will be useful, but WITHOUT 00011 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 00012 //# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public 00013 //# License for more details. 00014 //# 00015 //# You should have received a copy of the GNU Library General Public License 00016 //# along with this library; if not, write to the Free Software Foundation, 00017 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA. 00018 //# 00019 //# Correspondence concerning AIPS++ should be addressed as follows: 00020 //# Internet email: aips2-request@nrao.edu. 00021 //# Postal address: AIPS++ Project Office 00022 //# National Radio Astronomy Observatory 00023 //# 520 Edgemont Road 00024 //# Charlottesville, VA 22903-2475 USA 00025 //# 00026 //# $Id: $ 00027 #ifndef CALCACHE_H_ 00028 #define CALCACHE_H_ 00029 00030 #include <plotms/Data/PlotMSCacheBase.h> 00031 00032 #include <plotms/PlotMS/PlotMSAveraging.h> 00033 #include <plotms/PlotMS/PlotMSConstants.h> 00034 #include <plotms/PlotMS/PlotMSFlagging.h> 00035 #include <plotms/Actions/PlotMSCacheThread.qo.h> 00036 00037 #include <synthesis/CalTables/NewCalTable.h> 00038 #include <synthesis/CalTables/CTIter.h> 00039 #include <casa/aips.h> 00040 #include <casa/Arrays.h> 00041 #include <casa/Containers/Block.h> 00042 00043 namespace casa { 00044 00045 //# Forward declarations. 00046 class PlotMSApp; 00047 class PlotMSIndexer; 00048 00049 class CalCache : public PlotMSCacheBase { 00050 00051 // Friend class declarations. 00052 friend class PlotMSIndexer; 00053 00054 public: 00055 00056 // Constructor which takes parent PlotMS. 00057 CalCache(PlotMSApp* parent); 00058 00059 // Destructor 00060 virtual ~CalCache(); 00061 00062 // Identify myself 00063 PlotMSCacheBase::Type cacheType() { return PlotMSCacheBase::CAL; }; 00064 00065 // Is the underlying table complex? 00066 inline Bool parsAreComplex() { return parsAreComplex_; }; 00067 00068 // Access to channel averaging bounds 00069 Matrix<Int>& chanAveBounds(Int spw) { return chanAveBounds_p(spw); }; 00070 00071 // ...not yet CAL-specific... (or ever?) 00072 // Set up indexing for the plot 00073 // void setUpIndexer(PMS::Axis iteraxis=PMS::SCAN, 00074 // Bool globalXRange=False, Bool globalYRange=False); 00075 00076 virtual String polname(Int ipol); 00077 00078 00079 protected: 00080 00081 // CAL-specific loadIt method 00082 virtual void loadIt(vector<PMS::Axis>& loadAxes, 00083 vector<PMS::DataColumn>& loadData, 00084 PlotMSCacheThread* thread = NULL); 00085 00086 private: 00087 00088 // Forbid copy for now 00089 CalCache(const CalCache&); 00090 00091 // Setup the CalIter 00092 void setUpCalIter(const String& calname, 00093 const PlotMSSelection& selection, 00094 Bool readonly=True, 00095 Bool chanselect=True, 00096 Bool corrselect=True); 00097 00098 // Count the chunks required in the cache 00099 void countChunks(ROCTIter& ci,PlotMSCacheThread* thread); // old 00100 00101 // Trap attempt to use to much memory (too many points) 00102 // void trapExcessVolume(map<PMS::Axis,Bool> pendingLoadAxes); 00103 00104 // Loop over VisIter, filling the cache 00105 void loadCalChunks(ROCTIter& ci, 00106 const vector<PMS::Axis> loadAxes, 00107 PlotMSCacheThread* thread); 00108 00109 // Loads the specific axis/metadata into the cache using the given VisBuffer. 00110 void loadCalAxis(ROCTIter& cti, Int chunk, PMS::Axis axis); 00111 00112 // Set flags in the CalTable 00113 virtual void flagToDisk(const PlotMSFlagging& flagging, 00114 Vector<Int>& chunks, 00115 Vector<Int>& relids, 00116 Bool flag, 00117 PlotMSIndexer* indexer); 00118 00119 00120 // A container for channel averaging bounds 00121 Vector<Matrix<Int> > chanAveBounds_p; 00122 00123 // Provisional flagging helpers 00124 Vector<Int> nVBPerAve_; 00125 00126 // The polarization basis 00127 String basis_; 00128 00129 // VisIterator pointer 00130 ROCTIter* ci_p; 00131 CTIter* wci_p; 00132 00133 // Is parameter column complex? 00134 Bool parsAreComplex_; 00135 00136 // Volume meter for volume calculation 00137 // PMSCacheVolMeter vm_; 00138 00139 00140 }; 00141 typedef CountedPtr<CalCache> CalCachePtr; 00142 00143 00144 } 00145 00146 #endif /* CALCACHE_H_ */