Line data Source code
1 : 2 : #include <casacore/casa/Arrays/ArrayFwd.h> 3 : #include <casacore/casa/aips.h> 4 : #include <vector> 5 : #if ! defined (MSVIS_VisModelDataI_H) 6 : #define MSVIS_VisModelDataI_H 7 : 8 : namespace casacore{ 9 : 10 : class MeasurementSet; 11 : class RecordInterface; 12 : class String; 13 : class TableRecord; 14 : 15 : } 16 : 17 : namespace casa { 18 : 19 : class VisBuffer; 20 : namespace vi{class VisBuffer2;} 21 : 22 : 23 : class VisModelDataI; 24 : 25 : 26 : 27 : class VisModelDataI { 28 : 29 : public: 30 : 31 : typedef VisModelDataI * (* Factory) (); 32 : 33 : static bool setFactory (Factory, casacore::Int whichone=0); 34 : 35 : //empty constructor 36 2 : VisModelDataI() {} 37 : 38 : //From a FTMachine Record 39 : //VisModelDataI(const casacore::Record& ftmachinerec, const casacore::Vector<casacore::Int>& validfieldids, const casacore::Vector<casacore::Int>& msIds); 40 1 : virtual ~VisModelDataI() {} 41 : 42 : //Add Image/FTMachine to generate visibilities for 43 : //void addFTMachine(const casacore::Record& recordFTMachine, const casacore::Vector<casacore::Int>& validfieldids, const casacore::Vector<casacore::Int>& msIds); 44 : //Add componentlist to generate visibilities for 45 : //void addCompFTMachine(const ComponentList& cl, const casacore::Vector<casacore::Int>& validfieldids, 46 : // const casacore::Vector<casacore::Int>& msIds); 47 : //For simple model a special case for speed 48 : 49 : // void addFlatModel(const casacore::Vector<casacore::Double>& value, const casacore::Vector<casacore::Int>& validfieldids, 50 : // const casacore::Vector<casacore::Int>& msIds); 51 : 52 : // //add componentlists or ftmachines 53 : virtual void addModel(const casacore::RecordInterface& rec, const casacore::Vector<casacore::Int>& msids, const VisBuffer& vb) = 0; 54 : virtual void addModel(const casacore::RecordInterface& rec, const casacore::Vector<casacore::Int>& msids, const vi::VisBuffer2& vb) = 0; 55 : virtual VisModelDataI * clone () = 0; 56 : 57 : static VisModelDataI * create (); 58 : static VisModelDataI * create2 (); 59 : // //put the model data for this VisBuffer in the modelVisCube 60 : virtual casacore::Bool getModelVis(VisBuffer& vb) = 0; 61 : virtual casacore::Bool getModelVis(vi::VisBuffer2& vb) = 0; 62 : // //this is a helper function that writes the model record to the ms 63 : 64 : virtual void putModelI (const casacore::MeasurementSet& thems, const casacore::RecordInterface& rec, 65 : const casacore::Vector<casacore::Int>& validfields, const casacore::Vector<casacore::Int>& spws, 66 : const casacore::Vector<casacore::Int>& starts, const casacore::Vector<casacore::Int>& nchan, 67 : const casacore::Vector<casacore::Int>& incr, casacore::Bool iscomponentlist=true, casacore::Bool incremental=false) = 0; 68 : //Version 2 record to keep track of state and scan number 69 : virtual void putModelI(const casacore::MeasurementSet& thems,const casacore::RecordInterface& rec, const casacore::Matrix<casacore::Int>& indexComb, const casacore::Matrix<casacore::Int>& chansel, 70 : casacore::Bool iscomponentlist=true, casacore::Bool incremental=false)=0; 71 : 72 : // //helper function to clear the keywordSet of the ms of the model for the fields 73 : // //in that ms 74 : virtual void clearModelI(const casacore::MeasurementSet& thems) = 0; 75 : // // ...with field selection and optionally spw 76 : // static void clearModel(const casacore::MeasurementSet& thems, const casacore::String field, const casacore::String spws=casacore::String("")); 77 : 78 : // //Functions to see if model is defined in the casacore::MS either in the SOURCE table or else in the MAIN 79 : virtual casacore::Bool isModelDefinedI(const casacore::Int fieldId, const casacore::MeasurementSet& thems, casacore::String& key, casacore::Int& sourceRow) = 0; 80 : // static casacore::Bool isModelDefined(const casacore::String& elkey, const casacore::MeasurementSet& thems); 81 : 82 : // //Get a given model that is defined by key 83 : // //Forcing user to use a casacore::TableRecord rather than Generic casacore::RecordInterface ...just so as to avoid a copy. 84 : virtual casacore::Bool getModelRecordI(const casacore::String& theKey, casacore::TableRecord& theRec, const casacore::MeasurementSet& theMs) = 0; 85 : 86 : // // casacore::List the fields 87 : // static void listModel(const casacore::MeasurementSet& thems); 88 : 89 : // static FTMachine* NEW_FT(const casacore::Record& ftrec); 90 : // //check if an addFT or addCompFT is necessary 91 : // //casacore::Bool hasFT(casacore::Int msid, casacore::Int fieldid); 92 : // //casacore::Bool hasCL(casacore::Int msid, casacore::Int fieldid); 93 : // //returns a -1 if there is no model for this combination of ms,field,spw...but has not been // checked yet if there is one 94 : // //returns a -2 if it has been tested before but does have it. 95 : // //returns a 1 if it has a model stored 96 : virtual casacore::Int hasModel(casacore::Int msid, casacore::Int field, casacore::Int spw) = 0; 97 : 98 : virtual casacore::Bool isVersion2() = 0; 99 : ///Make sure that VisModel has been called once loaded checks and 100 : ///detection of version 1 or 2 is valid 101 : virtual void init(const VisBuffer& vb) = 0; 102 : virtual void init(const vi::VisBuffer2& vb) = 0; 103 : 104 : private: 105 : 106 : static Factory factory_p; 107 : static Factory factory2_p; 108 : 109 : }; 110 : 111 : 112 : 113 : } 114 : 115 : #endif // ! defined (MSVIS_VisModelDataI_H)