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.

LayeredEarthMR.h 5.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  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 08/28/2017 03:32:26 PM
  11. * @version $Id$
  12. * @author Trevor Irons (ti)
  13. * @email tirons@egi.utah.edu
  14. * @copyright Copyright (c) 2017, University of Utah
  15. * @copyright Copyright (c) 2017, Lemma Software, LLC
  16. */
  17. #ifndef LAYEREDEARTHMR_INC
  18. #define LAYEREDEARTHMR_INC
  19. #pragma once
  20. #include "LayeredEarth.h"
  21. #include "MerlinConfig.h"
  22. #include "KernelV0.h"
  23. namespace Lemma {
  24. /**
  25. * \ingroup Merlin
  26. * \brief
  27. * \details
  28. */
  29. class LayeredEarthMR : public LayeredEarth {
  30. friend std::ostream &operator<<(std::ostream &stream, const LayeredEarthMR &ob);
  31. public:
  32. // ==================== LIFECYCLE =======================
  33. /**
  34. * Default constructor.
  35. * @note This method is locked, and cannot be called directly.
  36. * The reason that the method is public is to enable the use
  37. * of make_shared whilst enforcing the use of shared_ptr,
  38. * in c++-17, this curiosity may be resolved.
  39. * @see LayeredEarthMR::NewSP
  40. */
  41. explicit LayeredEarthMR ( const ctor_key& );
  42. /**
  43. * DeSerializing constructor.
  44. * @note This method is locked, and cannot be called directly.
  45. * The reason that the method is public is to enable the use
  46. * of make_shared whilst enforcing the use of shared_ptr,
  47. * in c++-17, this curiosity may be resolved.
  48. * @see LayeredEarthMR::DeSerialize
  49. */
  50. LayeredEarthMR ( const YAML::Node& node, const ctor_key& );
  51. /**
  52. * Default destructor.
  53. * @note This method should never be called due to the mandated
  54. * use of smart pointers. It is necessary to keep the method
  55. * public in order to allow for the use of the more efficient
  56. * make_shared constructor.
  57. */
  58. virtual ~LayeredEarthMR ();
  59. /**
  60. * Uses YAML to serialize this object.
  61. * @return a YAML::Node
  62. * @see LayeredEarthMR::DeSerialize
  63. */
  64. virtual YAML::Node Serialize() const;
  65. /**
  66. * Factory method for generating concrete class.
  67. * @return a std::shared_ptr of type LayeredEarthMR
  68. */
  69. static std::shared_ptr< LayeredEarthMR > NewSP();
  70. /**
  71. * Constructs an LayeredEarthMR object from a YAML::Node.
  72. * @see LayeredEarthMR::Serialize
  73. */
  74. static std::shared_ptr<LayeredEarthMR> DeSerialize(const YAML::Node& node);
  75. // ==================== OPERATORS =======================
  76. // ==================== OPERATIONS =======================
  77. // ==================== ACCESS =======================
  78. /**
  79. * @return a VectorXr of the T2* bins
  80. */
  81. VectorXr GetT2StarBins();
  82. /**
  83. * @return a flattened version of the model matrix
  84. */
  85. VectorXr GetModelVector();
  86. /**
  87. * @return the model matrix
  88. */
  89. MatrixXr GetModelMatrix();
  90. /**
  91. * Sets the T2StarBins to solve for, these are log spaced
  92. * @param[in] first is the beginning of the bins
  93. * @param[in] last is the end of the bins
  94. * @param[in] nT2 is the number of bins
  95. */
  96. void SetT2StarBins(const Real& first, const Real& last, const int& nT2);
  97. /**
  98. * Convenience method, that aligns model with a Kernel
  99. * @param[in] Kern input kernel to align with
  100. */
  101. void AlignWithKernel( std::shared_ptr<KernelV0> Kern );
  102. // ==================== INQUIRY =======================
  103. /**
  104. * Returns the name of the underlying class, similiar to Python's type
  105. * @return string of class name
  106. */
  107. virtual inline std::string GetName() const {
  108. return CName;
  109. }
  110. protected:
  111. // ==================== LIFECYCLE =======================
  112. /** Copy is disabled */
  113. LayeredEarthMR( const LayeredEarthMR& ) = delete;
  114. // ==================== DATA MEMBERS =========================
  115. private:
  116. /** ASCII string representation of the class name */
  117. static constexpr auto CName = "LayeredEarthMR";
  118. /**
  119. * Sets the number of layers
  120. */
  121. void SetNumberOfLayers(const int& nlay);
  122. /** Initializes the model matrix */
  123. void InitModelMat();
  124. VectorXr Interfaces; // Layer interfaces, for pcolor
  125. VectorXr T2StarBins; // the actual T2* values
  126. VectorXr T2StarBinEdges; // Convenience, for pcolor
  127. MatrixXr ModelMat; // The NMR model, in matrix form
  128. }; // ----- end of class LayeredEarthMR -----
  129. } // ----- end of namespace Lemma ----
  130. /* vim: set tabstop=4 expandtab: */
  131. /* vim: set filetype=cpp: */
  132. #endif // ----- #ifndef LAYEREDEARTHMR_INC -----