Lemma is an Electromagnetics API
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

KernelEM1DManager.cpp 2.6KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  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 06/26/2012
  9. **/
  10. #include "KernelEM1DManager.h"
  11. namespace Lemma {
  12. std::ostream &operator<<(std::ostream &stream, const KernelEM1DManager &ob) {
  13. stream << ob.Serialize() << "\n---\n";
  14. return stream;
  15. }
  16. // ==================== LIFECYCLE =======================
  17. KernelEM1DManager::KernelEM1DManager( const ctor_key& ) : LemmaObject( ), TEReflBase(nullptr),
  18. TMReflBase(nullptr), Earth(nullptr), Dipole(nullptr) {
  19. }
  20. KernelEM1DManager::~KernelEM1DManager() {
  21. }
  22. std::shared_ptr<KernelEM1DManager> KernelEM1DManager::NewSP() {
  23. return std::make_shared<KernelEM1DManager>( ctor_key() );
  24. }
  25. // ==================== ACCESS =======================
  26. // A race condition can develop with these. It's OK to not attach, since this is an internal class, and
  27. // we know what is going on.
  28. void KernelEM1DManager::SetEarth( std::shared_ptr<LayeredEarthEM> Earthin) {
  29. Earth = Earthin;
  30. }
  31. void KernelEM1DManager::SetDipoleSource( DipoleSource* DipoleIn, const int& ifreqin,
  32. const Real& rx_zin) {
  33. Dipole = DipoleIn;
  34. ifreq = ifreqin;
  35. rx_z = rx_zin;
  36. }
  37. std::shared_ptr<KernelEM1DBase> KernelEM1DManager::GetKernel(const unsigned int& ik) {
  38. return KernelVec[ik];
  39. }
  40. KernelEM1DBase* KernelEM1DManager::GetRAWKernel(const unsigned int& ik) {
  41. return KernelVec[ik].get();
  42. }
  43. DipoleSource* KernelEM1DManager::GetDipole( ) {
  44. return Dipole;
  45. }
  46. // ==================== OPERATIONS =======================
  47. void KernelEM1DManager::ComputeReflectionCoeffs(const Real& lambda, const int& idx, const Real& rho0) {
  48. if (TEReflBase != nullptr) {
  49. TEReflBase->ComputeReflectionCoeffs(lambda);
  50. TEReflBase->PreComputePotentialTerms( );
  51. }
  52. if (TMReflBase != nullptr) {
  53. TMReflBase->ComputeReflectionCoeffs(lambda);
  54. TMReflBase->PreComputePotentialTerms( );
  55. }
  56. }
  57. void KernelEM1DManager::ResetSource(const int& ifreq) {
  58. if (TEReflBase != nullptr) {
  59. TEReflBase->SetUpSource(Dipole, ifreq);
  60. }
  61. if (TMReflBase != nullptr) {
  62. TMReflBase->SetUpSource(Dipole, ifreq);
  63. }
  64. }
  65. } // ----- end of Lemma name -----