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.

GridReader.h 2.6KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. /* This file is part of Lemma, a geophysical modelling and inversion API */
  2. /* This Source Code Form is subject to the terms of the Mozilla Public
  3. * License, v. 2.0. If a copy of the MPL was not distributed with this
  4. * file, You can obtain one at http://mozilla.org/MPL/2.0/.
  5. */
  6. /**
  7. @file
  8. @date 09/23/2013 11:25:11 AM
  9. @version $Id$
  10. @author Trevor Irons (ti)
  11. @email Trevor.Irons@xri-geo.com
  12. @copyright Copyright (c) 2013, XRI Geophysics, LLC
  13. @copyright Copyright (c) 2013, Trevor Irons
  14. **/
  15. #ifndef GRIDREADER_INC
  16. #define GRIDREADER_INC
  17. #include "LemmaObject.h"
  18. #include "Grid.h"
  19. namespace Lemma {
  20. /**
  21. @class
  22. \ingroup LemmaCore
  23. \brief Abstract class for grid readers.
  24. \details Provides a consistent interface for reading grid files in Lemma.
  25. */
  26. class GridReader : public LemmaObject {
  27. friend std::ostream &operator << (std::ostream &stream, const GridReader &ob) {
  28. stream << ob.Serialize() << "\n---\n"; // End of doc --- as a direct stream should encapulste thingy
  29. return stream;
  30. }
  31. public:
  32. // ==================== LIFECYCLE =======================
  33. // ==================== OPERATORS =======================
  34. // ==================== OPERATIONS =======================
  35. virtual void ReadASCIIGridFile( const std::string& name )=0;
  36. virtual std::shared_ptr< Grid > GetGrid( ) const =0;
  37. // ==================== ACCESS =======================
  38. // ==================== INQUIRY =======================
  39. /** Returns the name of the underlying class, similiar to Python's type */
  40. virtual std::string GetName() const = 0;
  41. protected:
  42. // ==================== LIFECYCLE =======================
  43. /** Default protected constructor, use New */
  44. GridReader ( const ctor_key& key ) : LemmaObject( key ) {
  45. }
  46. /** Default protected constructor, use New */
  47. GridReader ( const YAML::Node& node, const ctor_key& key ) : LemmaObject( node, key ) {
  48. }
  49. /** Default protected constructor, use Delete */
  50. ~GridReader () {
  51. }
  52. private:
  53. /** ASCII string representation of the class name */
  54. static constexpr auto CName = "GridReader";
  55. // ==================== DATA MEMBERS =========================
  56. }; // ----- end of class GridReader -----
  57. } // ----- end of Lemma name -----
  58. #endif // ----- #ifndef GRIDREADER_INC -----