Lemma is an Electromagnetics API
Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

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