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.

PolygonalWireAntenna.h 5.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  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 05/18/2010
  9. @version $Id: PolygonalWireAntenna.h 211 2015-02-27 05:43:26Z tirons $
  10. **/
  11. #include "WireAntenna.h"
  12. #ifndef POLYGONALWIREANTENNA_INC
  13. #define POLYGONALWIREANTENNA_INC
  14. namespace Lemma {
  15. // ===================================================================
  16. // Class: PolygonalWireAntenna
  17. /// \brief Class representing polygonal wire antennae.
  18. /// \details For EM calculations, dipoles representing this loop are
  19. /// created dynamically, depending on receiver location.
  20. /// @todo enforce minimum dipole moment.
  21. // ===================================================================
  22. class PolygonalWireAntenna : public WireAntenna {
  23. friend std::ostream &operator<<(std::ostream &stream,
  24. const PolygonalWireAntenna &ob);
  25. public:
  26. // ==================== LIFECYCLE =======================
  27. /**
  28. * Declares all memory and returns a new instance.
  29. */
  30. static PolygonalWireAntenna* New();
  31. /**
  32. * @copybrief LemmaObject::Delete()
  33. * @copydetails LemmaObject::Delete()
  34. */
  35. void Delete();
  36. /// Makes a deep copy of this antenna with all connections except
  37. /// the dipole approximation.
  38. PolygonalWireAntenna* Clone();
  39. // ==================== OPERATORS =======================
  40. // ==================== OPERATIONS =======================
  41. /// Approximates with ungrounded electrical dipoles, such that
  42. /// minDipoleRatio is satisfied.
  43. virtual void ApproximateWithElectricDipoles(const Vector3r &rp);
  44. /** Sets the minimum ratio for dipole moments to be used to
  45. * approximate the loop. A smaller ratio yields a more accurate
  46. * result, but is more expensive. Default is (1/5).
  47. */
  48. void SetMinDipoleRatio(const Real& ratio);
  49. /** Sets the minimum moment for dipole moments to be used to
  50. * approximate the loop.
  51. */
  52. void SetMinDipoleMoment(const Real& m);
  53. /** Sets the minimum moment for dipole moments to be used to
  54. * approximate the loop.
  55. */
  56. void SetMaxDipoleMoment(const Real& m);
  57. // ==================== ACCESS =======================
  58. // ==================== INQUIRY =======================
  59. #ifdef HAVE_YAMLCPP
  60. /**
  61. * Uses YAML to serialize this object.
  62. * @return a YAML::Node
  63. */
  64. YAML::Node Serialize() const;
  65. /**
  66. * Constructs an object from a YAML::Node.
  67. */
  68. static PolygonalWireAntenna* DeSerialize(const YAML::Node& node);
  69. #endif
  70. protected:
  71. // ==================== LIFECYCLE =======================
  72. /// Default protected constructor.
  73. PolygonalWireAntenna (const std::string& name);
  74. #ifdef HAVE_YAMLCPP
  75. /// Default protected constructor.
  76. PolygonalWireAntenna (const YAML::Node& node);
  77. #endif
  78. /// Default protected constructor.
  79. ~PolygonalWireAntenna ();
  80. /**
  81. * @copybrief LemmaObject::Release()
  82. * @copydetails LemmaObject::Release()
  83. */
  84. void Release();
  85. // ==================== DATA MEMBERS =======================
  86. /// minimum ratio of dipole moment to distance to receiver point
  87. Real minDipoleRatio;
  88. /// Maximum dipole moment allowed
  89. Real minDipoleMoment;
  90. /// Maximum dipole moment allowed
  91. Real maxDipoleMoment;
  92. /// appends
  93. void PushXYZDipoles(const Vector3r &step, const Vector3r &cp,
  94. const Vector3r &dir,
  95. std::vector<DipoleSource*> &Dipoles) ;
  96. /// corrects for overstep
  97. void CorrectOverstepXYZDipoles(const Vector3r &step,
  98. const Vector3r &cp,
  99. const Vector3r &dir,
  100. std::vector<DipoleSource*> &Dipoles );
  101. // ==================== OPERATIONS =======================
  102. /// Returns the nearest point on a line segment to another point.
  103. /// if the point is not on the line-segment, return the
  104. /// nearest end-point
  105. /// @param[in] p0, p1 define the line segement
  106. /// @param[in] rp is a point in space. The function returns the
  107. /// closest point on the line to this point.
  108. /// @return The point (Lemma::Vector3r) on the line defined by p0,
  109. /// and p1, closest to rp
  110. Vector3r ClosestPointOnLine(const Vector3r &p0, const Vector3r &p1,
  111. const Vector3r &rp);
  112. /// Interpolates dipoles along line segment defined by p0 and p1.
  113. void InterpolateLineSegment(const Vector3r &p0, const Vector3r &p1,
  114. const Vector3r &rp);
  115. /// List of the dipoles
  116. //std::vector<DipoleSource*> Dipoles;
  117. /// Points that define this loop
  118. //Vector3Xr Points;
  119. private:
  120. Vector3r rRepeat;
  121. }; // ----- end of class PolygonalWireAntenna -----
  122. } // ----- end of Lemma name -----
  123. #endif // ----- #ifndef POLYGONALWIREANTENNA_INC -----