Line data Source code
1 : /* 2 : * VisibilityBufferAsync.h 3 : * 4 : * Created on: Nov 3, 2010 5 : * Author: jjacobs 6 : */ 7 : 8 : #ifndef VISIBILITYBUFFERASYNC_H_ 9 : #define VISIBILITYBUFFERASYNC_H_ 10 : 11 : #include <msvis/MSVis/VisBuffer.h> 12 : 13 : namespace casa { 14 : 15 : class ROVisibilityIteratorAsync; 16 : 17 : namespace asyncio { 18 : class VlaDatum; 19 : class VLAT; 20 : } 21 : 22 : class VisBufferAsync : public VisBuffer { 23 : 24 : friend class Rovia_Test; 25 : friend class ViReadImplAsync; 26 : friend class VisBufferAsyncWrapper; 27 : friend class VisBufferAutoPtr; 28 : friend class asyncio::VlaDatum; 29 : friend class asyncio::VLAT; 30 : 31 : public: 32 : 33 : //VisBufferAsync (const VisBuffer& vb); 34 : 35 : ~VisBufferAsync (); 36 : 37 : VisBufferAsync & operator= (const VisBufferAsync & other); 38 : 39 : virtual void allSelectedSpectralWindows(casacore::Vector<casacore::Int>& spws, casacore::Vector<casacore::Int>& nvischan); 40 : virtual VisBufferAsync & assign (const VisBuffer & vb, casacore::Bool copy); 41 : virtual casacore::Vector<casacore::MDirection> azel(casacore::Double time) const; 42 : virtual casacore::MDirection azel0(casacore::Double time) const; 43 : virtual VisBuffer * clone () const; 44 : //virtual casacore::Int dataDescriptionId() const; 45 : virtual void detachFromVisIter (); 46 : virtual casacore::Vector<casacore::Float> feed_pa(casacore::Double time) const; 47 : virtual casacore::Double hourang(casacore::Double time) const; 48 : virtual void invalidate (); // This one is booby-trapped right now 49 : virtual void invalidateAsync (); // Use this one in async code 50 : // virtual casacore::Vector<casacore::Double> & lsrFrequency (); 51 : // virtual const casacore::Vector<casacore::Double> & lsrFrequency () const; 52 : virtual void lsrFrequency(const casacore::Int& spw, casacore::Vector<casacore::Double>& freq, casacore::Bool& convert) const; 53 : virtual const casacore::MSColumns& msColumns() const; 54 : casacore::Int msId () const; 55 : virtual casacore::Bool newArrayId () const; 56 : virtual casacore::Bool newFieldId () const; 57 : casacore::Bool newMS() const; 58 : virtual casacore::Bool newSpectralWindow () const; 59 0 : casacore::Int nRowChunk() const{ 60 0 : return nRowChunk_p; 61 : } 62 : 63 : casacore::Int numberAnt () const; 64 : casacore::Int numberCoh () const; 65 : virtual casacore::Vector<casacore::Float> parang(casacore::Double time) const; 66 : virtual casacore::Float parang0(casacore::Double time) const; 67 : virtual casacore::Int polarizationId() const; 68 0 : virtual casacore::Vector<casacore::rownr_t>& rowIds(){throw(casacore::AipsError("rowIds() not implemented for VBA."));} 69 0 : virtual const casacore::Vector<casacore::rownr_t>& rowIds() const {throw(casacore::AipsError("rowIds() const not implemented for VBA."));} 70 : virtual void setCorrectedVisCube(casacore::Complex c); 71 : virtual void setCorrectedVisCube (const casacore::Cube<casacore::Complex> & vis); 72 : virtual void setModelVisCube(casacore::Complex c); 73 : virtual void setModelVisCube (const casacore::Cube<casacore::Complex> & vis); 74 : virtual void setModelVisCube (const casacore::Vector<casacore::Float> & stokes); 75 : virtual void setVisCube(casacore::Complex c); 76 : virtual void setVisCube (const casacore::Cube<casacore::Complex>& vis); 77 : 78 : protected: 79 : 80 : // The constructors are not public because creation should be performed 81 : // by a factory object (e.g., VisBufferAutoPtr). The use of a factory 82 : // makes it possible to fine tune at run time whether a VisBuffer or a 83 : // VisBufferAsync is created. 84 : 85 : VisBufferAsync (); 86 : VisBufferAsync (const VisBufferAsync & other); 87 : VisBufferAsync (ROVisibilityIterator & iter); 88 : 89 : void attachToVisIter(ROVisibilityIterator & iter); 90 : void checkVisIter (const char * func, const char * file, int line, const char * extra = "") const; 91 : void clear (); 92 : void construct (); 93 : virtual void copyAsyncValues (const VisBufferAsync & other); 94 : virtual void copyCache (const VisBuffer & other, casacore::Bool force); 95 : template<typename T> void copyVector (const casacore::Vector<T> & from, casacore::Vector<T> & to); 96 : casacore::Vector<casacore::MDirection>& fillDirection1(); 97 : casacore::Vector<casacore::MDirection>& fillDirection2(); 98 : void fillFrom (const VisBufferAsync & other); 99 : casacore::MDirection & fillPhaseCenter(); 100 : casacore::Bool getAllBeamOffsetsZero () const; 101 : const casacore::Vector <casacore::String> & getAntennaMounts () const; 102 : const casacore::Cube <casacore::RigidVector <casacore::Double, 2> > & getBeamOffsets () const; 103 : const casacore::MeasurementSet & getMs () const; 104 : casacore::Int getNSpw () const; 105 : casacore::MDirection getPhaseCenter () const; 106 : const casacore::Cube <casacore::Double> & getReceptorAngles () const; 107 : void setAngleInfo (casacore::Bool allBeamOffsetsZero, 108 : const casacore::Vector<casacore::String> antennaMounts, 109 : casacore::Cube<casacore::RigidVector<casacore::Double, 2> > beamOffsets, 110 : const casacore::Cube<casacore::Double> & receptorAngles); 111 : void initializeScalars (); 112 : /////void setDataDescriptionId (casacore::Int id); 113 : void setFilling (casacore::Bool isFilling); 114 : void setLsrInfo (const casacore::Block <casacore::Int> & channelGroupNumber, 115 : const casacore::Block <casacore::Int> & channelIncrement, 116 : const casacore::Block <casacore::Int> & channelStart, 117 : const casacore::Block <casacore::Int> & channelWidth, 118 : const casacore::MPosition & observatoryPosition, 119 : const casacore::MDirection & phaseCenter, 120 : casacore::Bool velocitySelection); 121 : void setMeasurementSet (const casacore::MeasurementSet & ms); 122 : void setMeasurementSetId (casacore::Int id, bool isNew); 123 : void setMEpoch (const casacore::MEpoch & mEpoch); 124 : void setMSD (const casacore::MSDerivedValues & msd); 125 : void setNAntennas (casacore::Int); 126 : void setNCoh (casacore::Int); 127 : void setNSpw (casacore::Int); 128 : void setNewEntityFlags (bool newArrayId, bool newFieldId, bool newSpectralWindow); 129 : void setPolarizationId (casacore::Int); 130 : void setNRowChunk (casacore::Int); 131 : void setReceptor0Angle (const casacore::Vector<casacore::Float> & receptor0Angle); 132 : void setRowIds (const casacore::Vector<casacore::rownr_t> & rowIds); 133 : void setSelectedNVisibilityChannels (const casacore::Vector<casacore::Int> & nVisibilityChannels); 134 : void setSelectedSpectralWindows (const casacore::Vector<casacore::Int> & spectralWindows); 135 : void setTopoFreqs (const casacore::Vector<casacore::Double> & lsrFreq, const casacore::Vector<casacore::Double> & selFreq_p); 136 : void setVisibilityShape (const casacore::IPosition & pvisibilityShape); 137 : void updateCoordInfo (const VisBuffer *, const casacore::Bool dirDependent=true); 138 : 139 : static casacore::MDirection unsharedCopyDirection (const casacore::MDirection & direction); 140 : static void unsharedCopyDirectionVector (casacore::Vector<casacore::MDirection> & direction); 141 : static casacore::MEpoch unsharedCopyEpoch (const casacore::MEpoch & mEpoch); 142 : static casacore::MPosition unsharedCopyPosition (const casacore::MPosition & position); 143 : 144 : private: 145 : 146 : casacore::Bool fillAllBeamOffsetsZero (); 147 : casacore::Vector <casacore::String> fillAntennaMounts (); 148 : casacore::Cube <casacore::RigidVector <casacore::Double, 2> > fillBeamOffsets (); 149 : casacore::Cube <casacore::Double> fillReceptorAngles (); 150 : 151 : casacore::Bool allBeamOffsetsZero_p; 152 : casacore::Vector<casacore::String> antennaMounts_p; 153 : mutable casacore::Vector<casacore::MDirection> azelCached_p; // mutable because it is a cached value 154 : mutable casacore::Double azelCachedTime_p; // mutable because it is a cached value 155 : casacore::Cube<casacore::RigidVector<casacore::Double, 2> > beamOffsets_p; 156 : casacore::Block<casacore::Int> channelGroupNumber_p; 157 : casacore::Block<casacore::Int> channelIncrement_p; 158 : casacore::Block<casacore::Int> channelStart_p; 159 : casacore::Block<casacore::Int> channelWidth_p; 160 : //casacore::Int dataDescriptionId_p; 161 : mutable casacore::Vector<casacore::Float> feedpaCached_p; // mutable because it is a cached value 162 : mutable casacore::Double feedpaCachedTime_p; // mutable because it is a cached value 163 : casacore::Bool isFilling_p; 164 : casacore::Vector<casacore::Double> lsrFrequency_p; // calculated by getTopoFreqs if velSelection_p 165 : casacore::MEpoch mEpoch_p; 166 : const casacore::MeasurementSet * measurementSet_p; // [use] 167 : mutable casacore::MSColumns * msColumns_p; // [own] 168 : casacore::MSDerivedValues * msd_p; // [own] 169 : casacore::Int nAntennas_p; 170 : casacore::Int nCoh_p; 171 : casacore::Bool newArrayId_p; 172 : casacore::Bool newFieldId_p; 173 : casacore::Bool newSpectralWindow_p; 174 : casacore::Int nRowChunk_p; 175 : casacore::Int nSpw_p; 176 : //const casacore::ScalarColumn<casacore::Int> * obsMFreqTypes_p; // [use] 177 : casacore::MPosition observatoryPosition_p; 178 : mutable casacore::Vector<casacore::Float> parangCached_p; // mutable because it is a cached value 179 : mutable casacore::Double parangCachedTime_p; // mutable because it is a cached value 180 : casacore::Int polarizationId_p; 181 : casacore::Vector<casacore::Float> receptor0Angle_p; 182 : casacore::Cube<casacore::Double> receptorAngles_p; 183 : casacore::Vector<casacore::Double> selFreq_p; 184 : casacore::Vector<casacore::Int> selectedNVisibilityChannels_p; 185 : casacore::Vector<casacore::Int> selectedSpectralWindows_p; 186 : casacore::Bool velSelection_p; 187 : casacore::IPosition visibilityShape_p; 188 : }; 189 : 190 : 191 : template<typename T> 192 0 : void VisBufferAsync::copyVector (const casacore::Vector<T> & from, casacore::Vector<T> & to) 193 : { 194 : // Make an independent copy of the vector. 195 : // N.B.: the independence is only at the top casacore::Vector level 196 : // so any deep dependence is not undone 197 : 198 0 : casacore::Vector<T> tmp = from; 199 0 : to = tmp.copy(); 200 0 : } 201 : 202 : 203 : } // end namespace casa 204 : 205 : 206 : #endif /* VISIBILITYBUFFERASYNC_H_ */