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

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