Line data Source code
1 : //# SIMapperCollection.h: Imager functionality sits here;
2 : //# Copyright (C) 1996,1997,1998,1999,2000,2001,2002,2003
3 : //# Associated Universities, Inc. Washington DC, USA.
4 : //#
5 : //# This library is free software; you can redistribute it and/or modify it
6 : //# under the terms of the GNU Library General Public License as published by
7 : //# the Free Software Foundation; either version 2 of the License, or (at your
8 : //# option) any later version.
9 : //#
10 : //# This library is distributed in the hope that it will be useful, but WITHOUT
11 : //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 : //# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
13 : //# License for more details.
14 : //#
15 : //# You should have received a copy of the GNU Library General Public License
16 : //# along with this library; if not, write to the Free Software Foundation,
17 : //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
18 : //#
19 : //# Correspondence concerning AIPS++ should be addressed as follows:
20 : //# Internet email: casa-feedback@nrao.edu.
21 : //# Postal address: AIPS++ Project Office
22 : //# National Radio Astronomy Observatory
23 : //# 520 Edgemont Road
24 : //#
25 : //# $Id$
26 :
27 : #ifndef SYNTHESIS_SIMAPPERCOLLECTION_H
28 : #define SYNTHESIS_SIMAPPERCOLLECTION_H
29 :
30 : #include <casacore/casa/aips.h>
31 : #include <casacore/casa/OS/Timer.h>
32 : #include <casacore/casa/Containers/Record.h>
33 : #include <casacore/ms/MeasurementSets/MeasurementSet.h>
34 : #include <casacore/casa/Arrays/IPosition.h>
35 : #include <casacore/casa/Quanta/Quantum.h>
36 : #include <casacore/measures/Measures/MDirection.h>
37 :
38 : #include <synthesis/ImagerObjects/SIMapper.h>
39 : #include <synthesis/ImagerObjects/SIMapperImageMosaic.h>
40 :
41 : namespace casa { //# NAMESPACE CASA - BEGIN
42 :
43 : class SIMapperCollection
44 : {
45 : public:
46 : // Default constructor
47 :
48 : SIMapperCollection();
49 : ~SIMapperCollection();
50 :
51 : void addMapper(casacore::CountedPtr <SIMapper> map);
52 : casacore::Int nMappers();
53 : casacore::Vector<casacore::String> getImageNames();
54 :
55 : /* // No need for now.
56 : // Write this function only if we need to support multiple facets on outlier fields too.
57 : // In that case, hold a list of original ImageStores and a map to the list of Mappers
58 : // to keep track of which original image points to which subset of the Mapper list.
59 : // Also add code into "finalizeGrid" to copy only one PSF to the original.
60 : void addMapper( casacore::Int mapperId,
61 : casacore::String mapperType,
62 : casacore::uInt nTaylorTerms,
63 : casacore::CountedPtr<FTMachine> ftm,
64 : casacore::CountedPtr<FTMachine> iftm,
65 : casacore::String imageName,
66 : casacore::CoordinateSystem& cSys,
67 : casacore::IPosition imShape,
68 : const casacore::Bool overwrite );
69 : */
70 : void initializeGrid(vi::VisBuffer2& vb, casacore::Bool dopsf=false,const casacore::Int mapperid=-1);
71 : ///This version is for initializing BriggsCubeWeightor
72 : void initializeGrid(vi::VisibilityIterator2& vi, casacore::Bool dopsf=false, const casacore::Int mapperid=-1);
73 : void handleNewMs(const casacore::MeasurementSet &ms, const casacore::Int mapperid=-1);
74 : void grid(vi::VisBuffer2& vb, casacore::Bool dopsf=false, refim::FTMachine::Type col=refim::FTMachine::CORRECTED,
75 : const casacore::Int mapperid=-1);
76 : void finalizeGrid(vi::VisBuffer2& vb, casacore::Bool dopsf=false,const casacore::Int mapperid=-1);
77 : void initializeDegrid(vi::VisBuffer2& vb,const casacore::Int mapperid=-1);
78 : void degrid(vi::VisBuffer2& vb, casacore::Bool saveVirtualMod=false,const casacore::Int mapperid=-1);
79 : void saveVirtualModel(vi::VisBuffer2& vb);
80 : void finalizeDegrid(vi::VisBuffer2& vb,const casacore::Int mapperid=-1);
81 : void addPB(vi::VisBuffer2& vb, PBMath& pbMath, const casacore::MDirection& altDir=casacore::MDirection(), const casacore::Bool useAltDir=False);
82 :
83 : //////////// OLD VI/VB : Version that use old vi/vb can be removed the vi2/vb2 works
84 : void initializeGrid(VisBuffer& vb, casacore::Bool dopsf=false,const casacore::Int mapperid=-1);
85 : void grid(VisBuffer& vb, casacore::Bool dopsf=false, FTMachine::Type col=FTMachine::CORRECTED,
86 : const casacore::Int mapperid=-1);
87 : void finalizeGrid(VisBuffer& vb, casacore::Bool dopsf=false,const casacore::Int mapperid=-1);
88 : void initializeDegrid(VisBuffer& vb,const casacore::Int mapperid=-1);
89 : void degrid(VisBuffer& vb, casacore::Bool saveVirtualMod=false,const casacore::Int mapperid=-1);
90 : void saveVirtualModel(VisBuffer& vb);
91 : void finalizeDegrid(VisBuffer& vb,const casacore::Int mapperid=-1);
92 : void addPB(VisBuffer& vb, PBMath& pbMath);
93 : ////////////////////////////////////////////////////
94 : casacore::Record getFTMRecord(casacore::Int mapperid);
95 :
96 : casacore::CountedPtr<SIImageStore> imageStore(const casacore::Int id=0);
97 : casacore::Bool releaseImageLocks();
98 : std::vector<casacore::String> cleanupTempFiles(const casacore::String& mes=casacore::String(""));
99 : void checkOverlappingModels(casacore::String action); // action='blank' or 'restore'
100 :
101 : casacore::Bool anyNonZeroModels();
102 :
103 0 : const casacore::CountedPtr<FTMachine> getFTM(casacore::Int which, const casacore::Bool ift=true)
104 : {
105 0 : AlwaysAssert(which>=0 && which<(casacore::Int)itsMappers.nelements(),casacore::AipsError);
106 0 : return itsMappers[which]->getFTM(ift);
107 : };
108 3807 : const casacore::CountedPtr<refim::FTMachine>& getFTM2(casacore::Int which, const casacore::Bool ift=true)
109 : {
110 3807 : AlwaysAssert(which>=0 && which<(casacore::Int)itsMappers.nelements(),casacore::AipsError);
111 3807 : return itsMappers[which]->getFTM2(ift);
112 : };
113 :
114 :
115 : void initPB();
116 :
117 0 : const casacore::CountedPtr<SIMapper> getMapper(casacore::Int which)
118 0 : {AlwaysAssert(which>=0 && which<(casacore::Int)itsMappers.nelements(),casacore::AipsError);
119 0 : return itsMappers[which];};
120 : virtual casacore::Long estimateRAM();
121 :
122 : protected:
123 :
124 : ///////////////////// Member Objects
125 :
126 : casacore::Block<casacore::CountedPtr<SIMapper> > itsMappers;
127 : casacore::Int oldMsId_p;
128 :
129 : casacore::Bool itsIsNonZeroModel;
130 :
131 : };
132 :
133 :
134 : } //# NAMESPACE CASA - END
135 :
136 : #endif
|