QGpCoreWave/AutocorrEngine.h
Go to the documentation of this file.
00001 /***************************************************************************
00002 **
00003 **  This file is part of QGpCoreWave.
00004 **
00005 **  This library is free software; you can redistribute it and/or
00006 **  modify it under the terms of the GNU Lesser General Public
00007 **  License as published by the Free Software Foundation; either
00008 **  version 2.1 of the License, or (at your option) any later version.
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 Lesser General Public
00013 **  License for more details.
00014 **
00015 **  You should have received a copy of the GNU Lesser General Public
00016 **  License along with this library; if not, write to the Free Software
00017 **  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
00018 **
00019 **  See http://www.geopsy.org for more information.
00020 **
00021 **  Created : 2009-02-04
00022 **  Authors :
00023 **    Marc Wathelet
00024 **    Marc Wathelet (LGIT, Grenoble, France)
00025 **
00026 ***************************************************************************/
00027 
00028 #ifndef AUTOCORRENGINE_H
00029 #define AUTOCORRENGINE_H
00030 
00031 #include <QGpCoreTools.h>
00032 
00033 #include "QGpCoreWaveDLLExport.h"
00034 #include "AutocorrRing.h"
00035 
00036 namespace QGpCoreWave {
00037 
00038 class QGPCOREWAVE_EXPORT AutocorrEngine
00039 {
00040 public:
00041   inline void setVerticalRing(const AutocorrRing& r);
00042   inline void setHorizontalRing(const AutocorrRing& r);
00043 
00044   bool isThinRing() {return fabs(_dr) < 0.02 * _r0;}
00045 
00046   inline RealValue verticalThinRing(double omega, const RealValue& dispR);
00047   inline RealValue verticalThickRing(double omega, const RealValue& dispR);
00048 
00049   inline double verticalThinRing(double k);
00050   inline double verticalThickRing(double k);
00051 
00052   inline bool initHorizontalThinRing(double omega, const RealValue& dispR , const RealValue& dispL);
00053   inline bool initHorizontalThickRing(double omega, const RealValue& dispR , const RealValue& dispL);
00054 
00055   inline RealValue radial(double alphaRayleigh, double alphaLove);
00056   inline RealValue transverse(double alphaRayleigh, double alphaLove);
00057 private:
00058   double _r1, _r2, _r0, _dr, _rFactor;
00059   double _jRR, _jLR, _jRT, _jLT;
00060 };
00061 
00062 inline void AutocorrEngine::setVerticalRing(const AutocorrRing& ring)
00063 {
00064   TRACE;
00065   _r1=ring.minRadius();
00066   _r2=ring.maxRadius();
00067   _r0=0.5 * (_r1 + _r2);
00068   _dr=_r2 - _r1;
00069   _rFactor=_r0 * _dr;  // (r2^2-r1^2)/2
00070 }
00071 
00072 inline void AutocorrEngine::setHorizontalRing(const AutocorrRing& ring)
00073 {
00074   TRACE;
00075   _r1=ring.minRadius();
00076   _r2=ring.maxRadius();
00077   _r0=0.5 * (_r1 + _r2);
00078   _dr=_r2 - _r1;
00079   _rFactor=2.0/(_r0 * _dr);  // 4/(r2^2-r1^2)
00080 }
00081 
00082 inline RealValue AutocorrEngine::verticalThinRing(double omega, const RealValue& dispR)
00083 {
00084   if(dispR.isValid()) {
00085     return RealValue(verticalThinRing( omega *  dispR.value()) );
00086   } else {
00087     return RealValue();
00088   }
00089 }
00090 
00091 inline double AutocorrEngine::verticalThinRing(double k)
00092 {
00093   return j0(k * _r0);
00094 }
00095 
00096 inline RealValue AutocorrEngine::verticalThickRing(double omega, const RealValue& dispR)
00097 {
00098   TRACE;
00099   if(dispR.isValid()) {
00100     return RealValue(verticalThickRing( omega * dispR.value()) );
00101   } else {
00102     return RealValue();
00103   }
00104 }
00105 
00106 inline double AutocorrEngine::verticalThickRing(double k)
00107 {
00108   return (_r2 * j1(k * _r2) - _r1 * j1(k * _r1) )/(k * _rFactor);
00109 }
00110 
00111 inline bool AutocorrEngine::initHorizontalThinRing(double omega,
00112                                                        const RealValue& dispR,
00113                                                        const RealValue& dispL)
00114 {
00115   if(dispR .isValid() && dispL.isValid()) {
00116     double omegaR=omega * _r0;
00117     double argR=omegaR * dispR.value();
00118     double j0R=j0(argR);
00119     double j2R=jn(2, argR);
00120     double argL=omegaR * dispL.value();
00121     double j0L=j0(argL);
00122     double j2L=jn(2, argL);
00123     _jRR=j0R - j2R;
00124     _jLR=j0L + j2L;
00125     _jRT=j0R + j2R;
00126     _jLT=j0L - j2L;
00127     return true;
00128   } else {
00129     return false;
00130   }
00131 }
00132 
00133 inline bool AutocorrEngine::initHorizontalThickRing(double omega,
00134                                                         const RealValue& dispR,
00135                                                         const RealValue& dispL)
00136 {
00137   if(dispR .isValid() && dispL.isValid()) {
00138     double omegaR1=omega * _r1;
00139     double omegaR2=omega * _r2;
00140 
00141     double invKR=1.0/(omega * dispR.value());
00142     double argR1=omegaR1 * dispR.value();
00143     double argR2=omegaR2 * dispR.value();
00144     double j0R1=j0(argR1);
00145     double j1R1=j1(argR1);
00146     double j0R2=j0(argR2);
00147     double j1R2=j1(argR2);
00148 
00149     double invKL=1.0/(omega * dispL.value());
00150     double argL1=omegaR1 * dispL.value();
00151     double argL2=omegaR2 * dispL.value();
00152     double j0L1=j0(argL1);
00153     double j1L1=j1(argL1);
00154     double j0L2=j0(argL2);
00155     double j1L2=j1(argL2);
00156 
00157     _jRR=_rFactor * invKR *(invKR * (j0R2 - j0R1) + _r2 * j1R2 - _r1 * j1R1);
00158     _jLR=_rFactor * invKL * invKL * (j0L1 - j0L2);
00159     _jRT=_rFactor * invKR * invKR * (j0R1 - j0R2);
00160     _jLT=_rFactor * invKL *(invKL * (j0L2 - j0L1) + _r2 * j1L2 - _r1 * j1L1);
00161     return true;
00162   } else {
00163     return false;
00164   }
00165 }
00166 
00167 inline RealValue AutocorrEngine::radial(double alphaRayleigh, double alphaLove)
00168 {
00169   return RealValue(alphaRayleigh * _jRR + alphaLove * _jLR);
00170 }
00171 
00172 inline RealValue AutocorrEngine::transverse(double alphaRayleigh, double alphaLove)
00173 {
00174   return RealValue(alphaRayleigh * _jRT + alphaLove * _jLT);
00175 }
00176 
00177 } // namespace QGpCoreWave
00178 
00179 #endif // AUTOCORRENGINE_H
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines