Main Lemma Repository
Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

KernelEM1DSpec.h 52KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474
  1. /* This file is part of Lemma, a geophysical modelling and inversion API */
  2. /* This Source Code Form is subject to the terms of the Mozilla Public
  3. * License, v. 2.0. If a copy of the MPL was not distributed with this
  4. * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
  5. /**
  6. @file
  7. @author Trevor Irons
  8. @date 05/16/2012
  9. **/
  10. #ifndef KERNELEM1DSPEC_INC
  11. #define KERNELEM1DSPEC_INC
  12. #include "KernelEM1DBase.h"
  13. #include "KernelEM1DReflSpec.h"
  14. #include "KernelEM1DReflBase.h"
  15. #include "LayeredEarthEM.h"
  16. #include "DipoleSource.h"
  17. namespace Lemma {
  18. //class KernelEM1DReflBase;
  19. // ===================================================================
  20. // Class: KernelEM1DSpec
  21. /**
  22. \ingroup FDEM1D
  23. \brief Optimized version of KernelEm1D
  24. \details Through use of template specialisations, this KernelEm1D
  25. class delivers much better performance.
  26. \note This class is internal and cannot be serialized.
  27. */
  28. // ===================================================================
  29. template<EMMODE Mode, int Ikernel, DIPOLE_LOCATION Isource, DIPOLE_LOCATION Irecv>
  30. class KernelEM1DSpec : public KernelEM1DBase {
  31. public:
  32. // ==================== LIFECYCLE =======================
  33. /// Default locked constructor.
  34. explicit KernelEM1DSpec (const ctor_key& key ) : KernelEM1DBase( key ), ReflCalc(nullptr) {
  35. }
  36. /// Default destructor.
  37. ~KernelEM1DSpec () {
  38. }
  39. /** Returns a pointer to a new object of type KernelEM1DSpec.
  40. * It allocates all necessary memory.
  41. */
  42. static std::shared_ptr<KernelEM1DSpec> NewSP() {
  43. return std::make_shared< KernelEM1DSpec > ( ctor_key() );
  44. }
  45. /* Management has shifted from this approach, this will be removed
  46. static std::shared_ptr<KernelEM1DSpec> NewSP2(LayeredEarthEM* Earth, std::shared_ptr<DipoleSource> Dipole,
  47. const int& ifreq, const Real& rz) {
  48. auto Obj = std::make_shared< KernelEM1DSpec > ( ctor_key() );
  49. // under this scenario KernelEM1DSpec manages its own Refl Base
  50. Obj->ReflCalc = KernelEM1DReflSpec<Mode, Isource, Irecv>::NewSP();
  51. Obj->ReflCalc->Initialise(Earth);
  52. Obj->ReflCalc->SetUpSource(Dipole, ifreq);
  53. Obj->ReflCalc->SetUpReceiver( rz );
  54. return Obj;
  55. }
  56. */
  57. // ==================== OPERATORS =======================
  58. // ==================== OPERATIONS =======================
  59. /** Returns the Complex bessel argument to be evaluated for a given
  60. * lambda value. This is specialised for each kernel type.
  61. */
  62. Complex BesselArg(const Real& lambda);
  63. /** Returns the Complex bessel argument to be evaluated for a given
  64. * lambda value. This is used in the calculation of related kernels.
  65. * This function does not call
  66. * KernelEM1DReflBase->ComputeReflectionCoeffs() Which saves
  67. * significant cost. This is specialised for each kernel type.
  68. */
  69. Complex RelBesselArg(const Real& lambda);
  70. // ==================== ACCESS =======================
  71. void SetIk(const int& ikin) {
  72. std::cerr << "deprecated (SetIk in KernelEm1dSpec.h)\n";
  73. exit(EXIT_FAILURE);
  74. }
  75. void SetMode(const EMMODE& modein) {
  76. //ReflCalc->mode = modein;
  77. std::cerr << "deprecated (SetMode in KernelEM1DSpec.h)\n";
  78. exit(EXIT_FAILURE);
  79. }
  80. void SetReflBase( std::shared_ptr<KernelEM1DReflBase> Base ) {
  81. ReflCalc = Base;
  82. }
  83. // ==================== INQUIRY =======================
  84. int GetNumRel() {
  85. std::cerr << "deprecated GetNumRel() (in KernelEM1DSpec.h) ";
  86. return -1;
  87. }
  88. int GetBesselOrder();
  89. Complex GetZm() {
  90. return ReflCalc->GetZm();
  91. }
  92. Complex GetYm() {
  93. return ReflCalc->GetYm();
  94. }
  95. Complex GetZs() {
  96. return ReflCalc->GetZs();
  97. }
  98. Complex GetKs() {
  99. return ReflCalc->GetKs();
  100. }
  101. /** Returns the name of the underlying class, similiar to Python's type */
  102. virtual std::string GetName() const;
  103. protected:
  104. // ==================== OPERATIONS =======================
  105. /// Calculates the potential when the receiver is above the source
  106. /// layer
  107. Complex PotentialAboveSourceLayer(const Real &ra);
  108. /// Calculates the potential when the receiver is below the source
  109. /// layer
  110. Complex PotentialBelowSourceLayer(const Real &ra);
  111. /// Calculates the potential when the receiver is below the source
  112. /// layer
  113. Complex RelPotentialBelowSourceLayer(const Real &ra);
  114. /// Used for related kernels. Stores expensive exp(Complex) values
  115. Complex PotentialInSourceLayer(const Real &ra);
  116. /// Used for related kernels. Stores expensive exp(Complex) values
  117. Complex RelPotentialInSourceLayer(const Real &ra);
  118. // ==================== DATA MEMBERS =========================
  119. /// Make these static consts
  120. static const Eigen::Matrix<int, 13, 1> JD;
  121. static const Eigen::Matrix<Real, 4, 4> SS_SN;
  122. static const Eigen::Matrix<Real, 4, 4> SR_SN;
  123. static const Eigen::Matrix<Real, 4, 4> RS_SN;
  124. static const Eigen::Matrix<Real, 4, 2> SS_SL;
  125. std::shared_ptr<KernelEM1DReflBase> ReflCalc;
  126. private:
  127. static constexpr auto CName = "KernelEM1DSpec";
  128. }; // ----- end of class KernelEM1DSpec -----
  129. // ================ INITIALISE STATIC CONSTS ==========================
  130. template<EMMODE Mode, int Ikernel, DIPOLE_LOCATION Isource, DIPOLE_LOCATION Irecv>
  131. const Eigen::Matrix<int, 13, 1> KernelEM1DSpec<Mode, Ikernel, Isource, Irecv>::JD =
  132. ( Eigen::Matrix<int, 13, 1>() << 4, 4, 1, 1, 3, 3, 3, 2, 2, 1, 2, 1, 1 ).finished();
  133. template<EMMODE Mode, int Ikernel, DIPOLE_LOCATION Isource, DIPOLE_LOCATION Irecv>
  134. const Eigen::Matrix<Real, 4, 4> KernelEM1DSpec<Mode, Ikernel, Isource, Irecv>::SS_SN =
  135. ( Eigen::Matrix<Real, 4, 4>() <<
  136. 1.e0, 1.e0, 1.e0, 1.e0,
  137. -1.e0, -1.e0, 1.e0, 1.e0,
  138. -1.e0, 1.e0, 1.e0, -1.e0,
  139. 1.e0, -1.e0, 1.e0, -1.e0 ).finished();
  140. template<EMMODE Mode, int Ikernel, DIPOLE_LOCATION Isource, DIPOLE_LOCATION Irecv>
  141. const Eigen::Matrix<Real, 4, 4> KernelEM1DSpec<Mode, Ikernel, Isource, Irecv>::SR_SN =
  142. ( Eigen::Matrix<Real, 4, 4>() <<
  143. 1.e0, 1.e0, 1.e0, 1.e0,
  144. -1.e0, -1.e0, 1.e0, 1.e0,
  145. 1.e0, -1.e0, 1.e0, -1.e0,
  146. -1.e0, 1.e0, 1.e0, -1.e0 ).finished();
  147. template<EMMODE Mode, int Ikernel, DIPOLE_LOCATION Isource, DIPOLE_LOCATION Irecv>
  148. const Eigen::Matrix<Real, 4, 4> KernelEM1DSpec<Mode, Ikernel, Isource, Irecv>::RS_SN =
  149. ( Eigen::Matrix<Real, 4, 4>() <<
  150. 1.e0, 1.e0, 1.e0, 1.e0,
  151. -1.e0, -1.e0, 1.e0, 1.e0,
  152. -1.e0, 1.e0, -1.e0, 1.e0,
  153. 1.e0, -1.e0, -1.e0, 1.e0 ).finished();
  154. template<EMMODE Mode, int Ikernel, DIPOLE_LOCATION Isource, DIPOLE_LOCATION Irecv>
  155. const Eigen::Matrix<Real, 4, 2> KernelEM1DSpec<Mode, Ikernel, Isource, Irecv>::SS_SL =
  156. ( Eigen::Matrix<Real, 4, 2>() <<
  157. 1.e0, 1.e0,
  158. -1.e0, 1.e0,
  159. 1.e0, -1.e0,
  160. -1.e0, -1.e0 ).finished();
  161. template<EMMODE Mode, int Ikernel, DIPOLE_LOCATION Isource, DIPOLE_LOCATION Irecv>
  162. std::string KernelEM1DSpec<Mode, Ikernel, Isource, Irecv>::GetName() const {
  163. return CName;
  164. }
  165. ///////////////////////////////////////////////
  166. // Declarations of specialisations for private fuctions
  167. // (some compilers seem to need these, or defaults are fallen back on)
  168. /* Bessel Args */
  169. template <>
  170. Complex KernelEM1DSpec<TM, 0, INAIR, INAIR>::BesselArg( const Real& lambda );
  171. template <>
  172. Complex KernelEM1DSpec<TM, 0, INAIR, INAIR>::RelBesselArg( const Real& lambda );
  173. template <>
  174. Complex KernelEM1DSpec<TM, 1, INAIR, INAIR>::BesselArg( const Real& lambda );
  175. template <>
  176. Complex KernelEM1DSpec<TM, 1, INAIR, INAIR>::RelBesselArg( const Real& lambda );
  177. template <>
  178. Complex KernelEM1DSpec<TM, 2, INAIR, INAIR>::BesselArg( const Real& lambda );
  179. template <>
  180. Complex KernelEM1DSpec<TM, 2, INAIR, INAIR>::RelBesselArg( const Real& lambda );
  181. template <>
  182. Complex KernelEM1DSpec<TM, 3, INAIR, INAIR>::BesselArg( const Real& lambda );
  183. template <>
  184. Complex KernelEM1DSpec<TM, 3, INAIR, INAIR>::RelBesselArg( const Real& lambda );
  185. template <>
  186. Complex KernelEM1DSpec<TM, 4, INAIR, INAIR>::BesselArg( const Real& lambda );
  187. template <>
  188. Complex KernelEM1DSpec<TM, 4, INAIR, INAIR>::RelBesselArg( const Real& lambda );
  189. template <>
  190. Complex KernelEM1DSpec<TM, 5, INAIR, INAIR>::BesselArg( const Real& lambda );
  191. template <>
  192. Complex KernelEM1DSpec<TM, 5, INAIR, INAIR>::RelBesselArg( const Real& lambda );
  193. template <>
  194. Complex KernelEM1DSpec<TM, 6, INAIR, INAIR>::BesselArg( const Real& lambda );
  195. template <>
  196. Complex KernelEM1DSpec<TM, 6, INAIR, INAIR>::RelBesselArg( const Real& lambda );
  197. template <>
  198. Complex KernelEM1DSpec<TM, 7, INAIR, INAIR>::BesselArg( const Real& lambda );
  199. template <>
  200. Complex KernelEM1DSpec<TM, 7, INAIR, INAIR>::RelBesselArg( const Real& lambda );
  201. template <>
  202. Complex KernelEM1DSpec<TM, 8, INAIR, INAIR>::BesselArg( const Real& lambda );
  203. template <>
  204. Complex KernelEM1DSpec<TM, 8, INAIR, INAIR>::RelBesselArg( const Real& lambda );
  205. template <>
  206. Complex KernelEM1DSpec<TM, 9, INAIR, INAIR>::BesselArg( const Real& lambda );
  207. template <>
  208. Complex KernelEM1DSpec<TM, 9, INAIR, INAIR>::RelBesselArg( const Real& lambda );
  209. template <>
  210. Complex KernelEM1DSpec<TM, 10, INAIR, INAIR>::BesselArg( const Real& lambda );
  211. template <>
  212. Complex KernelEM1DSpec<TM, 10, INAIR, INAIR>::RelBesselArg( const Real& lambda );
  213. template <>
  214. Complex KernelEM1DSpec<TM, 11, INAIR, INAIR>::BesselArg( const Real& lambda );
  215. template <>
  216. Complex KernelEM1DSpec<TM, 11, INAIR, INAIR>::RelBesselArg( const Real& lambda );
  217. template <>
  218. Complex KernelEM1DSpec<TM, 12, INAIR, INAIR>::BesselArg( const Real& lambda );
  219. template <>
  220. Complex KernelEM1DSpec<TM, 12, INAIR, INAIR>::RelBesselArg( const Real& lambda );
  221. template <>
  222. Complex KernelEM1DSpec<TE, 0, INAIR, INAIR>::BesselArg( const Real& lambda );
  223. template <>
  224. Complex KernelEM1DSpec<TE, 0, INAIR, INAIR>::RelBesselArg( const Real& lambda );
  225. template <>
  226. Complex KernelEM1DSpec<TE, 1, INAIR, INAIR>::BesselArg( const Real& lambda );
  227. template <>
  228. Complex KernelEM1DSpec<TE, 1, INAIR, INAIR>::RelBesselArg( const Real& lambda );
  229. template <>
  230. Complex KernelEM1DSpec<TE, 2, INAIR, INAIR>::BesselArg( const Real& lambda );
  231. template <>
  232. Complex KernelEM1DSpec<TE, 2, INAIR, INAIR>::RelBesselArg( const Real& lambda );
  233. template <>
  234. Complex KernelEM1DSpec<TE, 3, INAIR, INAIR>::BesselArg( const Real& lambda );
  235. template <>
  236. Complex KernelEM1DSpec<TE, 3, INAIR, INAIR>::RelBesselArg( const Real& lambda );
  237. template <>
  238. Complex KernelEM1DSpec<TE, 4, INAIR, INAIR>::BesselArg( const Real& lambda );
  239. template <>
  240. Complex KernelEM1DSpec<TE, 4, INAIR, INAIR>::RelBesselArg( const Real& lambda );
  241. template <>
  242. Complex KernelEM1DSpec<TE, 5, INAIR, INAIR>::BesselArg( const Real& lambda );
  243. template <>
  244. Complex KernelEM1DSpec<TE, 5, INAIR, INAIR>::RelBesselArg( const Real& lambda );
  245. template <>
  246. Complex KernelEM1DSpec<TE, 6, INAIR, INAIR>::BesselArg( const Real& lambda );
  247. template <>
  248. Complex KernelEM1DSpec<TE, 6, INAIR, INAIR>::RelBesselArg( const Real& lambda );
  249. template <>
  250. Complex KernelEM1DSpec<TE, 7, INAIR, INAIR>::BesselArg( const Real& lambda );
  251. template <>
  252. Complex KernelEM1DSpec<TE, 7, INAIR, INAIR>::RelBesselArg( const Real& lambda );
  253. template <>
  254. Complex KernelEM1DSpec<TE, 8, INAIR, INAIR>::BesselArg( const Real& lambda );
  255. template <>
  256. Complex KernelEM1DSpec<TE, 8, INAIR, INAIR>::RelBesselArg( const Real& lambda );
  257. template <>
  258. Complex KernelEM1DSpec<TE, 9, INAIR, INAIR>::BesselArg( const Real& lambda );
  259. template <>
  260. Complex KernelEM1DSpec<TE, 9, INAIR, INAIR>::RelBesselArg( const Real& lambda );
  261. template <>
  262. Complex KernelEM1DSpec<TE, 10, INAIR, INAIR>::BesselArg( const Real& lambda );
  263. template <>
  264. Complex KernelEM1DSpec<TE, 10, INAIR, INAIR>::RelBesselArg( const Real& lambda );
  265. template <>
  266. Complex KernelEM1DSpec<TE, 11, INAIR, INAIR>::BesselArg( const Real& lambda );
  267. template <>
  268. Complex KernelEM1DSpec<TE, 11, INAIR, INAIR>::RelBesselArg( const Real& lambda );
  269. template <>
  270. Complex KernelEM1DSpec<TE, 12, INAIR, INAIR>::BesselArg( const Real& lambda );
  271. template <>
  272. Complex KernelEM1DSpec<TE, 12, INAIR, INAIR>::RelBesselArg( const Real& lambda );
  273. template <>
  274. Complex KernelEM1DSpec<TM, 0, INAIR, INGROUND>::BesselArg( const Real& lambda );
  275. template <>
  276. Complex KernelEM1DSpec<TM, 0, INAIR, INGROUND>::RelBesselArg( const Real& lambda );
  277. template <>
  278. Complex KernelEM1DSpec<TM, 1, INAIR, INGROUND>::BesselArg( const Real& lambda );
  279. template <>
  280. Complex KernelEM1DSpec<TM, 1, INAIR, INGROUND>::RelBesselArg( const Real& lambda );
  281. template <>
  282. Complex KernelEM1DSpec<TM, 2, INAIR, INGROUND>::BesselArg( const Real& lambda );
  283. template <>
  284. Complex KernelEM1DSpec<TM, 2, INAIR, INGROUND>::RelBesselArg( const Real& lambda );
  285. template <>
  286. Complex KernelEM1DSpec<TM, 3, INAIR, INGROUND>::BesselArg( const Real& lambda );
  287. template <>
  288. Complex KernelEM1DSpec<TM, 3, INAIR, INGROUND>::RelBesselArg( const Real& lambda );
  289. template <>
  290. Complex KernelEM1DSpec<TM, 4, INAIR, INGROUND>::BesselArg( const Real& lambda );
  291. template <>
  292. Complex KernelEM1DSpec<TM, 4, INAIR, INGROUND>::RelBesselArg( const Real& lambda );
  293. template <>
  294. Complex KernelEM1DSpec<TM, 5, INAIR, INGROUND>::BesselArg( const Real& lambda );
  295. template <>
  296. Complex KernelEM1DSpec<TM, 5, INAIR, INGROUND>::RelBesselArg( const Real& lambda );
  297. template <>
  298. Complex KernelEM1DSpec<TM, 6, INAIR, INGROUND>::BesselArg( const Real& lambda );
  299. template <>
  300. Complex KernelEM1DSpec<TM, 6, INAIR, INGROUND>::RelBesselArg( const Real& lambda );
  301. template <>
  302. Complex KernelEM1DSpec<TM, 7, INAIR, INGROUND>::BesselArg( const Real& lambda );
  303. template <>
  304. Complex KernelEM1DSpec<TM, 7, INAIR, INGROUND>::RelBesselArg( const Real& lambda );
  305. template <>
  306. Complex KernelEM1DSpec<TM, 8, INAIR, INGROUND>::BesselArg( const Real& lambda );
  307. template <>
  308. Complex KernelEM1DSpec<TM, 8, INAIR, INGROUND>::RelBesselArg( const Real& lambda );
  309. template <>
  310. Complex KernelEM1DSpec<TM, 9, INAIR, INGROUND>::BesselArg( const Real& lambda );
  311. template <>
  312. Complex KernelEM1DSpec<TM, 9, INAIR, INGROUND>::RelBesselArg( const Real& lambda );
  313. template <>
  314. Complex KernelEM1DSpec<TM, 10, INAIR, INGROUND>::BesselArg( const Real& lambda );
  315. template <>
  316. Complex KernelEM1DSpec<TM, 10, INAIR, INGROUND>::RelBesselArg( const Real& lambda );
  317. template <>
  318. Complex KernelEM1DSpec<TM, 11, INAIR, INGROUND>::BesselArg( const Real& lambda );
  319. template <>
  320. Complex KernelEM1DSpec<TM, 11, INAIR, INGROUND>::RelBesselArg( const Real& lambda );
  321. template <>
  322. Complex KernelEM1DSpec<TM, 12, INAIR, INGROUND>::BesselArg( const Real& lambda );
  323. template <>
  324. Complex KernelEM1DSpec<TM, 12, INAIR, INGROUND>::RelBesselArg( const Real& lambda );
  325. template <>
  326. Complex KernelEM1DSpec<TE, 0, INAIR, INGROUND>::BesselArg( const Real& lambda );
  327. template <>
  328. Complex KernelEM1DSpec<TE, 0, INAIR, INGROUND>::RelBesselArg( const Real& lambda );
  329. template <>
  330. Complex KernelEM1DSpec<TE, 1, INAIR, INGROUND>::BesselArg( const Real& lambda );
  331. template <>
  332. Complex KernelEM1DSpec<TE, 1, INAIR, INGROUND>::RelBesselArg( const Real& lambda );
  333. template <>
  334. Complex KernelEM1DSpec<TE, 2, INAIR, INGROUND>::BesselArg( const Real& lambda );
  335. template <>
  336. Complex KernelEM1DSpec<TE, 2, INAIR, INGROUND>::RelBesselArg( const Real& lambda );
  337. template <>
  338. Complex KernelEM1DSpec<TE, 3, INAIR, INGROUND>::BesselArg( const Real& lambda );
  339. template <>
  340. Complex KernelEM1DSpec<TE, 3, INAIR, INGROUND>::RelBesselArg( const Real& lambda );
  341. template <>
  342. Complex KernelEM1DSpec<TE, 4, INAIR, INGROUND>::BesselArg( const Real& lambda );
  343. template <>
  344. Complex KernelEM1DSpec<TE, 4, INAIR, INGROUND>::RelBesselArg( const Real& lambda );
  345. template <>
  346. Complex KernelEM1DSpec<TE, 5, INAIR, INGROUND>::BesselArg( const Real& lambda );
  347. template <>
  348. Complex KernelEM1DSpec<TE, 5, INAIR, INGROUND>::RelBesselArg( const Real& lambda );
  349. template <>
  350. Complex KernelEM1DSpec<TE, 6, INAIR, INGROUND>::BesselArg( const Real& lambda );
  351. template <>
  352. Complex KernelEM1DSpec<TE, 6, INAIR, INGROUND>::RelBesselArg( const Real& lambda );
  353. template <>
  354. Complex KernelEM1DSpec<TE, 7, INAIR, INGROUND>::BesselArg( const Real& lambda );
  355. template <>
  356. Complex KernelEM1DSpec<TE, 7, INAIR, INGROUND>::RelBesselArg( const Real& lambda );
  357. template <>
  358. Complex KernelEM1DSpec<TE, 8, INAIR, INGROUND>::BesselArg( const Real& lambda );
  359. template <>
  360. Complex KernelEM1DSpec<TE, 8, INAIR, INGROUND>::RelBesselArg( const Real& lambda );
  361. template <>
  362. Complex KernelEM1DSpec<TE, 9, INAIR, INGROUND>::BesselArg( const Real& lambda );
  363. template <>
  364. Complex KernelEM1DSpec<TE, 9, INAIR, INGROUND>::RelBesselArg( const Real& lambda );
  365. template <>
  366. Complex KernelEM1DSpec<TE, 10, INAIR, INGROUND>::BesselArg( const Real& lambda );
  367. template <>
  368. Complex KernelEM1DSpec<TE, 10, INAIR, INGROUND>::RelBesselArg( const Real& lambda );
  369. template <>
  370. Complex KernelEM1DSpec<TE, 11, INAIR, INGROUND>::BesselArg( const Real& lambda );
  371. template <>
  372. Complex KernelEM1DSpec<TE, 11, INAIR, INGROUND>::RelBesselArg( const Real& lambda );
  373. template <>
  374. Complex KernelEM1DSpec<TE, 12, INAIR, INGROUND>::BesselArg( const Real& lambda );
  375. template <>
  376. Complex KernelEM1DSpec<TE, 12, INAIR, INGROUND>::RelBesselArg( const Real& lambda );
  377. /* Get Bessel Order */
  378. template <>
  379. int KernelEM1DSpec<TM, 0, INAIR, INAIR>::GetBesselOrder( );
  380. template <>
  381. int KernelEM1DSpec<TM, 1, INAIR, INAIR>::GetBesselOrder( );
  382. template <>
  383. int KernelEM1DSpec<TM, 2, INAIR, INAIR>::GetBesselOrder( );
  384. template <>
  385. int KernelEM1DSpec<TM, 3, INAIR, INAIR>::GetBesselOrder( );
  386. template <>
  387. int KernelEM1DSpec<TM, 4, INAIR, INAIR>::GetBesselOrder( );
  388. template <>
  389. int KernelEM1DSpec<TM, 5, INAIR, INAIR>::GetBesselOrder( );
  390. template <>
  391. int KernelEM1DSpec<TM, 6, INAIR, INAIR>::GetBesselOrder( );
  392. template <>
  393. int KernelEM1DSpec<TM, 7, INAIR, INAIR>::GetBesselOrder( );
  394. template <>
  395. int KernelEM1DSpec<TM, 8, INAIR, INAIR>::GetBesselOrder( );
  396. template <>
  397. int KernelEM1DSpec<TM, 9, INAIR, INAIR>::GetBesselOrder( );
  398. template <>
  399. int KernelEM1DSpec<TM, 10, INAIR, INAIR>::GetBesselOrder( );
  400. template <>
  401. int KernelEM1DSpec<TM, 11, INAIR, INAIR>::GetBesselOrder( );
  402. template <>
  403. int KernelEM1DSpec<TM, 12, INAIR, INAIR>::GetBesselOrder( );
  404. template <>
  405. int KernelEM1DSpec<TE, 0, INAIR, INAIR>::GetBesselOrder( );
  406. template <>
  407. int KernelEM1DSpec<TE, 1, INAIR, INAIR>::GetBesselOrder( );
  408. template <>
  409. int KernelEM1DSpec<TE, 2, INAIR, INAIR>::GetBesselOrder( );
  410. template <>
  411. int KernelEM1DSpec<TE, 3, INAIR, INAIR>::GetBesselOrder( );
  412. template <>
  413. int KernelEM1DSpec<TE, 4, INAIR, INAIR>::GetBesselOrder( );
  414. template <>
  415. int KernelEM1DSpec<TE, 5, INAIR, INAIR>::GetBesselOrder( );
  416. template <>
  417. int KernelEM1DSpec<TE, 6, INAIR, INAIR>::GetBesselOrder( );
  418. template <>
  419. int KernelEM1DSpec<TE, 7, INAIR, INAIR>::GetBesselOrder( );
  420. template <>
  421. int KernelEM1DSpec<TE, 8, INAIR, INAIR>::GetBesselOrder( );
  422. template <>
  423. int KernelEM1DSpec<TE, 9, INAIR, INAIR>::GetBesselOrder( );
  424. template <>
  425. int KernelEM1DSpec<TE, 10, INAIR, INAIR>::GetBesselOrder( );
  426. template <>
  427. int KernelEM1DSpec<TE, 11, INAIR, INAIR>::GetBesselOrder( );
  428. template <>
  429. int KernelEM1DSpec<TE, 12, INAIR, INAIR>::GetBesselOrder( );
  430. template <>
  431. int KernelEM1DSpec<TM, 0, INAIR, INGROUND>::GetBesselOrder( );
  432. template <>
  433. int KernelEM1DSpec<TM, 1, INAIR, INGROUND>::GetBesselOrder( );
  434. template <>
  435. int KernelEM1DSpec<TM, 2, INAIR, INGROUND>::GetBesselOrder( );
  436. template <>
  437. int KernelEM1DSpec<TM, 3, INAIR, INGROUND>::GetBesselOrder( );
  438. template <>
  439. int KernelEM1DSpec<TM, 4, INAIR, INGROUND>::GetBesselOrder( );
  440. template <>
  441. int KernelEM1DSpec<TM, 5, INAIR, INGROUND>::GetBesselOrder( );
  442. template <>
  443. int KernelEM1DSpec<TM, 6, INAIR, INGROUND>::GetBesselOrder( );
  444. template <>
  445. int KernelEM1DSpec<TM, 7, INAIR, INGROUND>::GetBesselOrder( );
  446. template <>
  447. int KernelEM1DSpec<TM, 8, INAIR, INGROUND>::GetBesselOrder( );
  448. template <>
  449. int KernelEM1DSpec<TM, 9, INAIR, INGROUND>::GetBesselOrder( );
  450. template <>
  451. int KernelEM1DSpec<TM, 10, INAIR, INGROUND>::GetBesselOrder( );
  452. template <>
  453. int KernelEM1DSpec<TM, 11, INAIR, INGROUND>::GetBesselOrder( );
  454. template <>
  455. int KernelEM1DSpec<TM, 12, INAIR, INGROUND>::GetBesselOrder( );
  456. template <>
  457. int KernelEM1DSpec<TE, 0, INAIR, INGROUND>::GetBesselOrder( );
  458. template <>
  459. int KernelEM1DSpec<TE, 1, INAIR, INGROUND>::GetBesselOrder( );
  460. template <>
  461. int KernelEM1DSpec<TE, 2, INAIR, INGROUND>::GetBesselOrder( );
  462. template <>
  463. int KernelEM1DSpec<TE, 3, INAIR, INGROUND>::GetBesselOrder( );
  464. template <>
  465. int KernelEM1DSpec<TE, 4, INAIR, INGROUND>::GetBesselOrder( );
  466. template <>
  467. int KernelEM1DSpec<TE, 5, INAIR, INGROUND>::GetBesselOrder( );
  468. template <>
  469. int KernelEM1DSpec<TE, 6, INAIR, INGROUND>::GetBesselOrder( );
  470. template <>
  471. int KernelEM1DSpec<TE, 7, INAIR, INGROUND>::GetBesselOrder( );
  472. template <>
  473. int KernelEM1DSpec<TE, 8, INAIR, INGROUND>::GetBesselOrder( );
  474. template <>
  475. int KernelEM1DSpec<TE, 9, INAIR, INGROUND>::GetBesselOrder( );
  476. template <>
  477. int KernelEM1DSpec<TE, 10, INAIR, INGROUND>::GetBesselOrder( );
  478. template <>
  479. int KernelEM1DSpec<TE, 11, INAIR, INGROUND>::GetBesselOrder( );
  480. template <>
  481. int KernelEM1DSpec<TE, 12, INAIR, INGROUND>::GetBesselOrder( );
  482. template <>
  483. int KernelEM1DSpec<TM, 0, INGROUND, INGROUND>::GetBesselOrder( );
  484. template <>
  485. int KernelEM1DSpec<TM, 1, INGROUND, INGROUND>::GetBesselOrder( );
  486. template <>
  487. int KernelEM1DSpec<TM, 2, INGROUND, INGROUND>::GetBesselOrder( );
  488. template <>
  489. int KernelEM1DSpec<TM, 3, INGROUND, INGROUND>::GetBesselOrder( );
  490. template <>
  491. int KernelEM1DSpec<TM, 4, INGROUND, INGROUND>::GetBesselOrder( );
  492. template <>
  493. int KernelEM1DSpec<TM, 5, INGROUND, INGROUND>::GetBesselOrder( );
  494. template <>
  495. int KernelEM1DSpec<TM, 6, INGROUND, INGROUND>::GetBesselOrder( );
  496. template <>
  497. int KernelEM1DSpec<TM, 7, INGROUND, INGROUND>::GetBesselOrder( );
  498. template <>
  499. int KernelEM1DSpec<TM, 8, INGROUND, INGROUND>::GetBesselOrder( );
  500. template <>
  501. int KernelEM1DSpec<TM, 9, INGROUND, INGROUND>::GetBesselOrder( );
  502. template <>
  503. int KernelEM1DSpec<TM, 10, INGROUND, INGROUND>::GetBesselOrder( );
  504. template <>
  505. int KernelEM1DSpec<TM, 11, INGROUND, INGROUND>::GetBesselOrder( );
  506. template <>
  507. int KernelEM1DSpec<TM, 12, INGROUND, INGROUND>::GetBesselOrder( );
  508. template <>
  509. int KernelEM1DSpec<TE, 0, INGROUND, INGROUND>::GetBesselOrder( );
  510. template <>
  511. int KernelEM1DSpec<TE, 1, INGROUND, INGROUND>::GetBesselOrder( );
  512. template <>
  513. int KernelEM1DSpec<TE, 2, INGROUND, INGROUND>::GetBesselOrder( );
  514. template <>
  515. int KernelEM1DSpec<TE, 3, INGROUND, INGROUND>::GetBesselOrder( );
  516. template <>
  517. int KernelEM1DSpec<TE, 4, INGROUND, INGROUND>::GetBesselOrder( );
  518. template <>
  519. int KernelEM1DSpec<TE, 5, INGROUND, INGROUND>::GetBesselOrder( );
  520. template <>
  521. int KernelEM1DSpec<TE, 6, INGROUND, INGROUND>::GetBesselOrder( );
  522. template <>
  523. int KernelEM1DSpec<TE, 7, INGROUND, INGROUND>::GetBesselOrder( );
  524. template <>
  525. int KernelEM1DSpec<TE, 8, INGROUND, INGROUND>::GetBesselOrder( );
  526. template <>
  527. int KernelEM1DSpec<TE, 9, INGROUND, INGROUND>::GetBesselOrder( );
  528. template <>
  529. int KernelEM1DSpec<TE, 10, INGROUND, INGROUND>::GetBesselOrder( );
  530. template <>
  531. int KernelEM1DSpec<TE, 11, INGROUND, INGROUND>::GetBesselOrder( );
  532. template <>
  533. int KernelEM1DSpec<TE, 12, INGROUND, INGROUND>::GetBesselOrder( );
  534. template <>
  535. int KernelEM1DSpec<TM, 0, INGROUND, INAIR>::GetBesselOrder( );
  536. template <>
  537. int KernelEM1DSpec<TM, 1, INGROUND, INAIR>::GetBesselOrder( );
  538. template <>
  539. int KernelEM1DSpec<TM, 2, INGROUND, INAIR>::GetBesselOrder( );
  540. template <>
  541. int KernelEM1DSpec<TM, 3, INGROUND, INAIR>::GetBesselOrder( );
  542. template <>
  543. int KernelEM1DSpec<TM, 4, INGROUND, INAIR>::GetBesselOrder( );
  544. template <>
  545. int KernelEM1DSpec<TM, 5, INGROUND, INAIR>::GetBesselOrder( );
  546. template <>
  547. int KernelEM1DSpec<TM, 6, INGROUND, INAIR>::GetBesselOrder( );
  548. template <>
  549. int KernelEM1DSpec<TM, 7, INGROUND, INAIR>::GetBesselOrder( );
  550. template <>
  551. int KernelEM1DSpec<TM, 8, INGROUND, INAIR>::GetBesselOrder( );
  552. template <>
  553. int KernelEM1DSpec<TM, 9, INGROUND, INAIR>::GetBesselOrder( );
  554. template <>
  555. int KernelEM1DSpec<TM, 10, INGROUND, INAIR>::GetBesselOrder( );
  556. template <>
  557. int KernelEM1DSpec<TM, 11, INGROUND, INAIR>::GetBesselOrder( );
  558. template <>
  559. int KernelEM1DSpec<TM, 12, INGROUND, INAIR>::GetBesselOrder( );
  560. template <>
  561. int KernelEM1DSpec<TE, 0, INGROUND, INAIR>::GetBesselOrder( );
  562. template <>
  563. int KernelEM1DSpec<TE, 1, INGROUND, INAIR>::GetBesselOrder( );
  564. template <>
  565. int KernelEM1DSpec<TE, 2, INGROUND, INAIR>::GetBesselOrder( );
  566. template <>
  567. int KernelEM1DSpec<TE, 3, INGROUND, INAIR>::GetBesselOrder( );
  568. template <>
  569. int KernelEM1DSpec<TE, 4, INGROUND, INAIR>::GetBesselOrder( );
  570. template <>
  571. int KernelEM1DSpec<TE, 5, INGROUND, INAIR>::GetBesselOrder( );
  572. template <>
  573. int KernelEM1DSpec<TE, 6, INGROUND, INAIR>::GetBesselOrder( );
  574. template <>
  575. int KernelEM1DSpec<TE, 7, INGROUND, INAIR>::GetBesselOrder( );
  576. template <>
  577. int KernelEM1DSpec<TE, 8, INGROUND, INAIR>::GetBesselOrder( );
  578. template <>
  579. int KernelEM1DSpec<TE, 9, INGROUND, INAIR>::GetBesselOrder( );
  580. template <>
  581. int KernelEM1DSpec<TE, 10, INGROUND, INAIR>::GetBesselOrder( );
  582. template <>
  583. int KernelEM1DSpec<TE, 11, INGROUND, INAIR>::GetBesselOrder( );
  584. template <>
  585. int KernelEM1DSpec<TE, 12, INGROUND, INAIR>::GetBesselOrder( );
  586. /* POTENTIAL CALCULATIONS */
  587. /* Potential in air source layer*/
  588. template<>
  589. Complex KernelEM1DSpec<TM, 0, INAIR, INAIR>::PotentialInSourceLayer(const Real &ra);
  590. template<>
  591. Complex KernelEM1DSpec<TM, 0, INAIR, INAIR>::RelPotentialInSourceLayer(const Real &ra);
  592. template<>
  593. Complex KernelEM1DSpec<TM, 1, INAIR, INAIR>::PotentialInSourceLayer(const Real &ra);
  594. template<>
  595. Complex KernelEM1DSpec<TM, 1, INAIR, INAIR>::RelPotentialInSourceLayer(const Real &ra);
  596. template<>
  597. Complex KernelEM1DSpec<TM, 2, INAIR, INAIR>::PotentialInSourceLayer(const Real &ra);
  598. template<>
  599. Complex KernelEM1DSpec<TM, 2, INAIR, INAIR>::RelPotentialInSourceLayer(const Real &ra);
  600. template<>
  601. Complex KernelEM1DSpec<TM, 3, INAIR, INAIR>::PotentialInSourceLayer(const Real &ra);
  602. template<>
  603. Complex KernelEM1DSpec<TM, 3, INAIR, INAIR>::RelPotentialInSourceLayer(const Real &ra);
  604. template<>
  605. Complex KernelEM1DSpec<TM, 4, INAIR, INAIR>::PotentialInSourceLayer(const Real &ra);
  606. template<>
  607. Complex KernelEM1DSpec<TM, 4, INAIR, INAIR>::RelPotentialInSourceLayer(const Real &ra);
  608. template<>
  609. Complex KernelEM1DSpec<TM, 5, INAIR, INAIR>::PotentialInSourceLayer(const Real &ra);
  610. template<>
  611. Complex KernelEM1DSpec<TM, 5, INAIR, INAIR>::RelPotentialInSourceLayer(const Real &ra);
  612. template<>
  613. Complex KernelEM1DSpec<TM, 6, INAIR, INAIR>::PotentialInSourceLayer(const Real &ra);
  614. template<>
  615. Complex KernelEM1DSpec<TM, 6, INAIR, INAIR>::RelPotentialInSourceLayer(const Real &ra);
  616. template<>
  617. Complex KernelEM1DSpec<TM, 7, INAIR, INAIR>::PotentialInSourceLayer(const Real &ra);
  618. template<>
  619. Complex KernelEM1DSpec<TM, 7, INAIR, INAIR>::RelPotentialInSourceLayer(const Real &ra);
  620. template<>
  621. Complex KernelEM1DSpec<TM, 8, INAIR, INAIR>::PotentialInSourceLayer(const Real &ra);
  622. template<>
  623. Complex KernelEM1DSpec<TM, 8, INAIR, INAIR>::RelPotentialInSourceLayer(const Real &ra);
  624. template<>
  625. Complex KernelEM1DSpec<TM, 9, INAIR, INAIR>::PotentialInSourceLayer(const Real &ra);
  626. template<>
  627. Complex KernelEM1DSpec<TM, 9, INAIR, INAIR>::RelPotentialInSourceLayer(const Real &ra);
  628. template<>
  629. Complex KernelEM1DSpec<TM, 10, INAIR, INAIR>::PotentialInSourceLayer(const Real &ra);
  630. template<>
  631. Complex KernelEM1DSpec<TM, 10, INAIR, INAIR>::RelPotentialInSourceLayer(const Real &ra);
  632. template<>
  633. Complex KernelEM1DSpec<TM, 11, INAIR, INAIR>::PotentialInSourceLayer(const Real &ra);
  634. template<>
  635. Complex KernelEM1DSpec<TM, 11, INAIR, INAIR>::RelPotentialInSourceLayer(const Real &ra);
  636. template<>
  637. Complex KernelEM1DSpec<TM, 12, INAIR, INAIR>::PotentialInSourceLayer(const Real &ra);
  638. template<>
  639. Complex KernelEM1DSpec<TM, 12, INAIR, INAIR>::RelPotentialInSourceLayer(const Real &ra);
  640. /* Potential in air source layer TE*/
  641. template<>
  642. Complex KernelEM1DSpec<TE, 0, INAIR, INAIR>::PotentialInSourceLayer(const Real &ra);
  643. template<>
  644. Complex KernelEM1DSpec<TE, 0, INAIR, INAIR>::RelPotentialInSourceLayer(const Real &ra);
  645. template<>
  646. Complex KernelEM1DSpec<TE, 1, INAIR, INAIR>::PotentialInSourceLayer(const Real &ra);
  647. template<>
  648. Complex KernelEM1DSpec<TE, 1, INAIR, INAIR>::RelPotentialInSourceLayer(const Real &ra);
  649. template<>
  650. Complex KernelEM1DSpec<TE, 2, INAIR, INAIR>::PotentialInSourceLayer(const Real &ra);
  651. template<>
  652. Complex KernelEM1DSpec<TE, 2, INAIR, INAIR>::RelPotentialInSourceLayer(const Real &ra);
  653. template<>
  654. Complex KernelEM1DSpec<TE, 3, INAIR, INAIR>::PotentialInSourceLayer(const Real &ra);
  655. template<>
  656. Complex KernelEM1DSpec<TE, 3, INAIR, INAIR>::RelPotentialInSourceLayer(const Real &ra);
  657. template<>
  658. Complex KernelEM1DSpec<TE, 4, INAIR, INAIR>::PotentialInSourceLayer(const Real &ra);
  659. template<>
  660. Complex KernelEM1DSpec<TE, 4, INAIR, INAIR>::RelPotentialInSourceLayer(const Real &ra);
  661. template<>
  662. Complex KernelEM1DSpec<TE, 5, INAIR, INAIR>::PotentialInSourceLayer(const Real &ra);
  663. template<>
  664. Complex KernelEM1DSpec<TE, 5, INAIR, INAIR>::RelPotentialInSourceLayer(const Real &ra);
  665. template<>
  666. Complex KernelEM1DSpec<TE, 6, INAIR, INAIR>::PotentialInSourceLayer(const Real &ra);
  667. template<>
  668. Complex KernelEM1DSpec<TE, 6, INAIR, INAIR>::RelPotentialInSourceLayer(const Real &ra);
  669. template<>
  670. Complex KernelEM1DSpec<TE, 7, INAIR, INAIR>::PotentialInSourceLayer(const Real &ra);
  671. template<>
  672. Complex KernelEM1DSpec<TE, 7, INAIR, INAIR>::RelPotentialInSourceLayer(const Real &ra);
  673. template<>
  674. Complex KernelEM1DSpec<TE, 8, INAIR, INAIR>::PotentialInSourceLayer(const Real &ra);
  675. template<>
  676. Complex KernelEM1DSpec<TE, 8, INAIR, INAIR>::RelPotentialInSourceLayer(const Real &ra);
  677. template<>
  678. Complex KernelEM1DSpec<TE, 9, INAIR, INAIR>::PotentialInSourceLayer(const Real &ra);
  679. template<>
  680. Complex KernelEM1DSpec<TE, 9, INAIR, INAIR>::RelPotentialInSourceLayer(const Real &ra);
  681. template<>
  682. Complex KernelEM1DSpec<TE, 10, INAIR, INAIR>::PotentialInSourceLayer(const Real &ra);
  683. template<>
  684. Complex KernelEM1DSpec<TE, 10, INAIR, INAIR>::RelPotentialInSourceLayer(const Real &ra);
  685. template<>
  686. Complex KernelEM1DSpec<TE, 11, INAIR, INAIR>::PotentialInSourceLayer(const Real &ra);
  687. template<>
  688. Complex KernelEM1DSpec<TE, 11, INAIR, INAIR>::RelPotentialInSourceLayer(const Real &ra);
  689. template<>
  690. Complex KernelEM1DSpec<TE, 12, INAIR, INAIR>::PotentialInSourceLayer(const Real &ra);
  691. template<>
  692. Complex KernelEM1DSpec<TE, 12, INAIR, INAIR>::RelPotentialInSourceLayer(const Real &ra);
  693. /* Potential below source in air*/
  694. template<>
  695. Complex KernelEM1DSpec<TM, 0, INAIR, INGROUND>::PotentialBelowSourceLayer(const Real &ra);
  696. template<>
  697. Complex KernelEM1DSpec<TM, 0, INAIR, INGROUND>::RelPotentialBelowSourceLayer(const Real &ra);
  698. template<>
  699. Complex KernelEM1DSpec<TM, 1, INAIR, INGROUND>::PotentialBelowSourceLayer(const Real &ra);
  700. template<>
  701. Complex KernelEM1DSpec<TM, 1, INAIR, INGROUND>::RelPotentialBelowSourceLayer(const Real &ra);
  702. template<>
  703. Complex KernelEM1DSpec<TM, 2, INAIR, INGROUND>::PotentialBelowSourceLayer(const Real &ra);
  704. template<>
  705. Complex KernelEM1DSpec<TM, 2, INAIR, INGROUND>::RelPotentialBelowSourceLayer(const Real &ra);
  706. template<>
  707. Complex KernelEM1DSpec<TM, 3, INAIR, INGROUND>::PotentialBelowSourceLayer(const Real &ra);
  708. template<>
  709. Complex KernelEM1DSpec<TM, 3, INAIR, INGROUND>::RelPotentialBelowSourceLayer(const Real &ra);
  710. template<>
  711. Complex KernelEM1DSpec<TM, 4, INAIR, INGROUND>::PotentialBelowSourceLayer(const Real &ra);
  712. template<>
  713. Complex KernelEM1DSpec<TM, 4, INAIR, INGROUND>::RelPotentialBelowSourceLayer(const Real &ra);
  714. template<>
  715. Complex KernelEM1DSpec<TM, 5, INAIR, INGROUND>::PotentialBelowSourceLayer(const Real &ra);
  716. template<>
  717. Complex KernelEM1DSpec<TM, 5, INAIR, INGROUND>::RelPotentialBelowSourceLayer(const Real &ra);
  718. template<>
  719. Complex KernelEM1DSpec<TM, 6, INAIR, INGROUND>::PotentialBelowSourceLayer(const Real &ra);
  720. template<>
  721. Complex KernelEM1DSpec<TM, 6, INAIR, INGROUND>::RelPotentialBelowSourceLayer(const Real &ra);
  722. template<>
  723. Complex KernelEM1DSpec<TM, 7, INAIR, INGROUND>::PotentialBelowSourceLayer(const Real &ra);
  724. template<>
  725. Complex KernelEM1DSpec<TM, 7, INAIR, INGROUND>::RelPotentialBelowSourceLayer(const Real &ra);
  726. template<>
  727. Complex KernelEM1DSpec<TM, 8, INAIR, INGROUND>::PotentialBelowSourceLayer(const Real &ra);
  728. template<>
  729. Complex KernelEM1DSpec<TM, 8, INAIR, INGROUND>::RelPotentialBelowSourceLayer(const Real &ra);
  730. template<>
  731. Complex KernelEM1DSpec<TM, 9, INAIR, INGROUND>::PotentialBelowSourceLayer(const Real &ra);
  732. template<>
  733. Complex KernelEM1DSpec<TM, 9, INAIR, INGROUND>::RelPotentialBelowSourceLayer(const Real &ra);
  734. template<>
  735. Complex KernelEM1DSpec<TM, 10, INAIR, INGROUND>::PotentialBelowSourceLayer(const Real &ra);
  736. template<>
  737. Complex KernelEM1DSpec<TM, 10, INAIR, INGROUND>::RelPotentialBelowSourceLayer(const Real &ra);
  738. template<>
  739. Complex KernelEM1DSpec<TM, 11, INAIR, INGROUND>::PotentialBelowSourceLayer(const Real &ra);
  740. template<>
  741. Complex KernelEM1DSpec<TM, 11, INAIR, INGROUND>::RelPotentialBelowSourceLayer(const Real &ra);
  742. template<>
  743. Complex KernelEM1DSpec<TM, 12, INAIR, INGROUND>::PotentialBelowSourceLayer(const Real &ra);
  744. template<>
  745. Complex KernelEM1DSpec<TM, 12, INAIR, INGROUND>::RelPotentialBelowSourceLayer(const Real &ra);
  746. template<>
  747. Complex KernelEM1DSpec<TE, 0, INAIR, INGROUND>::PotentialBelowSourceLayer(const Real &ra);
  748. template<>
  749. Complex KernelEM1DSpec<TE, 0, INAIR, INGROUND>::RelPotentialBelowSourceLayer(const Real &ra);
  750. template<>
  751. Complex KernelEM1DSpec<TE, 1, INAIR, INGROUND>::PotentialBelowSourceLayer(const Real &ra);
  752. template<>
  753. Complex KernelEM1DSpec<TE, 1, INAIR, INGROUND>::RelPotentialBelowSourceLayer(const Real &ra);
  754. template<>
  755. Complex KernelEM1DSpec<TE, 2, INAIR, INGROUND>::PotentialBelowSourceLayer(const Real &ra);
  756. template<>
  757. Complex KernelEM1DSpec<TE, 2, INAIR, INGROUND>::RelPotentialBelowSourceLayer(const Real &ra);
  758. template<>
  759. Complex KernelEM1DSpec<TE, 3, INAIR, INGROUND>::PotentialBelowSourceLayer(const Real &ra);
  760. template<>
  761. Complex KernelEM1DSpec<TE, 3, INAIR, INGROUND>::RelPotentialBelowSourceLayer(const Real &ra);
  762. template<>
  763. Complex KernelEM1DSpec<TE, 4, INAIR, INGROUND>::PotentialBelowSourceLayer(const Real &ra);
  764. template<>
  765. Complex KernelEM1DSpec<TE, 4, INAIR, INGROUND>::RelPotentialBelowSourceLayer(const Real &ra);
  766. template<>
  767. Complex KernelEM1DSpec<TE, 5, INAIR, INGROUND>::PotentialBelowSourceLayer(const Real &ra);
  768. template<>
  769. Complex KernelEM1DSpec<TE, 5, INAIR, INGROUND>::RelPotentialBelowSourceLayer(const Real &ra);
  770. template<>
  771. Complex KernelEM1DSpec<TE, 6, INAIR, INGROUND>::PotentialBelowSourceLayer(const Real &ra);
  772. template<>
  773. Complex KernelEM1DSpec<TE, 6, INAIR, INGROUND>::RelPotentialBelowSourceLayer(const Real &ra);
  774. template<>
  775. Complex KernelEM1DSpec<TE, 7, INAIR, INGROUND>::PotentialBelowSourceLayer(const Real &ra);
  776. template<>
  777. Complex KernelEM1DSpec<TE, 7, INAIR, INGROUND>::RelPotentialBelowSourceLayer(const Real &ra);
  778. template<>
  779. Complex KernelEM1DSpec<TE, 8, INAIR, INGROUND>::PotentialBelowSourceLayer(const Real &ra);
  780. template<>
  781. Complex KernelEM1DSpec<TE, 8, INAIR, INGROUND>::RelPotentialBelowSourceLayer(const Real &ra);
  782. template<>
  783. Complex KernelEM1DSpec<TE, 9, INAIR, INGROUND>::PotentialBelowSourceLayer(const Real &ra);
  784. template<>
  785. Complex KernelEM1DSpec<TE, 9, INAIR, INGROUND>::RelPotentialBelowSourceLayer(const Real &ra);
  786. template<>
  787. Complex KernelEM1DSpec<TE, 10, INAIR, INGROUND>::PotentialBelowSourceLayer(const Real &ra);
  788. template<>
  789. Complex KernelEM1DSpec<TE, 10, INAIR, INGROUND>::RelPotentialBelowSourceLayer(const Real &ra);
  790. template<>
  791. Complex KernelEM1DSpec<TE, 11, INAIR, INGROUND>::PotentialBelowSourceLayer(const Real &ra);
  792. template<>
  793. Complex KernelEM1DSpec<TE, 11, INAIR, INGROUND>::RelPotentialBelowSourceLayer(const Real &ra);
  794. template<>
  795. Complex KernelEM1DSpec<TE, 12, INAIR, INGROUND>::PotentialBelowSourceLayer(const Real &ra);
  796. template<>
  797. Complex KernelEM1DSpec<TE, 12, INAIR, INGROUND>::RelPotentialBelowSourceLayer(const Real &ra);
  798. /////////////////////////////////////////////////////////////////////////////////
  799. ///////////////////////////////////////////////
  800. // Default mode definitions
  801. template<EMMODE Mode, int Ikernel, DIPOLE_LOCATION Isource, DIPOLE_LOCATION Irecv>
  802. Complex KernelEM1DSpec<Mode, Ikernel, Isource, Irecv>::BesselArg(const Real& lambda) {
  803. static bool called = false;
  804. if (!called) {
  805. std::cout << "Unspecialised KernelEM1DSpec::BesselArg() <" << Mode << " " << Ikernel << " "
  806. << Isource << " " << Irecv << ">...slow" << std::endl;
  807. called = true;
  808. }
  809. ///////////////////////////////////////////////
  810. // Compute reflection coeffs (4) ways
  811. // 1) Member function pointer
  812. // 2) Fast Delegates way
  813. // 3) Boost::function and boost::bind way
  814. // 4) No function pointers, all logic @ each step.
  815. // For (4) about 40% of time is spent in this loop.
  816. // However, none of the other options are producing
  817. // apreciably faster code.
  818. // Function pointers used to specilized cases
  819. //(this->*ComputeReflectionCoeffs)( );
  820. // Boost::bind way and fast delegates way
  821. //ComputeReflectionCoeffs();
  822. //ComputeReflectionCoeffsTempl<TE>();
  823. // Don't use function pointers, ~ same speed right now :(
  824. ReflCalc->ComputeReflectionCoeffs(lambda);
  825. ReflCalc->id = this->JD(Ikernel);
  826. // If these params are equal they share reflection coeffs
  827. // + layr
  828. // ++ ifirst;
  829. Real ra=1.0;
  830. int i1=(Ikernel )*(Ikernel- 2)*(Ikernel- 5)*(Ikernel- 7);
  831. int i2=(Ikernel-4)*(Ikernel- 9)*(Ikernel-10)*(Ikernel-12);
  832. if(i1 == 0) ra=lambda;
  833. if(i2 == 0) ra=ReflCalc->rams;
  834. if(Ikernel == 11) ra=lambda*ReflCalc->rams;
  835. Complex pot;
  836. if (ReflCalc->lays == ReflCalc->layr) {
  837. pot = PotentialInSourceLayer(ra);
  838. } else if (ReflCalc->layr > ReflCalc->lays) {
  839. pot = PotentialBelowSourceLayer(ra);
  840. } else {
  841. pot = PotentialAboveSourceLayer(ra);
  842. }
  843. return pot/ReflCalc->uk;
  844. }
  845. template<EMMODE Mode, int Ikernel, DIPOLE_LOCATION Isource, DIPOLE_LOCATION Irecv>
  846. int KernelEM1DSpec<Mode, Ikernel, Isource, Irecv>::GetBesselOrder( ) {
  847. std::cerr << "Calling base GetBesselOrder in KernelEM1DSpec < " << Mode
  848. << "\t" << Ikernel << "\t" << Isource << "\t" << Irecv << "\n";
  849. exit(EXIT_FAILURE);
  850. return 1;
  851. }
  852. template<EMMODE Mode, int Ikernel, DIPOLE_LOCATION Isource, DIPOLE_LOCATION Irecv>
  853. Complex KernelEM1DSpec<Mode, Ikernel, Isource, Irecv>::RelBesselArg(const Real& lambda) {
  854. static bool called = false;
  855. if (!called) {
  856. std::cout << "Unspecialised KernelEM1DSpec::RelBesselArg <" << Mode << " " << Ikernel << " "
  857. << Isource << " " << Irecv << ">...slow" << std::endl;
  858. called = true;
  859. }
  860. return this->BesselArg(lambda);
  861. }
  862. template<EMMODE Mode, int Ikernel, DIPOLE_LOCATION Isource, DIPOLE_LOCATION Irecv>
  863. Complex KernelEM1DSpec<Mode, Ikernel, Isource, Irecv>::PotentialAboveSourceLayer(const Real &ra) {
  864. static bool called = false;
  865. if (!called) {
  866. std::cout << "WARNING: ";
  867. std::cout << "Unspecialised PotentialAboveSourceLayer <" << Mode << " " << Ikernel << " "
  868. << Isource << " " << Irecv << ">...this function will be slow\n\n";
  869. called = true;
  870. }
  871. Complex ud;
  872. switch (ReflCalc->id) {
  873. case (2):
  874. ud = ReflCalc->um;
  875. break;
  876. case (3):
  877. ud = ReflCalc->uk;
  878. break;
  879. case (4):
  880. ud = ReflCalc->um*ReflCalc->uk;
  881. break;
  882. default:
  883. ud = Complex(1,0);
  884. }
  885. int I1 = (Ikernel )*(Ikernel- 1)*(Ikernel- 4)*(Ikernel- 7)*
  886. (Ikernel- 8)*(Ikernel- 9)*(Ikernel-10)*(Ikernel-11);
  887. Complex CC, DD(1,0);
  888. if (Mode==TM && ReflCalc->layr==0 && I1==0) {
  889. CC = (Real)(2.) * ReflCalc->rtu(ReflCalc->lays)*ReflCalc->u(1)*ReflCalc->yh(0) /
  890. (ReflCalc->yh(0)*ReflCalc->u(1)-ReflCalc->yh(1)*ReflCalc->u(0));
  891. } else {
  892. CC = ReflCalc->rtu(ReflCalc->lays)+ReflCalc->rtu(ReflCalc->lays)/ReflCalc->rtu(ReflCalc->layr+1);
  893. }
  894. if (ReflCalc->lays < ReflCalc->nlay) {
  895. DD -= ReflCalc->rtu(ReflCalc->lays) * ReflCalc->rtd(ReflCalc->lays) * ReflCalc->cf(ReflCalc->lays) ;
  896. }
  897. if (ReflCalc->layr > 0) {
  898. DD *= ( (Real)(1.) + ReflCalc->rtu(ReflCalc->layr)*ReflCalc->cf(ReflCalc->layr));
  899. }
  900. Complex A = CC/DD;
  901. int LS = ReflCalc->layr + 1;
  902. int LE = ReflCalc->lays - 1;
  903. if (LE >= LS) {
  904. for (int N=LS; N<=LE; ++N) {
  905. A *= (ReflCalc->rtu(N)+ReflCalc->rtu(N)/ReflCalc->rtu(N+1)) /
  906. ( (Real)(1.)+ReflCalc->rtu(N)*ReflCalc->cf(N));
  907. }
  908. }
  909. Complex P(0);
  910. Complex CON(0);
  911. if (ReflCalc->layr == 0) {
  912. P = - ReflCalc->u(0)*ReflCalc->rx_z;
  913. if (LE > 0) {
  914. for (int N=1; N<=LE; ++N) {
  915. P += (Real)(2.)*ReflCalc->u(N)*ReflCalc->LayerThickness(N)+(ReflCalc->u(N+1)-ReflCalc->u(N))*ReflCalc->LayerDepth(N);
  916. }
  917. }
  918. CON = RS_SN(ReflCalc->id-1, 2) * std::exp(-P-ReflCalc->uk*(ReflCalc->tx_z-(Real)(2.)*ReflCalc->LayerDepth(ReflCalc->lays-1)));
  919. if (ReflCalc->lays < ReflCalc->nlay-1) {
  920. CON += RS_SN(ReflCalc->id-1, 3)*ReflCalc->rtd(ReflCalc->lays) *
  921. std::exp(-P-ReflCalc->uk*((Real)(2.)*ReflCalc->LayerThickness(ReflCalc->lays)-ReflCalc->tx_z));
  922. }
  923. } else {
  924. for (int N=ReflCalc->layr; N<=LE; ++N) {
  925. P += (Real)(2.)*ReflCalc->u(N)*ReflCalc->LayerThickness(N)+(ReflCalc->u(N+1)-ReflCalc->u(N))*ReflCalc->LayerDepth(N);
  926. }
  927. CON = RS_SN(ReflCalc->id-1, 0)*ReflCalc->rtu(ReflCalc->layr) *
  928. std::exp(-P-ReflCalc->uk*(ReflCalc->tx_z-(Real)(2.)*ReflCalc->LayerDepth(ReflCalc->lays-1))-ReflCalc->um*ReflCalc->rx_z) +
  929. RS_SN(ReflCalc->id-1, 2) *
  930. std::exp(-P-ReflCalc->uk*(ReflCalc->tx_z-(Real)(2.)*ReflCalc->LayerDepth(ReflCalc->lays-1))-
  931. ReflCalc->um*((Real)(2.)*ReflCalc->LayerDepth(ReflCalc->layr-1)-ReflCalc->rx_z));
  932. if (ReflCalc->layr < ReflCalc->nlay-1) {
  933. CON += ReflCalc->rtd(ReflCalc->lays)*(RS_SN(ReflCalc->id-1,1)*ReflCalc->rtu(ReflCalc->layr) *
  934. std::exp(-P-ReflCalc->uk*( (Real)(2.)*ReflCalc->LayerThickness(ReflCalc->lays)-ReflCalc->tx_z)-
  935. ReflCalc->um*ReflCalc->rx_z) + RS_SN(ReflCalc->id-1,3)*
  936. std::exp(-P-ReflCalc->uk*( (Real)(2.)*ReflCalc->LayerThickness(ReflCalc->lays)-ReflCalc->tx_z)-
  937. ReflCalc->um*( (Real)(2.)*ReflCalc->LayerDepth(ReflCalc->layr-1)-ReflCalc->rx_z)));
  938. }
  939. }
  940. return ra*A*CON*ud;
  941. }
  942. template<EMMODE Mode, int Ikernel, DIPOLE_LOCATION Isource, DIPOLE_LOCATION Irecv>
  943. Complex KernelEM1DSpec<Mode, Ikernel, Isource, Irecv>::RelPotentialBelowSourceLayer(const Real &ra) {
  944. static bool called = false;
  945. if (!called) {
  946. std::cout << "WARNING\n";
  947. std::cout << "Unspecialised RelPotentialBelowSourceLayer <" << Mode << " " << Ikernel << " "
  948. << Isource << " " << Irecv << ">...this function will be slow\n\n";
  949. called = true;
  950. }
  951. return PotentialBelowSourceLayer(ra);
  952. }
  953. template<EMMODE Mode, int Ikernel, DIPOLE_LOCATION Isource, DIPOLE_LOCATION Irecv>
  954. Complex KernelEM1DSpec<Mode, Ikernel, Isource, Irecv>::PotentialBelowSourceLayer(const Real &ra) {
  955. static bool called = false;
  956. if (!called) {
  957. std::cout << "WARNING\n";
  958. std::cout << "Unspecialised PotentialBelowSourceLayer <" << Mode << " " << Ikernel << " "
  959. << Isource << " " << Irecv << ">...this function will be slow\n\n";
  960. called = true;
  961. }
  962. Complex ud;
  963. switch (ReflCalc->id) {
  964. case 2:
  965. ud = ReflCalc->um;
  966. break;
  967. case 3:
  968. ud = ReflCalc->uk;
  969. break;
  970. case 4:
  971. ud = ReflCalc->um*ReflCalc->uk;
  972. break;
  973. default:
  974. ud = 1.;
  975. }
  976. Complex dd(1.,0);
  977. if (ReflCalc->lays > 0) {
  978. dd -= ReflCalc->rtu(ReflCalc->lays)*ReflCalc->rtd(ReflCalc->lays)*ReflCalc->cf(ReflCalc->lays);
  979. }
  980. if (ReflCalc->lays < ReflCalc->nlay) {
  981. dd *= ((Real)(1.)+ReflCalc->rtd(ReflCalc->lays+1)*ReflCalc->cf(ReflCalc->lays+1));
  982. }
  983. Complex a = ((Real)(1.) + ReflCalc->rtd(ReflCalc->lays)) / dd;
  984. if (ReflCalc->layr >= ReflCalc->lays+2) {
  985. for (int n=ReflCalc->lays+2; n<=ReflCalc->layr; ++n) {
  986. a *= ((Real)(1.)+ReflCalc->rtd(n-1));
  987. if (n < ReflCalc->nlay-1) {
  988. a /= ((Real)(1.)+ReflCalc->rtd(n)*ReflCalc->cf(n));
  989. }
  990. }
  991. }
  992. Complex p(0,0);
  993. for (int n=ReflCalc->lays+1; n<=ReflCalc->layr; ++n) {
  994. Complex ut = ReflCalc->u(0);
  995. if (n>1) {
  996. ut = ReflCalc->u(n-1);
  997. }
  998. p += (ReflCalc->u(n)-ut) * ReflCalc->LayerDepth(n-1);
  999. }
  1000. Complex con = SR_SN(ReflCalc->id-1, 0) * std::exp(ReflCalc->uk*ReflCalc->tx_z - ReflCalc->um*ReflCalc->rx_z + p);
  1001. if (ReflCalc->layr < ReflCalc->Earth->GetNumberOfLayers()-1) {
  1002. con += SR_SN(ReflCalc->id-1, 2) * ReflCalc->rtd(ReflCalc->layr) * std::exp(ReflCalc->uk*ReflCalc->tx_z-
  1003. ReflCalc->um*((Real)(2.)*ReflCalc->LayerDepth(ReflCalc->layr)-ReflCalc->rx_z)+p);
  1004. }
  1005. if (ReflCalc->lays > 0) {
  1006. con += SR_SN(ReflCalc->id-1, 1) * ReflCalc->rtu(ReflCalc->lays)*std::exp(ReflCalc->uk*( (Real)(2.)*
  1007. ReflCalc->LayerDepth(ReflCalc->lays-1)-ReflCalc->tx_z)-ReflCalc->um*ReflCalc->rx_z+p);
  1008. if (ReflCalc->layr < ReflCalc->Earth->GetNumberOfLayers()-1) {
  1009. con += SR_SN(ReflCalc->id-1, 3) * ReflCalc->rtu(ReflCalc->lays)*ReflCalc->rtd(ReflCalc->layr) *
  1010. std::exp(ReflCalc->uk*((Real)(2.)*ReflCalc->LayerDepth(ReflCalc->lays-1)-ReflCalc->tx_z)-ReflCalc->um*
  1011. ((Real)(2.)*ReflCalc->LayerDepth(ReflCalc->layr)-ReflCalc->rx_z)+p);
  1012. }
  1013. }
  1014. return ra*a*con*ud;
  1015. }
  1016. template<EMMODE Mode, int Ikernel, DIPOLE_LOCATION Isource, DIPOLE_LOCATION Irecv>
  1017. Complex KernelEM1DSpec<Mode, Ikernel, Isource, Irecv>::RelPotentialInSourceLayer(const Real &ra) {
  1018. static bool called = false;
  1019. if (!called) {
  1020. std::cout << "Unspecialised KernelEM1DSpec::RelPotentialInSourceLayer() <" << Mode << " " << Ikernel << " "
  1021. << Isource << " " << Irecv << ">...slow" << std::endl;
  1022. called = true;
  1023. }
  1024. return PotentialInSourceLayer(ra);
  1025. }
  1026. template<EMMODE Mode, int Ikernel, DIPOLE_LOCATION Isource, DIPOLE_LOCATION Irecv>
  1027. Complex KernelEM1DSpec<Mode, Ikernel, Isource, Irecv>::PotentialInSourceLayer(const Real &ra) {
  1028. static bool called = false;
  1029. if (!called) {
  1030. std::cout << "WARNING\n";
  1031. std::cout << "Unspecialised PotentialInSourceLayer <" << Mode << " " << Ikernel << " "
  1032. << Isource << " " << Irecv << ">...this function will be slow\n\n";
  1033. called = true;
  1034. }
  1035. int iud(0);
  1036. if (ReflCalc->rx_z <= ReflCalc->tx_z) iud=1;
  1037. Real adz = std::abs(ReflCalc->rx_z - ReflCalc->tx_z);
  1038. Complex con;
  1039. Complex ud;
  1040. switch (ReflCalc->id) {
  1041. case (1):
  1042. ud = 1.;
  1043. break;
  1044. case (4):
  1045. ud = ReflCalc->uk*ReflCalc->uk;
  1046. break;
  1047. default:
  1048. ud = ReflCalc->uk;
  1049. }
  1050. if (ReflCalc->lays == 0) {
  1051. con = ReflCalc->rtd(0)*std::exp(ReflCalc->u(0)*(ReflCalc->rx_z+ReflCalc->tx_z));
  1052. } else {
  1053. if (ReflCalc->lays == ReflCalc->Earth->GetNumberOfLayers() - 1) {
  1054. con = SS_SN(ReflCalc->id-1, 0)*ReflCalc->rtu(ReflCalc->nlay-1)*std::exp(ReflCalc->u(ReflCalc->nlay-1) *
  1055. ((Real)(2.)*ReflCalc->LayerDepth(ReflCalc->nlay-2)-ReflCalc->rx_z-ReflCalc->tx_z));
  1056. } else {
  1057. con = ReflCalc->rtu(ReflCalc->lays)*(SS_SN(ReflCalc->id-1,0)*
  1058. std::exp(ReflCalc->uk*((Real)(2.)*ReflCalc->LayerDepth(ReflCalc->lays-1)-ReflCalc->rx_z-ReflCalc->tx_z))
  1059. + SS_SN(ReflCalc->id-1, 1)*ReflCalc->rtd(ReflCalc->lays)
  1060. * std::exp(ReflCalc->uk*(ReflCalc->tx_z-ReflCalc->rx_z-(Real)(2.)* ReflCalc->LayerThickness(ReflCalc->lays))))
  1061. + ReflCalc->rtd(ReflCalc->lays)
  1062. * ( SS_SN(ReflCalc->id-1, 2)
  1063. * std::exp(ReflCalc->uk*(ReflCalc->rx_z+ReflCalc->tx_z-(Real)(2.) * ReflCalc->LayerDepth(ReflCalc->lays)))
  1064. + SS_SN(ReflCalc->id-1, 3)*ReflCalc->rtu(ReflCalc->lays)
  1065. * std::exp(ReflCalc->uk*(ReflCalc->rx_z-ReflCalc->tx_z-(Real)(2.) * ReflCalc->LayerThickness(ReflCalc->lays)))
  1066. ) ;
  1067. con /= ((Real)(1.)-ReflCalc->rtu(ReflCalc->lays)*ReflCalc->rtd(ReflCalc->lays)*ReflCalc->cf(ReflCalc->lays)) ;
  1068. }
  1069. }
  1070. // Add singular term (source term)
  1071. con += SS_SL(ReflCalc->id-1, iud)*std::exp(-ReflCalc->uk*adz);
  1072. return ra*ud*con;
  1073. }
  1074. } // ----- end of Lemma name -----
  1075. #endif // ----- #ifndef KERNELEM1DSPEC_INC -----