Lemma is an Electromagnetics API
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

KernelEM1DManager.cpp 3.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  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, const int& ifreqin,
  40. const Real& rx_zin) {
  41. Dipole = DipoleIn;
  42. ifreq = ifreqin;
  43. rx_z = rx_zin;
  44. }
  45. std::shared_ptr<KernelEM1DBase> KernelEM1DManager::GetKernel(const unsigned int& ik) {
  46. return KernelVec[ik];
  47. }
  48. KernelEM1DBase* KernelEM1DManager::GetRAWKernel(const unsigned int& ik) {
  49. return KernelVec[ik].get();
  50. }
  51. DipoleSource* KernelEM1DManager::GetDipole( ) {
  52. return Dipole;
  53. }
  54. // ==================== OPERATIONS =======================
  55. void KernelEM1DManager::ComputeReflectionCoeffs(const Real& lambda, const int& idx, const Real& rho0) {
  56. if (TEReflBase != nullptr) {
  57. TEReflBase->ComputeReflectionCoeffs(lambda);
  58. TEReflBase->PreComputePotentialTerms( );
  59. }
  60. if (TMReflBase != nullptr) {
  61. TMReflBase->ComputeReflectionCoeffs(lambda);
  62. TMReflBase->PreComputePotentialTerms( );
  63. }
  64. }
  65. void KernelEM1DManager::ResetSource(const int& ifreq) {
  66. if (TEReflBase != nullptr) {
  67. TEReflBase->SetUpSource(Dipole, ifreq);
  68. }
  69. if (TMReflBase != nullptr) {
  70. TMReflBase->SetUpSource(Dipole, ifreq);
  71. }
  72. }
  73. } // ----- end of Lemma name -----