Lemma is an Electromagnetics API
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

HankelTransformFactory.h 5.4KB

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