00001 /*************************************************************************** 00002 ** 00003 ** This file is part of geopsyarray. 00004 ** 00005 ** This file may be distributed and/or modified under the terms of the 00006 ** GNU General Public License version 2 or 3 as published by the Free 00007 ** Software Foundation and appearing in the file LICENSE.GPL included 00008 ** in the packaging of this file. 00009 ** 00010 ** This file is distributed in the hope that it will be useful, but WITHOUT 00011 ** ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 00012 ** FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 00013 ** more details. 00014 ** 00015 ** You should have received a copy of the GNU General Public License 00016 ** along with this program. If not, see <http://www.gnu.org/licenses/>. 00017 ** 00018 ** See http://www.geopsy.org for more information. 00019 ** 00020 ** Created : 2008-02-07 00021 ** Authors: 00022 ** Marc Wathelet 00023 ** Marc Wathelet (LGIT, Grenoble, France) 00024 ** 00025 ***************************************************************************/ 00026 00027 #ifndef FKLOOP_H 00028 #define FKLOOP_H 00029 00030 #include <ArrayCore.h> 00031 00032 class FKLoop: public ParallelLoop 00033 { 00034 public: 00035 FKLoop(); 00036 ~FKLoop(); 00037 00038 void setArray(const ArrayStations * a); 00039 void setLog(QString * l) {_log=l;} 00040 bool setParameters(FKParameters * p); 00041 00042 bool hasComponent(int iComp) const {return _dotmax[iComp];} 00043 QFile * output(int iComp) const {return _dotmax[iComp];} 00044 void lockOutput(int iComp) const {_dotmaxMutex[iComp].lock();} 00045 void unlockOutput(int iComp) const {_dotmaxMutex[iComp].unlock();} 00046 void addLog(const QString& s) const; 00047 protected: 00048 virtual LoopTask * newTask(); 00049 00050 const ArrayStations * _array; 00051 const FKParameters * _param; 00052 private: 00053 QFile * initMaxFile(QString suffix) const; 00054 00055 mutable QMutex _dotmaxMutex[3]; 00056 QFile * _dotmax[3]; 00057 mutable QMutex _logMutex; 00058 QString * _log; 00059 }; 00060 00061 class FKLoopTask : public LoopTask 00062 { 00063 public: 00064 FKLoopTask(); 00065 ~FKLoopTask(); 00066 00067 virtual void setArray(const ArrayStations& array); 00068 virtual void setGrid(); 00069 void setParameters(const FKParameters * param); 00070 void setLoop(const FKLoop * l) {_loop=l;} 00071 protected: 00072 virtual void run(int index); 00073 virtual void initGridValues() {} 00074 virtual void getPower(const Point2D& pos, double& beampower, double& semblance); 00075 virtual void exportMax(); 00076 void exportGrid(QString baseName, int iOmega, int iWin); 00077 void exportResults(const Point2D& pos); 00078 00079 const FKLoop * _loop; 00080 FKArrayProcess * _process; 00081 int _nStations, _currentComponent; 00082 double _nStations2; 00083 const TimeRange * _win; 00084 FKGridSearch * _grid[3]; 00085 }; 00086 00087 #endif // FKLOOP_H