casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
ResamplerWorklet.h
Go to the documentation of this file.
00001 // -*- C++ -*-
00002 //# ResamplerWorklet.h: Definition of the ResamplerWorklet class
00003 //# Copyright (C) 1997,1998,1999,2000,2001,2002,2003
00004 //# Associated Universities, Inc. Washington DC, USA.
00005 //#
00006 //# This library is free software; you can redistribute it and/or modify it
00007 //# under the terms of the GNU Library General Public License as published by
00008 //# the Free Software Foundation; either version 2 of the License, or (at your
00009 //# option) any later version.
00010 //#
00011 //# This library is distributed in the hope that it will be useful, but WITHOUT
00012 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00013 //# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public
00014 //# License for more details.
00015 //#
00016 //# You should have received a copy of the GNU Library General Public License
00017 //# along with this library; if not, write to the Free Software Foundation,
00018 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
00019 //#
00020 //# Correspondence concerning AIPS++ should be addressed as follows:
00021 //#        Internet email: aips2-request@nrao.edu.
00022 //#        Postal address: AIPS++ Project Office
00023 //#                        National Radio Astronomy Observatory
00024 //#                        520 Edgemont Road
00025 //#                        Charlottesville, VA 22903-2475 USA
00026 //#
00027 //# $Id$
00028 
00029 #ifndef SYNTHESIS_RESAMPLERWORKLET_H
00030 #define SYNTHESIS_RESAMPLERWORKLET_H
00031 
00032 #include <synthesis/TransformMachines/VisibilityResamplerBase.h>
00033 #include <synthesis/TransformMachines/VBStore.h>
00034 #include <synthesis/Utilities/ThreadCoordinator.h>
00035 #include <synthesis/MSVis/AsynchronousTools.h>
00036 #include <synthesis/MSVis/VisBuffer.h>
00037 #include <casa/Arrays/Vector.h>
00038 #include <casa/Arrays/Array.h>
00039 
00040 #include <casa/Logging/LogMessage.h>
00041 #include <casa/Logging/LogSink.h>
00042 #include <casa/Logging/LogIO.h>
00043 #include <sys/syscall.h>
00044 
00045 using namespace casa::async;
00046 using namespace std;
00047 namespace casa { //# NAMESPACE CASA - BEGIN
00048   class ResamplerWorklet : public Thread 
00049   {
00050   public: 
00051     enum PGridderMode {DataToGrid=0, GridToData};
00052     ResamplerWorklet() {myGriddedDataDouble_p=NULL;myGriddedDataSingle_p=NULL;};
00053     virtual ~ResamplerWorklet(){terminate();}
00054     ResamplerWorklet& operator=(const ResamplerWorklet& other);
00055 
00056     void setID(const Int& id) {myID_p=id;}
00057     void initThread(Int& id, CountedPtr<ThreadCoordinator<Int> >& threadClerk,
00058                     VisibilityResamplerBase* resampler);
00059     void initToVis(VBStore* vbs, const Array<Complex>* skyFTGrid) ;
00060     void initToSky(VBStore* vbs,Array<DComplex>* griddedData, Matrix<Double>* sumwt) ;
00061     void initToSky(VBStore* vbs,Array<Complex>* griddedData, Matrix<Double>* sumwt) ;
00062 
00063     void init(Int& id, 
00064               CountedPtr<ThreadCoordinator<Int> >& threadClerk,
00065               VisibilityResamplerBase* resampler, VBStore* vbs,
00066               Array<DComplex>* griddedData, Matrix<Double>* sumwt,
00067               Array<Complex>* skyFTGrid=NULL);
00068     void init(Int& id, 
00069               CountedPtr<ThreadCoordinator<Int> >& threadClerk,
00070               VisibilityResamplerBase* resampler, VBStore* vbs,
00071               Array<Complex>* griddedData, Matrix<Double>* sumwt,
00072               Array<Complex>* skyFTGrid=NULL);
00073     void* run();
00074     void setPID();
00075     pid_t getPID() {return myPID_p;}
00076     pid_t getTID() {return myTID_p;}
00077     Int getID () {return myID_p;}
00078 
00079     //
00080     //------------------------------------------------------------------------------
00081     //----------------------------Private parts-------------------------------------
00082     //------------------------------------------------------------------------------
00083     //
00084   private:
00085     Int myID_p;
00086     CountedPtr<ThreadCoordinator<Int> > myThreadClerk_p;
00087     VisibilityResamplerBase *myResampler_p;
00088     VBStore* myVBStore_p;
00089     Array<DComplex>* myGriddedDataDouble_p;
00090     Array<Complex>* myGriddedDataSingle_p;
00091     Matrix<Double>* mySumWt_p;
00092     pid_t myPID_p, myTID_p;
00093     const Array<Complex>* mySkyFTGrid_p;
00094     pid_t gettid_p () {return syscall (SYS_gettid);};
00095   };
00096 }; //# NAMESPACE CASA - END
00097 
00098 #endif //