Main Lemma Repository
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

instrumenttem.h 6.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213
  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 M. Andy Kass
  8. @date 02/10/2011
  9. @version $Id: instrumenttem.h 201 2015-01-03 00:07:47Z tirons $
  10. **/
  11. #ifndef __INSTRUMENTTEM_H
  12. #define __INSTRUMENTTEM_H
  13. #include "instrument.h"
  14. #include "emearth1d.h"
  15. #include "WireAntenna.h"
  16. #include "PolygonalWireAntenna.h"
  17. #include "receiverpoints.h"
  18. #include "dipolesource.h"
  19. #include "layeredearthem.h"
  20. #include "digitalfiltercostrans.h"
  21. #include "digitalfiltersintrans.h"
  22. #include "temintegrationkernel.h"
  23. #include "CubicSplineInterpolator.h"
  24. namespace Lemma {
  25. enum ReceiverType { INDUCTIVE, MAGNETOMETER, ELECTRIC };
  26. // ===================================================================
  27. // Class: InstrumentTem
  28. /// \brief TEM Instrument Class
  29. /// \details Provides utility to forward model TEM data in Lemma.
  30. // ===================================================================
  31. class InstrumentTem : public Instrument {
  32. friend std::ostream &operator<<(std::ostream &stream,
  33. const InstrumentTem &ob);
  34. public:
  35. // ==================== LIFECYCLE =======================
  36. static InstrumentTem* New();
  37. void Delete();
  38. // ==================== OPERATORS =======================
  39. // ==================== OPERATIONS =======================
  40. /// Perform the forward model calculation
  41. void MakeDirectCalculation( const HANKELTRANSFORMTYPE& hType );
  42. /** Perform the forward model calculation, use lagged convolutions to
  43. * speed up the calculations
  44. */
  45. void MakeLaggedCalculation( const HANKELTRANSFORMTYPE& hType );
  46. // ==================== ACCESS =======================
  47. /** Sets pulse parameters as a linearly segmented graph, so
  48. * for example a triangle wave needs three points in Amps and
  49. * times, a trapazoidal needs for. The pulse is assumed (defaults) to be
  50. * bipolar, only the positive polarity should be specified.
  51. * @param[in] Amp is the waveform current in Amps
  52. * @param[in] times are the abscissa values of the waveform
  53. * @param[in] bipolar specifies whether or not the pulse is bipolar
  54. */
  55. void SetPulse( const VectorXr& Amp, const VectorXr& times, bool bipolar=true );
  56. /// Sets layered earth model
  57. void EMEarthModel(LayeredEarthEM* Earth);
  58. /// Sets transmitter parameters
  59. void SetTransmitLoop(WireAntenna *antennae);
  60. /// Sets dipole source parameters
  61. void SetDipoleSource(DipoleSource* dipolesource);
  62. /// Sets receiver points and parameters
  63. void SetReceiver(ReceiverPoints* Receivers);
  64. /** Sets the type of receiver/measurement
  65. */
  66. void SetReceiverType( const ReceiverType& rtype );
  67. /// Return calculated data
  68. MatrixXr GetMeasurements();
  69. /**
  70. Set time gates, assumes gates widths are delta (instantaneous)
  71. @param[in] times gate centres units are in seconds
  72. */
  73. void SetTimes(const VectorXr &times);
  74. /** Sets time gates centres and widths, both in seconds. The window is assumed to be
  75. * a simple boxcar. Simpson's rule is used to integrate the response
  76. * @param[in] times gate centres units are in seconds
  77. * @param[in] widths gate widths units are in seconds
  78. */
  79. void SetTimeGates(const VectorXr &centres, const VectorXr& widths);
  80. /// Get number of times
  81. int GetNumberOfTimes();
  82. /** Sets reference time for time gate to pulse time offset.
  83. */
  84. void SetReferenceTime(const Real& RefTime);
  85. /// Attach EMEarth1D
  86. //void AttachEMEarth1D(EMEarth1D *EMEarth);
  87. // ==================== INQUIRY =======================
  88. protected:
  89. // ==================== LIFECYCLE =======================
  90. /// Default protected constructor.
  91. InstrumentTem (const std::string &name);
  92. /// Default protected constructor.
  93. ~InstrumentTem ();
  94. void Release();
  95. // ==================== OPERATIONS =======================
  96. /**
  97. * Converts impulse B response (step db/dt) into inductive db/dt
  98. * response for general waveform.
  99. */
  100. void FoldAndConvolve( CubicSplineInterpolator* Spline );
  101. /** Convolves the transmitter waveform(s), takes the impulse response
  102. and uses simpson's rule to evaluate the integral.
  103. @param[in] Spline is the Cubic Spline object representing the solution.
  104. @param[in] t is the evaluation time.
  105. */
  106. Real ConvolveWaveform( CubicSplineInterpolator* Spline, const Real& t );
  107. /** Subtracts previous waveform(s) from current impulse response, and re-splines.
  108. */
  109. void SubtractPrevious( CubicSplineInterpolator* Spline );
  110. // ==================== DATA MEMBERS =========================
  111. //EMEarth1D* EmEarth;
  112. WireAntenna* Antenna;
  113. ReceiverPoints* Receiver;
  114. LayeredEarthEM* EarthMod;
  115. DipoleSource* Dipole;
  116. bool bipolarWaveform;
  117. /** Number of previous pules to model */
  118. int NPreviousPulse;
  119. /** Reference time (relative to pulse abscissa) for time gates */
  120. Real RefTime;
  121. /** Pulse period, if bimodal 1/2 repitition period */
  122. Real PulseT;
  123. /** Transmitter repitition frequency */
  124. Real TxFreq;
  125. /** Receiver type */
  126. ReceiverType RType;
  127. MatrixXr ModelledData;
  128. /** Centre of time gate */
  129. VectorXr TimeGates;
  130. /** Width of time gates */
  131. VectorXr GateWidths;
  132. /** Pulse waveform */
  133. VectorXr Waveform;
  134. /** Current Amplitude of pulse */
  135. VectorXr TxAmp;
  136. /** Current -delta of pulse */
  137. VectorXr TxDelta;
  138. /** Current derivative of pulse */
  139. VectorXr TxDiff;
  140. /** times associated with TxAmp segments */
  141. VectorXr TxAbs;
  142. private:
  143. }; // ----- end of class InstrumentTem -----
  144. } // End of namespace Lemma
  145. #endif // __TEMINSTRUMENT_H