Main Lemma Repository
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.

inversesolver.h 3.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  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 07/14/2010
  9. @version $Id: inversesolver.h 193 2014-11-10 23:51:41Z tirons $
  10. **/
  11. #ifndef INVERSESOLVER_H_INC
  12. #define INVERSESOLVER_H_INC
  13. #include "LemmaObject.h"
  14. #include "data.h"
  15. #include "instrument.h"
  16. #include "octreegrid.h"
  17. namespace Lemma {
  18. // ===================================================================
  19. // Class: InverseSolver
  20. /**
  21. @class InverseSolver
  22. \brief Abstract class for inverse problem solver.
  23. \details General solution of inverse problems.
  24. */
  25. // ===================================================================
  26. class InverseSolver : public LemmaObject {
  27. friend std::ostream &operator<<(std::ostream &stream,
  28. const InverseSolver &ob);
  29. friend class OctreeGrid;
  30. public:
  31. // ==================== LIFECYCLE =======================
  32. // ==================== OPERATORS =======================
  33. // ==================== OPERATIONS =======================
  34. // ==================== ACCESS =======================
  35. /** @brief Sets the obsered data, any instance of Data.
  36. * @details This may either be field data, or forward modelled
  37. * data.
  38. * @param[in] ObsData a pointer to the observed data class.
  39. */
  40. void SetObservedData(Data* ObsData);
  41. /** @brief Sets the instument that is used to create the data.
  42. * @details This is used for all forward modelling.
  43. * @param[in] inst is a pointer to the instrument class.
  44. */
  45. void SetInstrument(Instrument* inst);
  46. /** @brief Returns the predicted data.
  47. * @return a pointer to the predicted data.
  48. */
  49. Data* GetPredictedData();
  50. // ==================== INQUIRY =======================
  51. /** Returns the number of iterations it took to converge to a
  52. * solution.
  53. */
  54. virtual int NumberOfIterations()=0;
  55. /** Returns true if the inversion converged successfully.
  56. */
  57. virtual bool Success()=0;
  58. /** Returns a vector of \f$ \phi_M \f$
  59. */
  60. virtual VectorXr GetPhiMVector()=0;
  61. /** Returns a vector of \f$ \phi_D \f$
  62. */
  63. virtual VectorXr GetPhiDVector()=0;
  64. protected:
  65. // ==================== OPERATIONS =======================
  66. /// Used as a callback function from iterating mesh.
  67. virtual void FillInG(const Vector3r& pos, const Vector3r& step)=0;
  68. // ==================== LIFECYCLE =======================
  69. /// Default protected constructor.
  70. InverseSolver (const std::string &name);
  71. /// Default protected constructor.
  72. ~InverseSolver ();
  73. // ==================== DATA MEMBERS =========================
  74. /// The Observed Data
  75. Data* ObservedData;
  76. /// The Predicted Data
  77. Data* PredictedData;
  78. /// Instrument that makes the data
  79. Instrument* ModelInstrument;
  80. private:
  81. }; // ----- end of class InverseSolver -----
  82. } // ----- end of Lemma name -----
  83. #endif // ----- #ifndef INVERSESOLVER_H_INC -----