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.

CompactSupportEMSource.h 4.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. /* This file is part of Lemma, a geophysical modelling and inversion API.
  2. * More information is available at http://lemmasoftware.org
  3. */
  4. /* This Source Code Form is subject to the terms of the Mozilla Public
  5. * License, v. 2.0. If a copy of the MPL was not distributed with this
  6. * file, You can obtain one at http://mozilla.org/MPL/2.0/.
  7. */
  8. /**
  9. * @file
  10. * @date 02/01/2018 08:26:44 AM
  11. * @version $Id$
  12. * @author Trevor Irons (ti)
  13. * @email tirons@egi.utah.edu
  14. * @copyright Copyright (c) 2018, University of Utah
  15. * @copyright Copyright (c) 2018, Lemma Software, LLC
  16. */
  17. #ifndef COMPACTSUPPORTEMSOURCE_INC
  18. #define COMPACTSUPPORTEMSOURCE_INC
  19. #pragma once
  20. #include "LemmaObject.h"
  21. namespace Lemma {
  22. /**
  23. * \ingroup FDEM1D
  24. * \brief Abstract base class representing an EM source.
  25. * \details Derived types include simple dipoles, as well as line sources or wire loops.
  26. */
  27. class CompactSupportEMSource : public LemmaObject {
  28. friend std::ostream &operator<<(std::ostream &stream, const CompactSupportEMSource &ob);
  29. protected:
  30. /*
  31. * This key is used to lock the constructor. It is protected so that inhereted
  32. * classes also have the key to contruct their base class.
  33. */
  34. struct ctor_key {};
  35. public:
  36. // ==================== LIFECYCLE =======================
  37. /**
  38. * Default constructor.
  39. * @note This method is locked, and cannot be called directly.
  40. * The reason that the method is public is to enable the use
  41. * of make_shared whilst enforcing the use of shared_ptr,
  42. * in c++-17, this curiosity may be resolved.
  43. * @see CompactSupportEMSource::NewSP
  44. */
  45. explicit CompactSupportEMSource ( const ctor_key& );
  46. /**
  47. * DeSerializing constructor.
  48. * @note This method is locked, and cannot be called directly.
  49. * The reason that the method is public is to enable the use
  50. * of make_shared whilst enforcing the use of shared_ptr,
  51. * in c++-17, this curiosity may be resolved.
  52. * @see CompactSupportEMSource::DeSerialize
  53. */
  54. CompactSupportEMSource ( const YAML::Node& node, const ctor_key& );
  55. /**
  56. * Default destructor.
  57. * @note This method should never be called due to the mandated
  58. * use of smart pointers. It is necessary to keep the method
  59. * public in order to allow for the use of the more efficient
  60. * make_shared constructor.
  61. */
  62. virtual ~CompactSupportEMSource ();
  63. /**
  64. * Uses YAML to serialize this object.
  65. * @return a YAML::Node
  66. * @see CompactSupportEMSource::DeSerialize
  67. */
  68. virtual YAML::Node Serialize() const;
  69. /*
  70. * Factory method for generating concrete class.
  71. * @return a std::shared_ptr of type CompactSupportEMSource
  72. */
  73. static std::shared_ptr< CompactSupportEMSource > NewSP();
  74. /**
  75. * Constructs an CompactSupportEMSource object from a YAML::Node.
  76. * @see CompactSupportEMSource::Serialize
  77. */
  78. static std::shared_ptr<CompactSupportEMSource> DeSerialize(const YAML::Node& node);
  79. // ==================== OPERATORS =======================
  80. // ==================== OPERATIONS =======================
  81. // ==================== ACCESS =======================
  82. // ==================== INQUIRY =======================
  83. /**
  84. * Returns the name of the underlying class, similiar to Python's type
  85. * @return string of class name
  86. */
  87. virtual inline std::string GetName() const {
  88. return CName;
  89. }
  90. protected:
  91. // ==================== LIFECYCLE =======================
  92. /** Copy is disabled */
  93. CompactSupportEMSource( const CompactSupportEMSource& ) = delete;
  94. // ==================== DATA MEMBERS =========================
  95. private:
  96. /** ASCII string representation of the class name */
  97. static constexpr auto CName = "CompactSupportEMSource";
  98. }; // ----- end of class CompactSupportEMSource -----
  99. } // ----- end of namespace Lemma ----
  100. /* vim: set tabstop=4 expandtab: */
  101. /* vim: set filetype=cpp: */
  102. #endif // ----- #ifndef COMPACTSUPPORTEMSOURCE_INC -----