Main Lemma Repository
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

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