Lemma is an Electromagnetics API
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

kernelem1dspec.cpp 96KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652
  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/17/2012
  9. @version $Id: kernelem1dspec.cpp 87 2013-09-05 22:44:05Z tirons $
  10. **/
  11. #include "kernelem1dspec.h"
  12. namespace Lemma {
  13. // ==================== SPECIALISATIONS ===============================
  14. ////////////////////////////////////////////////////////////////////////
  15. // GetBesselOrder
  16. /* TM INAIR INAIR */
  17. template <>
  18. int KernelEm1DSpec<TM, 0, INAIR, INAIR>::GetBesselOrder( ) {
  19. return 0;
  20. }
  21. template <>
  22. int KernelEm1DSpec<TM, 1, INAIR, INAIR>::GetBesselOrder( ) {
  23. return 1;
  24. }
  25. template <>
  26. int KernelEm1DSpec<TM, 2, INAIR, INAIR>::GetBesselOrder( ) {
  27. return 0;
  28. }
  29. template <>
  30. int KernelEm1DSpec<TM, 3, INAIR, INAIR>::GetBesselOrder( ) {
  31. return 1;
  32. }
  33. template <>
  34. int KernelEm1DSpec<TM, 4, INAIR, INAIR>::GetBesselOrder( ) {
  35. return 1;
  36. }
  37. template <>
  38. int KernelEm1DSpec<TM, 5, INAIR, INAIR>::GetBesselOrder( ) {
  39. return 0;
  40. }
  41. template <>
  42. int KernelEm1DSpec<TM, 6, INAIR, INAIR>::GetBesselOrder( ) {
  43. return 1;
  44. }
  45. template <>
  46. int KernelEm1DSpec<TM, 7, INAIR, INAIR>::GetBesselOrder( ) {
  47. return 0;
  48. }
  49. template <>
  50. int KernelEm1DSpec<TM, 8, INAIR, INAIR>::GetBesselOrder( ) {
  51. return 1;
  52. }
  53. template <>
  54. int KernelEm1DSpec<TM, 9, INAIR, INAIR>::GetBesselOrder( ) {
  55. return 1;
  56. }
  57. template <>
  58. int KernelEm1DSpec<TM, 10, INAIR, INAIR>::GetBesselOrder( ) {
  59. return 1;
  60. }
  61. template <>
  62. int KernelEm1DSpec<TM, 11, INAIR, INAIR>::GetBesselOrder( ) {
  63. return 0;
  64. }
  65. template <>
  66. int KernelEm1DSpec<TM, 12, INAIR, INAIR>::GetBesselOrder( ) {
  67. return 1;
  68. }
  69. /* TE INAIR INAIR */
  70. template <>
  71. int KernelEm1DSpec<TE, 0, INAIR, INAIR>::GetBesselOrder( ) {
  72. return 0;
  73. }
  74. template <>
  75. int KernelEm1DSpec<TE, 1, INAIR, INAIR>::GetBesselOrder( ) {
  76. return 1;
  77. }
  78. template <>
  79. int KernelEm1DSpec<TE, 2, INAIR, INAIR>::GetBesselOrder( ) {
  80. return 0;
  81. }
  82. template <>
  83. int KernelEm1DSpec<TE, 3, INAIR, INAIR>::GetBesselOrder( ) {
  84. return 1;
  85. }
  86. template <>
  87. int KernelEm1DSpec<TE, 4, INAIR, INAIR>::GetBesselOrder( ) {
  88. return 1;
  89. }
  90. template <>
  91. int KernelEm1DSpec<TE, 5, INAIR, INAIR>::GetBesselOrder( ) {
  92. return 0;
  93. }
  94. template <>
  95. int KernelEm1DSpec<TE, 6, INAIR, INAIR>::GetBesselOrder( ) {
  96. return 1;
  97. }
  98. template <>
  99. int KernelEm1DSpec<TE, 7, INAIR, INAIR>::GetBesselOrder( ) {
  100. return 0;
  101. }
  102. template <>
  103. int KernelEm1DSpec<TE, 8, INAIR, INAIR>::GetBesselOrder( ) {
  104. return 1;
  105. }
  106. template <>
  107. int KernelEm1DSpec<TE, 9, INAIR, INAIR>::GetBesselOrder( ) {
  108. return 1;
  109. }
  110. template <>
  111. int KernelEm1DSpec<TE, 10, INAIR, INAIR>::GetBesselOrder( ) {
  112. return 1;
  113. }
  114. template <>
  115. int KernelEm1DSpec<TE, 11, INAIR, INAIR>::GetBesselOrder( ) {
  116. return 0;
  117. }
  118. template <>
  119. int KernelEm1DSpec<TE, 12, INAIR, INAIR>::GetBesselOrder( ) {
  120. return 1;
  121. }
  122. /* TM INAIR INGROUND */
  123. template <>
  124. int KernelEm1DSpec<TM, 0, INAIR, INGROUND>::GetBesselOrder( ) {
  125. return 0;
  126. }
  127. template <>
  128. int KernelEm1DSpec<TM, 1, INAIR, INGROUND>::GetBesselOrder( ) {
  129. return 1;
  130. }
  131. template <>
  132. int KernelEm1DSpec<TM, 2, INAIR, INGROUND>::GetBesselOrder( ) {
  133. return 0;
  134. }
  135. template <>
  136. int KernelEm1DSpec<TM, 3, INAIR, INGROUND>::GetBesselOrder( ) {
  137. return 1;
  138. }
  139. template <>
  140. int KernelEm1DSpec<TM, 4, INAIR, INGROUND>::GetBesselOrder( ) {
  141. return 1;
  142. }
  143. template <>
  144. int KernelEm1DSpec<TM, 5, INAIR, INGROUND>::GetBesselOrder( ) {
  145. return 0;
  146. }
  147. template <>
  148. int KernelEm1DSpec<TM, 6, INAIR, INGROUND>::GetBesselOrder( ) {
  149. return 1;
  150. }
  151. template <>
  152. int KernelEm1DSpec<TM, 7, INAIR, INGROUND>::GetBesselOrder( ) {
  153. return 0;
  154. }
  155. template <>
  156. int KernelEm1DSpec<TM, 8, INAIR, INGROUND>::GetBesselOrder( ) {
  157. return 1;
  158. }
  159. template <>
  160. int KernelEm1DSpec<TM, 9, INAIR, INGROUND>::GetBesselOrder( ) {
  161. return 1;
  162. }
  163. template <>
  164. int KernelEm1DSpec<TM, 10, INAIR, INGROUND>::GetBesselOrder( ) {
  165. return 1;
  166. }
  167. template <>
  168. int KernelEm1DSpec<TM, 11, INAIR, INGROUND>::GetBesselOrder( ) {
  169. return 0;
  170. }
  171. template <>
  172. int KernelEm1DSpec<TM, 12, INAIR, INGROUND>::GetBesselOrder( ) {
  173. return 1;
  174. }
  175. /* TE INAIR INGROUND */
  176. template <>
  177. int KernelEm1DSpec<TE, 0, INAIR, INGROUND>::GetBesselOrder( ) {
  178. return 0;
  179. }
  180. template <>
  181. int KernelEm1DSpec<TE, 1, INAIR, INGROUND>::GetBesselOrder( ) {
  182. return 1;
  183. }
  184. template <>
  185. int KernelEm1DSpec<TE, 2, INAIR, INGROUND>::GetBesselOrder( ) {
  186. return 0;
  187. }
  188. template <>
  189. int KernelEm1DSpec<TE, 3, INAIR, INGROUND>::GetBesselOrder( ) {
  190. return 1;
  191. }
  192. template <>
  193. int KernelEm1DSpec<TE, 4, INAIR, INGROUND>::GetBesselOrder( ) {
  194. return 1;
  195. }
  196. template <>
  197. int KernelEm1DSpec<TE, 5, INAIR, INGROUND>::GetBesselOrder( ) {
  198. return 0;
  199. }
  200. template <>
  201. int KernelEm1DSpec<TE, 6, INAIR, INGROUND>::GetBesselOrder( ) {
  202. return 1;
  203. }
  204. template <>
  205. int KernelEm1DSpec<TE, 7, INAIR, INGROUND>::GetBesselOrder( ) {
  206. return 0;
  207. }
  208. template <>
  209. int KernelEm1DSpec<TE, 8, INAIR, INGROUND>::GetBesselOrder( ) {
  210. return 1;
  211. }
  212. template <>
  213. int KernelEm1DSpec<TE, 9, INAIR, INGROUND>::GetBesselOrder( ) {
  214. return 1;
  215. }
  216. template <>
  217. int KernelEm1DSpec<TE, 10, INAIR, INGROUND>::GetBesselOrder( ) {
  218. return 1;
  219. }
  220. template <>
  221. int KernelEm1DSpec<TE, 11, INAIR, INGROUND>::GetBesselOrder( ) {
  222. return 0;
  223. }
  224. template <>
  225. int KernelEm1DSpec<TE, 12, INAIR, INGROUND>::GetBesselOrder( ) {
  226. return 1;
  227. }
  228. /* TM INGROUND INAIR */
  229. template <>
  230. int KernelEm1DSpec<TM, 0, INGROUND, INAIR>::GetBesselOrder( ) {
  231. return 0;
  232. }
  233. template <>
  234. int KernelEm1DSpec<TM, 1, INGROUND, INAIR>::GetBesselOrder( ) {
  235. return 1;
  236. }
  237. template <>
  238. int KernelEm1DSpec<TM, 2, INGROUND, INAIR>::GetBesselOrder( ) {
  239. return 0;
  240. }
  241. template <>
  242. int KernelEm1DSpec<TM, 3, INGROUND, INAIR>::GetBesselOrder( ) {
  243. return 1;
  244. }
  245. template <>
  246. int KernelEm1DSpec<TM, 4, INGROUND, INAIR>::GetBesselOrder( ) {
  247. return 1;
  248. }
  249. template <>
  250. int KernelEm1DSpec<TM, 5, INGROUND, INAIR>::GetBesselOrder( ) {
  251. return 0;
  252. }
  253. template <>
  254. int KernelEm1DSpec<TM, 6, INGROUND, INAIR>::GetBesselOrder( ) {
  255. return 1;
  256. }
  257. template <>
  258. int KernelEm1DSpec<TM, 7, INGROUND, INAIR>::GetBesselOrder( ) {
  259. return 0;
  260. }
  261. template <>
  262. int KernelEm1DSpec<TM, 8, INGROUND, INAIR>::GetBesselOrder( ) {
  263. return 1;
  264. }
  265. template <>
  266. int KernelEm1DSpec<TM, 9, INGROUND, INAIR>::GetBesselOrder( ) {
  267. return 1;
  268. }
  269. template <>
  270. int KernelEm1DSpec<TM, 10, INGROUND, INAIR>::GetBesselOrder( ) {
  271. return 1;
  272. }
  273. template <>
  274. int KernelEm1DSpec<TM, 11, INGROUND, INAIR>::GetBesselOrder( ) {
  275. return 0;
  276. }
  277. template <>
  278. int KernelEm1DSpec<TM, 12, INGROUND, INAIR>::GetBesselOrder( ) {
  279. return 1;
  280. }
  281. /* TE INGROUND INAIR */
  282. template <>
  283. int KernelEm1DSpec<TE, 0, INGROUND, INAIR>::GetBesselOrder( ) {
  284. return 0;
  285. }
  286. template <>
  287. int KernelEm1DSpec<TE, 1, INGROUND, INAIR>::GetBesselOrder( ) {
  288. return 1;
  289. }
  290. template <>
  291. int KernelEm1DSpec<TE, 2, INGROUND, INAIR>::GetBesselOrder( ) {
  292. return 0;
  293. }
  294. template <>
  295. int KernelEm1DSpec<TE, 3, INGROUND, INAIR>::GetBesselOrder( ) {
  296. return 1;
  297. }
  298. template <>
  299. int KernelEm1DSpec<TE, 4, INGROUND, INAIR>::GetBesselOrder( ) {
  300. return 1;
  301. }
  302. template <>
  303. int KernelEm1DSpec<TE, 5, INGROUND, INAIR>::GetBesselOrder( ) {
  304. return 0;
  305. }
  306. template <>
  307. int KernelEm1DSpec<TE, 6, INGROUND, INAIR>::GetBesselOrder( ) {
  308. return 1;
  309. }
  310. template <>
  311. int KernelEm1DSpec<TE, 7, INGROUND, INAIR>::GetBesselOrder( ) {
  312. return 0;
  313. }
  314. template <>
  315. int KernelEm1DSpec<TE, 8, INGROUND, INAIR>::GetBesselOrder( ) {
  316. return 1;
  317. }
  318. template <>
  319. int KernelEm1DSpec<TE, 9, INGROUND, INAIR>::GetBesselOrder( ) {
  320. return 1;
  321. }
  322. template <>
  323. int KernelEm1DSpec<TE, 10, INGROUND, INAIR>::GetBesselOrder( ) {
  324. return 1;
  325. }
  326. template <>
  327. int KernelEm1DSpec<TE, 11, INGROUND, INAIR>::GetBesselOrder( ) {
  328. return 0;
  329. }
  330. template <>
  331. int KernelEm1DSpec<TE, 12, INGROUND, INAIR>::GetBesselOrder( ) {
  332. return 1;
  333. }
  334. /* TM INGROUND INGROUND */
  335. template <>
  336. int KernelEm1DSpec<TM, 0, INGROUND, INGROUND>::GetBesselOrder( ) {
  337. return 0;
  338. }
  339. template <>
  340. int KernelEm1DSpec<TM, 1, INGROUND, INGROUND>::GetBesselOrder( ) {
  341. return 1;
  342. }
  343. template <>
  344. int KernelEm1DSpec<TM, 2, INGROUND, INGROUND>::GetBesselOrder( ) {
  345. return 0;
  346. }
  347. template <>
  348. int KernelEm1DSpec<TM, 3, INGROUND, INGROUND>::GetBesselOrder( ) {
  349. return 1;
  350. }
  351. template <>
  352. int KernelEm1DSpec<TM, 4, INGROUND, INGROUND>::GetBesselOrder( ) {
  353. return 1;
  354. }
  355. template <>
  356. int KernelEm1DSpec<TM, 5, INGROUND, INGROUND>::GetBesselOrder( ) {
  357. return 0;
  358. }
  359. template <>
  360. int KernelEm1DSpec<TM, 6, INGROUND, INGROUND>::GetBesselOrder( ) {
  361. return 1;
  362. }
  363. template <>
  364. int KernelEm1DSpec<TM, 7, INGROUND, INGROUND>::GetBesselOrder( ) {
  365. return 0;
  366. }
  367. template <>
  368. int KernelEm1DSpec<TM, 8, INGROUND, INGROUND>::GetBesselOrder( ) {
  369. return 1;
  370. }
  371. template <>
  372. int KernelEm1DSpec<TM, 9, INGROUND, INGROUND>::GetBesselOrder( ) {
  373. return 1;
  374. }
  375. template <>
  376. int KernelEm1DSpec<TM, 10, INGROUND, INGROUND>::GetBesselOrder( ) {
  377. return 1;
  378. }
  379. template <>
  380. int KernelEm1DSpec<TM, 11, INGROUND, INGROUND>::GetBesselOrder( ) {
  381. return 0;
  382. }
  383. template <>
  384. int KernelEm1DSpec<TM, 12, INGROUND, INGROUND>::GetBesselOrder( ) {
  385. return 1;
  386. }
  387. /* TE INGROUND INGROUND */
  388. template <>
  389. int KernelEm1DSpec<TE, 0, INGROUND, INGROUND>::GetBesselOrder( ) {
  390. return 0;
  391. }
  392. template <>
  393. int KernelEm1DSpec<TE, 1, INGROUND, INGROUND>::GetBesselOrder( ) {
  394. return 1;
  395. }
  396. template <>
  397. int KernelEm1DSpec<TE, 2, INGROUND, INGROUND>::GetBesselOrder( ) {
  398. return 0;
  399. }
  400. template <>
  401. int KernelEm1DSpec<TE, 3, INGROUND, INGROUND>::GetBesselOrder( ) {
  402. return 1;
  403. }
  404. template <>
  405. int KernelEm1DSpec<TE, 4, INGROUND, INGROUND>::GetBesselOrder( ) {
  406. return 1;
  407. }
  408. template <>
  409. int KernelEm1DSpec<TE, 5, INGROUND, INGROUND>::GetBesselOrder( ) {
  410. return 0;
  411. }
  412. template <>
  413. int KernelEm1DSpec<TE, 6, INGROUND, INGROUND>::GetBesselOrder( ) {
  414. return 1;
  415. }
  416. template <>
  417. int KernelEm1DSpec<TE, 7, INGROUND, INGROUND>::GetBesselOrder( ) {
  418. return 0;
  419. }
  420. template <>
  421. int KernelEm1DSpec<TE, 8, INGROUND, INGROUND>::GetBesselOrder( ) {
  422. return 1;
  423. }
  424. template <>
  425. int KernelEm1DSpec<TE, 9, INGROUND, INGROUND>::GetBesselOrder( ) {
  426. return 1;
  427. }
  428. template <>
  429. int KernelEm1DSpec<TE, 10, INGROUND, INGROUND>::GetBesselOrder( ) {
  430. return 1;
  431. }
  432. template <>
  433. int KernelEm1DSpec<TE, 11, INGROUND, INGROUND>::GetBesselOrder( ) {
  434. return 0;
  435. }
  436. template <>
  437. int KernelEm1DSpec<TE, 12, INGROUND, INGROUND>::GetBesselOrder( ) {
  438. return 1;
  439. }
  440. ////////////////////////////////////////////////////////////////////////
  441. // BesselArg specialisations
  442. // TODO eradicate all ReflCalc->id terms, these should be hard coded
  443. /* TM INAIR INAIR */
  444. template <>
  445. Complex KernelEm1DSpec<TM, 0, INAIR, INAIR>::BesselArg( const Real& lambda ) {
  446. ReflCalc->ComputeReflectionCoeffs(lambda);
  447. ReflCalc->id = 4;
  448. return PotentialInSourceLayer(lambda)/ReflCalc->uk;
  449. }
  450. template <>
  451. Complex KernelEm1DSpec<TM, 0, INAIR, INAIR>::RelBesselArg( const Real& lambda ) {
  452. ReflCalc->id = 4;
  453. return RelPotentialInSourceLayer(lambda)/ReflCalc->uk;
  454. }
  455. template <>
  456. Complex KernelEm1DSpec<TM, 1, INAIR, INAIR>::BesselArg( const Real& lambda ) {
  457. ReflCalc->ComputeReflectionCoeffs(lambda);
  458. ReflCalc->id = 4;
  459. return PotentialInSourceLayer(1)/ReflCalc->uk;
  460. }
  461. template <>
  462. Complex KernelEm1DSpec<TM, 1, INAIR, INAIR>::RelBesselArg( const Real& lambda ) {
  463. ReflCalc->id = 4;
  464. return RelPotentialInSourceLayer(1)/ReflCalc->uk;
  465. }
  466. template <>
  467. Complex KernelEm1DSpec<TM, 2, INAIR, INAIR>::BesselArg(const Real& lambda ) {
  468. ReflCalc->ComputeReflectionCoeffs(lambda);
  469. ReflCalc->id = 1;
  470. return PotentialInSourceLayer(lambda)/ReflCalc->uk;
  471. }
  472. template <>
  473. Complex KernelEm1DSpec<TM, 2, INAIR, INAIR>::RelBesselArg(const Real& lambda ) {
  474. ReflCalc->id = 1;
  475. return RelPotentialInSourceLayer(lambda)/ReflCalc->uk;
  476. }
  477. template <>
  478. Complex KernelEm1DSpec<TM, 3, INAIR, INAIR>::BesselArg(const Real& lambda ) {
  479. ReflCalc->ComputeReflectionCoeffs(lambda);
  480. ReflCalc->id = 1;
  481. return PotentialInSourceLayer(1)/ReflCalc->uk;
  482. }
  483. template <>
  484. Complex KernelEm1DSpec<TM, 3, INAIR, INAIR>::RelBesselArg(const Real& lambda ) {
  485. ReflCalc->id = 1;
  486. return RelPotentialInSourceLayer(1)/ReflCalc->uk;
  487. }
  488. template <>
  489. Complex KernelEm1DSpec<TM, 4, INAIR, INAIR>::BesselArg(const Real& lambda ) {
  490. ReflCalc->ComputeReflectionCoeffs(lambda);
  491. ReflCalc->id = 3;
  492. return PotentialInSourceLayer(ReflCalc->rams)/ReflCalc->uk;
  493. }
  494. template <>
  495. Complex KernelEm1DSpec<TM, 4, INAIR, INAIR>::RelBesselArg(const Real& lambda ) {
  496. ReflCalc->id = 3;
  497. return RelPotentialInSourceLayer(ReflCalc->rams)/ReflCalc->uk;
  498. }
  499. template <>
  500. Complex KernelEm1DSpec<TM, 5, INAIR, INAIR>::BesselArg(const Real& lambda ) {
  501. ReflCalc->ComputeReflectionCoeffs(lambda);
  502. ReflCalc->id = 3;
  503. return PotentialInSourceLayer(lambda)/ReflCalc->uk;
  504. }
  505. template <>
  506. Complex KernelEm1DSpec<TM, 5, INAIR, INAIR>::RelBesselArg(const Real& lambda ) {
  507. ReflCalc->id = 3;
  508. return RelPotentialInSourceLayer(lambda)/ReflCalc->uk;
  509. }
  510. template <>
  511. Complex KernelEm1DSpec<TM, 6, INAIR, INAIR>::BesselArg(const Real& lambda ) {
  512. ReflCalc->ComputeReflectionCoeffs(lambda);
  513. ReflCalc->id = 3;
  514. return PotentialInSourceLayer(1)/ReflCalc->uk;
  515. }
  516. template <>
  517. Complex KernelEm1DSpec<TM, 6, INAIR, INAIR>::RelBesselArg(const Real& lambda ) {
  518. ReflCalc->id = 3;
  519. return RelPotentialInSourceLayer(1)/ReflCalc->uk;
  520. }
  521. template <>
  522. Complex KernelEm1DSpec<TM, 7, INAIR, INAIR>::BesselArg(const Real& lambda ) {
  523. ReflCalc->ComputeReflectionCoeffs(lambda);
  524. ReflCalc->id = 2;
  525. return PotentialInSourceLayer(lambda)/ReflCalc->uk;
  526. }
  527. template <>
  528. Complex KernelEm1DSpec<TM, 7, INAIR, INAIR>::RelBesselArg(const Real& lambda ) {
  529. ReflCalc->id = 2;
  530. return RelPotentialInSourceLayer(lambda)/ReflCalc->uk;
  531. }
  532. template <>
  533. Complex KernelEm1DSpec<TM, 8, INAIR, INAIR>::BesselArg(const Real& lambda ) {
  534. ReflCalc->ComputeReflectionCoeffs(lambda);
  535. ReflCalc->id = 2;
  536. return PotentialInSourceLayer(1)/ReflCalc->uk;
  537. }
  538. template <>
  539. Complex KernelEm1DSpec<TM, 8, INAIR, INAIR>::RelBesselArg(const Real& lambda ) {
  540. ReflCalc->id = 2;
  541. return RelPotentialInSourceLayer(1)/ReflCalc->uk;
  542. }
  543. template <>
  544. Complex KernelEm1DSpec<TM, 9, INAIR, INAIR>::BesselArg(const Real& lambda ) {
  545. ReflCalc->ComputeReflectionCoeffs(lambda);
  546. ReflCalc->id = 1;
  547. return PotentialInSourceLayer(ReflCalc->rams)/ReflCalc->uk;
  548. }
  549. template <>
  550. Complex KernelEm1DSpec<TM, 9, INAIR, INAIR>::RelBesselArg(const Real& lambda ) {
  551. ReflCalc->id = 1;
  552. return RelPotentialInSourceLayer(ReflCalc->rams)/ReflCalc->uk;
  553. }
  554. template <>
  555. Complex KernelEm1DSpec<TM, 10, INAIR, INAIR>::BesselArg(const Real& lambda ) {
  556. ReflCalc->ComputeReflectionCoeffs(lambda);
  557. ReflCalc->id = 2;
  558. return PotentialInSourceLayer(ReflCalc->rams)/ReflCalc->uk;
  559. }
  560. template <>
  561. Complex KernelEm1DSpec<TM, 10, INAIR, INAIR>::RelBesselArg(const Real& lambda ) {
  562. ReflCalc->id = 2;
  563. return RelPotentialInSourceLayer(ReflCalc->rams)/ReflCalc->uk;
  564. }
  565. template <>
  566. Complex KernelEm1DSpec<TM, 11, INAIR, INAIR>::BesselArg(const Real& lambda ) {
  567. ReflCalc->ComputeReflectionCoeffs(lambda);
  568. ReflCalc->id = 1;
  569. return PotentialInSourceLayer(lambda*ReflCalc->rams)/ReflCalc->uk;
  570. }
  571. template <>
  572. Complex KernelEm1DSpec<TM, 11, INAIR, INAIR>::RelBesselArg(const Real& lambda ) {
  573. ReflCalc->id = 1;
  574. return RelPotentialInSourceLayer(lambda*ReflCalc->rams)/ReflCalc->uk;
  575. }
  576. template <>
  577. Complex KernelEm1DSpec<TM, 12, INAIR, INAIR>::BesselArg(const Real& lambda ) {
  578. ReflCalc->ComputeReflectionCoeffs(lambda);
  579. ReflCalc->id = 1;
  580. return PotentialInSourceLayer(ReflCalc->rams)/ReflCalc->uk;
  581. }
  582. template <>
  583. Complex KernelEm1DSpec<TM, 12, INAIR, INAIR>::RelBesselArg(const Real& lambda ) {
  584. ReflCalc->id = 1;
  585. return RelPotentialInSourceLayer(ReflCalc->rams)/ReflCalc->uk;
  586. }
  587. /* TE INAIR INAIR */
  588. template <>
  589. Complex KernelEm1DSpec<TE, 0, INAIR, INAIR>::BesselArg(const Real& lambda ) {
  590. ReflCalc->ComputeReflectionCoeffs(lambda);
  591. ReflCalc->id = 4;
  592. return PotentialInSourceLayer(lambda)/ReflCalc->uk;
  593. }
  594. template <>
  595. Complex KernelEm1DSpec<TE, 0, INAIR, INAIR>::RelBesselArg(const Real& lambda ) {
  596. ReflCalc->id = 4;
  597. return RelPotentialInSourceLayer(lambda)/ReflCalc->uk;
  598. }
  599. template <>
  600. Complex KernelEm1DSpec<TE, 1, INAIR, INAIR>::BesselArg(const Real& lambda ) {
  601. ReflCalc->ComputeReflectionCoeffs(lambda);
  602. ReflCalc->id = 4;
  603. return PotentialInSourceLayer(1)/ReflCalc->uk;
  604. }
  605. template <>
  606. Complex KernelEm1DSpec<TE, 1, INAIR, INAIR>::RelBesselArg(const Real& lambda ) {
  607. ReflCalc->id = 4;
  608. return RelPotentialInSourceLayer(1)/ReflCalc->uk;
  609. }
  610. template <>
  611. Complex KernelEm1DSpec<TE, 2, INAIR, INAIR>::BesselArg(const Real& lambda ) {
  612. ReflCalc->ComputeReflectionCoeffs(lambda);
  613. ReflCalc->id = 1;
  614. return PotentialInSourceLayer(lambda)/ReflCalc->uk;
  615. }
  616. template <>
  617. Complex KernelEm1DSpec<TE, 2, INAIR, INAIR>::RelBesselArg(const Real& lambda ) {
  618. ReflCalc->id = 1;
  619. return RelPotentialInSourceLayer(lambda)/ReflCalc->uk;
  620. }
  621. template <>
  622. Complex KernelEm1DSpec<TE, 3, INAIR, INAIR>::BesselArg(const Real& lambda ) {
  623. ReflCalc->ComputeReflectionCoeffs(lambda);
  624. ReflCalc->id = 1;
  625. return PotentialInSourceLayer(1)/ReflCalc->uk;
  626. }
  627. template <>
  628. Complex KernelEm1DSpec<TE, 3, INAIR, INAIR>::RelBesselArg(const Real& lambda ) {
  629. ReflCalc->id = 1;
  630. return RelPotentialInSourceLayer(1)/ReflCalc->uk;
  631. }
  632. template <>
  633. Complex KernelEm1DSpec<TE, 4, INAIR, INAIR>::BesselArg(const Real& lambda ) {
  634. ReflCalc->ComputeReflectionCoeffs(lambda);
  635. ReflCalc->id = 3;
  636. return PotentialInSourceLayer(ReflCalc->rams)/ReflCalc->uk;
  637. }
  638. template <>
  639. Complex KernelEm1DSpec<TE, 4, INAIR, INAIR>::RelBesselArg(const Real& lambda ) {
  640. ReflCalc->id = 3;
  641. return RelPotentialInSourceLayer(ReflCalc->rams)/ReflCalc->uk;
  642. }
  643. template <>
  644. Complex KernelEm1DSpec<TE, 5, INAIR, INAIR>::BesselArg(const Real& lambda ) {
  645. ReflCalc->ComputeReflectionCoeffs(lambda);
  646. ReflCalc->id = 3;
  647. return PotentialInSourceLayer(lambda)/ReflCalc->uk;
  648. }
  649. template <>
  650. Complex KernelEm1DSpec<TE, 5, INAIR, INAIR>::RelBesselArg(const Real& lambda ) {
  651. ReflCalc->id = 3;
  652. return RelPotentialInSourceLayer(lambda)/ReflCalc->uk;
  653. }
  654. template <>
  655. Complex KernelEm1DSpec<TE, 6, INAIR, INAIR>::BesselArg(const Real& lambda ) {
  656. ReflCalc->ComputeReflectionCoeffs(lambda);
  657. ReflCalc->id = 3;
  658. return PotentialInSourceLayer(1)/ReflCalc->uk;
  659. }
  660. template <>
  661. Complex KernelEm1DSpec<TE, 6, INAIR, INAIR>::RelBesselArg(const Real& lambda ) {
  662. ReflCalc->id = 3;
  663. return RelPotentialInSourceLayer(1)/ReflCalc->uk;
  664. }
  665. template <>
  666. Complex KernelEm1DSpec<TE, 7, INAIR, INAIR>::BesselArg(const Real& lambda ) {
  667. ReflCalc->ComputeReflectionCoeffs(lambda);
  668. ReflCalc->id = 2;
  669. return PotentialInSourceLayer(lambda)/ReflCalc->uk;
  670. }
  671. template <>
  672. Complex KernelEm1DSpec<TE, 7, INAIR, INAIR>::RelBesselArg(const Real& lambda ) {
  673. ReflCalc->id = 2;
  674. return RelPotentialInSourceLayer(lambda)/ReflCalc->uk;
  675. }
  676. template <>
  677. Complex KernelEm1DSpec<TE, 8, INAIR, INAIR>::BesselArg(const Real& lambda ) {
  678. ReflCalc->ComputeReflectionCoeffs(lambda);
  679. ReflCalc->id = 2;
  680. return PotentialInSourceLayer(1)/ReflCalc->uk;
  681. }
  682. template <>
  683. Complex KernelEm1DSpec<TE, 8, INAIR, INAIR>::RelBesselArg(const Real& lambda ) {
  684. ReflCalc->id = 2;
  685. return RelPotentialInSourceLayer(1)/ReflCalc->uk;
  686. }
  687. template <>
  688. Complex KernelEm1DSpec<TE, 9, INAIR, INAIR>::BesselArg(const Real& lambda ) {
  689. ReflCalc->ComputeReflectionCoeffs(lambda);
  690. ReflCalc->id = 1;
  691. return PotentialInSourceLayer(ReflCalc->rams)/ReflCalc->uk;
  692. }
  693. template <>
  694. Complex KernelEm1DSpec<TE, 9, INAIR, INAIR>::RelBesselArg(const Real& lambda ) {
  695. ReflCalc->id = 1;
  696. return RelPotentialInSourceLayer(ReflCalc->rams)/ReflCalc->uk;
  697. }
  698. template <>
  699. Complex KernelEm1DSpec<TE, 10, INAIR, INAIR>::BesselArg(const Real& lambda ) {
  700. ReflCalc->ComputeReflectionCoeffs(lambda);
  701. ReflCalc->id = 2;
  702. return PotentialInSourceLayer(ReflCalc->rams)/ReflCalc->uk;
  703. }
  704. template <>
  705. Complex KernelEm1DSpec<TE, 10, INAIR, INAIR>::RelBesselArg(const Real& lambda ) {
  706. ReflCalc->id = 2;
  707. return RelPotentialInSourceLayer(ReflCalc->rams)/ReflCalc->uk;
  708. }
  709. template <>
  710. Complex KernelEm1DSpec<TE, 11, INAIR, INAIR>::BesselArg(const Real& lambda ) {
  711. ReflCalc->ComputeReflectionCoeffs(lambda);
  712. ReflCalc->id = 1;
  713. return PotentialInSourceLayer(lambda*ReflCalc->rams)/ReflCalc->uk;
  714. }
  715. template <>
  716. Complex KernelEm1DSpec<TE, 11, INAIR, INAIR>::RelBesselArg(const Real& lambda ) {
  717. ReflCalc->id = 1;
  718. return RelPotentialInSourceLayer(lambda*ReflCalc->rams)/ReflCalc->uk;
  719. }
  720. template <>
  721. Complex KernelEm1DSpec<TE, 12, INAIR, INAIR>::BesselArg(const Real& lambda ) {
  722. ReflCalc->ComputeReflectionCoeffs(lambda);
  723. ReflCalc->id = 1;
  724. return PotentialInSourceLayer(ReflCalc->rams)/ReflCalc->uk;
  725. }
  726. template <>
  727. Complex KernelEm1DSpec<TE, 12, INAIR, INAIR>::RelBesselArg(const Real& lambda ) {
  728. ReflCalc->id = 1;
  729. return RelPotentialInSourceLayer(ReflCalc->rams)/ReflCalc->uk;
  730. }
  731. /* TM INAIR INGROUND */
  732. template <>
  733. Complex KernelEm1DSpec<TM, 0, INAIR, INGROUND>::BesselArg(const Real& lambda ) {
  734. ReflCalc->ComputeReflectionCoeffs(lambda);
  735. ReflCalc->id = 4;
  736. return PotentialBelowSourceLayer(lambda)/ReflCalc->uk;
  737. }
  738. template <>
  739. Complex KernelEm1DSpec<TM, 0, INAIR, INGROUND>::RelBesselArg(const Real& lambda ) {
  740. ReflCalc->id = 4;
  741. return RelPotentialBelowSourceLayer(lambda)/ReflCalc->uk;
  742. }
  743. template <>
  744. Complex KernelEm1DSpec<TM, 1, INAIR, INGROUND>::BesselArg(const Real& lambda ) {
  745. ReflCalc->ComputeReflectionCoeffs(lambda);
  746. ReflCalc->id = 4;
  747. return PotentialBelowSourceLayer(1)/ReflCalc->uk;
  748. }
  749. template <>
  750. Complex KernelEm1DSpec<TM, 1, INAIR, INGROUND>::RelBesselArg(const Real& lambda ) {
  751. ReflCalc->id = 4;
  752. return RelPotentialBelowSourceLayer(1)/ReflCalc->uk;
  753. }
  754. template <>
  755. Complex KernelEm1DSpec<TM, 2, INAIR, INGROUND>::BesselArg(const Real& lambda ) {
  756. ReflCalc->ComputeReflectionCoeffs(lambda);
  757. ReflCalc->id = 1;
  758. return PotentialBelowSourceLayer(lambda)/ReflCalc->uk;
  759. }
  760. template <>
  761. Complex KernelEm1DSpec<TM, 2, INAIR, INGROUND>::RelBesselArg(const Real& lambda ) {
  762. ReflCalc->id = 1;
  763. return RelPotentialBelowSourceLayer(lambda)/ReflCalc->uk;
  764. }
  765. template <>
  766. Complex KernelEm1DSpec<TM, 3, INAIR, INGROUND>::BesselArg(const Real& lambda ) {
  767. ReflCalc->ComputeReflectionCoeffs(lambda);
  768. ReflCalc->id = 1;
  769. return PotentialBelowSourceLayer(1)/ReflCalc->uk;
  770. }
  771. template <>
  772. Complex KernelEm1DSpec<TM, 3, INAIR, INGROUND>::RelBesselArg(const Real& lambda ) {
  773. ReflCalc->id = 1;
  774. return RelPotentialBelowSourceLayer(1)/ReflCalc->uk;
  775. }
  776. template <>
  777. Complex KernelEm1DSpec<TM, 4, INAIR, INGROUND>::BesselArg(const Real& lambda ) {
  778. ReflCalc->ComputeReflectionCoeffs(lambda);
  779. ReflCalc->id = 3;
  780. return PotentialBelowSourceLayer(ReflCalc->rams)/ReflCalc->uk;
  781. }
  782. template <>
  783. Complex KernelEm1DSpec<TM, 4, INAIR, INGROUND>::RelBesselArg(const Real& lambda ) {
  784. ReflCalc->id = 3;
  785. return RelPotentialBelowSourceLayer(ReflCalc->rams)/ReflCalc->uk;
  786. }
  787. template <>
  788. Complex KernelEm1DSpec<TM, 5, INAIR, INGROUND>::BesselArg(const Real& lambda ) {
  789. ReflCalc->ComputeReflectionCoeffs(lambda);
  790. ReflCalc->id = 3;
  791. return PotentialBelowSourceLayer(lambda)/ReflCalc->uk;
  792. }
  793. template <>
  794. Complex KernelEm1DSpec<TM, 5, INAIR, INGROUND>::RelBesselArg(const Real& lambda ) {
  795. ReflCalc->id = 3;
  796. return RelPotentialBelowSourceLayer(lambda)/ReflCalc->uk;
  797. }
  798. template <>
  799. Complex KernelEm1DSpec<TM, 6, INAIR, INGROUND>::BesselArg(const Real& lambda ) {
  800. ReflCalc->ComputeReflectionCoeffs(lambda);
  801. ReflCalc->id = 3;
  802. return PotentialBelowSourceLayer(1)/ReflCalc->uk;
  803. }
  804. template <>
  805. Complex KernelEm1DSpec<TM, 6, INAIR, INGROUND>::RelBesselArg(const Real& lambda ) {
  806. ReflCalc->id = 3;
  807. return RelPotentialBelowSourceLayer(1)/ReflCalc->uk;
  808. }
  809. template <>
  810. Complex KernelEm1DSpec<TM, 7, INAIR, INGROUND>::BesselArg(const Real& lambda ) {
  811. ReflCalc->ComputeReflectionCoeffs(lambda);
  812. ReflCalc->id = 2;
  813. return PotentialBelowSourceLayer(lambda)/ReflCalc->uk;
  814. }
  815. template <>
  816. Complex KernelEm1DSpec<TM, 7, INAIR, INGROUND>::RelBesselArg(const Real& lambda ) {
  817. ReflCalc->id = 2;
  818. return RelPotentialBelowSourceLayer(lambda)/ReflCalc->uk;
  819. }
  820. template <>
  821. Complex KernelEm1DSpec<TM, 8, INAIR, INGROUND>::BesselArg(const Real& lambda ) {
  822. ReflCalc->ComputeReflectionCoeffs(lambda);
  823. ReflCalc->id = 2;
  824. return PotentialBelowSourceLayer(1)/ReflCalc->uk;
  825. }
  826. template <>
  827. Complex KernelEm1DSpec<TM, 8, INAIR, INGROUND>::RelBesselArg(const Real& lambda ) {
  828. ReflCalc->id = 2;
  829. return RelPotentialBelowSourceLayer(1)/ReflCalc->uk;
  830. }
  831. template <>
  832. Complex KernelEm1DSpec<TM, 9, INAIR, INGROUND>::BesselArg(const Real& lambda ) {
  833. ReflCalc->ComputeReflectionCoeffs(lambda);
  834. ReflCalc->id = 1;
  835. return PotentialBelowSourceLayer(ReflCalc->rams)/ReflCalc->uk;
  836. }
  837. template <>
  838. Complex KernelEm1DSpec<TM, 9, INAIR, INGROUND>::RelBesselArg(const Real& lambda ) {
  839. ReflCalc->id = 1;
  840. return RelPotentialBelowSourceLayer(ReflCalc->rams)/ReflCalc->uk;
  841. }
  842. template <>
  843. Complex KernelEm1DSpec<TM, 10, INAIR, INGROUND>::BesselArg(const Real& lambda ) {
  844. ReflCalc->ComputeReflectionCoeffs(lambda);
  845. ReflCalc->id = 2;
  846. return PotentialBelowSourceLayer(ReflCalc->rams)/ReflCalc->uk;
  847. }
  848. template <>
  849. Complex KernelEm1DSpec<TM, 10, INAIR, INGROUND>::RelBesselArg(const Real& lambda ) {
  850. ReflCalc->id = 2;
  851. return RelPotentialBelowSourceLayer(ReflCalc->rams)/ReflCalc->uk;
  852. }
  853. template <>
  854. Complex KernelEm1DSpec<TM, 11, INAIR, INGROUND>::BesselArg(const Real& lambda ) {
  855. ReflCalc->ComputeReflectionCoeffs(lambda);
  856. ReflCalc->id = 1;
  857. return PotentialBelowSourceLayer(lambda*ReflCalc->rams)/ReflCalc->uk;
  858. }
  859. template <>
  860. Complex KernelEm1DSpec<TM, 11, INAIR, INGROUND>::RelBesselArg(const Real& lambda ) {
  861. ReflCalc->id = 1;
  862. return RelPotentialBelowSourceLayer(lambda*ReflCalc->rams)/ReflCalc->uk;
  863. }
  864. template <>
  865. Complex KernelEm1DSpec<TM, 12, INAIR, INGROUND>::BesselArg(const Real& lambda ) {
  866. ReflCalc->ComputeReflectionCoeffs(lambda);
  867. ReflCalc->id = 1;
  868. return PotentialBelowSourceLayer(ReflCalc->rams)/ReflCalc->uk;
  869. }
  870. template <>
  871. Complex KernelEm1DSpec<TM, 12, INAIR, INGROUND>::RelBesselArg(const Real& lambda ) {
  872. ReflCalc->id = 1;
  873. return RelPotentialBelowSourceLayer(ReflCalc->rams)/ReflCalc->uk;
  874. }
  875. /* TE INAIR INGROUND */
  876. template <>
  877. Complex KernelEm1DSpec<TE, 0, INAIR, INGROUND>::BesselArg(const Real& lambda ) {
  878. ReflCalc->ComputeReflectionCoeffs(lambda);
  879. ReflCalc->id = 4;
  880. return PotentialBelowSourceLayer(lambda)/ReflCalc->uk;
  881. }
  882. template <>
  883. Complex KernelEm1DSpec<TE, 0, INAIR, INGROUND>::RelBesselArg(const Real& lambda ) {
  884. ReflCalc->id = 4;
  885. return RelPotentialBelowSourceLayer(lambda)/ReflCalc->uk;
  886. }
  887. template <>
  888. Complex KernelEm1DSpec<TE, 1, INAIR, INGROUND>::BesselArg(const Real& lambda ) {
  889. ReflCalc->ComputeReflectionCoeffs(lambda);
  890. ReflCalc->id = 4;
  891. return PotentialBelowSourceLayer(1)/ReflCalc->uk;
  892. }
  893. template <>
  894. Complex KernelEm1DSpec<TE, 1, INAIR, INGROUND>::RelBesselArg(const Real& lambda ) {
  895. ReflCalc->id = 4;
  896. return RelPotentialBelowSourceLayer(1)/ReflCalc->uk;
  897. }
  898. template <>
  899. Complex KernelEm1DSpec<TE, 2, INAIR, INGROUND>::BesselArg(const Real& lambda ) {
  900. ReflCalc->ComputeReflectionCoeffs(lambda);
  901. ReflCalc->id = 1;
  902. return PotentialBelowSourceLayer(lambda)/ReflCalc->uk;
  903. }
  904. template <>
  905. Complex KernelEm1DSpec<TE, 2, INAIR, INGROUND>::RelBesselArg(const Real& lambda ) {
  906. ReflCalc->id = 1;
  907. return RelPotentialBelowSourceLayer(lambda)/ReflCalc->uk;
  908. }
  909. template <>
  910. Complex KernelEm1DSpec<TE, 3, INAIR, INGROUND>::BesselArg(const Real& lambda ) {
  911. ReflCalc->ComputeReflectionCoeffs(lambda);
  912. ReflCalc->id = 1;
  913. return PotentialBelowSourceLayer(1)/ReflCalc->uk;
  914. }
  915. template <>
  916. Complex KernelEm1DSpec<TE, 3, INAIR, INGROUND>::RelBesselArg(const Real& lambda ) {
  917. ReflCalc->id = 1;
  918. return RelPotentialBelowSourceLayer(1)/ReflCalc->uk;
  919. }
  920. template <>
  921. Complex KernelEm1DSpec<TE, 4, INAIR, INGROUND>::BesselArg(const Real& lambda ) {
  922. ReflCalc->ComputeReflectionCoeffs(lambda);
  923. ReflCalc->id = 3;
  924. return PotentialBelowSourceLayer(ReflCalc->rams)/ReflCalc->uk;
  925. }
  926. template <>
  927. Complex KernelEm1DSpec<TE, 4, INAIR, INGROUND>::RelBesselArg(const Real& lambda ) {
  928. ReflCalc->id = 3;
  929. return RelPotentialBelowSourceLayer(ReflCalc->rams)/ReflCalc->uk;
  930. }
  931. template <>
  932. Complex KernelEm1DSpec<TE, 5, INAIR, INGROUND>::BesselArg(const Real& lambda ) {
  933. ReflCalc->ComputeReflectionCoeffs(lambda);
  934. ReflCalc->id = 3;
  935. return PotentialBelowSourceLayer(lambda)/ReflCalc->uk;
  936. }
  937. template <>
  938. Complex KernelEm1DSpec<TE, 5, INAIR, INGROUND>::RelBesselArg(const Real& lambda ) {
  939. ReflCalc->id = 3;
  940. return RelPotentialBelowSourceLayer(lambda)/ReflCalc->uk;
  941. }
  942. template <>
  943. Complex KernelEm1DSpec<TE, 6, INAIR, INGROUND>::BesselArg(const Real& lambda ) {
  944. ReflCalc->ComputeReflectionCoeffs(lambda);
  945. ReflCalc->id = 3;
  946. return PotentialBelowSourceLayer(1)/ReflCalc->uk;
  947. }
  948. template <>
  949. Complex KernelEm1DSpec<TE, 6, INAIR, INGROUND>::RelBesselArg(const Real& lambda ) {
  950. ReflCalc->id = 3;
  951. return RelPotentialBelowSourceLayer(1)/ReflCalc->uk;
  952. }
  953. template <>
  954. Complex KernelEm1DSpec<TE, 7, INAIR, INGROUND>::BesselArg(const Real& lambda ) {
  955. ReflCalc->ComputeReflectionCoeffs(lambda);
  956. ReflCalc->id = 2;
  957. return PotentialBelowSourceLayer(lambda)/ReflCalc->uk;
  958. }
  959. template <>
  960. Complex KernelEm1DSpec<TE, 7, INAIR, INGROUND>::RelBesselArg(const Real& lambda ) {
  961. ReflCalc->id = 2;
  962. return RelPotentialBelowSourceLayer(lambda)/ReflCalc->uk;
  963. }
  964. template <>
  965. Complex KernelEm1DSpec<TE, 8, INAIR, INGROUND>::BesselArg(const Real& lambda ) {
  966. ReflCalc->ComputeReflectionCoeffs(lambda);
  967. ReflCalc->id = 2;
  968. return PotentialBelowSourceLayer(1)/ReflCalc->uk;
  969. }
  970. template <>
  971. Complex KernelEm1DSpec<TE, 8, INAIR, INGROUND>::RelBesselArg(const Real& lambda ) {
  972. ReflCalc->id = 2;
  973. return RelPotentialBelowSourceLayer(1)/ReflCalc->uk;
  974. }
  975. template <>
  976. Complex KernelEm1DSpec<TE, 9, INAIR, INGROUND>::BesselArg(const Real& lambda ) {
  977. ReflCalc->ComputeReflectionCoeffs(lambda);
  978. ReflCalc->id = 1;
  979. return PotentialBelowSourceLayer(ReflCalc->rams)/ReflCalc->uk;
  980. }
  981. template <>
  982. Complex KernelEm1DSpec<TE, 9, INAIR, INGROUND>::RelBesselArg(const Real& lambda ) {
  983. ReflCalc->id = 1;
  984. return RelPotentialBelowSourceLayer(ReflCalc->rams)/ReflCalc->uk;
  985. }
  986. template <>
  987. Complex KernelEm1DSpec<TE, 10, INAIR, INGROUND>::BesselArg(const Real& lambda ) {
  988. ReflCalc->ComputeReflectionCoeffs(lambda);
  989. ReflCalc->id = 2;
  990. return PotentialBelowSourceLayer(ReflCalc->rams)/ReflCalc->uk;
  991. }
  992. template <>
  993. Complex KernelEm1DSpec<TE, 10, INAIR, INGROUND>::RelBesselArg(const Real& lambda ) {
  994. ReflCalc->id = 2;
  995. return RelPotentialBelowSourceLayer(ReflCalc->rams)/ReflCalc->uk;
  996. }
  997. template <>
  998. Complex KernelEm1DSpec<TE, 11, INAIR, INGROUND>::BesselArg(const Real& lambda ) {
  999. ReflCalc->ComputeReflectionCoeffs(lambda);
  1000. ReflCalc->id = 1;
  1001. return PotentialBelowSourceLayer(lambda*ReflCalc->rams)/ReflCalc->uk;
  1002. }
  1003. template <>
  1004. Complex KernelEm1DSpec<TE, 11, INAIR, INGROUND>::RelBesselArg(const Real& lambda ) {
  1005. ReflCalc->id = 1;
  1006. return RelPotentialBelowSourceLayer(lambda*ReflCalc->rams)/ReflCalc->uk;
  1007. }
  1008. template <>
  1009. Complex KernelEm1DSpec<TE, 12, INAIR, INGROUND>::BesselArg(const Real& lambda ) {
  1010. ReflCalc->ComputeReflectionCoeffs(lambda);
  1011. ReflCalc->id = 1;
  1012. return PotentialBelowSourceLayer(ReflCalc->rams)/ReflCalc->uk;
  1013. }
  1014. template <>
  1015. Complex KernelEm1DSpec<TE, 12, INAIR, INGROUND>::RelBesselArg(const Real& lambda) {
  1016. ReflCalc->id = 1;
  1017. return RelPotentialBelowSourceLayer(ReflCalc->rams)/ReflCalc->uk;
  1018. }
  1019. ////////////////////////////////////////////////////////////////////////
  1020. // Potential terms
  1021. // TODO the following could be precomputed in PotentialInSourceLayer: adz,
  1022. // iud, and con *before* source term.
  1023. template <>
  1024. Complex KernelEm1DSpec<TM, 0, INAIR, INAIR>::PotentialInSourceLayer(const Real &ra) {
  1025. int iud(0);
  1026. if (ReflCalc->rx_z <= ReflCalc->tx_z) iud=1;
  1027. Real adz = std::abs(ReflCalc->rx_z-ReflCalc->tx_z);
  1028. Complex con = ReflCalc->rtd(0)*std::exp(ReflCalc->u(0)*(ReflCalc->rx_z+ReflCalc->tx_z));
  1029. // Add singular term (source term)
  1030. con += SS_SL(3, iud)*std::exp(-ReflCalc->uk*adz);
  1031. return ra*ReflCalc->uk*ReflCalc->uk*con;
  1032. }
  1033. template <>
  1034. Complex KernelEm1DSpec<TM, 0, INAIR, INAIR>::RelPotentialInSourceLayer(const Real &ra) {
  1035. Complex con = ReflCalc->relCon + SS_SL(3, ReflCalc->relIud)*ReflCalc->relenukadz;
  1036. return ra*ReflCalc->uk*ReflCalc->uk*con;
  1037. }
  1038. template <>
  1039. Complex KernelEm1DSpec<TM, 1, INAIR, INAIR>::PotentialInSourceLayer(const Real &ra) {
  1040. int iud(0);
  1041. if (ReflCalc->rx_z <= ReflCalc->tx_z) iud=1;
  1042. Real adz = std::abs(ReflCalc->rx_z-ReflCalc->tx_z);
  1043. Complex con = ReflCalc->rtd(0)*std::exp(ReflCalc->u(0)*(ReflCalc->rx_z+ReflCalc->tx_z));
  1044. // Add singular term (source term)
  1045. con += SS_SL(3, iud)*std::exp(-ReflCalc->uk*adz);
  1046. return ra*ReflCalc->uk*ReflCalc->uk*con;
  1047. }
  1048. template <>
  1049. Complex KernelEm1DSpec<TM, 1, INAIR, INAIR>::RelPotentialInSourceLayer(const Real &ra) {
  1050. Complex con = ReflCalc->relCon + SS_SL(3, ReflCalc->relIud)*ReflCalc->relenukadz;
  1051. return ra*ReflCalc->uk*ReflCalc->uk*con;
  1052. }
  1053. template <>
  1054. Complex KernelEm1DSpec<TM, 2, INAIR, INAIR>::PotentialInSourceLayer(const Real &ra) {
  1055. int iud(0);
  1056. if (ReflCalc->rx_z <= ReflCalc->tx_z) iud=1;
  1057. Real adz = std::abs(ReflCalc->rx_z-ReflCalc->tx_z);
  1058. Complex con = ReflCalc->rtd(0)*std::exp(ReflCalc->u(0)*(ReflCalc->rx_z+ReflCalc->tx_z));
  1059. // Add singular term (source term)
  1060. con += SS_SL(0, iud)*std::exp(-ReflCalc->uk*adz);
  1061. return ra*con;
  1062. }
  1063. template <>
  1064. Complex KernelEm1DSpec<TM, 2, INAIR, INAIR>::RelPotentialInSourceLayer(const Real &ra) {
  1065. Complex con = ReflCalc->relCon + SS_SL(0, ReflCalc->relIud)*ReflCalc->relenukadz;
  1066. return ra*con;
  1067. }
  1068. template <>
  1069. Complex KernelEm1DSpec<TM, 3, INAIR, INAIR>::PotentialInSourceLayer(const Real &ra) {
  1070. int iud(0);
  1071. if (ReflCalc->rx_z <= ReflCalc->tx_z) iud=1;
  1072. Real adz = std::abs(ReflCalc->rx_z-ReflCalc->tx_z);
  1073. Complex con = ReflCalc->rtd(0)*std::exp(ReflCalc->u(0)*(ReflCalc->rx_z+ReflCalc->tx_z));
  1074. // Add singular term (source term)
  1075. con += SS_SL(0, iud)*std::exp(-ReflCalc->uk*adz);
  1076. return ra*con;
  1077. }
  1078. template <>
  1079. Complex KernelEm1DSpec<TM, 3, INAIR, INAIR>::RelPotentialInSourceLayer(const Real &ra) {
  1080. Complex con = ReflCalc->relCon + SS_SL(0, ReflCalc->relIud)*ReflCalc->relenukadz;
  1081. return ra*con;
  1082. }
  1083. template <>
  1084. Complex KernelEm1DSpec<TM, 4, INAIR, INAIR>::PotentialInSourceLayer(const Real &ra) {
  1085. int iud(0);
  1086. if (ReflCalc->rx_z <= ReflCalc->tx_z) iud=1;
  1087. Real adz = std::abs(ReflCalc->rx_z-ReflCalc->tx_z);
  1088. Complex con = ReflCalc->rtd(0)*std::exp(ReflCalc->u(0)*(ReflCalc->rx_z+ReflCalc->tx_z));
  1089. // Add singular term (source term)
  1090. con += SS_SL(2, iud)*std::exp(-ReflCalc->uk*adz);
  1091. return ra*ReflCalc->uk*con;
  1092. }
  1093. template <>
  1094. Complex KernelEm1DSpec<TM, 4, INAIR, INAIR>::RelPotentialInSourceLayer(const Real &ra) {
  1095. Complex con = ReflCalc->relCon + SS_SL(2, ReflCalc->relIud)*ReflCalc->relenukadz;
  1096. return ra*ReflCalc->uk*con;
  1097. }
  1098. template <>
  1099. Complex KernelEm1DSpec<TM, 5, INAIR, INAIR>::PotentialInSourceLayer(const Real &ra) {
  1100. int iud(0);
  1101. if (ReflCalc->rx_z <= ReflCalc->tx_z) iud=1;
  1102. Real adz = std::abs(ReflCalc->rx_z-ReflCalc->tx_z);
  1103. Complex con = ReflCalc->rtd(0)*std::exp(ReflCalc->u(0)*(ReflCalc->rx_z+ReflCalc->tx_z));
  1104. // Add singular term (source term)
  1105. con += SS_SL(2, iud)*std::exp(-ReflCalc->uk*adz);
  1106. return ra*ReflCalc->uk*con;
  1107. }
  1108. template <>
  1109. Complex KernelEm1DSpec<TM, 5, INAIR, INAIR>::RelPotentialInSourceLayer(const Real &ra) {
  1110. Complex con = ReflCalc->relCon + SS_SL(2, ReflCalc->relIud)*ReflCalc->relenukadz;
  1111. return ra*ReflCalc->uk*con;
  1112. }
  1113. template <>
  1114. Complex KernelEm1DSpec<TM, 6, INAIR, INAIR>::PotentialInSourceLayer(const Real &ra) {
  1115. int iud(0);
  1116. if (ReflCalc->rx_z <= ReflCalc->tx_z) iud=1;
  1117. Real adz = std::abs(ReflCalc->rx_z-ReflCalc->tx_z);
  1118. Complex con = ReflCalc->rtd(0)*std::exp(ReflCalc->u(0)*(ReflCalc->rx_z+ReflCalc->tx_z));
  1119. // Add singular term (source term)
  1120. con += SS_SL(2, iud)*std::exp(-ReflCalc->uk*adz);
  1121. return ra*ReflCalc->uk*con;
  1122. }
  1123. template <>
  1124. Complex KernelEm1DSpec<TM, 6, INAIR, INAIR>::RelPotentialInSourceLayer(const Real &ra) {
  1125. Complex con = ReflCalc->relCon + SS_SL(2, ReflCalc->relIud)*ReflCalc->relenukadz;
  1126. return ra*ReflCalc->uk*con;
  1127. }
  1128. template <>
  1129. Complex KernelEm1DSpec<TM, 7, INAIR, INAIR>::PotentialInSourceLayer(const Real &ra) {
  1130. int iud(0);
  1131. if (ReflCalc->rx_z <= ReflCalc->tx_z) iud=1;
  1132. Real adz = std::abs(ReflCalc->rx_z-ReflCalc->tx_z);
  1133. Complex con = ReflCalc->rtd(0)*std::exp(ReflCalc->u(0)*(ReflCalc->rx_z+ReflCalc->tx_z));
  1134. // Add singular term (source term)
  1135. con += SS_SL(1, iud)*std::exp(-ReflCalc->uk*adz);
  1136. return ra*ReflCalc->uk*con;
  1137. }
  1138. template <>
  1139. Complex KernelEm1DSpec<TM, 7, INAIR, INAIR>::RelPotentialInSourceLayer(const Real &ra) {
  1140. Complex con = ReflCalc->relCon + SS_SL(1, ReflCalc->relIud)*ReflCalc->relenukadz;
  1141. return ra*ReflCalc->uk*con;
  1142. }
  1143. template <>
  1144. Complex KernelEm1DSpec<TM, 8, INAIR, INAIR>::PotentialInSourceLayer(const Real &ra) {
  1145. int iud(0);
  1146. if (ReflCalc->rx_z <= ReflCalc->tx_z) iud=1;
  1147. Real adz = std::abs(ReflCalc->rx_z-ReflCalc->tx_z);
  1148. Complex con = ReflCalc->rtd(0)*std::exp(ReflCalc->u(0)*(ReflCalc->rx_z+ReflCalc->tx_z));
  1149. // Add singular term (source term)
  1150. con += SS_SL(1, iud)*std::exp(-ReflCalc->uk*adz);
  1151. return ra*ReflCalc->uk*con;
  1152. }
  1153. template <>
  1154. Complex KernelEm1DSpec<TM, 8, INAIR, INAIR>::RelPotentialInSourceLayer(const Real &ra) {
  1155. Complex con = ReflCalc->relCon + SS_SL(1, ReflCalc->relIud)*ReflCalc->relenukadz;
  1156. return ra*ReflCalc->uk*con;
  1157. }
  1158. template <>
  1159. Complex KernelEm1DSpec<TM, 9, INAIR, INAIR>::PotentialInSourceLayer(const Real &ra) {
  1160. int iud(0);
  1161. if (ReflCalc->rx_z <= ReflCalc->tx_z) iud=1;
  1162. Real adz = std::abs(ReflCalc->rx_z-ReflCalc->tx_z);
  1163. Complex con = ReflCalc->rtd(0)*std::exp(ReflCalc->u(0)*(ReflCalc->rx_z+ReflCalc->tx_z));
  1164. // Add singular term (source term)
  1165. con += SS_SL(0, iud)*std::exp(-ReflCalc->uk*adz);
  1166. return ra*con;
  1167. }
  1168. template <>
  1169. Complex KernelEm1DSpec<TM, 9, INAIR, INAIR>::RelPotentialInSourceLayer(const Real &ra) {
  1170. Complex con = ReflCalc->relCon + SS_SL(0, ReflCalc->relIud)*ReflCalc->relenukadz;
  1171. return ra*con;
  1172. }
  1173. template <>
  1174. Complex KernelEm1DSpec<TM, 10, INAIR, INAIR>::PotentialInSourceLayer(const Real &ra) {
  1175. int iud(0);
  1176. if (ReflCalc->rx_z <= ReflCalc->tx_z) iud=1;
  1177. Real adz = std::abs(ReflCalc->rx_z-ReflCalc->tx_z);
  1178. Complex con = ReflCalc->rtd(0)*std::exp(ReflCalc->u(0)*(ReflCalc->rx_z+ReflCalc->tx_z));
  1179. // Add singular term (source term)
  1180. con += SS_SL(1, iud)*std::exp(-ReflCalc->uk*adz);
  1181. return ra*ReflCalc->uk*con;
  1182. }
  1183. template <>
  1184. Complex KernelEm1DSpec<TM, 10, INAIR, INAIR>::RelPotentialInSourceLayer(const Real &ra) {
  1185. Complex con = ReflCalc->relCon + SS_SL(1, ReflCalc->relIud)*ReflCalc->relenukadz;
  1186. return ra*ReflCalc->uk*con;
  1187. }
  1188. template <>
  1189. Complex KernelEm1DSpec<TM, 11, INAIR, INAIR>::PotentialInSourceLayer(const Real &ra) {
  1190. int iud(0);
  1191. if (ReflCalc->rx_z <= ReflCalc->tx_z) iud=1;
  1192. Real adz = std::abs(ReflCalc->rx_z-ReflCalc->tx_z);
  1193. Complex con = ReflCalc->rtd(0)*std::exp(ReflCalc->u(0)*(ReflCalc->rx_z+ReflCalc->tx_z));
  1194. // Add singular term (source term)
  1195. con += SS_SL(0, iud)*std::exp(-ReflCalc->uk*adz);
  1196. return ra*con;
  1197. }
  1198. template <>
  1199. Complex KernelEm1DSpec<TM, 11, INAIR, INAIR>::RelPotentialInSourceLayer(const Real &ra) {
  1200. Complex con = ReflCalc->relCon + SS_SL(0, ReflCalc->relIud)*ReflCalc->relenukadz;
  1201. return ra*con;
  1202. }
  1203. template <>
  1204. Complex KernelEm1DSpec<TM, 12, INAIR, INAIR>::PotentialInSourceLayer(const Real &ra) {
  1205. int iud(0);
  1206. if (ReflCalc->rx_z <= ReflCalc->tx_z) iud=1;
  1207. Real adz = std::abs(ReflCalc->rx_z-ReflCalc->tx_z);
  1208. Complex con = ReflCalc->rtd(0)*std::exp(ReflCalc->u(0)*(ReflCalc->rx_z+ReflCalc->tx_z));
  1209. // Add singular term (source term)
  1210. con += SS_SL(0, iud)*std::exp(-ReflCalc->uk*adz);
  1211. return ra*con;
  1212. }
  1213. template <>
  1214. Complex KernelEm1DSpec<TM, 12, INAIR, INAIR>::RelPotentialInSourceLayer(const Real &ra) {
  1215. Complex con = ReflCalc->relCon + SS_SL(0, ReflCalc->relIud)*ReflCalc->relenukadz;
  1216. return ra*con;
  1217. }
  1218. template <>
  1219. Complex KernelEm1DSpec<TE, 0, INAIR, INAIR>::PotentialInSourceLayer(const Real &ra) {
  1220. int iud(0);
  1221. if (ReflCalc->rx_z <= ReflCalc->tx_z) iud=1;
  1222. Real adz = std::abs(ReflCalc->rx_z-ReflCalc->tx_z);
  1223. Complex con = ReflCalc->rtd(0)*std::exp(ReflCalc->u(0)*(ReflCalc->rx_z+ReflCalc->tx_z));
  1224. // Add singular term (source term)
  1225. con += SS_SL(3, iud)*std::exp(-ReflCalc->uk*adz);
  1226. return ra*ReflCalc->uk*ReflCalc->uk*con;
  1227. }
  1228. template <>
  1229. Complex KernelEm1DSpec<TE, 0, INAIR, INAIR>::RelPotentialInSourceLayer(const Real &ra) {
  1230. Complex con = ReflCalc->relCon + SS_SL(3, ReflCalc->relIud)*ReflCalc->relenukadz;
  1231. return ra*ReflCalc->uk*ReflCalc->uk*con;
  1232. }
  1233. template <>
  1234. Complex KernelEm1DSpec<TE, 1, INAIR, INAIR>::PotentialInSourceLayer(const Real &ra) {
  1235. int iud(0);
  1236. if (ReflCalc->rx_z <= ReflCalc->tx_z) iud=1;
  1237. Real adz = std::abs(ReflCalc->rx_z-ReflCalc->tx_z);
  1238. Complex con = ReflCalc->rtd(0)*std::exp(ReflCalc->u(0)*(ReflCalc->rx_z+ReflCalc->tx_z));
  1239. // Add singular term (source term)
  1240. con += SS_SL(3, iud)*std::exp(-ReflCalc->uk*adz);
  1241. return ra*ReflCalc->uk*ReflCalc->uk*con;
  1242. }
  1243. template <>
  1244. Complex KernelEm1DSpec<TE, 1, INAIR, INAIR>::RelPotentialInSourceLayer(const Real &ra) {
  1245. Complex con = ReflCalc->relCon + SS_SL(3, ReflCalc->relIud)*ReflCalc->relenukadz;
  1246. return ra*ReflCalc->uk*ReflCalc->uk*con;
  1247. }
  1248. template <>
  1249. Complex KernelEm1DSpec<TE, 2, INAIR, INAIR>::PotentialInSourceLayer(const Real &ra) {
  1250. int iud(0);
  1251. if (ReflCalc->rx_z <= ReflCalc->tx_z) iud=1;
  1252. Real adz = std::abs(ReflCalc->rx_z-ReflCalc->tx_z);
  1253. Complex con = ReflCalc->rtd(0)*std::exp(ReflCalc->u(0)*(ReflCalc->rx_z+ReflCalc->tx_z));
  1254. // Add singular term (source term)
  1255. con += SS_SL(0, iud)*std::exp(-ReflCalc->uk*adz);
  1256. return ra*con;
  1257. }
  1258. template <>
  1259. Complex KernelEm1DSpec<TE, 2, INAIR, INAIR>::RelPotentialInSourceLayer(const Real &ra) {
  1260. Complex con = ReflCalc->relCon + SS_SL(0, ReflCalc->relIud)*ReflCalc->relenukadz;
  1261. return ra*con;
  1262. }
  1263. template <>
  1264. Complex KernelEm1DSpec<TE, 3, INAIR, INAIR>::PotentialInSourceLayer(const Real &ra) {
  1265. int iud(0);
  1266. if (ReflCalc->rx_z <= ReflCalc->tx_z) iud=1;
  1267. Real adz = std::abs(ReflCalc->rx_z-ReflCalc->tx_z);
  1268. Complex con = ReflCalc->rtd(0)*std::exp(ReflCalc->u(0)*(ReflCalc->rx_z+ReflCalc->tx_z));
  1269. // Add singular term (source term)
  1270. con += SS_SL(0, iud)*std::exp(-ReflCalc->uk*adz);
  1271. return ra*con;
  1272. }
  1273. template <>
  1274. Complex KernelEm1DSpec<TE, 3, INAIR, INAIR>::RelPotentialInSourceLayer(const Real &ra) {
  1275. Complex con = ReflCalc->relCon + SS_SL(0, ReflCalc->relIud)*ReflCalc->relenukadz;
  1276. return ra*con;
  1277. }
  1278. template <>
  1279. Complex KernelEm1DSpec<TE, 4, INAIR, INAIR>::PotentialInSourceLayer(const Real &ra) {
  1280. int iud(0);
  1281. if (ReflCalc->rx_z <= ReflCalc->tx_z) iud=1;
  1282. Real adz = std::abs(ReflCalc->rx_z-ReflCalc->tx_z);
  1283. Complex con = ReflCalc->rtd(0)*std::exp(ReflCalc->u(0)*(ReflCalc->rx_z+ReflCalc->tx_z));
  1284. // Add singular term (source term)
  1285. con += SS_SL(2, iud)*std::exp(-ReflCalc->uk*adz);
  1286. return ra*ReflCalc->uk*con;
  1287. }
  1288. template <>
  1289. Complex KernelEm1DSpec<TE, 4, INAIR, INAIR>::RelPotentialInSourceLayer(const Real &ra) {
  1290. Complex con = ReflCalc->relCon + SS_SL(2, ReflCalc->relIud)*ReflCalc->relenukadz;
  1291. return ra*ReflCalc->uk*con;
  1292. }
  1293. template <>
  1294. Complex KernelEm1DSpec<TE, 5, INAIR, INAIR>::PotentialInSourceLayer(const Real &ra) {
  1295. int iud(0);
  1296. if (ReflCalc->rx_z <= ReflCalc->tx_z) iud=1;
  1297. Real adz = std::abs(ReflCalc->rx_z-ReflCalc->tx_z);
  1298. Complex con = ReflCalc->rtd(0)*std::exp(ReflCalc->u(0)*(ReflCalc->rx_z+ReflCalc->tx_z));
  1299. // Add singular term (source term)
  1300. con += SS_SL(2, iud)*std::exp(-ReflCalc->uk*adz);
  1301. return ra*ReflCalc->uk*con;
  1302. }
  1303. template <>
  1304. Complex KernelEm1DSpec<TE, 5, INAIR, INAIR>::RelPotentialInSourceLayer(const Real &ra) {
  1305. Complex con = ReflCalc->relCon + SS_SL(2, ReflCalc->relIud)*ReflCalc->relenukadz;
  1306. return ra*ReflCalc->uk*con;
  1307. }
  1308. template <>
  1309. Complex KernelEm1DSpec<TE, 6, INAIR, INAIR>::PotentialInSourceLayer(const Real &ra) {
  1310. int iud(0);
  1311. if (ReflCalc->rx_z <= ReflCalc->tx_z) iud=1;
  1312. Real adz = std::abs(ReflCalc->rx_z-ReflCalc->tx_z);
  1313. Complex con = ReflCalc->rtd(0)*std::exp(ReflCalc->u(0)*(ReflCalc->rx_z+ReflCalc->tx_z));
  1314. // Add singular term (source term)
  1315. con += SS_SL(2, iud)*std::exp(-ReflCalc->uk*adz);
  1316. return ra*ReflCalc->uk*con;
  1317. }
  1318. template <>
  1319. Complex KernelEm1DSpec<TE, 6, INAIR, INAIR>::RelPotentialInSourceLayer(const Real &ra) {
  1320. Complex con = ReflCalc->relCon + SS_SL(2, ReflCalc->relIud)*ReflCalc->relenukadz;
  1321. return ra*ReflCalc->uk*con;
  1322. }
  1323. template <>
  1324. Complex KernelEm1DSpec<TE, 7, INAIR, INAIR>::PotentialInSourceLayer(const Real &ra) {
  1325. int iud(0);
  1326. if (ReflCalc->rx_z <= ReflCalc->tx_z) iud=1;
  1327. Real adz = std::abs(ReflCalc->rx_z-ReflCalc->tx_z);
  1328. Complex con = ReflCalc->rtd(0)*std::exp(ReflCalc->u(0)*(ReflCalc->rx_z+ReflCalc->tx_z));
  1329. // Add singular term (source term)
  1330. con += SS_SL(1, iud)*std::exp(-ReflCalc->uk*adz);
  1331. return ra*ReflCalc->uk*con;
  1332. }
  1333. template <>
  1334. Complex KernelEm1DSpec<TE, 7, INAIR, INAIR>::RelPotentialInSourceLayer(const Real &ra) {
  1335. Complex con = ReflCalc->relCon + SS_SL(1, ReflCalc->relIud)*ReflCalc->relenukadz;
  1336. return ra*ReflCalc->uk*con;
  1337. }
  1338. template <>
  1339. Complex KernelEm1DSpec<TE, 8, INAIR, INAIR>::PotentialInSourceLayer(const Real &ra) {
  1340. int iud(0);
  1341. if (ReflCalc->rx_z <= ReflCalc->tx_z) iud=1;
  1342. Real adz = std::abs(ReflCalc->rx_z-ReflCalc->tx_z);
  1343. Complex con = ReflCalc->rtd(0)*std::exp(ReflCalc->u(0)*(ReflCalc->rx_z+ReflCalc->tx_z));
  1344. // Add singular term (source term)
  1345. con += SS_SL(1, iud)*std::exp(-ReflCalc->uk*adz);
  1346. return ra*ReflCalc->uk*con;
  1347. }
  1348. template <>
  1349. Complex KernelEm1DSpec<TE, 8, INAIR, INAIR>::RelPotentialInSourceLayer(const Real &ra) {
  1350. Complex con = ReflCalc->relCon + SS_SL(1, ReflCalc->relIud)*ReflCalc->relenukadz;
  1351. return ra*ReflCalc->uk*con;
  1352. }
  1353. template <>
  1354. Complex KernelEm1DSpec<TE, 9, INAIR, INAIR>::PotentialInSourceLayer(const Real &ra) {
  1355. int iud(0);
  1356. if (ReflCalc->rx_z <= ReflCalc->tx_z) iud=1;
  1357. Real adz = std::abs(ReflCalc->rx_z-ReflCalc->tx_z);
  1358. Complex con = ReflCalc->rtd(0)*std::exp(ReflCalc->u(0)*(ReflCalc->rx_z+ReflCalc->tx_z));
  1359. // Add singular term (source term)
  1360. con += SS_SL(0, iud)*std::exp(-ReflCalc->uk*adz);
  1361. return ra*con;
  1362. }
  1363. template <>
  1364. Complex KernelEm1DSpec<TE, 9, INAIR, INAIR>::RelPotentialInSourceLayer(const Real &ra) {
  1365. Complex con = ReflCalc->relCon + SS_SL(0, ReflCalc->relIud)*ReflCalc->relenukadz;
  1366. return ra*con;
  1367. }
  1368. template <>
  1369. Complex KernelEm1DSpec<TE, 10, INAIR, INAIR>::PotentialInSourceLayer(const Real &ra) {
  1370. int iud(0);
  1371. if (ReflCalc->rx_z <= ReflCalc->tx_z) iud=1;
  1372. Real adz = std::abs(ReflCalc->rx_z-ReflCalc->tx_z);
  1373. Complex con = ReflCalc->rtd(0)*std::exp(ReflCalc->u(0)*(ReflCalc->rx_z+ReflCalc->tx_z));
  1374. // Add singular term (source term)
  1375. con += SS_SL(1, iud)*std::exp(-ReflCalc->uk*adz);
  1376. return ra*ReflCalc->uk*con;
  1377. }
  1378. template <>
  1379. Complex KernelEm1DSpec<TE, 10, INAIR, INAIR>::RelPotentialInSourceLayer(const Real &ra) {
  1380. Complex con = ReflCalc->relCon + SS_SL(1, ReflCalc->relIud)*ReflCalc->relenukadz;
  1381. return ra*ReflCalc->uk*con;
  1382. }
  1383. template <>
  1384. Complex KernelEm1DSpec<TE, 11, INAIR, INAIR>::PotentialInSourceLayer(const Real &ra) {
  1385. int iud(0);
  1386. if (ReflCalc->rx_z <= ReflCalc->tx_z) iud=1;
  1387. Real adz = std::abs(ReflCalc->rx_z-ReflCalc->tx_z);
  1388. Complex con = ReflCalc->rtd(0)*std::exp(ReflCalc->u(0)*(ReflCalc->rx_z+ReflCalc->tx_z));
  1389. // Add singular term (source term)
  1390. con += SS_SL(0, iud)*std::exp(-ReflCalc->uk*adz);
  1391. return ra*con;
  1392. }
  1393. template <>
  1394. Complex KernelEm1DSpec<TE, 11, INAIR, INAIR>::RelPotentialInSourceLayer(const Real &ra) {
  1395. Complex con = ReflCalc->relCon + SS_SL(0, ReflCalc->relIud)*ReflCalc->relenukadz;
  1396. return ra*con;
  1397. }
  1398. template <>
  1399. Complex KernelEm1DSpec<TE, 12, INAIR, INAIR>::PotentialInSourceLayer(const Real &ra) {
  1400. int iud(0);
  1401. if (ReflCalc->rx_z <= ReflCalc->tx_z) iud=1;
  1402. Real adz = std::abs(ReflCalc->rx_z-ReflCalc->tx_z);
  1403. Complex con = ReflCalc->rtd(0)*std::exp(ReflCalc->u(0)*(ReflCalc->rx_z+ReflCalc->tx_z));
  1404. // Add singular term (source term)
  1405. con += SS_SL(0, iud)*std::exp(-ReflCalc->uk*adz);
  1406. return ra*con;
  1407. }
  1408. template <>
  1409. Complex KernelEm1DSpec<TE, 12, INAIR, INAIR>::RelPotentialInSourceLayer(const Real &ra) {
  1410. Complex con = ReflCalc->relCon + SS_SL(0, ReflCalc->relIud)*ReflCalc->relenukadz;
  1411. return ra*con;
  1412. }
  1413. // TODO in PotentialBelowSourceLayer:
  1414. template<>
  1415. Complex KernelEm1DSpec<TM, 0, INAIR, INGROUND>::PotentialBelowSourceLayer(const Real &ra) {
  1416. Complex dd = ((Real)(1.)+ReflCalc->rtd(1)*ReflCalc->cf(1));
  1417. Complex a = ((Real)(1.) + ReflCalc->rtd(0)) / dd;
  1418. if (ReflCalc->layr >= 2) {
  1419. for (int n=2; n<=ReflCalc->layr; ++n) {
  1420. a *= ((Real)(1.)+ReflCalc->rtd(n-1));
  1421. if (n < ReflCalc->nlay-1) {
  1422. a /= ((Real)(1.)+ReflCalc->rtd(n)*ReflCalc->cf(n));
  1423. }
  1424. }
  1425. }
  1426. Complex p(0,0);
  1427. for (int n=1; n<=ReflCalc->layr; ++n) {
  1428. Complex ut = ReflCalc->u(0);
  1429. if (n>1) {
  1430. ut = ReflCalc->u(n-1);
  1431. }
  1432. p += (ReflCalc->u(n)-ut) * ReflCalc->LayerDepth(n-1);
  1433. }
  1434. Complex con = SR_SN(3, 0) * std::exp(ReflCalc->uk*ReflCalc->tx_z - ReflCalc->um*ReflCalc->rx_z+ p);
  1435. if (ReflCalc->layr < ReflCalc->Earth->GetNumberOfLayers()-1) {
  1436. con += SR_SN(3, 2) * ReflCalc->rtd(ReflCalc->layr) * std::exp(ReflCalc->uk*ReflCalc->tx_z-
  1437. ReflCalc->um*((Real)(2.)*ReflCalc->LayerDepth(ReflCalc->layr)-ReflCalc->rx_z)+p);
  1438. }
  1439. return ra*a*con*ReflCalc->um*ReflCalc->uk;
  1440. }
  1441. template<>
  1442. Complex KernelEm1DSpec<TM, 0, INAIR, INGROUND>::RelPotentialBelowSourceLayer(const Real &ra) {
  1443. Complex con = SR_SN(3, 0) * ReflCalc->relexp_pbs1;
  1444. if (ReflCalc->layr < ReflCalc->Earth->GetNumberOfLayers()-1) {
  1445. con += SR_SN(3, 2) * ReflCalc->rtd(ReflCalc->layr) * ReflCalc->relexp_pbs2;
  1446. }
  1447. return ra*ReflCalc->rel_a*con*ReflCalc->um*ReflCalc->uk;
  1448. }
  1449. template<>
  1450. Complex KernelEm1DSpec<TM, 1, INAIR, INGROUND>::PotentialBelowSourceLayer(const Real &ra) {
  1451. Complex dd = ((Real)(1.)+ReflCalc->rtd(1)*ReflCalc->cf(1));
  1452. Complex a = ((Real)(1.) + ReflCalc->rtd(0)) / dd;
  1453. if (ReflCalc->layr >= 2) {
  1454. for (int n=2; n<=ReflCalc->layr; ++n) {
  1455. a *= ((Real)(1.)+ReflCalc->rtd(n-1));
  1456. if (n < ReflCalc->nlay-1) {
  1457. a /= ((Real)(1.)+ReflCalc->rtd(n)*ReflCalc->cf(n));
  1458. }
  1459. }
  1460. }
  1461. Complex p(0,0);
  1462. for (int n=1; n<=ReflCalc->layr; ++n) {
  1463. Complex ut = ReflCalc->u(0);
  1464. if (n>1) {
  1465. ut = ReflCalc->u(n-1);
  1466. }
  1467. p += (ReflCalc->u(n)-ut) * ReflCalc->LayerDepth(n-1);
  1468. }
  1469. Complex con = SR_SN(3, 0) * std::exp(ReflCalc->uk*ReflCalc->tx_z - ReflCalc->um*ReflCalc->rx_z+ p);
  1470. if (ReflCalc->layr < ReflCalc->Earth->GetNumberOfLayers()-1) {
  1471. con += SR_SN(3, 2) * ReflCalc->rtd(ReflCalc->layr) * std::exp(ReflCalc->uk*ReflCalc->tx_z-
  1472. ReflCalc->um*((Real)(2.)*ReflCalc->LayerDepth(ReflCalc->layr)-ReflCalc->rx_z)+p);
  1473. }
  1474. return ra*a*con*ReflCalc->um*ReflCalc->uk;
  1475. }
  1476. template<>
  1477. Complex KernelEm1DSpec<TM, 1, INAIR, INGROUND>::RelPotentialBelowSourceLayer(const Real &ra) {
  1478. Complex con = SR_SN(3, 0) * ReflCalc->relexp_pbs1;
  1479. if (ReflCalc->layr < ReflCalc->Earth->GetNumberOfLayers()-1) {
  1480. con += SR_SN(3, 2) * ReflCalc->rtd(ReflCalc->layr) * ReflCalc->relexp_pbs2;
  1481. }
  1482. return ra*ReflCalc->rel_a*con*ReflCalc->um*ReflCalc->uk;
  1483. }
  1484. template<>
  1485. Complex KernelEm1DSpec<TM, 2, INAIR, INGROUND>::PotentialBelowSourceLayer(const Real &ra) {
  1486. Complex dd = ((Real)(1.)+ReflCalc->rtd(1)*ReflCalc->cf(1));
  1487. Complex a = ((Real)(1.) + ReflCalc->rtd(0)) / dd;
  1488. if (ReflCalc->layr >= 2) {
  1489. for (int n=2; n<=ReflCalc->layr; ++n) {
  1490. a *= ((Real)(1.)+ReflCalc->rtd(n-1));
  1491. if (n < ReflCalc->nlay-1) {
  1492. a /= ((Real)(1.)+ReflCalc->rtd(n)*ReflCalc->cf(n));
  1493. }
  1494. }
  1495. }
  1496. Complex p(0,0);
  1497. for (int n=1; n<=ReflCalc->layr; ++n) {
  1498. Complex ut = ReflCalc->u(0);
  1499. if (n>1) {
  1500. ut = ReflCalc->u(n-1);
  1501. }
  1502. p += (ReflCalc->u(n)-ut) * ReflCalc->LayerDepth(n-1);
  1503. }
  1504. Complex con = SR_SN(0, 0) * std::exp(ReflCalc->uk*ReflCalc->tx_z - ReflCalc->um*ReflCalc->rx_z+ p);
  1505. if (ReflCalc->layr < ReflCalc->Earth->GetNumberOfLayers()-1) {
  1506. con += SR_SN(0, 2) * ReflCalc->rtd(ReflCalc->layr) * std::exp(ReflCalc->uk*ReflCalc->tx_z-
  1507. ReflCalc->um*((Real)(2.)*ReflCalc->LayerDepth(ReflCalc->layr)-ReflCalc->rx_z)+p);
  1508. }
  1509. return ra*a*con;//*ReflCalc->um;
  1510. }
  1511. template<>
  1512. Complex KernelEm1DSpec<TM, 2, INAIR, INGROUND>::RelPotentialBelowSourceLayer(const Real &ra) {
  1513. Complex con = SR_SN(0, 0) * ReflCalc->relexp_pbs1;
  1514. if (ReflCalc->layr < ReflCalc->Earth->GetNumberOfLayers()-1) {
  1515. con += SR_SN(0, 2) * ReflCalc->rtd(ReflCalc->layr) * ReflCalc->relexp_pbs2;
  1516. }
  1517. return ra*ReflCalc->rel_a*con;//*ReflCalc->um;
  1518. }
  1519. template<>
  1520. Complex KernelEm1DSpec<TM, 3, INAIR, INGROUND>::PotentialBelowSourceLayer(const Real &ra) {
  1521. Complex dd = ((Real)(1.)+ReflCalc->rtd(1)*ReflCalc->cf(1));
  1522. Complex a = ((Real)(1.) + ReflCalc->rtd(0)) / dd;
  1523. if (ReflCalc->layr >= 2) {
  1524. for (int n=2; n<=ReflCalc->layr; ++n) {
  1525. a *= ((Real)(1.)+ReflCalc->rtd(n-1));
  1526. if (n < ReflCalc->nlay-1) {
  1527. a /= ((Real)(1.)+ReflCalc->rtd(n)*ReflCalc->cf(n));
  1528. }
  1529. }
  1530. }
  1531. Complex p(0,0);
  1532. for (int n=1; n<=ReflCalc->layr; ++n) {
  1533. Complex ut = ReflCalc->u(0);
  1534. if (n>1) {
  1535. ut = ReflCalc->u(n-1);
  1536. }
  1537. p += (ReflCalc->u(n)-ut) * ReflCalc->LayerDepth(n-1);
  1538. }
  1539. Complex con = SR_SN(0, 0) * std::exp(ReflCalc->uk*ReflCalc->tx_z - ReflCalc->um*ReflCalc->rx_z+ p);
  1540. if (ReflCalc->layr < ReflCalc->Earth->GetNumberOfLayers()-1) {
  1541. con += SR_SN(0, 2) * ReflCalc->rtd(ReflCalc->layr) * std::exp(ReflCalc->uk*ReflCalc->tx_z-
  1542. ReflCalc->um*((Real)(2.)*ReflCalc->LayerDepth(ReflCalc->layr)-ReflCalc->rx_z)+p);
  1543. }
  1544. return ra*a*con;
  1545. }
  1546. template<>
  1547. Complex KernelEm1DSpec<TM, 3, INAIR, INGROUND>::RelPotentialBelowSourceLayer(const Real &ra) {
  1548. Complex con = SR_SN(0, 0) * ReflCalc->relexp_pbs1;
  1549. if (ReflCalc->layr < ReflCalc->Earth->GetNumberOfLayers()-1) {
  1550. con += SR_SN(0, 2) * ReflCalc->rtd(ReflCalc->layr) * ReflCalc->relexp_pbs2;
  1551. }
  1552. return ra*ReflCalc->rel_a*con;
  1553. }
  1554. template<>
  1555. Complex KernelEm1DSpec<TM, 4, INAIR, INGROUND>::PotentialBelowSourceLayer(const Real &ra) {
  1556. Complex dd = ((Real)(1.)+ReflCalc->rtd(1)*ReflCalc->cf(1));
  1557. Complex a = ((Real)(1.) + ReflCalc->rtd(0)) / dd;
  1558. if (ReflCalc->layr >= 2) {
  1559. for (int n=2; n<=ReflCalc->layr; ++n) {
  1560. a *= ((Real)(1.)+ReflCalc->rtd(n-1));
  1561. if (n < ReflCalc->nlay-1) {
  1562. a /= ((Real)(1.)+ReflCalc->rtd(n)*ReflCalc->cf(n));
  1563. }
  1564. }
  1565. }
  1566. Complex p(0,0);
  1567. for (int n=1; n<=ReflCalc->layr; ++n) {
  1568. Complex ut = ReflCalc->u(0);
  1569. if (n>1) {
  1570. ut = ReflCalc->u(n-1);
  1571. }
  1572. p += (ReflCalc->u(n)-ut) * ReflCalc->LayerDepth(n-1);
  1573. }
  1574. Complex con = SR_SN(2, 0) * std::exp(ReflCalc->uk*ReflCalc->tx_z - ReflCalc->um*ReflCalc->rx_z+ p);
  1575. if (ReflCalc->layr < ReflCalc->Earth->GetNumberOfLayers()-1) {
  1576. con += SR_SN(2, 2) * ReflCalc->rtd(ReflCalc->layr) * std::exp(ReflCalc->uk*ReflCalc->tx_z-
  1577. ReflCalc->um*((Real)(2.)*ReflCalc->LayerDepth(ReflCalc->layr)-ReflCalc->rx_z)+p);
  1578. }
  1579. return ra*a*con*ReflCalc->uk;
  1580. }
  1581. template<>
  1582. Complex KernelEm1DSpec<TM, 4, INAIR, INGROUND>::RelPotentialBelowSourceLayer(const Real &ra) {
  1583. Complex con = SR_SN(2, 0) * ReflCalc->relexp_pbs1;
  1584. if (ReflCalc->layr < ReflCalc->Earth->GetNumberOfLayers()-1) {
  1585. con += SR_SN(2, 2) * ReflCalc->rtd(ReflCalc->layr) * ReflCalc->relexp_pbs2;
  1586. }
  1587. return ra*ReflCalc->rel_a*con*ReflCalc->uk;
  1588. }
  1589. template<>
  1590. Complex KernelEm1DSpec<TM, 5, INAIR, INGROUND>::PotentialBelowSourceLayer(const Real &ra) {
  1591. Complex dd = ((Real)(1.)+ReflCalc->rtd(1)*ReflCalc->cf(1));
  1592. Complex a = ((Real)(1.) + ReflCalc->rtd(0)) / dd;
  1593. if (ReflCalc->layr >= 2) {
  1594. for (int n=2; n<=ReflCalc->layr; ++n) {
  1595. a *= ((Real)(1.)+ReflCalc->rtd(n-1));
  1596. if (n < ReflCalc->nlay-1) {
  1597. a /= ((Real)(1.)+ReflCalc->rtd(n)*ReflCalc->cf(n));
  1598. }
  1599. }
  1600. }
  1601. Complex p(0,0);
  1602. for (int n=1; n<=ReflCalc->layr; ++n) {
  1603. Complex ut = ReflCalc->u(0);
  1604. if (n>1) {
  1605. ut = ReflCalc->u(n-1);
  1606. }
  1607. p += (ReflCalc->u(n)-ut) * ReflCalc->LayerDepth(n-1);
  1608. }
  1609. Complex con = SR_SN(2, 0) * std::exp(ReflCalc->uk*ReflCalc->tx_z - ReflCalc->um*ReflCalc->rx_z+ p);
  1610. if (ReflCalc->layr < ReflCalc->Earth->GetNumberOfLayers()-1) {
  1611. con += SR_SN(2, 2) * ReflCalc->rtd(ReflCalc->layr) * std::exp(ReflCalc->uk*ReflCalc->tx_z-
  1612. ReflCalc->um*((Real)(2.)*ReflCalc->LayerDepth(ReflCalc->layr)-ReflCalc->rx_z)+p);
  1613. }
  1614. return ra*a*con*ReflCalc->uk;
  1615. }
  1616. template<>
  1617. Complex KernelEm1DSpec<TM, 5, INAIR, INGROUND>::RelPotentialBelowSourceLayer(const Real &ra) {
  1618. Complex con = SR_SN(2, 0) * ReflCalc->relexp_pbs1;
  1619. if (ReflCalc->layr < ReflCalc->Earth->GetNumberOfLayers()-1) {
  1620. con += SR_SN(2, 2) * ReflCalc->rtd(ReflCalc->layr) * ReflCalc->relexp_pbs2;
  1621. }
  1622. return ra*ReflCalc->rel_a*con*ReflCalc->uk;
  1623. }
  1624. template<>
  1625. Complex KernelEm1DSpec<TM, 6, INAIR, INGROUND>::PotentialBelowSourceLayer(const Real &ra) {
  1626. Complex dd = ((Real)(1.)+ReflCalc->rtd(1)*ReflCalc->cf(1));
  1627. Complex a = ((Real)(1.) + ReflCalc->rtd(0)) / dd;
  1628. if (ReflCalc->layr >= 2) {
  1629. for (int n=2; n<=ReflCalc->layr; ++n) {
  1630. a *= ((Real)(1.)+ReflCalc->rtd(n-1));
  1631. if (n < ReflCalc->nlay-1) {
  1632. a /= ((Real)(1.)+ReflCalc->rtd(n)*ReflCalc->cf(n));
  1633. }
  1634. }
  1635. }
  1636. Complex p(0,0);
  1637. for (int n=1; n<=ReflCalc->layr; ++n) {
  1638. Complex ut = ReflCalc->u(0);
  1639. if (n>1) {
  1640. ut = ReflCalc->u(n-1);
  1641. }
  1642. p += (ReflCalc->u(n)-ut) * ReflCalc->LayerDepth(n-1);
  1643. }
  1644. Complex con = SR_SN(2, 0) * std::exp(ReflCalc->uk*ReflCalc->tx_z - ReflCalc->um*ReflCalc->rx_z+ p);
  1645. if (ReflCalc->layr < ReflCalc->Earth->GetNumberOfLayers()-1) {
  1646. con += SR_SN(2, 2) * ReflCalc->rtd(ReflCalc->layr) * std::exp(ReflCalc->uk*ReflCalc->tx_z-
  1647. ReflCalc->um*((Real)(2.)*ReflCalc->LayerDepth(ReflCalc->layr)-ReflCalc->rx_z)+p);
  1648. }
  1649. return ra*a*con*ReflCalc->uk;
  1650. }
  1651. template<>
  1652. Complex KernelEm1DSpec<TM, 6, INAIR, INGROUND>::RelPotentialBelowSourceLayer(const Real &ra) {
  1653. Complex con = SR_SN(2, 0) * ReflCalc->relexp_pbs1;
  1654. if (ReflCalc->layr < ReflCalc->Earth->GetNumberOfLayers()-1) {
  1655. con += SR_SN(2, 2) * ReflCalc->rtd(ReflCalc->layr) * ReflCalc->relexp_pbs2;
  1656. }
  1657. return ra*ReflCalc->rel_a*con*ReflCalc->uk;
  1658. }
  1659. template<>
  1660. Complex KernelEm1DSpec<TM, 7, INAIR, INGROUND>::PotentialBelowSourceLayer(const Real &ra) {
  1661. Complex dd = ((Real)(1.)+ReflCalc->rtd(1)*ReflCalc->cf(1));
  1662. Complex a = ((Real)(1.) + ReflCalc->rtd(0)) / dd;
  1663. if (ReflCalc->layr >= 2) {
  1664. for (int n=2; n<=ReflCalc->layr; ++n) {
  1665. a *= ((Real)(1.)+ReflCalc->rtd(n-1));
  1666. if (n < ReflCalc->nlay-1) {
  1667. a /= ((Real)(1.)+ReflCalc->rtd(n)*ReflCalc->cf(n));
  1668. }
  1669. }
  1670. }
  1671. Complex p(0,0);
  1672. for (int n=1; n<=ReflCalc->layr; ++n) {
  1673. Complex ut = ReflCalc->u(0);
  1674. if (n>1) {
  1675. ut = ReflCalc->u(n-1);
  1676. }
  1677. p += (ReflCalc->u(n)-ut) * ReflCalc->LayerDepth(n-1);
  1678. }
  1679. Complex con = SR_SN(1, 0) * std::exp(ReflCalc->uk*ReflCalc->tx_z - ReflCalc->um*ReflCalc->rx_z+ p);
  1680. if (ReflCalc->layr < ReflCalc->Earth->GetNumberOfLayers()-1) {
  1681. con += SR_SN(1, 2) * ReflCalc->rtd(ReflCalc->layr) * std::exp(ReflCalc->uk*ReflCalc->tx_z-
  1682. ReflCalc->um*((Real)(2.)*ReflCalc->LayerDepth(ReflCalc->layr)-ReflCalc->rx_z)+p);
  1683. }
  1684. return ra*a*con*ReflCalc->um;
  1685. }
  1686. template<>
  1687. Complex KernelEm1DSpec<TM, 7, INAIR, INGROUND>::RelPotentialBelowSourceLayer(const Real &ra) {
  1688. Complex con = SR_SN(1, 0) * ReflCalc->relexp_pbs1;
  1689. if (ReflCalc->layr < ReflCalc->Earth->GetNumberOfLayers()-1) {
  1690. con += SR_SN(1, 2) * ReflCalc->rtd(ReflCalc->layr) * ReflCalc->relexp_pbs2;
  1691. }
  1692. return ra*ReflCalc->rel_a*con*ReflCalc->um;
  1693. }
  1694. template<>
  1695. Complex KernelEm1DSpec<TM, 8, INAIR, INGROUND>::PotentialBelowSourceLayer(const Real &ra) {
  1696. Complex dd = ((Real)(1.)+ReflCalc->rtd(1)*ReflCalc->cf(1));
  1697. Complex a = ((Real)(1.) + ReflCalc->rtd(0)) / dd;
  1698. if (ReflCalc->layr >= 2) {
  1699. for (int n=2; n<=ReflCalc->layr; ++n) {
  1700. a *= ((Real)(1.)+ReflCalc->rtd(n-1));
  1701. if (n < ReflCalc->nlay-1) {
  1702. a /= ((Real)(1.)+ReflCalc->rtd(n)*ReflCalc->cf(n));
  1703. }
  1704. }
  1705. }
  1706. Complex p(0,0);
  1707. for (int n=1; n<=ReflCalc->layr; ++n) {
  1708. Complex ut = ReflCalc->u(0);
  1709. if (n>1) {
  1710. ut = ReflCalc->u(n-1);
  1711. }
  1712. p += (ReflCalc->u(n)-ut) * ReflCalc->LayerDepth(n-1);
  1713. }
  1714. Complex con = SR_SN(1, 0) * std::exp(ReflCalc->uk*ReflCalc->tx_z - ReflCalc->um*ReflCalc->rx_z+ p);
  1715. if (ReflCalc->layr < ReflCalc->Earth->GetNumberOfLayers()-1) {
  1716. con += SR_SN(1, 2) * ReflCalc->rtd(ReflCalc->layr) * std::exp(ReflCalc->uk*ReflCalc->tx_z-
  1717. ReflCalc->um*((Real)(2.)*ReflCalc->LayerDepth(ReflCalc->layr)-ReflCalc->rx_z)+p);
  1718. }
  1719. return ra*a*con*ReflCalc->um;
  1720. }
  1721. template<>
  1722. Complex KernelEm1DSpec<TM, 8, INAIR, INGROUND>::RelPotentialBelowSourceLayer(const Real &ra) {
  1723. Complex con = SR_SN(1, 0) * ReflCalc->relexp_pbs1;
  1724. if (ReflCalc->layr < ReflCalc->Earth->GetNumberOfLayers()-1) {
  1725. con += SR_SN(1, 2) * ReflCalc->rtd(ReflCalc->layr) * ReflCalc->relexp_pbs2;
  1726. }
  1727. return ra*ReflCalc->rel_a*con*ReflCalc->um;
  1728. }
  1729. template<>
  1730. Complex KernelEm1DSpec<TM, 9, INAIR, INGROUND>::PotentialBelowSourceLayer(const Real &ra) {
  1731. Complex dd = ((Real)(1.)+ReflCalc->rtd(1)*ReflCalc->cf(1));
  1732. Complex a = ((Real)(1.) + ReflCalc->rtd(0)) / dd;
  1733. if (ReflCalc->layr >= 2) {
  1734. for (int n=2; n<=ReflCalc->layr; ++n) {
  1735. a *= ((Real)(1.)+ReflCalc->rtd(n-1));
  1736. if (n < ReflCalc->nlay-1) {
  1737. a /= ((Real)(1.)+ReflCalc->rtd(n)*ReflCalc->cf(n));
  1738. }
  1739. }
  1740. }
  1741. Complex p(0,0);
  1742. for (int n=1; n<=ReflCalc->layr; ++n) {
  1743. Complex ut = ReflCalc->u(0);
  1744. if (n>1) {
  1745. ut = ReflCalc->u(n-1);
  1746. }
  1747. p += (ReflCalc->u(n)-ut) * ReflCalc->LayerDepth(n-1);
  1748. }
  1749. Complex con = SR_SN(0, 0) * std::exp(ReflCalc->uk*ReflCalc->tx_z - ReflCalc->um*ReflCalc->rx_z+ p);
  1750. if (ReflCalc->layr < ReflCalc->Earth->GetNumberOfLayers()-1) {
  1751. con += SR_SN(0, 2) * ReflCalc->rtd(ReflCalc->layr) * std::exp(ReflCalc->uk*ReflCalc->tx_z-
  1752. ReflCalc->um*((Real)(2.)*ReflCalc->LayerDepth(ReflCalc->layr)-ReflCalc->rx_z)+p);
  1753. }
  1754. return ra*a*con;
  1755. }
  1756. template<>
  1757. Complex KernelEm1DSpec<TM, 9, INAIR, INGROUND>::RelPotentialBelowSourceLayer(const Real &ra) {
  1758. Complex con = SR_SN(0, 0) * ReflCalc->relexp_pbs1;
  1759. if (ReflCalc->layr < ReflCalc->Earth->GetNumberOfLayers()-1) {
  1760. con += SR_SN(0, 2) * ReflCalc->rtd(ReflCalc->layr) * ReflCalc->relexp_pbs2;
  1761. }
  1762. return ra*ReflCalc->rel_a*con;
  1763. }
  1764. template<>
  1765. Complex KernelEm1DSpec<TM, 10, INAIR, INGROUND>::PotentialBelowSourceLayer(const Real &ra) {
  1766. Complex dd = ((Real)(1.)+ReflCalc->rtd(1)*ReflCalc->cf(1));
  1767. Complex a = ((Real)(1.) + ReflCalc->rtd(0)) / dd;
  1768. if (ReflCalc->layr >= 2) {
  1769. for (int n=2; n<=ReflCalc->layr; ++n) {
  1770. a *= ((Real)(1.)+ReflCalc->rtd(n-1));
  1771. if (n < ReflCalc->nlay-1) {
  1772. a /= ((Real)(1.)+ReflCalc->rtd(n)*ReflCalc->cf(n));
  1773. }
  1774. }
  1775. }
  1776. Complex p(0,0);
  1777. for (int n=1; n<=ReflCalc->layr; ++n) {
  1778. Complex ut = ReflCalc->u(0);
  1779. if (n>1) {
  1780. ut = ReflCalc->u(n-1);
  1781. }
  1782. p += (ReflCalc->u(n)-ut) * ReflCalc->LayerDepth(n-1);
  1783. }
  1784. Complex con = SR_SN(ReflCalc->id-1, 0) * std::exp(ReflCalc->uk*ReflCalc->tx_z - ReflCalc->um*ReflCalc->rx_z+ p);
  1785. if (ReflCalc->layr < ReflCalc->Earth->GetNumberOfLayers()-1) {
  1786. con += SR_SN(ReflCalc->id-1, 2) * ReflCalc->rtd(ReflCalc->layr) * std::exp(ReflCalc->uk*ReflCalc->tx_z-
  1787. ReflCalc->um*((Real)(2.)*ReflCalc->LayerDepth(ReflCalc->layr)-ReflCalc->rx_z)+p);
  1788. }
  1789. return ra*a*con*ReflCalc->um;
  1790. }
  1791. template<>
  1792. Complex KernelEm1DSpec<TM, 10, INAIR, INGROUND>::RelPotentialBelowSourceLayer(const Real &ra) {
  1793. Complex con = SR_SN(ReflCalc->id-1, 0) * ReflCalc->relexp_pbs1;
  1794. if (ReflCalc->layr < ReflCalc->Earth->GetNumberOfLayers()-1) {
  1795. con += SR_SN(ReflCalc->id-1, 2) * ReflCalc->rtd(ReflCalc->layr) * ReflCalc->relexp_pbs2;
  1796. }
  1797. return ra*ReflCalc->rel_a*con*ReflCalc->um;
  1798. }
  1799. template<>
  1800. Complex KernelEm1DSpec<TM, 11, INAIR, INGROUND>::PotentialBelowSourceLayer(const Real &ra) {
  1801. Complex dd = ((Real)(1.)+ReflCalc->rtd(1)*ReflCalc->cf(1));
  1802. Complex a = ((Real)(1.) + ReflCalc->rtd(0)) / dd;
  1803. if (ReflCalc->layr >= 2) {
  1804. for (int n=2; n<=ReflCalc->layr; ++n) {
  1805. a *= ((Real)(1.)+ReflCalc->rtd(n-1));
  1806. if (n < ReflCalc->nlay-1) {
  1807. a /= ((Real)(1.)+ReflCalc->rtd(n)*ReflCalc->cf(n));
  1808. }
  1809. }
  1810. }
  1811. Complex p(0,0);
  1812. for (int n=1; n<=ReflCalc->layr; ++n) {
  1813. Complex ut = ReflCalc->u(0);
  1814. if (n>1) {
  1815. ut = ReflCalc->u(n-1);
  1816. }
  1817. p += (ReflCalc->u(n)-ut) * ReflCalc->LayerDepth(n-1);
  1818. }
  1819. Complex con = SR_SN(ReflCalc->id-1, 0) * std::exp(ReflCalc->uk*ReflCalc->tx_z - ReflCalc->um*ReflCalc->rx_z+ p);
  1820. if (ReflCalc->layr < ReflCalc->Earth->GetNumberOfLayers()-1) {
  1821. con += SR_SN(ReflCalc->id-1, 2) * ReflCalc->rtd(ReflCalc->layr) * std::exp(ReflCalc->uk*ReflCalc->tx_z-
  1822. ReflCalc->um*((Real)(2.)*ReflCalc->LayerDepth(ReflCalc->layr)-ReflCalc->rx_z)+p);
  1823. }
  1824. return ra*a*con;
  1825. }
  1826. template<>
  1827. Complex KernelEm1DSpec<TM, 11, INAIR, INGROUND>::RelPotentialBelowSourceLayer(const Real &ra) {
  1828. Complex con = SR_SN(ReflCalc->id-1, 0) * ReflCalc->relexp_pbs1;
  1829. if (ReflCalc->layr < ReflCalc->Earth->GetNumberOfLayers()-1) {
  1830. con += SR_SN(ReflCalc->id-1, 2) * ReflCalc->rtd(ReflCalc->layr) * ReflCalc->relexp_pbs2;
  1831. }
  1832. return ra*ReflCalc->rel_a*con;
  1833. }
  1834. template<>
  1835. Complex KernelEm1DSpec<TM, 12, INAIR, INGROUND>::PotentialBelowSourceLayer(const Real &ra) {
  1836. Complex dd = ((Real)(1.)+ReflCalc->rtd(1)*ReflCalc->cf(1));
  1837. Complex a = ((Real)(1.) + ReflCalc->rtd(0)) / dd;
  1838. if (ReflCalc->layr >= 2) {
  1839. for (int n=2; n<=ReflCalc->layr; ++n) {
  1840. a *= ((Real)(1.)+ReflCalc->rtd(n-1));
  1841. if (n < ReflCalc->nlay-1) {
  1842. a /= ((Real)(1.)+ReflCalc->rtd(n)*ReflCalc->cf(n));
  1843. }
  1844. }
  1845. }
  1846. Complex p(0,0);
  1847. for (int n=1; n<=ReflCalc->layr; ++n) {
  1848. Complex ut = ReflCalc->u(0);
  1849. if (n>1) {
  1850. ut = ReflCalc->u(n-1);
  1851. }
  1852. p += (ReflCalc->u(n)-ut) * ReflCalc->LayerDepth(n-1);
  1853. }
  1854. Complex con = SR_SN(ReflCalc->id-1, 0) * std::exp(ReflCalc->uk*ReflCalc->tx_z - ReflCalc->um*ReflCalc->rx_z+ p);
  1855. if (ReflCalc->layr < ReflCalc->Earth->GetNumberOfLayers()-1) {
  1856. con += SR_SN(ReflCalc->id-1, 2) * ReflCalc->rtd(ReflCalc->layr) * std::exp(ReflCalc->uk*ReflCalc->tx_z-
  1857. ReflCalc->um*((Real)(2.)*ReflCalc->LayerDepth(ReflCalc->layr)-ReflCalc->rx_z)+p);
  1858. }
  1859. return ra*a*con;
  1860. }
  1861. template<>
  1862. Complex KernelEm1DSpec<TM, 12, INAIR, INGROUND>::RelPotentialBelowSourceLayer(const Real &ra) {
  1863. Complex con = SR_SN(ReflCalc->id-1, 0) * ReflCalc->relexp_pbs1;
  1864. if (ReflCalc->layr < ReflCalc->Earth->GetNumberOfLayers()-1) {
  1865. con += SR_SN(ReflCalc->id-1, 2) * ReflCalc->rtd(ReflCalc->layr) * ReflCalc->relexp_pbs2;
  1866. }
  1867. return ra*ReflCalc->rel_a*con;
  1868. }
  1869. template<>
  1870. Complex KernelEm1DSpec<TE, 0, INAIR, INGROUND>::PotentialBelowSourceLayer(const Real &ra) {
  1871. Complex dd = ((Real)(1.)+ReflCalc->rtd(1)*ReflCalc->cf(1));
  1872. Complex a = ((Real)(1.) + ReflCalc->rtd(0)) / dd;
  1873. if (ReflCalc->layr >= 2) {
  1874. for (int n=2; n<=ReflCalc->layr; ++n) {
  1875. a *= ((Real)(1.)+ReflCalc->rtd(n-1));
  1876. if (n < ReflCalc->nlay-1) {
  1877. a /= ((Real)(1.)+ReflCalc->rtd(n)*ReflCalc->cf(n));
  1878. }
  1879. }
  1880. }
  1881. Complex p(0,0);
  1882. for (int n=1; n<=ReflCalc->layr; ++n) {
  1883. Complex ut = ReflCalc->u(0);
  1884. if (n>1) {
  1885. ut = ReflCalc->u(n-1);
  1886. }
  1887. p += (ReflCalc->u(n)-ut) * ReflCalc->LayerDepth(n-1);
  1888. }
  1889. Complex con = SR_SN(3, 0) * std::exp(ReflCalc->uk*ReflCalc->tx_z - ReflCalc->um*ReflCalc->rx_z+ p);
  1890. if (ReflCalc->layr < ReflCalc->Earth->GetNumberOfLayers()-1) {
  1891. con += SR_SN(3, 2) * ReflCalc->rtd(ReflCalc->layr) * std::exp(ReflCalc->uk*ReflCalc->tx_z-
  1892. ReflCalc->um*((Real)(2.)*ReflCalc->LayerDepth(ReflCalc->layr)-ReflCalc->rx_z)+p);
  1893. }
  1894. return ra*a*con*ReflCalc->um*ReflCalc->uk;
  1895. }
  1896. template<>
  1897. Complex KernelEm1DSpec<TE, 0, INAIR, INGROUND>::RelPotentialBelowSourceLayer(const Real &ra) {
  1898. Complex con = SR_SN(3, 0) * ReflCalc->relexp_pbs1;
  1899. if (ReflCalc->layr < ReflCalc->Earth->GetNumberOfLayers()-1) {
  1900. con += SR_SN(3, 2) * ReflCalc->rtd(ReflCalc->layr) * ReflCalc->relexp_pbs2;
  1901. }
  1902. return ra*ReflCalc->rel_a*con*ReflCalc->um*ReflCalc->uk;
  1903. }
  1904. template<>
  1905. Complex KernelEm1DSpec<TE, 1, INAIR, INGROUND>::PotentialBelowSourceLayer(const Real &ra) {
  1906. Complex dd = ((Real)(1.)+ReflCalc->rtd(1)*ReflCalc->cf(1));
  1907. Complex a = ((Real)(1.) + ReflCalc->rtd(0)) / dd;
  1908. if (ReflCalc->layr >= 2) {
  1909. for (int n=2; n<=ReflCalc->layr; ++n) {
  1910. a *= ((Real)(1.)+ReflCalc->rtd(n-1));
  1911. if (n < ReflCalc->nlay-1) {
  1912. a /= ((Real)(1.)+ReflCalc->rtd(n)*ReflCalc->cf(n));
  1913. }
  1914. }
  1915. }
  1916. Complex p(0,0);
  1917. for (int n=1; n<=ReflCalc->layr; ++n) {
  1918. Complex ut = ReflCalc->u(0);
  1919. if (n>1) {
  1920. ut = ReflCalc->u(n-1);
  1921. }
  1922. p += (ReflCalc->u(n)-ut) * ReflCalc->LayerDepth(n-1);
  1923. }
  1924. Complex con = SR_SN(3, 0) * std::exp(ReflCalc->uk*ReflCalc->tx_z - ReflCalc->um*ReflCalc->rx_z+ p);
  1925. if (ReflCalc->layr < ReflCalc->Earth->GetNumberOfLayers()-1) {
  1926. con += SR_SN(3, 2) * ReflCalc->rtd(ReflCalc->layr) * std::exp(ReflCalc->uk*ReflCalc->tx_z-
  1927. ReflCalc->um*((Real)(2.)*ReflCalc->LayerDepth(ReflCalc->layr)-ReflCalc->rx_z)+p);
  1928. }
  1929. return ra*a*con*ReflCalc->um*ReflCalc->uk;
  1930. }
  1931. template<>
  1932. Complex KernelEm1DSpec<TE, 1, INAIR, INGROUND>::RelPotentialBelowSourceLayer(const Real &ra) {
  1933. Complex con = SR_SN(3, 0) * ReflCalc->relexp_pbs1;
  1934. if (ReflCalc->layr < ReflCalc->Earth->GetNumberOfLayers()-1) {
  1935. con += SR_SN(3, 2) * ReflCalc->rtd(ReflCalc->layr) * ReflCalc->relexp_pbs2;
  1936. }
  1937. return ra*ReflCalc->rel_a*con*ReflCalc->um*ReflCalc->uk;
  1938. }
  1939. template<>
  1940. Complex KernelEm1DSpec<TE, 2, INAIR, INGROUND>::PotentialBelowSourceLayer(const Real &ra) {
  1941. Complex dd = ((Real)(1.)+ReflCalc->rtd(1)*ReflCalc->cf(1));
  1942. Complex a = ((Real)(1.) + ReflCalc->rtd(0)) / dd;
  1943. if (ReflCalc->layr >= 2) {
  1944. for (int n=2; n<=ReflCalc->layr; ++n) {
  1945. a *= ((Real)(1.)+ReflCalc->rtd(n-1));
  1946. if (n < ReflCalc->nlay-1) {
  1947. a /= ((Real)(1.)+ReflCalc->rtd(n)*ReflCalc->cf(n));
  1948. }
  1949. }
  1950. }
  1951. Complex p(0,0);
  1952. for (int n=1; n<=ReflCalc->layr; ++n) {
  1953. Complex ut = ReflCalc->u(0);
  1954. if (n>1) {
  1955. ut = ReflCalc->u(n-1);
  1956. }
  1957. p += (ReflCalc->u(n)-ut) * ReflCalc->LayerDepth(n-1);
  1958. }
  1959. Complex con = SR_SN(0, 0) * std::exp(ReflCalc->uk*ReflCalc->tx_z - ReflCalc->um*ReflCalc->rx_z+ p);
  1960. if (ReflCalc->layr < ReflCalc->Earth->GetNumberOfLayers()-1) {
  1961. con += SR_SN(0, 2) * ReflCalc->rtd(ReflCalc->layr) * std::exp(ReflCalc->uk*ReflCalc->tx_z-
  1962. ReflCalc->um*((Real)(2.)*ReflCalc->LayerDepth(ReflCalc->layr)-ReflCalc->rx_z)+p);
  1963. }
  1964. return ra*a*con;
  1965. }
  1966. template<>
  1967. Complex KernelEm1DSpec<TE, 2, INAIR, INGROUND>::RelPotentialBelowSourceLayer(const Real &ra) {
  1968. Complex con = SR_SN(0, 0) * ReflCalc->relexp_pbs1;
  1969. if (ReflCalc->layr < ReflCalc->Earth->GetNumberOfLayers()-1) {
  1970. con += SR_SN(0, 2) * ReflCalc->rtd(ReflCalc->layr) * ReflCalc->relexp_pbs2;
  1971. }
  1972. return ra*ReflCalc->rel_a*con;
  1973. }
  1974. template<>
  1975. Complex KernelEm1DSpec<TE, 3, INAIR, INGROUND>::PotentialBelowSourceLayer(const Real &ra) {
  1976. Complex dd = ((Real)(1.)+ReflCalc->rtd(1)*ReflCalc->cf(1));
  1977. Complex a = ((Real)(1.) + ReflCalc->rtd(0)) / dd;
  1978. if (ReflCalc->layr >= 2) {
  1979. for (int n=2; n<=ReflCalc->layr; ++n) {
  1980. a *= ((Real)(1.)+ReflCalc->rtd(n-1));
  1981. if (n < ReflCalc->nlay-1) {
  1982. a /= ((Real)(1.)+ReflCalc->rtd(n)*ReflCalc->cf(n));
  1983. }
  1984. }
  1985. }
  1986. Complex p(0,0);
  1987. for (int n=1; n<=ReflCalc->layr; ++n) {
  1988. Complex ut = ReflCalc->u(0);
  1989. if (n>1) {
  1990. ut = ReflCalc->u(n-1);
  1991. }
  1992. p += (ReflCalc->u(n)-ut) * ReflCalc->LayerDepth(n-1);
  1993. }
  1994. Complex con = SR_SN(0, 0) * std::exp(ReflCalc->uk*ReflCalc->tx_z - ReflCalc->um*ReflCalc->rx_z+ p);
  1995. if (ReflCalc->layr < ReflCalc->Earth->GetNumberOfLayers()-1) {
  1996. con += SR_SN(0, 2) * ReflCalc->rtd(ReflCalc->layr) * std::exp(ReflCalc->uk*ReflCalc->tx_z-
  1997. ReflCalc->um*((Real)(2.)*ReflCalc->LayerDepth(ReflCalc->layr)-ReflCalc->rx_z)+p);
  1998. }
  1999. return ra*a*con;
  2000. }
  2001. template<>
  2002. Complex KernelEm1DSpec<TE, 3, INAIR, INGROUND>::RelPotentialBelowSourceLayer(const Real &ra) {
  2003. Complex con = SR_SN(0, 0) * ReflCalc->relexp_pbs1;
  2004. if (ReflCalc->layr < ReflCalc->Earth->GetNumberOfLayers()-1) {
  2005. con += SR_SN(0, 2) * ReflCalc->rtd(ReflCalc->layr) * ReflCalc->relexp_pbs2;
  2006. }
  2007. return ra*ReflCalc->rel_a*con;
  2008. }
  2009. template<>
  2010. Complex KernelEm1DSpec<TE, 4, INAIR, INGROUND>::PotentialBelowSourceLayer(const Real &ra) {
  2011. Complex dd = ((Real)(1.)+ReflCalc->rtd(1)*ReflCalc->cf(1));
  2012. Complex a = ((Real)(1.) + ReflCalc->rtd(0)) / dd;
  2013. if (ReflCalc->layr >= 2) {
  2014. for (int n=2; n<=ReflCalc->layr; ++n) {
  2015. a *= ((Real)(1.)+ReflCalc->rtd(n-1));
  2016. if (n < ReflCalc->nlay-1) {
  2017. a /= ((Real)(1.)+ReflCalc->rtd(n)*ReflCalc->cf(n));
  2018. }
  2019. }
  2020. }
  2021. Complex p(0,0);
  2022. for (int n=1; n<=ReflCalc->layr; ++n) {
  2023. Complex ut = ReflCalc->u(0);
  2024. if (n>1) {
  2025. ut = ReflCalc->u(n-1);
  2026. }
  2027. p += (ReflCalc->u(n)-ut) * ReflCalc->LayerDepth(n-1);
  2028. }
  2029. Complex con = SR_SN(2, 0) * std::exp(ReflCalc->uk*ReflCalc->tx_z - ReflCalc->um*ReflCalc->rx_z+ p);
  2030. if (ReflCalc->layr < ReflCalc->Earth->GetNumberOfLayers()-1) {
  2031. con += SR_SN(2, 2) * ReflCalc->rtd(ReflCalc->layr) * std::exp(ReflCalc->uk*ReflCalc->tx_z-
  2032. ReflCalc->um*((Real)(2.)*ReflCalc->LayerDepth(ReflCalc->layr)-ReflCalc->rx_z)+p);
  2033. }
  2034. return ra*a*con*ReflCalc->uk;
  2035. }
  2036. template<>
  2037. Complex KernelEm1DSpec<TE, 4, INAIR, INGROUND>::RelPotentialBelowSourceLayer(const Real &ra) {
  2038. Complex con = SR_SN(2, 0) * ReflCalc->relexp_pbs1;
  2039. if (ReflCalc->layr < ReflCalc->Earth->GetNumberOfLayers()-1) {
  2040. con += SR_SN(2, 2) * ReflCalc->rtd(ReflCalc->layr) * ReflCalc->relexp_pbs2;
  2041. }
  2042. return ra*ReflCalc->rel_a*con*ReflCalc->uk;
  2043. }
  2044. template<>
  2045. Complex KernelEm1DSpec<TE, 5, INAIR, INGROUND>::PotentialBelowSourceLayer(const Real &ra) {
  2046. Complex dd = ((Real)(1.)+ReflCalc->rtd(1)*ReflCalc->cf(1));
  2047. Complex a = ((Real)(1.) + ReflCalc->rtd(0)) / dd;
  2048. if (ReflCalc->layr >= 2) {
  2049. for (int n=2; n<=ReflCalc->layr; ++n) {
  2050. a *= ((Real)(1.)+ReflCalc->rtd(n-1));
  2051. if (n < ReflCalc->nlay-1) {
  2052. a /= ((Real)(1.)+ReflCalc->rtd(n)*ReflCalc->cf(n));
  2053. }
  2054. }
  2055. }
  2056. Complex p(0,0);
  2057. for (int n=1; n<=ReflCalc->layr; ++n) {
  2058. Complex ut = ReflCalc->u(0);
  2059. if (n>1) {
  2060. ut = ReflCalc->u(n-1);
  2061. }
  2062. p += (ReflCalc->u(n)-ut) * ReflCalc->LayerDepth(n-1);
  2063. }
  2064. Complex con = SR_SN(2, 0) * std::exp(ReflCalc->uk*ReflCalc->tx_z - ReflCalc->um*ReflCalc->rx_z+ p);
  2065. if (ReflCalc->layr < ReflCalc->Earth->GetNumberOfLayers()-1) {
  2066. con += SR_SN(2, 2) * ReflCalc->rtd(ReflCalc->layr) * std::exp(ReflCalc->uk*ReflCalc->tx_z-
  2067. ReflCalc->um*((Real)(2.)*ReflCalc->LayerDepth(ReflCalc->layr)-ReflCalc->rx_z)+p);
  2068. }
  2069. return ra*a*con*ReflCalc->uk;
  2070. }
  2071. template<>
  2072. Complex KernelEm1DSpec<TE, 5, INAIR, INGROUND>::RelPotentialBelowSourceLayer(const Real &ra) {
  2073. Complex con = SR_SN(2, 0) * ReflCalc->relexp_pbs1;
  2074. if (ReflCalc->layr < ReflCalc->Earth->GetNumberOfLayers()-1) {
  2075. con += SR_SN(2, 2) * ReflCalc->rtd(ReflCalc->layr) * ReflCalc->relexp_pbs2;
  2076. }
  2077. return ra*ReflCalc->rel_a*con*ReflCalc->uk;
  2078. }
  2079. template<>
  2080. Complex KernelEm1DSpec<TE, 6, INAIR, INGROUND>::PotentialBelowSourceLayer(const Real &ra) {
  2081. Complex dd = ((Real)(1.)+ReflCalc->rtd(1)*ReflCalc->cf(1));
  2082. Complex a = ((Real)(1.) + ReflCalc->rtd(0)) / dd;
  2083. if (ReflCalc->layr >= 2) {
  2084. for (int n=2; n<=ReflCalc->layr; ++n) {
  2085. a *= ((Real)(1.)+ReflCalc->rtd(n-1));
  2086. if (n < ReflCalc->nlay-1) {
  2087. a /= ((Real)(1.)+ReflCalc->rtd(n)*ReflCalc->cf(n));
  2088. }
  2089. }
  2090. }
  2091. Complex p(0,0);
  2092. for (int n=1; n<=ReflCalc->layr; ++n) {
  2093. Complex ut = ReflCalc->u(0);
  2094. if (n>1) {
  2095. ut = ReflCalc->u(n-1);
  2096. }
  2097. p += (ReflCalc->u(n)-ut) * ReflCalc->LayerDepth(n-1);
  2098. }
  2099. Complex con = SR_SN(2, 0) * std::exp(ReflCalc->uk*ReflCalc->tx_z - ReflCalc->um*ReflCalc->rx_z+ p);
  2100. if (ReflCalc->layr < ReflCalc->Earth->GetNumberOfLayers()-1) {
  2101. con += SR_SN(2, 2) * ReflCalc->rtd(ReflCalc->layr) * std::exp(ReflCalc->uk*ReflCalc->tx_z-
  2102. ReflCalc->um*((Real)(2.)*ReflCalc->LayerDepth(ReflCalc->layr)-ReflCalc->rx_z)+p);
  2103. }
  2104. return ra*a*con*ReflCalc->uk;
  2105. }
  2106. template<>
  2107. Complex KernelEm1DSpec<TE, 6, INAIR, INGROUND>::RelPotentialBelowSourceLayer(const Real &ra) {
  2108. Complex con = SR_SN(2, 0) * ReflCalc->relexp_pbs1;
  2109. if (ReflCalc->layr < ReflCalc->Earth->GetNumberOfLayers()-1) {
  2110. con += SR_SN(2, 2) * ReflCalc->rtd(ReflCalc->layr) * ReflCalc->relexp_pbs2;
  2111. }
  2112. return ra*ReflCalc->rel_a*con*ReflCalc->uk;
  2113. }
  2114. template<>
  2115. Complex KernelEm1DSpec<TE, 7, INAIR, INGROUND>::PotentialBelowSourceLayer(const Real &ra) {
  2116. Complex dd = ((Real)(1.)+ReflCalc->rtd(1)*ReflCalc->cf(1));
  2117. Complex a = ((Real)(1.) + ReflCalc->rtd(0)) / dd;
  2118. if (ReflCalc->layr >= 2) {
  2119. for (int n=2; n<=ReflCalc->layr; ++n) {
  2120. a *= ((Real)(1.)+ReflCalc->rtd(n-1));
  2121. if (n < ReflCalc->nlay-1) {
  2122. a /= ((Real)(1.)+ReflCalc->rtd(n)*ReflCalc->cf(n));
  2123. }
  2124. }
  2125. }
  2126. Complex p(0,0);
  2127. for (int n=1; n<=ReflCalc->layr; ++n) {
  2128. Complex ut = ReflCalc->u(0);
  2129. if (n>1) {
  2130. ut = ReflCalc->u(n-1);
  2131. }
  2132. p += (ReflCalc->u(n)-ut) * ReflCalc->LayerDepth(n-1);
  2133. }
  2134. Complex con = SR_SN(1, 0) * std::exp(ReflCalc->uk*ReflCalc->tx_z - ReflCalc->um*ReflCalc->rx_z+ p);
  2135. if (ReflCalc->layr < ReflCalc->Earth->GetNumberOfLayers()-1) {
  2136. con += SR_SN(1, 2) * ReflCalc->rtd(ReflCalc->layr) * std::exp(ReflCalc->uk*ReflCalc->tx_z-
  2137. ReflCalc->um*((Real)(2.)*ReflCalc->LayerDepth(ReflCalc->layr)-ReflCalc->rx_z)+p);
  2138. }
  2139. return ra*a*con*ReflCalc->um;
  2140. }
  2141. template<>
  2142. Complex KernelEm1DSpec<TE, 7, INAIR, INGROUND>::RelPotentialBelowSourceLayer(const Real &ra) {
  2143. Complex con = SR_SN(1, 0) * ReflCalc->relexp_pbs1;
  2144. if (ReflCalc->layr < ReflCalc->Earth->GetNumberOfLayers()-1) {
  2145. con += SR_SN(1, 2) * ReflCalc->rtd(ReflCalc->layr) * ReflCalc->relexp_pbs2;
  2146. }
  2147. return ra*ReflCalc->rel_a*con*ReflCalc->um;
  2148. }
  2149. template<>
  2150. Complex KernelEm1DSpec<TE, 8, INAIR, INGROUND>::PotentialBelowSourceLayer(const Real &ra) {
  2151. Complex dd = ((Real)(1.)+ReflCalc->rtd(1)*ReflCalc->cf(1));
  2152. Complex a = ((Real)(1.) + ReflCalc->rtd(0)) / dd;
  2153. if (ReflCalc->layr >= 2) {
  2154. for (int n=2; n<=ReflCalc->layr; ++n) {
  2155. a *= ((Real)(1.)+ReflCalc->rtd(n-1));
  2156. if (n < ReflCalc->nlay-1) {
  2157. a /= ((Real)(1.)+ReflCalc->rtd(n)*ReflCalc->cf(n));
  2158. }
  2159. }
  2160. }
  2161. Complex p(0,0);
  2162. for (int n=1; n<=ReflCalc->layr; ++n) {
  2163. Complex ut = ReflCalc->u(0);
  2164. if (n>1) {
  2165. ut = ReflCalc->u(n-1);
  2166. }
  2167. p += (ReflCalc->u(n)-ut) * ReflCalc->LayerDepth(n-1);
  2168. }
  2169. Complex con = SR_SN(1, 0) * std::exp(ReflCalc->uk*ReflCalc->tx_z - ReflCalc->um*ReflCalc->rx_z+ p);
  2170. if (ReflCalc->layr < ReflCalc->Earth->GetNumberOfLayers()-1) {
  2171. con += SR_SN(1, 2) * ReflCalc->rtd(ReflCalc->layr) * std::exp(ReflCalc->uk*ReflCalc->tx_z-
  2172. ReflCalc->um*((Real)(2.)*ReflCalc->LayerDepth(ReflCalc->layr)-ReflCalc->rx_z)+p);
  2173. }
  2174. return ra*a*con*ReflCalc->um;
  2175. }
  2176. template<>
  2177. Complex KernelEm1DSpec<TE, 8, INAIR, INGROUND>::RelPotentialBelowSourceLayer(const Real &ra) {
  2178. Complex con = SR_SN(1, 0) * ReflCalc->relexp_pbs1;
  2179. if (ReflCalc->layr < ReflCalc->Earth->GetNumberOfLayers()-1) {
  2180. con += SR_SN(1, 2) * ReflCalc->rtd(ReflCalc->layr) * ReflCalc->relexp_pbs2;
  2181. }
  2182. return ra*ReflCalc->rel_a*con*ReflCalc->um;
  2183. }
  2184. template<>
  2185. Complex KernelEm1DSpec<TE, 9, INAIR, INGROUND>::PotentialBelowSourceLayer(const Real &ra) {
  2186. Complex dd = ((Real)(1.)+ReflCalc->rtd(1)*ReflCalc->cf(1));
  2187. Complex a = ((Real)(1.) + ReflCalc->rtd(0)) / dd;
  2188. if (ReflCalc->layr >= 2) {
  2189. for (int n=2; n<=ReflCalc->layr; ++n) {
  2190. a *= ((Real)(1.)+ReflCalc->rtd(n-1));
  2191. if (n < ReflCalc->nlay-1) {
  2192. a /= ((Real)(1.)+ReflCalc->rtd(n)*ReflCalc->cf(n));
  2193. }
  2194. }
  2195. }
  2196. Complex p(0,0);
  2197. for (int n=1; n<=ReflCalc->layr; ++n) {
  2198. Complex ut = ReflCalc->u(0);
  2199. if (n>1) {
  2200. ut = ReflCalc->u(n-1);
  2201. }
  2202. p += (ReflCalc->u(n)-ut) * ReflCalc->LayerDepth(n-1);
  2203. }
  2204. Complex con = SR_SN(0, 0) * std::exp(ReflCalc->uk*ReflCalc->tx_z - ReflCalc->um*ReflCalc->rx_z+ p);
  2205. if (ReflCalc->layr < ReflCalc->Earth->GetNumberOfLayers()-1) {
  2206. con += SR_SN(0, 2) * ReflCalc->rtd(ReflCalc->layr) * std::exp(ReflCalc->uk*ReflCalc->tx_z-
  2207. ReflCalc->um*((Real)(2.)*ReflCalc->LayerDepth(ReflCalc->layr)-ReflCalc->rx_z)+p);
  2208. }
  2209. return ra*a*con;
  2210. }
  2211. template<>
  2212. Complex KernelEm1DSpec<TE, 9, INAIR, INGROUND>::RelPotentialBelowSourceLayer(const Real &ra) {
  2213. Complex con = SR_SN(0, 0) * ReflCalc->relexp_pbs1;
  2214. if (ReflCalc->layr < ReflCalc->Earth->GetNumberOfLayers()-1) {
  2215. con += SR_SN(0, 2) * ReflCalc->rtd(ReflCalc->layr) * ReflCalc->relexp_pbs2;
  2216. }
  2217. return ra*ReflCalc->rel_a*con;
  2218. }
  2219. template<>
  2220. Complex KernelEm1DSpec<TE, 10, INAIR, INGROUND>::PotentialBelowSourceLayer(const Real &ra) {
  2221. Complex dd = ((Real)(1.)+ReflCalc->rtd(1)*ReflCalc->cf(1));
  2222. Complex a = ((Real)(1.) + ReflCalc->rtd(0)) / dd;
  2223. if (ReflCalc->layr >= 2) {
  2224. for (int n=2; n<=ReflCalc->layr; ++n) {
  2225. a *= ((Real)(1.)+ReflCalc->rtd(n-1));
  2226. if (n < ReflCalc->nlay-1) {
  2227. a /= ((Real)(1.)+ReflCalc->rtd(n)*ReflCalc->cf(n));
  2228. }
  2229. }
  2230. }
  2231. Complex p(0,0);
  2232. for (int n=1; n<=ReflCalc->layr; ++n) {
  2233. Complex ut = ReflCalc->u(0);
  2234. if (n>1) {
  2235. ut = ReflCalc->u(n-1);
  2236. }
  2237. p += (ReflCalc->u(n)-ut) * ReflCalc->LayerDepth(n-1);
  2238. }
  2239. Complex con = SR_SN(ReflCalc->id-1, 0) * std::exp(ReflCalc->uk*ReflCalc->tx_z - ReflCalc->um*ReflCalc->rx_z+ p);
  2240. if (ReflCalc->layr < ReflCalc->Earth->GetNumberOfLayers()-1) {
  2241. con += SR_SN(ReflCalc->id-1, 2) * ReflCalc->rtd(ReflCalc->layr) * std::exp(ReflCalc->uk*ReflCalc->tx_z-
  2242. ReflCalc->um*((Real)(2.)*ReflCalc->LayerDepth(ReflCalc->layr)-ReflCalc->rx_z)+p);
  2243. }
  2244. return ra*a*con*ReflCalc->um;
  2245. }
  2246. template<>
  2247. Complex KernelEm1DSpec<TE, 10, INAIR, INGROUND>::RelPotentialBelowSourceLayer(const Real &ra) {
  2248. Complex con = SR_SN(ReflCalc->id-1, 0) * ReflCalc->relexp_pbs1;
  2249. if (ReflCalc->layr < ReflCalc->Earth->GetNumberOfLayers()-1) {
  2250. con += SR_SN(ReflCalc->id-1, 2) * ReflCalc->rtd(ReflCalc->layr) * ReflCalc->relexp_pbs2;
  2251. }
  2252. return ra*ReflCalc->rel_a*con*ReflCalc->um;
  2253. }
  2254. template<>
  2255. Complex KernelEm1DSpec<TE, 11, INAIR, INGROUND>::PotentialBelowSourceLayer(const Real &ra) {
  2256. Complex dd = ((Real)(1.)+ReflCalc->rtd(1)*ReflCalc->cf(1));
  2257. Complex a = ((Real)(1.) + ReflCalc->rtd(0)) / dd;
  2258. if (ReflCalc->layr >= 2) {
  2259. for (int n=2; n<=ReflCalc->layr; ++n) {
  2260. a *= ((Real)(1.)+ReflCalc->rtd(n-1));
  2261. if (n < ReflCalc->nlay-1) {
  2262. a /= ((Real)(1.)+ReflCalc->rtd(n)*ReflCalc->cf(n));
  2263. }
  2264. }
  2265. }
  2266. Complex p(0,0);
  2267. for (int n=1; n<=ReflCalc->layr; ++n) {
  2268. Complex ut = ReflCalc->u(0);
  2269. if (n>1) {
  2270. ut = ReflCalc->u(n-1);
  2271. }
  2272. p += (ReflCalc->u(n)-ut) * ReflCalc->LayerDepth(n-1);
  2273. }
  2274. Complex con = SR_SN(ReflCalc->id-1, 0) * std::exp(ReflCalc->uk*ReflCalc->tx_z - ReflCalc->um*ReflCalc->rx_z+ p);
  2275. if (ReflCalc->layr < ReflCalc->Earth->GetNumberOfLayers()-1) {
  2276. con += SR_SN(ReflCalc->id-1, 2) * ReflCalc->rtd(ReflCalc->layr) * std::exp(ReflCalc->uk*ReflCalc->tx_z-
  2277. ReflCalc->um*((Real)(2.)*ReflCalc->LayerDepth(ReflCalc->layr)-ReflCalc->rx_z)+p);
  2278. }
  2279. return ra*a*con;
  2280. }
  2281. template<>
  2282. Complex KernelEm1DSpec<TE, 11, INAIR, INGROUND>::RelPotentialBelowSourceLayer(const Real &ra) {
  2283. Complex con = SR_SN(ReflCalc->id-1, 0) * ReflCalc->relexp_pbs1;
  2284. if (ReflCalc->layr < ReflCalc->Earth->GetNumberOfLayers()-1) {
  2285. con += SR_SN(ReflCalc->id-1, 2) * ReflCalc->rtd(ReflCalc->layr) * ReflCalc->relexp_pbs2;
  2286. }
  2287. return ra*ReflCalc->rel_a*con;
  2288. }
  2289. template<>
  2290. Complex KernelEm1DSpec<TE, 12, INAIR, INGROUND>::PotentialBelowSourceLayer(const Real &ra) {
  2291. Complex dd = ((Real)(1.)+ReflCalc->rtd(1)*ReflCalc->cf(1));
  2292. Complex a = ((Real)(1.) + ReflCalc->rtd(0)) / dd;
  2293. if (ReflCalc->layr >= 2) {
  2294. for (int n=2; n<=ReflCalc->layr; ++n) {
  2295. a *= ((Real)(1.)+ReflCalc->rtd(n-1));
  2296. if (n < ReflCalc->nlay-1) {
  2297. a /= ((Real)(1.)+ReflCalc->rtd(n)*ReflCalc->cf(n));
  2298. }
  2299. }
  2300. }
  2301. Complex p(0,0);
  2302. for (int n=1; n<=ReflCalc->layr; ++n) {
  2303. Complex ut = ReflCalc->u(0);
  2304. if (n>1) {
  2305. ut = ReflCalc->u(n-1);
  2306. }
  2307. p += (ReflCalc->u(n)-ut) * ReflCalc->LayerDepth(n-1);
  2308. }
  2309. Complex con = SR_SN(ReflCalc->id-1, 0) * std::exp(ReflCalc->uk*ReflCalc->tx_z - ReflCalc->um*ReflCalc->rx_z+ p);
  2310. if (ReflCalc->layr < ReflCalc->Earth->GetNumberOfLayers()-1) {
  2311. con += SR_SN(ReflCalc->id-1, 2) * ReflCalc->rtd(ReflCalc->layr) * std::exp(ReflCalc->uk*ReflCalc->tx_z-
  2312. ReflCalc->um*((Real)(2.)*ReflCalc->LayerDepth(ReflCalc->layr)-ReflCalc->rx_z)+p);
  2313. }
  2314. return ra*a*con;
  2315. }
  2316. template<>
  2317. Complex KernelEm1DSpec<TE, 12, INAIR, INGROUND>::RelPotentialBelowSourceLayer(const Real &ra) {
  2318. Complex con = SR_SN(ReflCalc->id-1, 0) * ReflCalc->relexp_pbs1;
  2319. if (ReflCalc->layr < ReflCalc->Earth->GetNumberOfLayers()-1) {
  2320. con += SR_SN(ReflCalc->id-1, 2) * ReflCalc->rtd(ReflCalc->layr) * ReflCalc->relexp_pbs2;
  2321. }
  2322. return ra*ReflCalc->rel_a*con;
  2323. }
  2324. } // ----- end of :Lemma name -----