Surface NMR forward modelling
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.

KernelV0.cpp 5.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. /* This file is part of Lemma, a geophysical modelling and inversion API.
  2. * More information is available at http://lemmasoftware.org
  3. */
  4. /* This Source Code Form is subject to the terms of the Mozilla Public
  5. * License, v. 2.0. If a copy of the MPL was not distributed with this
  6. * file, You can obtain one at http://mozilla.org/MPL/2.0/.
  7. */
  8. /**
  9. * @file
  10. * @date 11/11/2016 01:47:25 PM
  11. * @version $Id$
  12. * @author Trevor Irons (ti)
  13. * @email tirons@egi.utah.edu
  14. * @copyright Copyright (c) 2016, University of Utah
  15. * @copyright Copyright (c) 2016, Lemma Software, LLC
  16. */
  17. #include "KernelV0.h"
  18. #include "EMEarth1D.h"
  19. #include "FieldPoints.h"
  20. namespace Lemma {
  21. // ==================== FRIEND METHODS =====================
  22. std::ostream &operator << (std::ostream &stream, const KernelV0 &ob) {
  23. stream << ob.Serialize() << "\n---\n"; // End of doc ---
  24. return stream;
  25. }
  26. // ==================== LIFECYCLE =======================
  27. //--------------------------------------------------------------------------------------
  28. // Class: KernelV0
  29. // Method: KernelV0
  30. // Description: constructor (locked)
  31. //--------------------------------------------------------------------------------------
  32. KernelV0::KernelV0 (const ctor_key&) : LemmaObject( ) {
  33. } // ----- end of method KernelV0::KernelV0 (constructor) -----
  34. //--------------------------------------------------------------------------------------
  35. // Class: KernelV0
  36. // Method: KernelV0
  37. // Description: DeSerializing constructor (locked)
  38. //--------------------------------------------------------------------------------------
  39. KernelV0::KernelV0 (const YAML::Node& node, const ctor_key&) : LemmaObject(node) {
  40. } // ----- end of method KernelV0::KernelV0 (constructor) -----
  41. //--------------------------------------------------------------------------------------
  42. // Class: KernelV0
  43. // Method: NewSP()
  44. // Description: public constructor returing a shared_ptr
  45. //--------------------------------------------------------------------------------------
  46. std::shared_ptr< KernelV0 > KernelV0::NewSP() {
  47. return std::make_shared< KernelV0 >( ctor_key() );
  48. }
  49. //--------------------------------------------------------------------------------------
  50. // Class: KernelV0
  51. // Method: ~KernelV0
  52. // Description: destructor (protected)
  53. //--------------------------------------------------------------------------------------
  54. KernelV0::~KernelV0 () {
  55. } // ----- end of method KernelV0::~KernelV0 (destructor) -----
  56. //--------------------------------------------------------------------------------------
  57. // Class: KernelV0
  58. // Method: Serialize
  59. //--------------------------------------------------------------------------------------
  60. YAML::Node KernelV0::Serialize ( ) const {
  61. YAML::Node node = LemmaObject::Serialize();
  62. node.SetTag( GetName() );
  63. // Coils Transmitters & Receivers
  64. for ( auto txm : TxRx) {
  65. node[txm.first] = txm.second->Serialize();
  66. }
  67. // LayeredEarthEM
  68. node["SigmaModel"] = SigmaModel->Serialize();
  69. return node;
  70. } // ----- end of method KernelV0::Serialize -----
  71. //--------------------------------------------------------------------------------------
  72. // Class: KernelV0
  73. // Method: DeSerialize
  74. //--------------------------------------------------------------------------------------
  75. std::shared_ptr<KernelV0> KernelV0::DeSerialize ( const YAML::Node& node ) {
  76. if (node.Tag() != "KernelV0" ) {
  77. throw DeSerializeTypeMismatch( "KernelV0", node.Tag());
  78. }
  79. return std::make_shared< KernelV0 > ( node, ctor_key() );
  80. } // ----- end of method KernelV0::DeSerialize -----
  81. //--------------------------------------------------------------------------------------
  82. // Class: KernelV0
  83. // Method: DeSerialize
  84. //--------------------------------------------------------------------------------------
  85. void KernelV0::CalculateK0 (const std::vector< std::string>& Tx, const std::vector<std::string >& Rx ) {
  86. for (auto tx : Tx) {
  87. // Set up EMEarth
  88. auto EmEarth = EMEarth1D::NewSP();
  89. EmEarth->AttachWireAntenna(TxRx[tx]);
  90. EmEarth->AttachLayeredEarthEM(SigmaModel);
  91. EmEarth->SetFieldsToCalculate(H);
  92. // TODO query for method, altough with flat antennae, this is fastest
  93. EmEarth->SetHankelTransformMethod(ANDERSON801);
  94. // EmEarth->AttachFieldPoints(receivers);
  95. // //EmEarth->SetHankelTransformMethod(FHTKEY101);
  96. // EmEarth->CalculateWireAntennaFields();
  97. // Vector3Xcr Rx1 = receivers->GetHfield(0);
  98. // //receivers->ClearFields();
  99. //
  100. // //EmEarth->AttachWireAntenna(Tx2);
  101. // EmEarth->CalculateWireAntennaFields();
  102. // Rx1 += receivers->GetHfield(0);
  103. }
  104. }
  105. void KernelV0::CalculateK0 ( const char* tx, const char* rx ) {
  106. }
  107. } // ---- end of namespace Lemma ----
  108. /* vim: set tabstop=4 expandtab: */
  109. /* vim: set filetype=cpp: */