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.

KernelEM1DManager.cpp 2.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  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( std::shared_ptr<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. std::shared_ptr<DipoleSource> KernelEM1DManager::GetDipole( ) {
  41. return Dipole;
  42. }
  43. // ==================== OPERATIONS =======================
  44. void KernelEM1DManager::ComputeReflectionCoeffs(const Real& lambda, const int& idx, const Real& rho0) {
  45. if (TEReflBase != nullptr) {
  46. TEReflBase->ComputeReflectionCoeffs(lambda);
  47. TEReflBase->PreComputePotentialTerms( );
  48. }
  49. if (TMReflBase != nullptr) {
  50. TMReflBase->ComputeReflectionCoeffs(lambda);
  51. TMReflBase->PreComputePotentialTerms( );
  52. }
  53. }
  54. void KernelEM1DManager::ResetSource(const int& ifreq) {
  55. if (TEReflBase != nullptr) {
  56. TEReflBase->SetUpSource(Dipole, ifreq);
  57. }
  58. if (TMReflBase != nullptr) {
  59. TMReflBase->SetUpSource(Dipole, ifreq);
  60. }
  61. }
  62. } // ----- end of Lemma name -----