Line data Source code
1 : // -*- C++ -*- 2 : //# ResamplerWorklet.h: Definition of the ResamplerWorklet class 3 : //# Copyright (C) 1997,1998,1999,2000,2001,2002,2003 4 : //# Associated Universities, Inc. Washington DC, USA. 5 : //# 6 : //# This library is free software; you can redistribute it and/or modify it 7 : //# under the terms of the GNU Library General Public License as published by 8 : //# the Free Software Foundation; either version 2 of the License, or (at your 9 : //# option) any later version. 10 : //# 11 : //# This library is distributed in the hope that it will be useful, but WITHOUT 12 : //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 : //# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public 14 : //# License for more details. 15 : //# 16 : //# You should have received a copy of the GNU Library General Public License 17 : //# along with this library; if not, write to the Free Software Foundation, 18 : //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA. 19 : //# 20 : //# Correspondence concerning AIPS++ should be addressed as follows: 21 : //# Internet email: casa-feedback@nrao.edu. 22 : //# Postal address: AIPS++ Project Office 23 : //# National Radio Astronomy Observatory 24 : //# 520 Edgemont Road 25 : //# Charlottesville, VA 22903-2475 USA 26 : //# 27 : //# $Id$ 28 : 29 : #ifndef SYNTHESIS_RESAMPLERWORKLET_H 30 : #define SYNTHESIS_RESAMPLERWORKLET_H 31 : 32 : #include <synthesis/TransformMachines/VisibilityResamplerBase.h> 33 : #include <synthesis/TransformMachines/VBStore.h> 34 : #include <synthesis/Utilities/ThreadCoordinator.h> 35 : #include <stdcasa/thread/AsynchronousTools.h> 36 : #include <msvis/MSVis/VisBuffer.h> 37 : #include <casacore/casa/Arrays/Vector.h> 38 : #include <casacore/casa/Arrays/Array.h> 39 : 40 : #include <casacore/casa/Logging/LogMessage.h> 41 : #include <casacore/casa/Logging/LogSink.h> 42 : #include <casacore/casa/Logging/LogIO.h> 43 : #include <sys/syscall.h> 44 : 45 : using namespace casa::async; 46 : using namespace std; 47 : namespace casa { //# NAMESPACE CASA - BEGIN 48 : class ResamplerWorklet : public Thread 49 : { 50 : public: 51 : enum PGridderMode {DataToGrid=0, GridToData}; 52 0 : ResamplerWorklet() {myGriddedDataDouble_p=NULL;myGriddedDataSingle_p=NULL;}; 53 0 : virtual ~ResamplerWorklet(){terminate();} 54 : ResamplerWorklet& operator=(const ResamplerWorklet& other); 55 : 56 0 : void setID(const casacore::Int& id) {myID_p=id;} 57 : void initThread(casacore::Int& id, casacore::CountedPtr<ThreadCoordinator<casacore::Int> >& threadClerk, 58 : VisibilityResamplerBase* resampler); 59 : void initToVis(VBStore* vbs, const casacore::Array<casacore::Complex>* skyFTGrid) ; 60 : void initToSky(VBStore* vbs,casacore::Array<casacore::DComplex>* griddedData, casacore::Matrix<casacore::Double>* sumwt) ; 61 : void initToSky(VBStore* vbs,casacore::Array<casacore::Complex>* griddedData, casacore::Matrix<casacore::Double>* sumwt) ; 62 : 63 : void init(casacore::Int& id, 64 : casacore::CountedPtr<ThreadCoordinator<casacore::Int> >& threadClerk, 65 : VisibilityResamplerBase* resampler, VBStore* vbs, 66 : casacore::Array<casacore::DComplex>* griddedData, casacore::Matrix<casacore::Double>* sumwt, 67 : casacore::Array<casacore::Complex>* skyFTGrid=NULL); 68 : void init(casacore::Int& id, 69 : casacore::CountedPtr<ThreadCoordinator<casacore::Int> >& threadClerk, 70 : VisibilityResamplerBase* resampler, VBStore* vbs, 71 : casacore::Array<casacore::Complex>* griddedData, casacore::Matrix<casacore::Double>* sumwt, 72 : casacore::Array<casacore::Complex>* skyFTGrid=NULL); 73 : void* run(); 74 : void setPID(); 75 : pid_t getPID() {return myPID_p;} 76 : pid_t getTID() {return myTID_p;} 77 : casacore::Int getID () {return myID_p;} 78 : 79 : // 80 : //------------------------------------------------------------------------------ 81 : //----------------------------Private parts------------------------------------- 82 : //------------------------------------------------------------------------------ 83 : // 84 : private: 85 : casacore::Int myID_p; 86 : casacore::CountedPtr<ThreadCoordinator<casacore::Int> > myThreadClerk_p; 87 : VisibilityResamplerBase *myResampler_p; 88 : VBStore* myVBStore_p; 89 : casacore::Array<casacore::DComplex>* myGriddedDataDouble_p; 90 : casacore::Array<casacore::Complex>* myGriddedDataSingle_p; 91 : casacore::Matrix<casacore::Double>* mySumWt_p; 92 : pid_t myPID_p, myTID_p; 93 : const casacore::Array<casacore::Complex>* mySkyFTGrid_p; 94 0 : pid_t gettid_p () {return syscall (SYS_gettid);}; 95 : }; 96 : }; //# NAMESPACE CASA - END 97 : 98 : #endif //