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.6KB

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