Main Lemma Repository
Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

HankelTransformFactory.h 5.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  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 FHTKey101::NewSP();
  88. case FHTKEY51:
  89. return FHTKey51::NewSP();
  90. case CHAVE:
  91. return GQChave::NewSP();
  92. case QWEKEY:
  93. return QWEKey::NewSP();
  94. default:
  95. std::cerr << "HankelTransformFactory only works with defined types\n";
  96. }
  97. }
  98. /**
  99. * Constructs an HankelTransformFactory object from a YAML::Node.
  100. * @see HankelTransformFactory::Serialize
  101. */
  102. static std::shared_ptr<HankelTransformFactory> DeSerialize(const YAML::Node& node);
  103. // ==================== OPERATORS =======================
  104. // ==================== OPERATIONS =======================
  105. // ==================== ACCESS =======================
  106. // ==================== INQUIRY =======================
  107. /**
  108. * Returns the name of the underlying class, similiar to Python's type
  109. * @return string of class name
  110. */
  111. virtual inline std::string GetName() const {
  112. return CName;
  113. }
  114. protected:
  115. // ==================== LIFECYCLE =======================
  116. /** Copy is disabled */
  117. HankelTransformFactory( const HankelTransformFactory& ) = delete;
  118. // ==================== DATA MEMBERS =========================
  119. private:
  120. /** ASCII string representation of the class name */
  121. static constexpr auto CName = "HankelTransformFactory";
  122. }; // ----- end of class HankelTransformFactory -----
  123. } // ----- end of namespace Lemma ----
  124. /* vim: set tabstop=4 expandtab: */
  125. /* vim: set filetype=cpp: */