Main Lemma Repository
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

kernelem1dspec.h 53KB

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