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

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