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.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185
  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 08:49:51 AM
  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 FORWARDFID_INC
  18. #define FORWARDFID_INC
  19. #pragma once
  20. #include "LayeredEarthEM.h"
  21. #include "PolygonalWireAntenna.h"
  22. #include "EMEarth1D.h"
  23. #include "MerlinObject.h"
  24. #include "DataFID.h"
  25. #include "KernelV0.h"
  26. #include "LayeredEarthMR.h"
  27. namespace Lemma {
  28. /**
  29. * \ingroup Merlin
  30. * \brief Forward modelling for FID sNMR pulses
  31. * \details This class performs forward modelling of sNMR
  32. * FID experiments.
  33. */
  34. class ForwardFID : public MerlinObject {
  35. friend std::ostream &operator<<(std::ostream &stream, const ForwardFID &ob);
  36. protected:
  37. /*
  38. * This key is used to lock the constructor. It is protected so that inhereted
  39. * classes also have the key to contruct their base class.
  40. */
  41. struct ctor_key {};
  42. public:
  43. // ==================== LIFECYCLE =======================
  44. /**
  45. * Default constructor.
  46. * @note This method is locked, and cannot be called directly.
  47. * The reason that the method is public is to enable the use
  48. * of make_shared whilst enforcing the use of shared_ptr,
  49. * in c++-17, this curiosity may be resolved.
  50. * @see ForwardFID::NewSP
  51. */
  52. explicit ForwardFID ( const ctor_key& );
  53. /**
  54. * DeSerializing constructor.
  55. * @note This method is locked, and cannot be called directly.
  56. * The reason that the method is public is to enable the use
  57. * of make_shared whilst enforcing the use of shared_ptr,
  58. * in c++-17, this curiosity may be resolved.
  59. * @see ForwardFID::DeSerialize
  60. */
  61. ForwardFID ( const YAML::Node& node, const ctor_key& );
  62. /**
  63. * Default destructor.
  64. * @note This method should never be called due to the mandated
  65. * use of smart pointers. It is necessary to keep the method
  66. * public in order to allow for the use of the more efficient
  67. * make_shared constructor.
  68. */
  69. virtual ~ForwardFID ();
  70. /**
  71. * Uses YAML to serialize this object.
  72. * @return a YAML::Node
  73. * @see ForwardFID::DeSerialize
  74. */
  75. virtual YAML::Node Serialize() const;
  76. /*
  77. * Factory method for generating concrete class.
  78. * @return a std::shared_ptr of type ForwardFID
  79. */
  80. static std::shared_ptr< ForwardFID > NewSP();
  81. /**
  82. * Constructs an ForwardFID object from a YAML::Node.
  83. * @see ForwardFID::Serialize
  84. */
  85. static std::shared_ptr<ForwardFID> DeSerialize(const YAML::Node& node);
  86. // ==================== OPERATORS =======================
  87. // ==================== OPERATIONS =======================
  88. /**
  89. * Performs forward model calculation based on input parameters
  90. * @return Merlin class representing data
  91. */
  92. std::shared_ptr<DataFID> ForwardModel( std::shared_ptr<LayeredEarthMR> );
  93. // ==================== ACCESS =======================
  94. /**
  95. * Sets windows using the edges in a Eigen VectorXr
  96. * @param[in] Edges are the edges of the time gate windows
  97. */
  98. void SetWindowEdges( const VectorXr& Edges );
  99. /**
  100. * Sets the windows for calculation as a series of log spaced windows.
  101. * This method calculates the window edges, so the centres will be n-1
  102. * @param[in] first is the beginning of the vector
  103. * @param[in] last is the last element in the vector
  104. * @param[in] n is the number of elements
  105. */
  106. void SetLogSpacedWindows(const Real& first, const Real& last, const int& n);
  107. /**
  108. * @param[in] K0 is the initial amplitude imaging kernel
  109. */
  110. void SetKernel( std::shared_ptr< KernelV0 > K0 );
  111. // ==================== INQUIRY =======================
  112. /**
  113. * Returns the name of the underlying class, similiar to Python's type
  114. * @return string of class name
  115. */
  116. virtual inline std::string GetName() const {
  117. return CName;
  118. }
  119. protected:
  120. // ==================== LIFECYCLE =======================
  121. /** Copy is disabled */
  122. ForwardFID( const ForwardFID& ) = delete;
  123. // ==================== DATA MEMBERS =========================
  124. private:
  125. /**
  126. * Calculates the QT matrix
  127. * @param[in] T2StarBins are the T2* bins to use
  128. */
  129. void CalcQTMatrix( VectorXr T2StarBins );
  130. /** ASCII string representation of the class name */
  131. static constexpr auto CName = "ForwardFID";
  132. /** Imaging kernel used in calculation */
  133. std::shared_ptr< KernelV0 > Kernel = nullptr;
  134. /** Time gate windows */
  135. VectorXr WindowEdges;
  136. /** Time gate centres */
  137. VectorXr WindowCentres;
  138. /** QT matrix */
  139. MatrixXcr QT;
  140. /** Include RDP effects? */
  141. bool RDP = false;
  142. }; // ----- end of class ForwardFID -----
  143. } // ----- end of namespace Lemma ----
  144. /* vim: set tabstop=4 expandtab: */
  145. /* vim: set filetype=cpp: */
  146. #endif // ----- #ifndef FORWARDFID_INC -----