casa
$Rev:20696$
|
00001 /* 00002 * VisibilityBufferAsync.h 00003 * 00004 * Created on: Nov 3, 2010 00005 * Author: jjacobs 00006 */ 00007 00008 #ifndef VISIBILITYBUFFERASYNC_H_ 00009 #define VISIBILITYBUFFERASYNC_H_ 00010 00011 #include <synthesis/MSVis/VisBuffer.h> 00012 00013 namespace casa { 00014 00015 class ROVisibilityIteratorAsync; 00016 00017 namespace asyncio { 00018 class VlaDatum; 00019 class VLAT; 00020 } 00021 00022 class VisBufferAsync : public VisBuffer { 00023 00024 friend class Rovia_Test; 00025 friend class ViReadImplAsync; 00026 friend class VisBufferAsyncWrapper; 00027 friend class VisBufferAutoPtr; 00028 friend class asyncio::VlaDatum; 00029 friend class asyncio::VLAT; 00030 00031 public: 00032 00033 //VisBufferAsync (const VisBuffer& vb); 00034 00035 ~VisBufferAsync (); 00036 00037 VisBufferAsync & operator= (const VisBufferAsync & other); 00038 00039 virtual void allSelectedSpectralWindows(Vector<Int>& spws, Vector<Int>& nvischan); 00040 virtual VisBufferAsync & assign (const VisBuffer & vb, Bool copy); 00041 virtual Vector<MDirection> azel(Double time) const; 00042 virtual MDirection azel0(Double time) const; 00043 virtual VisBuffer * clone (); 00044 //virtual Int dataDescriptionId() const; 00045 virtual void detachFromVisIter (); 00046 virtual Vector<Float> feed_pa(Double time) const; 00047 virtual Double hourang(Double time) const; 00048 virtual void invalidate (); // This one is booby-trapped right now 00049 virtual void invalidateAsync (); // Use this one in async code 00050 // virtual Vector<Double> & lsrFrequency (); 00051 // virtual const Vector<Double> & lsrFrequency () const; 00052 virtual void lsrFrequency(const Int& spw, Vector<Double>& freq, Bool& convert) const; 00053 virtual const ROMSColumns& msColumns() const; 00054 Int msId () const; 00055 virtual Bool newArrayId () const; 00056 virtual Bool newFieldId () const; 00057 Bool newMS() const; 00058 virtual Bool newSpectralWindow () const; 00059 Int nRowChunk() const{ 00060 return nRowChunk_p; 00061 } 00062 00063 Int numberAnt () const; 00064 Int numberCoh () const; 00065 virtual Vector<Float> parang(Double time) const; 00066 virtual Float parang0(Double time) const; 00067 virtual Int polarizationId() const; 00068 virtual Vector<uInt>& rowIds(){throw(AipsError("rowIds() not implemented for VBA."));} 00069 virtual const Vector<uInt>& rowIds() const {throw(AipsError("rowIds() const not implemented for VBA."));} 00070 virtual void setCorrectedVisCube(Complex c); 00071 virtual void setCorrectedVisCube (const Cube<Complex> & vis); 00072 virtual void setModelVisCube(Complex c); 00073 virtual void setModelVisCube (const Cube<Complex> & vis); 00074 virtual void setModelVisCube (const Vector<Float> & stokes); 00075 virtual void setVisCube(Complex c); 00076 virtual void setVisCube (const Cube<Complex>& vis); 00077 00078 protected: 00079 00080 // The constructors are not public because creation should be performed 00081 // by a factory object (e.g., VisBufferAutoPtr). The use of a factory 00082 // makes it possible to fine tune at run time whether a VisBuffer or a 00083 // VisBufferAsync is created. 00084 00085 VisBufferAsync (); 00086 VisBufferAsync (const VisBufferAsync & other); 00087 VisBufferAsync (ROVisibilityIterator & iter); 00088 00089 void attachToVisIter(ROVisibilityIterator & iter); 00090 void checkVisIter (const char * func, const char * file, int line, const char * extra = "") const; 00091 void clear (); 00092 void construct (); 00093 virtual void copyAsyncValues (const VisBufferAsync & other); 00094 virtual void copyCache (const VisBuffer & other, Bool force); 00095 template<typename T> void copyVector (const Vector<T> & from, Vector<T> & to); 00096 Vector<MDirection>& fillDirection1(); 00097 Vector<MDirection>& fillDirection2(); 00098 void fillFrom (const VisBufferAsync & other); 00099 MDirection & fillPhaseCenter(); 00100 Bool getAllBeamOffsetsZero () const; 00101 const Vector <String> & getAntennaMounts () const; 00102 const Cube <RigidVector <Double, 2> > & getBeamOffsets () const; 00103 const MeasurementSet & getMs () const; 00104 Int getNSpw () const; 00105 MDirection getPhaseCenter () const; 00106 const Cube <Double> & getReceptorAngles () const; 00107 void setAngleInfo (Bool allBeamOffsetsZero, 00108 const Vector<String> antennaMounts, 00109 Cube<RigidVector<Double, 2> > beamOffsets, 00110 const Cube<Double> & receptorAngles); 00111 void initializeScalars (); 00113 void setFilling (Bool isFilling); 00114 void setLsrInfo (const Block <Int> & channelGroupNumber, 00115 const Block <Int> & channelIncrement, 00116 const Block <Int> & channelStart, 00117 const Block <Int> & channelWidth, 00118 const MPosition & observatoryPosition, 00119 const MDirection & phaseCenter, 00120 Bool velocitySelection); 00121 void setMeasurementSet (const MeasurementSet & ms); 00122 void setMeasurementSetId (Int id, bool isNew); 00123 void setMEpoch (const MEpoch & mEpoch); 00124 void setMSD (const MSDerivedValues & msd); 00125 void setNAntennas (Int); 00126 void setNCoh (Int); 00127 void setNSpw (Int); 00128 void setNewEntityFlags (bool newArrayId, bool newFieldId, bool newSpectralWindow); 00129 void setPolarizationId (Int); 00130 void setNRowChunk (Int); 00131 void setReceptor0Angle (const Vector<Float> & receptor0Angle); 00132 void setRowIds (const Vector<uInt> & rowIds); 00133 void setSelectedNVisibilityChannels (const Vector<Int> & nVisibilityChannels); 00134 void setSelectedSpectralWindows (const Vector<Int> & spectralWindows); 00135 void setTopoFreqs (const Vector<Double> & lsrFreq, const Vector<Double> & selFreq_p); 00136 void setVisibilityShape (const IPosition & pvisibilityShape); 00137 void updateCoordInfo (const VisBuffer *, const Bool dirDependent=True); 00138 00139 static MDirection unsharedCopyDirection (const MDirection & direction); 00140 static void unsharedCopyDirectionVector (Vector<MDirection> & direction); 00141 static MEpoch unsharedCopyEpoch (const MEpoch & mEpoch); 00142 static MPosition unsharedCopyPosition (const MPosition & position); 00143 00144 private: 00145 00146 Bool fillAllBeamOffsetsZero (); 00147 Vector <String> fillAntennaMounts (); 00148 Cube <RigidVector <Double, 2> > fillBeamOffsets (); 00149 Cube <Double> fillReceptorAngles (); 00150 00151 Bool allBeamOffsetsZero_p; 00152 Vector<String> antennaMounts_p; 00153 mutable Vector<MDirection> azelCached_p; // mutable because it is a cached value 00154 mutable Double azelCachedTime_p; // mutable because it is a cached value 00155 Cube<RigidVector<Double, 2> > beamOffsets_p; 00156 Block<Int> channelGroupNumber_p; 00157 Block<Int> channelIncrement_p; 00158 Block<Int> channelStart_p; 00159 Block<Int> channelWidth_p; 00160 //Int dataDescriptionId_p; 00161 mutable Vector<Float> feedpaCached_p; // mutable because it is a cached value 00162 mutable Double feedpaCachedTime_p; // mutable because it is a cached value 00163 Bool isFilling_p; 00164 Vector<Double> lsrFrequency_p; // calculated by getTopoFreqs if velSelection_p 00165 MEpoch mEpoch_p; 00166 const MeasurementSet * measurementSet_p; // [use] 00167 mutable ROMSColumns * msColumns_p; // [own] 00168 MSDerivedValues * msd_p; // [own] 00169 Int nAntennas_p; 00170 Int nCoh_p; 00171 Bool newArrayId_p; 00172 Bool newFieldId_p; 00173 Bool newSpectralWindow_p; 00174 Int nRowChunk_p; 00175 Int nSpw_p; 00176 //const ROScalarColumn<Int> * obsMFreqTypes_p; // [use] 00177 MPosition observatoryPosition_p; 00178 mutable Vector<Float> parangCached_p; // mutable because it is a cached value 00179 mutable Double parangCachedTime_p; // mutable because it is a cached value 00180 Int polarizationId_p; 00181 Vector<Float> receptor0Angle_p; 00182 Cube<Double> receptorAngles_p; 00183 Vector<Double> selFreq_p; 00184 Vector<Int> selectedNVisibilityChannels_p; 00185 Vector<Int> selectedSpectralWindows_p; 00186 Bool velSelection_p; 00187 IPosition visibilityShape_p; 00188 }; 00189 00190 00191 template<typename T> 00192 void VisBufferAsync::copyVector (const Vector<T> & from, Vector<T> & to) 00193 { 00194 // Make an independent copy of the vector. 00195 // N.B.: the independence is only at the top Vector level 00196 // so any deep dependence is not undone 00197 00198 Vector<T> tmp = from; 00199 to = tmp.copy(); 00200 } 00201 00202 00203 } // end namespace casa 00204 00205 00206 #endif /* VISIBILITYBUFFERASYNC_H_ */