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.

ForwardFID.h 5.4KB

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