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

WireAntenna.h 6.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230
  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/16/2009
  9. @version $Id: WireAntenna.h 201 2015-01-03 00:07:47Z tirons $
  10. **/
  11. #ifndef __WIREANTENNA_H
  12. #define __WIREANTENNA_H
  13. #include "DipoleSource.h"
  14. #ifdef LEMMAUSEVTK
  15. #include "vtkActor.h"
  16. #endif
  17. namespace Lemma {
  18. // ===================================================================
  19. /** Class: WireAntenna
  20. * \brief Class representing a wire antennae.
  21. * \details This is an abstract class.
  22. */
  23. // ===================================================================
  24. class WireAntenna : public LemmaObject {
  25. friend std::ostream &operator<<(std::ostream &stream, const WireAntenna &ob);
  26. public:
  27. // ==================== LIFECYCLE =======================
  28. /** Locked default constructor */
  29. explicit WireAntenna ( const ctor_key& );
  30. /** Locked deserializing constructor */
  31. WireAntenna ( const YAML::Node& node, const ctor_key& );
  32. /** Destructor */
  33. virtual ~WireAntenna();
  34. /**
  35. * Initialises antenna to contain no points, with no current
  36. * and no frequency. NumberOfTurns set to 1
  37. */
  38. static std::shared_ptr<WireAntenna> NewSP();
  39. /**
  40. * Provides deep copy
  41. */
  42. virtual std::shared_ptr<WireAntenna> Clone() const ;
  43. /**
  44. * Uses YAML to serialize this object.
  45. * @return a YAML::Node
  46. */
  47. YAML::Node Serialize() const;
  48. /**
  49. * Constructs an object from a YAML::Node.
  50. */
  51. static std::shared_ptr<WireAntenna> DeSerialize( const YAML::Node& node );
  52. // ==================== OPERATORS =======================
  53. // ==================== OPERATIONS =======================
  54. /**
  55. * Approximates with evenly spaced electric dipoles around loop
  56. * @param[in] delta is the spacing between moments
  57. */
  58. virtual void ApproximateWithElectricDipoles(const Real &delta);
  59. // ==================== ACCESS =======================
  60. /**
  61. * Sets the number of turns in the loop, default is 1
  62. * @param[in] nturns is the number of turns of the loop.
  63. */
  64. void SetNumberOfTurns(const int &nturns);
  65. /**
  66. * Sets the number of points in the loop
  67. */
  68. void SetNumberOfPoints(const int &np);
  69. /**
  70. * Sets a corner point of the loop. Counting starts at 0. It
  71. * is not required to have the loop be closed right now, but
  72. * its a good idea.
  73. */
  74. void SetPoint(const int &p, const Vector3r &pos);
  75. /**
  76. * Sets a corner point of the loop. Counting starts at 0. It
  77. * is not required to have the loop be closed right now, but
  78. * its a good idea.
  79. */
  80. void SetPoint(const int &p, const Real&x, const Real& y, const Real& z);
  81. /** Sets the frequency of the current in the loop, default is 0
  82. * @param[in] ifreq is the frequency number to set
  83. * @param[in] freq is the frequency (Hz) of the current
  84. */
  85. void SetFrequency(const int& ifreq, const Real &freq);
  86. /**
  87. * Sets the number of frequencies.
  88. * @param[in] nfreq is the number of frequencies that will be
  89. * computed.
  90. */
  91. void SetNumberOfFrequencies(const int& nfreq);
  92. /**
  93. * Sets the current in the loop, default is 0
  94. * @param[in] amp is the current in the loop, in Amperes
  95. */
  96. void SetCurrent(const Real &amp);
  97. // ==================== INQUIRY =======================
  98. /**
  99. * Returns the number of turns
  100. * @return the number of turns of the loop.
  101. */
  102. int GetNumberOfTurns( );
  103. /**
  104. * Returns all of the points
  105. */
  106. Vector3Xr GetPoints();
  107. /**
  108. * Returns all of the points in a general matrix, useful for python wrapper
  109. */
  110. MatrixXr GetPointsMat();
  111. /**
  112. * Returns the frequency in the loop.
  113. * @return is the frequency in the loop in Hz
  114. */
  115. Real GetFrequency(const int& ifreq);
  116. /**
  117. * Returns the current in the loop.
  118. * @return is the Current
  119. */
  120. Real GetCurrent( );
  121. /**
  122. * Returns pointer to a dipole source
  123. */
  124. std::shared_ptr<DipoleSource> GetDipoleSource(const int &dip);
  125. /**
  126. * returns number of dipoles used to approximate this
  127. * loop
  128. */
  129. int GetNumberOfDipoles();
  130. /**
  131. * @return the number of frequencies of this wire loop.
  132. */
  133. int GetNumberOfFrequencies();
  134. #ifdef LEMMAUSEVTK
  135. /** Returns an actor that can be placed into a vtk scene easily
  136. * Note that this function throws a pointer, it is the
  137. * receivers job to manage this memory!
  138. */
  139. vtkActor* GetVtkActor(const int &idip);
  140. #endif
  141. /** Returns true or false if loop is horizontally planar
  142. */
  143. bool IsHorizontallyPlanar();
  144. /** Returns the name of the underlying class, similiar to Python's type */
  145. virtual std::string GetName() const;
  146. protected:
  147. // ==================== DATA MEMBERS =======================
  148. /**
  149. * Number of points that define the loop
  150. */
  151. int NumberOfPoints;
  152. /**
  153. * Current in antennae (Amps)
  154. */
  155. Real Current;
  156. /**
  157. * Number of turns
  158. */
  159. int NumberOfTurns;
  160. /**
  161. * List of the dipoles
  162. */
  163. std::vector< std::shared_ptr<DipoleSource> > Dipoles;
  164. /**
  165. * Points that define this loop
  166. */
  167. Vector3Xr Points;
  168. /**
  169. * Frequencies of the loop.
  170. */
  171. VectorXr Freqs;
  172. private:
  173. static constexpr auto CName = "WireAntenna";
  174. }; // ----- end of class WireAntenna -----
  175. }
  176. #endif // __WIREANTENNA_H