Main Lemma Repository
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

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