123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239 |
- /* This file is part of Lemma, a geophysical modelling and inversion API */
-
- /* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
- /**
- @file
- @author Trevor Irons
- @date 12/16/2009
- @version $Id: WireAntenna.h 201 2015-01-03 00:07:47Z tirons $
- **/
-
- #ifndef __WIREANTENNA_H
- #define __WIREANTENNA_H
-
- #include "DipoleSource.h"
-
- #ifdef LEMMAUSEVTK
- #include "vtkActor.h"
- #endif
-
- namespace Lemma {
-
-
- // ===================================================================
- /**
- * \ingroup FDEM1D
- * \brief Class representing a wire antennae.
- * \details This is an abstract class.
- */
- // ===================================================================
- class WireAntenna : public LemmaObject {
-
- friend std::ostream &operator<<(std::ostream &stream, const WireAntenna &ob);
-
- public:
-
- // ==================== LIFECYCLE =======================
-
- /** Locked default constructor */
- explicit WireAntenna ( const ctor_key& );
-
- /** Locked deserializing constructor */
- WireAntenna ( const YAML::Node& node, const ctor_key& );
-
- /** Destructor */
- virtual ~WireAntenna();
-
- /**
- * Initialises antenna to contain no points, with no current
- * and no frequency. NumberOfTurns set to 1
- */
- static std::shared_ptr<WireAntenna> NewSP();
-
- /**
- * Provides deep copy
- */
- virtual std::shared_ptr<WireAntenna> Clone() const ;
-
- /**
- * Uses YAML to serialize this object.
- * @return a YAML::Node
- */
- YAML::Node Serialize() const;
-
- /**
- * Constructs an object from a YAML::Node.
- */
- static std::shared_ptr<WireAntenna> DeSerialize( const YAML::Node& node );
-
- /**
- * Constructs an object from a string representation of a YAML::Node. This is primarily
- * used in Python wrapping
- */
- static std::shared_ptr<WireAntenna> DeSerialize( const std::string& node ) {
- return WireAntenna::DeSerialize(YAML::Load(node));
- }
-
- // ==================== OPERATORS =======================
-
- // ==================== OPERATIONS =======================
-
- /**
- * Approximates with evenly spaced electric dipoles around loop
- * @param[in] delta is the spacing between moments
- */
- virtual void ApproximateWithElectricDipoles(const Real &delta);
-
- // ==================== ACCESS =======================
-
- /**
- * Sets the number of turns in the loop, default is 1
- * @param[in] nturns is the number of turns of the loop.
- */
- void SetNumberOfTurns(const int &nturns);
-
- /**
- * Sets the number of points in the loop
- */
- void SetNumberOfPoints(const int &np);
-
- /**
- * Sets a corner point of the loop. Counting starts at 0. It
- * is not required to have the loop be closed right now, but
- * its a good idea.
- */
- void SetPoint(const int &p, const Vector3r &pos);
-
- /**
- * Sets a corner point of the loop. Counting starts at 0. It
- * is not required to have the loop be closed right now, but
- * its a good idea.
- */
- void SetPoint(const int &p, const Real&x, const Real& y, const Real& z);
-
- /** Sets the frequency of the current in the loop, default is 0
- * @param[in] ifreq is the frequency number to set
- * @param[in] freq is the frequency (Hz) of the current
- */
- void SetFrequency(const int& ifreq, const Real &freq);
- /**
- * Sets the number of frequencies.
- * @param[in] nfreq is the number of frequencies that will be
- * computed.
- */
- void SetNumberOfFrequencies(const int& nfreq);
-
- /**
- * Sets the current in the loop, default is 0
- * @param[in] amp is the current in the loop, in Amperes
- */
- void SetCurrent(const Real &);
-
- // ==================== INQUIRY =======================
-
- /**
- * Returns the number of turns
- * @return the number of turns of the loop.
- */
- int GetNumberOfTurns( );
-
- /**
- * Returns all of the points
- */
- Vector3Xr GetPoints();
-
- /**
- * Returns all of the points in a general matrix, useful for python wrapper
- */
- MatrixXr GetPointsMat();
-
- /**
- * Returns the frequency in the loop.
- * @return is the frequency in the loop in Hz
- */
- Real GetFrequency(const int& ifreq);
-
-
- /**
- * Returns the current in the loop.
- * @return is the Current
- */
- Real GetCurrent( );
-
-
- /**
- * Returns pointer to a dipole source
- */
- std::shared_ptr<DipoleSource> GetDipoleSource(const int &dip);
-
- /**
- * returns number of dipoles used to approximate this
- * loop
- */
- size_t GetNumberOfDipoles();
-
- /**
- * @return the number of frequencies of this wire loop.
- */
- int GetNumberOfFrequencies();
-
- #ifdef LEMMAUSEVTK
- /** Returns an actor that can be placed into a vtk scene easily
- * Note that this function throws a pointer, it is the
- * receivers job to manage this memory!
- */
- vtkActor* GetVtkActor(const int &idip);
- #endif
-
- /** Returns true or false if loop is horizontally planar
- */
- bool IsHorizontallyPlanar();
-
- /** Returns the name of the underlying class, similiar to Python's type */
- virtual std::string GetName() const;
-
- protected:
-
- // ==================== DATA MEMBERS =======================
-
- /**
- * Number of points that define the loop
- */
- int NumberOfPoints;
-
- /**
- * Current in antennae (Amps)
- */
- Real Current;
-
- /**
- * Number of turns
- */
- int NumberOfTurns;
-
- /**
- * List of the dipoles
- */
- std::vector< std::shared_ptr<DipoleSource> > Dipoles;
-
- /**
- * Points that define this loop
- */
- Vector3Xr Points;
-
- /**
- * Frequencies of the loop.
- */
- VectorXr Freqs;
-
- private:
-
- static constexpr auto CName = "WireAntenna";
-
- }; // ----- end of class WireAntenna -----
-
- }
- #endif // __WIREANTENNA_H
|