Lemma is an Electromagnetics API
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.

WireAntenna.h 6.9KB

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