00001 /*************************************************************************** 00002 ** 00003 ** This file is part of warand. 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-07-08 00021 ** Authors: 00022 ** Marc Wathelet 00023 ** Marc Wathelet (LGIT, Grenoble, France) 00024 ** 00025 ***************************************************************************/ 00026 00027 #ifndef REALTIMEARRAYPROCESS_H 00028 #define REALTIMEARRAYPROCESS_H 00029 00030 #include <GeopsyCore.h> 00031 00032 #include "PhaseShifter.h" 00033 00034 class RealTimeArrayManager; 00035 class ArrayTask; 00036 class RealTimeStationSignals; 00037 class GaussianFrequencyBand; 00038 00039 class RealTimeArrayProcess : public Thread 00040 { 00041 public: 00042 RealTimeArrayProcess(RealTimeArrayManager * manager, ArrayStations * array); 00043 ~RealTimeArrayProcess(); 00044 00045 void setMaximumSlowness(double s); 00046 void setWavenumberRange(double kmin, double kmax); 00047 void setFrequencyBands(const QVector<GaussianFrequencyBand> * bands) {_bands=bands;} 00048 00049 void terminate() {_terminate.fetchAndStoreOrdered(true);} 00050 bool terminated() const {return _terminate.testAndSetOrdered(true, true);} 00051 bool isWaiting() const {return _waiting.testAndSetOrdered(true, true);} 00052 protected: 00053 virtual void run(); 00054 private: 00055 void run(ArrayTask * t); 00056 bool lockTimeWindow(const TimeRange * r); 00057 void unlockTimeWindow(); 00058 ComplexMatrix crossSpectrum(int component, const GaussianFrequencyBand& f); 00059 void fk(ComplexMatrix r, const FrequencyBand& f); 00060 void hrfk(ComplexMatrix r, const FrequencyBand& f); 00061 void spac(ComplexMatrix r, const FrequencyBand& f); 00062 00063 RealTimeArrayManager * _manager; 00064 mutable QAtomicInt _terminate; 00065 mutable QAtomicInt _waiting; 00066 bool _signalsLocked; 00067 QList<RealTimeStationSignals *> _stations; 00068 00069 const QVector<GaussianFrequencyBand> * _bands; 00070 GridSearch _fkGrid, _hrfkGrid; 00071 PhaseShifter _phaseShifter; 00072 }; 00073 00074 #endif // REALTIMEARRAYPROCESS_H