Commit e6dcf35c authored by Réza Ansari's avatar Réza Ansari
Browse files

Classes VisiP4Reader completees, methodes Read(), SelectAll(), ... Reza 18/9/2017

parent 84a4f038
......@@ -86,7 +86,7 @@ VisiP4ReaderBase::~VisiP4ReaderBase()
}
/* --Methode-- */
void VisiP4ReaderBase::SelectSerialNum(int first, int last, int step)
void VisiP4ReaderBase::SelectSerialNum(long first, long last, long step)
{
ser_first_=first; ser_last_=last; ser_step_=step;
cur_serialnum_=ser_first_;
......@@ -99,6 +99,12 @@ void VisiP4ReaderBase::SelectTimeFrame(TimeStamp const & tustart, TimeStamp cons
throw ForbiddenError("VisiP4ReaderBase::SelectTimeFrame() - this operation is not implemented");
}
/* --Methode-- */
void VisiP4ReaderBase::SelectAll()
{
throw ForbiddenError("VisiP4ReaderBase::SelectAll() - this operation is not implemented");
}
/* --Methode-- */
bool VisiP4ReaderBase::Read_P(long sernum, TMatrix< complex<r_4> >* vismtx, TMatrix< complex<r_4> >* meanmtx,
TimeStamp& dateobs, double& mttag)
......@@ -294,7 +300,7 @@ VisiP4ReaderDB::~VisiP4ReaderDB()
}
/* --Methode-- */
void VisiP4ReaderDB::SelectSerialNum(int first, int last, int step)
void VisiP4ReaderDB::SelectSerialNum(long first, long last, long step)
{
if (last < first) throw ParmError("VisiP4ReaderDB::SelectSerialNum() last < first !");
VisiP4ReaderBase::SelectSerialNum(first, last, step);
......@@ -313,8 +319,8 @@ void VisiP4ReaderDB::SelectSerialNum(int first, int last, int step)
/* --Methode-- */
void VisiP4ReaderDB::SelectTimeFrame(TimeStamp const & tustart, TimeStamp const & tuend, int step)
{
int sfirst = 0;
int slast = 0;
long sfirst = 0;
long slast = 0;
for(size_t k=0; k<vdb_.size(); k++) {
if ((tustart >= vdb_[k].tu_start)&&(tustart < vdb_[k].tu_end)) sfirst = vdb_[k].ser_start;
if ((tuend >= vdb_[k].tu_start)&&(tuend < vdb_[k].tu_end)) slast = vdb_[k].ser_end;
......@@ -323,6 +329,13 @@ void VisiP4ReaderDB::SelectTimeFrame(TimeStamp const & tustart, TimeStamp const
return;
}
/* --Methode-- */
void VisiP4ReaderDB::SelectAll()
{
SelectSerialNum(db_first_ser_, db_end_ser_-1);
}
/* --Methode-- */
void VisiP4ReaderDB::Init()
{
......@@ -353,6 +366,11 @@ void VisiP4ReaderDB::Init()
vdb_.push_back(dbel);
}
}
db_first_ser_ = vdb_[0].ser_start;
db_end_ser_ = vdb_[vdb_.size()-1].ser_end;
db_first_filenum_ = vdb_[0].filenum;
db_last_filenum_ = vdb_[vdb_.size()-1].filenum;
cout << "VisiP4ReaderDB::Init(): "<<vdb_.size()<<" lines read from VisMtxDBWriter data description file"<<filenamebuff<<endl;
/*
for (size_t k=0; k<vdb_.size(); k++) {
......
......@@ -36,10 +36,13 @@ public:
/*! \brief Select range of Serial Number for Visibility Matrices to be processed
Process VisMtx with serial numbers sn such as ser_first_<= sn <= ser_last_ , one matrix out of ser_step_ */
virtual void SelectSerialNum(int first, int last, int step=1);
virtual void SelectSerialNum(long first, long last, long step=1);
/*! \brief Select the time interval for Visibility Matrices to be processed
Default implementation throws an exception */
virtual void SelectTimeFrame(TimeStamp const & tustart, TimeStamp const & tuend, int step=1);
/*! \brief Select all the available Visibility Matrices for processing
Default implementation throws an exception */
virtual void SelectAll();
//! Activate or deactivate frequency reordering when reading visibility matrices
inline void setFreqReordering(bool fg)
......@@ -123,7 +126,7 @@ protected:
virtual void ReadVisMtx(int band, int visgrp, long sernum, TMatrix< complex<r_4> > & vmtx, TMatrix< complex<r_4> > * mmtx) = 0;
vector<string> paths_; // path for visibility files produced for each BAO5,BAO6 (first,second frequency band)
int ser_first_, ser_last_, ser_step_; // VisMtx serial number I such as ser_first_<=I<=ser_last_ , one matrix out of ser_step_
long ser_first_, ser_last_, ser_step_; // VisMtx serial number I such as ser_first_<=I<=ser_last_ , one matrix out of ser_step_
bool fgreorderfreq_;
long cur_serialnum_; // current file number
......@@ -164,14 +167,18 @@ public:
VisiP4ReaderDB(vector<string> const& vpath, int first, int last, int step=1, bool reorderfreq=false);
virtual ~VisiP4ReaderDB();
virtual void SelectSerialNum(int first, int last, int step=1);
virtual void SelectSerialNum(long first, long last, long step=1);
virtual void SelectTimeFrame(TimeStamp const & tustart, TimeStamp const & tuend, int step=1);
virtual void SelectAll();
protected:
void Init();
virtual void ReadVisMtx(int band, int visgrp, long sernum, TMatrix< complex<r_4> > & vmtx, TMatrix< complex<r_4> > * mmtx);
void OpenFiles(size_t vdbidx);
long db_first_ser_, db_end_ser_; // first and last Matrix sequence number in directory
int db_first_filenum_, db_last_filenum_; // first and last file number in directory
typedef struct { int filenum, ser_start, ser_end; TimeStamp tu_start, tu_end; } VDBEL;
std::vector< VDBEL > vdb_;
int first_filenum_, last_filenum_;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment