casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
BaselinesSet.h
Go to the documentation of this file.
00001 #if     !defined(_BASELINESSET_H)
00002  
00003 #include "ASDMEntities.h"
00004 #include "Error.h"
00005 #include "BaselineMetadata.h"
00006 #include "SwitchCyclesList.h"
00007 #include "DataDescriptionsSet.h"
00008 
00009 #include <AxisName.h>
00010 #include <DataContent.h>
00011 
00012 
00013 namespace sdmbin {
00014   
00017   class BaselinesSet : public DataDescriptionsSet
00018   {
00019   public:
00020     BaselinesSet();
00021 
00038     BaselinesSet( vector<Tag>  v_antennaIdArray, 
00039                   vector<int>  v_feedIdArray,
00040                   vector<int>  v_phasedArrayList,
00041                   vector<bool> v_antennaUsedArray, 
00042                   DataDescriptionsSet& dataDescriptionsSet
00043                   );
00044 
00046     BaselinesSet(const BaselinesSet &);
00047 
00049     ~BaselinesSet();
00050 
00068     unsigned int transferId(unsigned int na,  unsigned int ndd, unsigned int nbin);
00069 
00087     unsigned int transferId(unsigned int na,  unsigned int nfe, unsigned int ndd, unsigned int nbin);
00088     
00100     unsigned int transferId(unsigned int na1, unsigned int na2, unsigned int ndd, unsigned int nbin, unsigned int napc);
00101 
00114     unsigned int transferId(unsigned int na1, unsigned int na2, unsigned int nfe, unsigned int ndd,  unsigned int nbin, unsigned int napc);
00115 
00125     unsigned int baselineIndex( Tag antennaId)  ; // throw (Error);
00126 
00146     unsigned int baselineIndex( Tag antennaId1, Tag antennaId2) ; // throw (Error);
00147 
00163     unsigned int baselineIndex( unsigned int na1, unsigned int na2) ; // throw(Error);
00164 
00174     unsigned int antenna1(unsigned int baselineIndex)  ; // throw (Error);
00175 
00185     unsigned int antenna2(unsigned int baselineIndex)  ; // throw (Error);
00186 
00195     unsigned int feedIndex(Tag antennaId, int feedId) ; // throw (Error);
00196 
00202     Tag         getEffAntennaId(unsigned int na) ; // throw (Error);
00203 
00207     unsigned int getNumAntennas();
00208 
00209 
00222     int         getFeedId(unsigned int na, unsigned int nfe) ; // throw (Error);
00223 
00234     unsigned int getNumEffAntennas();
00235 
00240     unsigned int getNumBaselines();
00241 
00247     unsigned int getNumEffBaselines();
00248     
00260     unsigned int getNumPDTvalue(Enum<DataContent> e_dc, EnumSet<AxisName> es_an, bool effective);
00261 
00262   private:
00263     vector<Tag>  v_AntennaIdArray_;   
00264     vector<int>  v_FeedIdArray_;      
00265     vector<int>  v_PhasedArrayList_;  
00266     unsigned int numFeeds_;           
00267     unsigned int numAntennas_;        
00268     unsigned int numEffAntennas_;     
00269     unsigned int numBaselines_;       
00270     unsigned int numEffBaselines_;    
00271     vector<Tag>  v_effAntennaIdArray_;
00272 
00273   };
00274 
00275 
00276   inline unsigned int BaselinesSet::transferId(unsigned int na1,unsigned int na2,unsigned int nfe, unsigned int ndd,unsigned int nbin,unsigned int napc){
00277 
00278     unsigned int baselineidx = baselineIndex(na1,na2);                   //cout << "baselineidx=" << baselineidx << endl;
00279 
00280     unsigned int v_cumulCrossSize_ndd=0; if(v_cumulCrossSize_.size()!=0)v_cumulCrossSize_ndd = v_cumulCrossSize_[ndd];
00281     unsigned int v_crossSize_ndd=0;      if(v_crossSize_.size()!=0)     v_crossSize_ndd      = v_crossSize_[ndd];
00282 
00283     unsigned int n = 
00284       baselineidx*numFeeds_*sumCrossSize_ +                           // /baseline
00285       nfe*sumCrossSize_ +                                             // /baseline/feed     
00286       v_cumulCrossSize_ndd +                                          // /baseline/feed/datadesc
00287       nbin*(v_crossSize_ndd/numBin(ndd)) +                            // /baseline/feed/datadesc/bin
00288       napc*(v_crossSize_ndd/(numBin(ndd)*numApc_));                   // /baseline/feed/datadesc/bin/napc
00289 
00290     return n;
00291   }
00292 
00293   inline unsigned int DataDescriptionsSet::numBin(unsigned int ndd) { // throw(Error){
00294     // if(ndd>=v_basebandName_.size())
00295     //   Error(SERIOUS,"The dataDescription index must be smaller than %d",
00296     //      v_basebandName_.size());
00297     return v_numBin_[ndd];  
00298   }
00299 
00300   inline unsigned int BaselinesSet::baselineIndex( unsigned int na1, unsigned int na2) { // throw(Error){
00301     unsigned int iIdx = min (na1, na2);
00302     unsigned int jIdx = max (na1, na2);
00303     return jIdx * (jIdx - 1) / 2 + iIdx;
00304   }
00305 }
00306 #define _BASELINESSET_H
00307 #endif