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.

inversesolvertem1d.h 3.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  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 M. Andy Kass
  8. @date 03/23/2011
  9. @version $Id: inversesolvertem1d.h 201 2015-01-03 00:07:47Z tirons $
  10. **/
  11. #ifndef _INVERSESOLVERTEM1D__H
  12. #define _INVERSESOLVERTEM1D__H
  13. #include "inversesolver.h"
  14. #include "layeredearthem.h"
  15. #include "WireAntenna.h"
  16. #include "dipolesource.h"
  17. #include "receiverpoints.h"
  18. #include "instrumenttem.h"
  19. #include "cg.h"
  20. namespace Lemma {
  21. // ===================================================================
  22. // Class: InverseSolverTEM1D
  23. /// \brief Inversion for 1D TEM data
  24. /// \details
  25. // ===================================================================
  26. class InverseSolverTEM1D : public InverseSolver {
  27. friend std::ostream &operator<<(std::ostream &stream,
  28. const InverseSolverTEM1D &ob);
  29. public:
  30. // ==================== LIFECYCLE =======================
  31. static InverseSolverTEM1D* New();
  32. void Delete();
  33. // ==================== OPERATORS =======================
  34. // ==================== OPERATIONS =======================
  35. /// Perform the inverse calculation
  36. void Calculate();
  37. // ==================== ACCESS =======================
  38. /// Attach starting model
  39. void AttachStartMod(LayeredEarthEM* inpstartmod);
  40. /// Attach recovered model
  41. void AttachRecMod(LayeredEarthEM* inprecmod);
  42. /// Attach wire antenna source
  43. void AttachWireAntenna(WireAntenna* inpwireantenna);
  44. /// Attach dipole source
  45. void AttachDipoleSource(DipoleSource* inpdipsource);
  46. /// Attach receiver points
  47. void AttachReceiver(ReceiverPoints* inpreceiver);
  48. /// Set the time gates
  49. void SetTimes(VectorXr &inptimes);
  50. /// Show forward modelled data
  51. void ShowSoln();
  52. /// Write recovered model to file
  53. void WriteSoln(const std::string &filename);
  54. /// Set free parameter indices: layer, conductivity
  55. void SetFreeParams(const VectorXi &layers, const VectorXi &cond);
  56. /// Attach measured data for misfit comparison
  57. void AttachMeasuredData(const MatrixXr &data);
  58. // ==================== INQUIRY =======================
  59. /// Report number of iterations
  60. int NumberOfIterations();
  61. /// Report success/failure
  62. bool Success();
  63. /// Return phi m vector
  64. VectorXr GetPhiMVector();
  65. /// Return phi d vector
  66. VectorXr GetPhiDVector();
  67. protected:
  68. /// Some crap trevor uses
  69. void FillInG(const Vector3r& pos, const Vector3r& step);
  70. /// Calculate Jacobian
  71. MatrixXr CalcJac(LayeredEarthEM* m0);
  72. // ==================== LIFECYCLE =======================
  73. /// Default protected constructor.
  74. InverseSolverTEM1D (const std::string &name);
  75. /// Default protected constructor.
  76. ~InverseSolverTEM1D ();
  77. void Release();
  78. // ==================== DATA MEMBERS =========================
  79. WireAntenna* Antenna;
  80. DipoleSource* Dipole;
  81. ReceiverPoints* Receiver;
  82. LayeredEarthEM* StartingMod;
  83. LayeredEarthEM* RecoveredMod;
  84. InstrumentTem *InstrumentFor;
  85. MatrixXr MeasuredData;
  86. VectorXr Times;
  87. /// Vector of indices for which layer conductivities are solved for
  88. VectorXi SCondIndex;
  89. /// Vecor of indices for which layer thicknesses are solved for
  90. VectorXi SThickIndex;
  91. /// Temporary vector for returning linearised step
  92. VectorXr RecModStep;
  93. private:
  94. }; // ----- end of class InverseSolverTEM1D -----
  95. } // End of namespace Lemma
  96. #endif // _INVERSESOLVERTEM1D__H