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 3.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  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";
  14. return stream;
  15. }
  16. // ==================== LIFECYCLE =======================
  17. KernelEM1DManager::KernelEM1DManager( const ctor_key& key ) : LemmaObject( key ), 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. //--------------------------------------------------------------------------------------
  27. // Class: KernelEM1DManager
  28. // Method: GetName
  29. // Description: Class identifier
  30. //--------------------------------------------------------------------------------------
  31. inline std::string KernelEM1DManager::GetName ( ) const {
  32. return CName;
  33. } // ----- end of method KernelEM1DManager::GetName -----
  34. // A race condition can develop with these. It's OK to not attach, since this is an internal class, and
  35. // we know what is going on.
  36. void KernelEM1DManager::SetEarth( std::shared_ptr<LayeredEarthEM> Earthin) {
  37. Earth = Earthin;
  38. }
  39. void KernelEM1DManager::SetDipoleSource( DipoleSource* DipoleIn,
  40. const int& ifreqin,
  41. const Real& rx_zin) {
  42. Dipole = DipoleIn;
  43. ifreq = ifreqin;
  44. rx_z = rx_zin;
  45. }
  46. std::shared_ptr<KernelEM1DBase> KernelEM1DManager::GetKernel(const unsigned int& ik) {
  47. return KernelVec[ik];
  48. }
  49. KernelEM1DBase* KernelEM1DManager::GetRAWKernel(const unsigned int& ik) {
  50. return KernelVec[ik].get();
  51. }
  52. DipoleSource* KernelEM1DManager::GetDipole( ) {
  53. return Dipole;
  54. }
  55. // ==================== OPERATIONS =======================
  56. void KernelEM1DManager::ComputeReflectionCoeffs(const Real& lambda, const int& idx, const Real& rho0) {
  57. if (TEReflBase != nullptr) {
  58. TEReflBase->ComputeReflectionCoeffs(lambda);
  59. TEReflBase->PreComputePotentialTerms( );
  60. }
  61. if (TMReflBase != nullptr) {
  62. TMReflBase->ComputeReflectionCoeffs(lambda);
  63. TMReflBase->PreComputePotentialTerms( );
  64. }
  65. }
  66. void KernelEM1DManager::ResetSource(const int& ifreq) {
  67. if (TEReflBase != nullptr) {
  68. TEReflBase->SetUpSource(Dipole, ifreq);
  69. }
  70. if (TMReflBase != nullptr) {
  71. TMReflBase->SetUpSource(Dipole, ifreq);
  72. }
  73. }
  74. } // ----- end of Lemma name -----