Lemma is an Electromagnetics API
Du kannst nicht mehr als 25 Themen auswählen Themen müssen mit entweder einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

KernelEM1DSpec.h 52KB

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