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: aips2-request@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 grid(vi::VisBuffer2& vb, casacore::Bool dopsf=false, refim::FTMachine::Type col=refim::FTMachine::CORRECTED,
74 : const casacore::Int mapperid=-1);
75 : void finalizeGrid(vi::VisBuffer2& vb, casacore::Bool dopsf=false,const casacore::Int mapperid=-1);
76 : void initializeDegrid(vi::VisBuffer2& vb,const casacore::Int mapperid=-1);
77 : void degrid(vi::VisBuffer2& vb, casacore::Bool saveVirtualMod=false,const casacore::Int mapperid=-1);
78 : void saveVirtualModel(vi::VisBuffer2& vb);
79 : void finalizeDegrid(vi::VisBuffer2& vb,const casacore::Int mapperid=-1);
80 : void addPB(vi::VisBuffer2& vb, PBMath& pbMath, const casacore::MDirection& altDir=casacore::MDirection(), const casacore::Bool useAltDir=False);
81 :
82 : //////////// OLD VI/VB : Version that use old vi/vb can be removed the vi2/vb2 works
83 : void initializeGrid(VisBuffer& vb, casacore::Bool dopsf=false,const casacore::Int mapperid=-1);
84 : void grid(VisBuffer& vb, casacore::Bool dopsf=false, FTMachine::Type col=FTMachine::CORRECTED,
85 : const casacore::Int mapperid=-1);
86 : void finalizeGrid(VisBuffer& vb, casacore::Bool dopsf=false,const casacore::Int mapperid=-1);
87 : void initializeDegrid(VisBuffer& vb,const casacore::Int mapperid=-1);
88 : void degrid(VisBuffer& vb, casacore::Bool saveVirtualMod=false,const casacore::Int mapperid=-1);
89 : void saveVirtualModel(VisBuffer& vb);
90 : void finalizeDegrid(VisBuffer& vb,const casacore::Int mapperid=-1);
91 : void addPB(VisBuffer& vb, PBMath& pbMath);
92 : ////////////////////////////////////////////////////
93 : casacore::Record getFTMRecord(casacore::Int mapperid);
94 :
95 : casacore::CountedPtr<SIImageStore> imageStore(const casacore::Int id=0);
96 : casacore::Bool releaseImageLocks();
97 : std::vector<casacore::String> cleanupTempFiles(const casacore::String& mes=casacore::String(""));
98 : void checkOverlappingModels(casacore::String action); // action='blank' or 'restore'
99 :
100 : casacore::Bool anyNonZeroModels();
101 :
102 0 : const casacore::CountedPtr<FTMachine> getFTM(casacore::Int which, const casacore::Bool ift=true)
103 : {
104 0 : AlwaysAssert(which>=0 && which<(casacore::Int)itsMappers.nelements(),casacore::AipsError);
105 0 : return itsMappers[which]->getFTM(ift);
106 : };
107 3636 : const casacore::CountedPtr<refim::FTMachine>& getFTM2(casacore::Int which, const casacore::Bool ift=true)
108 : {
109 3636 : AlwaysAssert(which>=0 && which<(casacore::Int)itsMappers.nelements(),casacore::AipsError);
110 3636 : return itsMappers[which]->getFTM2(ift);
111 : };
112 :
113 :
114 : void initPB();
115 :
116 0 : const casacore::CountedPtr<SIMapper> getMapper(casacore::Int which)
117 0 : {AlwaysAssert(which>=0 && which<(casacore::Int)itsMappers.nelements(),casacore::AipsError);
118 0 : return itsMappers[which];};
119 : virtual casacore::Long estimateRAM();
120 :
121 : protected:
122 :
123 : ///////////////////// Member Objects
124 :
125 : casacore::Block<casacore::CountedPtr<SIMapper> > itsMappers;
126 : casacore::Int oldMsId_p;
127 :
128 : casacore::Bool itsIsNonZeroModel;
129 :
130 : };
131 :
132 :
133 : } //# NAMESPACE CASA - END
134 :
135 : #endif
|