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.

LayeredEarthEMReader.h 3.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  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 09/27/2013 01:44:36 PM
  11. * @version $Id$
  12. * @author Trevor Irons (ti)
  13. * @email Trevor.Irons@lemmasoftware.org
  14. * @copyright Copyright (c) 2013, 2018 Trevor Irons
  15. */
  16. #ifndef LAYEREDEARTHEMREADER_INC
  17. #define LAYEREDEARTHEMREADER_INC
  18. #include "LemmaObject.h"
  19. #include "ASCIIParser.h"
  20. #include "LayeredEarthEM.h"
  21. namespace Lemma {
  22. /**
  23. \brief Reads ASCII representation of LayeredEarth, similiar to UBC format.
  24. \details Largely superceded by YAML serialisation, this class remains for legacy purposes.
  25. */
  26. class LayeredEarthEMReader : public LemmaObject {
  27. friend std::ostream &operator<<(std::ostream &stream,
  28. const LayeredEarthEMReader &ob);
  29. public:
  30. // ==================== LIFECYCLE =======================
  31. /**
  32. * @copybrief LemmaObject::NewSP()
  33. * @copydetails LemmaObject::NewSP()
  34. */
  35. static std::shared_ptr<LayeredEarthEMReader> NewSP();
  36. /** Default locked constructor, use New */
  37. explicit LayeredEarthEMReader ( const ctor_key& );
  38. /** Locked deserializing constructor. */
  39. LayeredEarthEMReader ( const YAML::Node& node, const ctor_key& );
  40. /** Default destructor */
  41. virtual ~LayeredEarthEMReader ();
  42. /* YAML Serializing method
  43. */
  44. //YAML::Node Serialize() const;
  45. /*
  46. * Constructs an object from a YAML::Node.
  47. */
  48. //static std::shared_ptr< LayeredEarthEMReader > DeSerialize(const YAML::Node& node);
  49. // ==================== OPERATORS =======================
  50. // ==================== OPERATIONS =======================
  51. /** Reads ASCII input file. The format is as follows
  52. @code
  53. 4 // Number of NON-AIR layers
  54. 200 10 // resistivity, thickness layer 1 [Ohm-m] [m]
  55. 20 10 // resistivity, thickness layer 2 [Ohm-m] [m]
  56. 1120 10 // resistivity, thickness layer 3 [Ohm-m] [m]
  57. 200 // resistivity of bottom layer [Ohm-m]
  58. @endcode
  59. * @param[in] name is the filename
  60. */
  61. void ReadASCIIInputFile( const std::string& name );
  62. // ==================== ACCESS =======================
  63. /** @return the pointer address of the LayeredEarthEM
  64. */
  65. std::shared_ptr<LayeredEarthEM> GetLayeredEarth();
  66. // ==================== INQUIRY =======================
  67. /** Returns the name of the underlying class, similiar to Python's type */
  68. virtual std::string GetName() const {
  69. return this->CName;
  70. }
  71. protected:
  72. // ==================== LIFECYCLE =======================
  73. private:
  74. // ==================== DATA MEMBERS =========================
  75. std::shared_ptr<LayeredEarthEM> LayEarth;
  76. /** ASCII string representation of the class name */
  77. static constexpr auto CName = "LayeredEarthEMReader";
  78. }; // ----- end of class LayeredEarthEMReader -----
  79. } // ----- end of Lemma name -----
  80. #endif // ----- #ifndef LAYEREDEARTHEMREADER_INC -----