Lemma is an Electromagnetics API
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

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