Lemma is an Electromagnetics API
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

EMEarth1D.h 7.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232
  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 12/02/2009
  9. **/
  10. #ifndef __EMEARTH1D_H
  11. #define __EMEARTH1D_H
  12. // forward declare these due to include cycle
  13. //#include "LayeredEarthEM.h"
  14. //#include "DipoleSource.h"
  15. //#include "FieldPoints.h"
  16. //#include "WireAntenna.h"
  17. //#include "PolygonalWireAntenna.h"
  18. //#include "KernelEM1DManager.h"
  19. #include "KernelEM1DSpec.h"
  20. #include "GQChave.h"
  21. #include "FHTAnderson801.h"
  22. #include "FHTKey201.h"
  23. #include "FHTKey101.h"
  24. #include "FHTKey51.h"
  25. #include "QWEKey.h"
  26. #include "CubicSplineInterpolator.h"
  27. #ifdef HAVEBOOSTPROGRESS
  28. #include "boost/progress.hpp"
  29. #endif
  30. namespace Lemma {
  31. class WireAntenna;
  32. class PolygonalWireAntenna;
  33. class FieldPoints;
  34. class DipoleSource;
  35. class LayeredEarthEM;
  36. // =======================================================================
  37. // Class: EmEarth1D
  38. /// \brief Implimentation of 1D EM solution.
  39. /// \details We've done a lot of different things.
  40. // =======================================================================
  41. class EMEarth1D : public LemmaObject {
  42. friend std::ostream &operator<<(std::ostream &stream,
  43. const EMEarth1D &ob);
  44. struct ctor_key{};
  45. public:
  46. //friend class KernelEm1D;
  47. // ==================== LIFECYCLE ===========================
  48. /** Default protected constructor. */
  49. explicit EMEarth1D ( const ctor_key& );
  50. /** Default protected constructor. */
  51. EMEarth1D ( const YAML::Node& node, const ctor_key& );
  52. /** Default protected constructor. */
  53. ~EMEarth1D ();
  54. /**
  55. * Returns pointer to new EMEarth1D. Location is
  56. * initialized to (0,0,0) type and polarization are
  57. * initialized to nonworking values that will throw
  58. * exceptions if used.
  59. */
  60. static std::shared_ptr<EMEarth1D> NewSP();
  61. /** stream debugging info to std::out
  62. */
  63. void Query();
  64. /** YAML Serializing method
  65. */
  66. YAML::Node Serialize() const;
  67. //static EMEarth1D* DeSerialize(const YAML::Node& node);
  68. // ==================== OPERATORS ===========================
  69. // ==================== OPERATIONS ===========================
  70. /// Calculates the field(s) due to an ungrounded dipole source
  71. /// Calls FORTRAN library em1d (em1dnew.for)
  72. #ifdef KIHALEE_EM1D
  73. void MakeCalc();
  74. #endif
  75. /** C++ wrapper for em1dnew.for, serial */
  76. void MakeCalc3();
  77. /** Calculates the field(s) due to a wire antennae */
  78. void CalculateWireAntennaFields(bool progressbar=false);
  79. // ==================== ACCESS ===========================
  80. /** Attaches an antennae */
  81. void AttachWireAntenna( std::shared_ptr<WireAntenna> antennae);
  82. /** Attaches a dipole for calculation */
  83. void AttachDipoleSource( std::shared_ptr<DipoleSource> dipole);
  84. /** Attaches a layered earth model for calculation */
  85. void AttachLayeredEarthEM( std::shared_ptr<LayeredEarthEM> Earth);
  86. /** Attaches a set of receiver points for calculation */
  87. void AttachFieldPoints( std::shared_ptr<FieldPoints> Receivers);
  88. /** Sets the fields that are calcultated, E,H or BOTH */
  89. void SetFieldsToCalculate(const FIELDCALCULATIONS &calc);
  90. /** Sets the method to use to evaluate the Hankel integral,
  91. */
  92. void SetHankelTransformMethod(const HANKELTRANSFORMTYPE &type);
  93. /**
  94. * Accesor for field points
  95. */
  96. inline FieldPoints* GetFieldPoints() {
  97. return this->Receivers.get();
  98. }
  99. // ==================== INQUIRY ===========================
  100. protected:
  101. // ==================== OPERATIONS ===========================
  102. /** Used internally, this is the innermost loop of the MakeCalc3,
  103. * and CalculateWireAntennaField routines.
  104. */
  105. void SolveSingleTxRxPair(const int &irec,
  106. HankelTransform* Hankel,
  107. const Real &wavef, const int &ifreq,
  108. DipoleSource* tDipole);
  109. // void SolveSingleTxRxPair(const int &irec,
  110. // std::shared_ptr<HankelTransform> Hankel,
  111. // const Real &wavef, const int &ifreq,
  112. // std::shared_ptr<DipoleSource> tDipole);
  113. /** Used internally, this is the innermost loop of the MakeCalc3,
  114. * and CalculateWireAntennaField routines.
  115. */
  116. void SolveLaggedTxRxPair(const int &irec, FHTAnderson801* Hankel,
  117. const Real &wavef, const int &ifreq,
  118. PolygonalWireAntenna* antenna);
  119. // ==================== DATA MEMBERS ===========================
  120. /** Computes field due to dipole */
  121. std::shared_ptr<DipoleSource> Dipole;
  122. /** Earth model (Cole-cole) */
  123. std::shared_ptr<LayeredEarthEM> Earth;
  124. /** Receiver points */
  125. std::shared_ptr<FieldPoints> Receivers;
  126. /** Wire antennae tx */
  127. std::shared_ptr<WireAntenna> Antenna;
  128. /** What fields are wanted */
  129. FIELDCALCULATIONS FieldsToCalculate;
  130. /** The type of Hankel transform to use, default to digital
  131. * filtering
  132. */
  133. HANKELTRANSFORMTYPE HankelType;
  134. /** Counter for number of caclulations made
  135. */
  136. int icalcinner;
  137. /** Counter for number of caclulations made
  138. */
  139. int icalc;
  140. }; // ----- end of class EMEarth1D -----
  141. /////////////////////////////////////////
  142. // Exception classes
  143. /** If a Receivers Class is NULL valued, throw this.
  144. */
  145. class NullReceivers : public std::runtime_error {
  146. /** Thrown when Receivers pointer is NULL
  147. */
  148. public: NullReceivers();
  149. };
  150. /** If an Antenna is NULL valued, throw this error.
  151. */
  152. class NullAntenna : public std::runtime_error {
  153. /** Thrown when an antenna pointer is NULL
  154. */
  155. public: NullAntenna();
  156. };
  157. /** If an Instrument is NULL valued, throw this error.
  158. */
  159. class NullInstrument : public std::runtime_error {
  160. /** thrown when an instrument pointer is NULL.
  161. * @param[in] ptr is a pointer to the class throwing the exception.
  162. */
  163. public: NullInstrument(LemmaObject* ptr);
  164. };
  165. /** If a dipole source is specified, but a method calling a wire antenna is
  166. * called, throw this.
  167. */
  168. class DipoleSourceSpecifiedForWireAntennaCalc : public std::runtime_error {
  169. /** Thrown when a dipole source is specified when a wire antenna is
  170. * expected
  171. */
  172. public: DipoleSourceSpecifiedForWireAntennaCalc();
  173. };
  174. } // Namespace Lemma
  175. #endif // __EMEARTH1D_H