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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  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 04/18/2018 11:59:00 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. #pragma once
  18. #include "LemmaObject.h"
  19. #include "FHTAnderson801.h"
  20. #include "FHT.h"
  21. #include "FHTKey201.h"
  22. #include "FHTKey101.h"
  23. #include "FHTKey51.h"
  24. #include "QWEKey.h"
  25. #include "GQChave.h"
  26. namespace Lemma {
  27. /**
  28. * \ingroup FDEM1D
  29. * \brief Factory generator of HankelTranform types
  30. * \details
  31. */
  32. class HankelTransformFactory : public LemmaObject {
  33. friend std::ostream &operator<<(std::ostream &stream, const HankelTransformFactory &ob);
  34. protected:
  35. /*
  36. * This key is used to lock the constructor. It is protected so that inhereted
  37. * classes also have the key to contruct their base class.
  38. */
  39. struct ctor_key {};
  40. public:
  41. // ==================== LIFECYCLE =======================
  42. /**
  43. * Default constructor.
  44. * @note This method is locked, and cannot be called directly.
  45. * The reason that the method is public is to enable the use
  46. * of make_shared whilst enforcing the use of shared_ptr,
  47. * in c++-17, this curiosity may be resolved.
  48. * @see HankelTransformFactory::NewSP
  49. */
  50. explicit HankelTransformFactory ( const ctor_key& );
  51. /**
  52. * DeSerializing constructor.
  53. * @note This method is locked, and cannot be called directly.
  54. * The reason that the method is public is to enable the use
  55. * of make_shared whilst enforcing the use of shared_ptr,
  56. * in c++-17, this curiosity may be resolved.
  57. * @see HankelTransformFactory::DeSerialize
  58. */
  59. HankelTransformFactory ( const YAML::Node& node, const ctor_key& );
  60. /**
  61. * Default destructor.
  62. * @note This method should never be called due to the mandated
  63. * use of smart pointers. It is necessary to keep the method
  64. * public in order to allow for the use of the more efficient
  65. * make_shared constructor.
  66. */
  67. virtual ~HankelTransformFactory ();
  68. /**
  69. * Uses YAML to serialize this object.
  70. * @return a YAML::Node
  71. * @see HankelTransformFactory::DeSerialize
  72. */
  73. virtual YAML::Node Serialize() const;
  74. /*
  75. * Factory method for generating concrete class.
  76. * @return a std::shared_ptr of type HankelTransformFactory
  77. */
  78. //static std::shared_ptr< HankelTransformFactory > NewSP();
  79. static std::shared_ptr< HankelTransform > NewSP( const HANKELTRANSFORMTYPE Type) {
  80. switch (Type) {
  81. case ANDERSON801:
  82. return FHTAnderson801::NewSP();
  83. case FHTKEY201:
  84. //return FHTKey201::NewSP();
  85. return FHT<FHTKEY201>::NewSP();
  86. case FHTKEY101:
  87. return FHT<FHTKEY101>::NewSP();
  88. //return FHTKey101::NewSP();
  89. case FHTKEY51:
  90. return FHT<FHTKEY51>::NewSP();
  91. case FHTKONG61:
  92. return FHT<FHTKONG61>::NewSP();
  93. case FHTKONG121:
  94. return FHT<FHTKONG121>::NewSP();
  95. case FHTKONG241:
  96. return FHT<FHTKONG241>::NewSP();
  97. case CHAVE:
  98. return GQChave::NewSP();
  99. case QWEKEY:
  100. return QWEKey::NewSP();
  101. case IRONS:
  102. return FHT<IRONS>::NewSP();
  103. default:
  104. std::cerr << "HankelTransformFactory only works with defined types\n";
  105. return FHTAnderson801::NewSP(); // dummy return
  106. }
  107. }
  108. /**
  109. * Constructs an HankelTransformFactory object from a YAML::Node.
  110. * @see HankelTransformFactory::Serialize
  111. */
  112. static std::shared_ptr<HankelTransformFactory> DeSerialize(const YAML::Node& node);
  113. // ==================== OPERATORS =======================
  114. // ==================== OPERATIONS =======================
  115. // ==================== ACCESS =======================
  116. // ==================== INQUIRY =======================
  117. /**
  118. * Returns the name of the underlying class, similiar to Python's type
  119. * @return string of class name
  120. */
  121. virtual inline std::string GetName() const {
  122. return CName;
  123. }
  124. protected:
  125. // ==================== LIFECYCLE =======================
  126. /** Copy is disabled */
  127. HankelTransformFactory( const HankelTransformFactory& ) = delete;
  128. // ==================== DATA MEMBERS =========================
  129. private:
  130. /** ASCII string representation of the class name */
  131. static constexpr auto CName = "HankelTransformFactory";
  132. }; // ----- end of class HankelTransformFactory -----
  133. } // ----- end of namespace Lemma ----
  134. /* vim: set tabstop=4 expandtab: */
  135. /* vim: set filetype=cpp: */