Main Lemma Repository
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.

HankelTransformFactory.h 5.2KB

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