Lemma is an Electromagnetics API
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

FHTKey51.cpp 11KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209
  1. /* This file is part of Lemma, a geophysical modelling and inversion API.
  2. * More information is available at http://lemmasoftware.org
  3. */
  4. /* This Source Code Form is subject to the terms of the Mozilla Public
  5. * License, v. 2.0. If a copy of the MPL was not distributed with this
  6. * file, You can obtain one at http://mozilla.org/MPL/2.0/.
  7. */
  8. /**
  9. * @file
  10. * @date 02/11/2014 03:42:53 PM
  11. * @version $Id$
  12. * @author Trevor Irons (ti)
  13. * @email Trevor.Irons@xri-geo.com
  14. * @copyright Copyright (c) 2014, XRI Geophysics, LLC
  15. * @copyright Copyright (c) 2014, Trevor Irons
  16. */
  17. #include "FHTKey51.h"
  18. namespace Lemma {
  19. // ==================== FRIEND METHODS =====================
  20. std::ostream &operator<<(std::ostream &stream, const FHTKey51 &ob) {
  21. stream << *(HankelTransform*)(&ob);
  22. return stream;
  23. }
  24. // ==================== STATIC CONST MEMBERS ============
  25. const Eigen::Matrix<Real, 51, 3> FHTKey51::WT51 =
  26. ( Eigen::Matrix<Real, 51, 3>() <<
  27. // Base J0 J1
  28. 4.9915939069102170e-03, 6.5314496156480717e-02, 3.8409924166118657e-05,
  29. 6.1703482511978082e-03, -2.2265895125268051e-01, -9.4382633059055269e-05,
  30. 7.6274629409160176e-03, 4.2794928430042073e-01, 1.6377612356675232e-04,
  31. 9.4286721829279947e-03, -5.8890658905204007e-01, -1.7853487610334151e-04,
  32. 1.1655233178024955e-02, 6.7897324897038758e-01, 1.9759569268356316e-04,
  33. 1.4407591843112350e-02, -6.8296549495756353e-01, -1.2796247718553291e-04,
  34. 1.7809914185937643e-02, 6.4702210424566342e-01, 1.3163370416771999e-04,
  35. 2.2015687754376449e-02, -5.6843090153083187e-01, 1.7066927559149181e-05,
  36. 2.7214645856121149e-02, 4.9960500362966542e-01, 4.1368007808198310e-05,
  37. 3.3641326918204623e-02, -4.0923517268678855e-01, 2.3582259002758631e-04,
  38. 4.1585655121173182e-02, 3.5487831784012780e-01, -1.9929745662753875e-05,
  39. 5.1406019627642255e-02, -2.7408257835871558e-01, 5.8196110748926486e-04,
  40. 6.3545442443014022e-02, 2.4668368971888163e-01, 1.1164151202379049e-05,
  41. 7.8551564282309541e-02, -1.7348161774657314e-01, 1.2053942009238238e-03,
  42. 9.7101350057185065e-02, 1.7509173908347012e-01, 2.8328713800714110e-04,
  43. 1.2003162851145673e-01, -1.0007796678766585e-01, 2.4375075610646724e-03,
  44. 1.4837684372696586e-01, 1.3297302593795621e-01, 1.1709289200267103e-03,
  45. 1.8341572156771246e-01, -4.3822390117083297e-02, 5.0080095645252103e-03,
  46. 2.2672895630607542e-01, 1.1415804492335258e-01, 3.5856849047131551e-03,
  47. 2.8027051982381157e-01, 4.2584271963990363e-03, 1.0536604059335859e-02,
  48. 3.4645581033005746e-01, 1.1496183925974515e-01, 9.6674718436839564e-03,
  49. 4.2827061721265969e-01, 5.1313336759457658e-02, 2.2583365267100426e-02,
  50. 5.2940581770869455e-01, 1.3312389010285514e-01, 2.4201911801947001e-02,
  51. 6.5442388190885858e-01, 1.0111673764393908e-01, 4.8602551164692191e-02,
  52. 8.0896469756649991e-01, 1.6331446488042209e-01, 5.6856974938076565e-02,
  53. 1.0000000000000000e+00, 1.4704406144951229e-01, 1.0202078096072606e-01,
  54. 1.2361478850785035e+00, 1.8341391219815678e-01, 1.2202639829343022e-01,
  55. 1.5280615937840571e+00, 1.5073655145087875e-01, 1.9561985197118459e-01,
  56. 1.8889101074258496e+00, 1.2356364992866918e-01, 2.1570853920674185e-01,
  57. 2.3349722343978727e+00, 1.1529465836107913e-02, 2.8552388758852060e-01,
  58. 2.8863709892679585e+00, -1.2852626053530605e-01, 2.0559964796530625e-01,
  59. 3.5679813939355345e+00, -2.9874216118407571e-01, 1.1666011451374350e-01,
  60. 4.4105526541128617e+00, -3.1330553036684633e-01, -2.3636714743601936e-01,
  61. 5.4520953354089947e+00, -3.2332453606385231e-02, -3.4036030266164258e-01,
  62. 6.7395961181122024e+00, 4.2056051544727674e-01, -1.9475364255836261e-01,
  63. 8.3311374876876929e+00, 1.3883637369942961e-01, 5.7608115965662166e-01,
  64. 1.0298517985703377e+01, -5.0223684329542873e-01, -2.1471464584834585e-01,
  65. 1.2730491227470161e+01, 3.7996073748731690e-01, -1.2611070492338947e-01,
  66. 1.5736769806847677e+01, -1.7984404170109178e-01, 2.0019703515125831e-01,
  67. 1.9452974714702009e+01, 7.0557286965350657e-02, -1.6147664664730754e-01,
  68. 2.4046753552064487e+01, -2.7522277139686569e-02, 1.1398023016900673e-01,
  69. 2.9725343546388515e+01, 1.1909130661901874e-02, -7.9924455203352035e-02,
  70. 3.6744920558100112e+01, -5.8977428045126450e-03, 5.7024556382799692e-02,
  71. 4.5422155835273074e+01, 3.2648420034561555e-03, -4.1006636508593382e-02,
  72. 5.6148501871478999e+01, -1.9304039780209286e-03, 2.9192063091319696e-02,
  73. 6.9407851838755207e+01, 1.1594138315987755e-03, -2.0089573135329029e-02,
  74. 8.5798369258319340e+01, -6.7050941490060716e-04, 1.2965400526524978e-02,
  75. 1.0605947270185592e+02, 3.5089803807606258e-04, -7.5154910983038946e-03,
  76. 1.3110519287294045e+02, -1.5287051174029577e-04, 3.6269079130258285e-03,
  77. 1.6206540689269471e+02, 4.8238483411813232e-05, -1.2668720233377250e-03,
  78. 2.0033680997479166e+02, -8.0433917146487977e-06, 2.3403502580547994e-04).finished();
  79. // ==================== LIFECYCLE =======================
  80. //--------------------------------------------------------------------------------------
  81. // Class: FHTKey51
  82. // Method: FHTKey51
  83. // Description: constructor (protected)
  84. //--------------------------------------------------------------------------------------
  85. FHTKey51::FHTKey51 (const std::string& name) : HankelTransform(name) {
  86. } // ----- end of method FHTKey51::FHTKey51 (constructor) -----
  87. //--------------------------------------------------------------------------------------
  88. // Class: FHTKey51
  89. // Method: New()
  90. // Description: public constructor
  91. //--------------------------------------------------------------------------------------
  92. FHTKey51* FHTKey51::New() {
  93. FHTKey51* Obj = new FHTKey51("FHTKey51");
  94. Obj->AttachTo(Obj);
  95. return Obj;
  96. }
  97. //--------------------------------------------------------------------------------------
  98. // Class: FHTKey51
  99. // Method: ~FHTKey51
  100. // Description: destructor (protected)
  101. //--------------------------------------------------------------------------------------
  102. FHTKey51::~FHTKey51 () {
  103. } // ----- end of method FHTKey51::~FHTKey51 (destructor) -----
  104. //--------------------------------------------------------------------------------------
  105. // Class: FHTKey51
  106. // Method: Delete
  107. // Description: public destructor
  108. //--------------------------------------------------------------------------------------
  109. void FHTKey51::Delete() {
  110. this->DetachFrom(this);
  111. }
  112. //--------------------------------------------------------------------------------------
  113. // Class: FHTKey51
  114. // Method: Release
  115. // Description: destructor (protected)
  116. //--------------------------------------------------------------------------------------
  117. void FHTKey51::Release() {
  118. delete this;
  119. }
  120. //--------------------------------------------------------------------------------------
  121. // Class: FHTKey51
  122. // Method: Zgauss
  123. //--------------------------------------------------------------------------------------
  124. Complex FHTKey51::Zgauss ( const int &ikk, const EMMODE &imode,
  125. const int &itype, const Real &rho,
  126. const Real &wavef, KernelEm1DBase *Kernel ) {
  127. return Zans(0, Kernel->GetManagerIndex());
  128. } // ----- end of method FHTKey51::ComputeRelated -----
  129. //--------------------------------------------------------------------------------------
  130. // Class: FHTKey51
  131. // Method: ComputeRelated
  132. //--------------------------------------------------------------------------------------
  133. void FHTKey51::ComputeRelated ( const Real& rho, KernelEm1DBase* Kernel ) {
  134. return ;
  135. } // ----- end of method FHTKey51::ComputeRelated -----
  136. //--------------------------------------------------------------------------------------
  137. // Class: FHTKey51
  138. // Method: ComputeRelated
  139. //--------------------------------------------------------------------------------------
  140. void FHTKey51::ComputeRelated ( const Real& rho, std::vector< KernelEm1DBase* > KernelVec ) {
  141. return ;
  142. } // ----- end of method FHTKey51::ComputeRelated -----
  143. //--------------------------------------------------------------------------------------
  144. // Class: FHTKey51
  145. // Method: ComputeRelated
  146. //--------------------------------------------------------------------------------------
  147. void FHTKey51::ComputeRelated ( const Real& rho, KernelEM1DManager* KernelManager ) {
  148. //kernelVec = KernelManager->GetSTLVector();
  149. int nrel = (int)(KernelManager->GetSTLVector().size());
  150. Eigen::Matrix<Complex, 51, Eigen::Dynamic > Zwork;
  151. // TODO, if we want to allow lagged, then 1 below should be nlag
  152. Zans= Eigen::Matrix<Complex, Eigen::Dynamic, Eigen::Dynamic>::Zero(1, nrel);
  153. Zwork.resize(51, nrel);
  154. VectorXr lambda = WT51.col(0).array()/rho;
  155. int NumFun = 0;
  156. int idx = 0;
  157. // Get Kernel values
  158. for (int ir=0; ir<lambda.size(); ++ir) {
  159. // irelated loop
  160. ++NumFun;
  161. KernelManager->ComputeReflectionCoeffs(lambda(ir), idx, rho);
  162. for (int ir2=0; ir2<nrel; ++ir2) {
  163. // Zwork* needed due to sign convention of filter weights
  164. Zwork(ir, ir2) = std::conj(KernelManager->GetSTLVector()[ir2]->RelBesselArg(lambda(ir)));
  165. }
  166. }
  167. // We diverge slightly from Key here, each kernel is evaluated seperately, whereby instead
  168. // they prefer to sum them. The reason is that all those terms have been removed from the kernels
  169. // in the interests of making them as generic and reusable as possible. This approach requires slightly
  170. // more multiplies, but the same number of kernel evaluations, which is the expensive part.
  171. // Inner product and scale
  172. for (int ir2=0; ir2<nrel; ++ir2) {
  173. Zans(0, ir2) = Zwork.col(ir2).dot(WT51.col(KernelManager->GetSTLVector()[ir2]->GetBesselOrder() + 1))/rho;
  174. }
  175. return ;
  176. } // ----- end of method FHTKey51::ComputeRelated -----
  177. } // ----- end of Lemma name -----