Lemma is an Electromagnetics API
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.

LayeredEarthEMReader.h 3.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  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. struct ctor_key{};
  30. public:
  31. // ==================== LIFECYCLE =======================
  32. /**
  33. * @copybrief LemmaObject::NewSP()
  34. * @copydetails LemmaObject::NewSP()
  35. */
  36. static std::shared_ptr<LayeredEarthEMReader> NewSP();
  37. /** Default locked constructor, use New */
  38. explicit LayeredEarthEMReader ( const ctor_key& );
  39. /** Locked deserializing constructor. */
  40. LayeredEarthEMReader ( const YAML::Node& node, const ctor_key& );
  41. /** Default destructor */
  42. virtual ~LayeredEarthEMReader ();
  43. /** YAML Serializing method
  44. */
  45. YAML::Node Serialize() const;
  46. /**
  47. * Constructs an object from a YAML::Node.
  48. */
  49. static std::shared_ptr< LayeredEarthEMReader > DeSerialize(const YAML::Node& node);
  50. // ==================== OPERATORS =======================
  51. // ==================== OPERATIONS =======================
  52. /** Reads ASCII input file. The format is as follows
  53. @code
  54. 4 // Number of NON-AIR layers
  55. 200 10 // resistivity, thickness layer 1 [Ohm-m] [m]
  56. 20 10 // resistivity, thickness layer 2 [Ohm-m] [m]
  57. 1120 10 // resistivity, thickness layer 3 [Ohm-m] [m]
  58. 200 // resistivity of bottom layer [Ohm-m]
  59. @endcode
  60. * @param[in] name is the filename
  61. */
  62. void ReadASCIIInputFile( const std::string& name );
  63. // ==================== ACCESS =======================
  64. /** @return the pointer address of the LayeredEarthEM
  65. */
  66. LayeredEarthEM* GetLayeredEarth();
  67. // ==================== INQUIRY =======================
  68. /** Returns the name of the underlying class, similiar to Python's type */
  69. virtual std::string GetName() const {
  70. return this->CName;
  71. }
  72. protected:
  73. // ==================== LIFECYCLE =======================
  74. private:
  75. // ==================== DATA MEMBERS =========================
  76. LayeredEarthEM* LayEarth;
  77. /** ASCII string representation of the class name */
  78. static constexpr auto CName = "LayeredEarthEMReader";
  79. }; // ----- end of class LayeredEarthEMReader -----
  80. } // ----- end of Lemma name -----
  81. #endif // ----- #ifndef LAYEREDEARTHEMREADER_INC -----