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.

RectilinearGridReader.h 3.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  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:05: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 RECTILINEARGRIDREADER_INC
  16. #define RECTILINEARGRIDREADER_INC
  17. #include "GridReader.h"
  18. #include "RectilinearGrid.h"
  19. #include "ASCIIParser.h"
  20. namespace Lemma {
  21. /**
  22. @class
  23. \brief
  24. \details
  25. */
  26. class RectilinearGridReader : public GridReader {
  27. friend std::ostream &operator<<(std::ostream &stream,
  28. const RectilinearGridReader &ob);
  29. public:
  30. // ==================== LIFECYCLE =======================
  31. /**
  32. * Factory method for generating concrete class.
  33. * @return a std::shared_ptr of type RectilinearGridReader
  34. */
  35. static std::shared_ptr< RectilinearGridReader > NewSP();
  36. // ==================== OPERATORS =======================
  37. // ==================== OPERATIONS =======================
  38. /**
  39. Reads a .mod file, a simple representation of the grid. These files
  40. have the following format:
  41. @verbatim
  42. nx ny nz // number of cells in x, y, and z
  43. ox oy oz // grid offset of top SW corner
  44. hx[0] hx[1] ... hx[nx-1] // grid cell spacing in x, from 0 to nx-1
  45. hy[0] hy[1] ... hy[ny-1] // grid cell spacing in y, from 0 to ny-1
  46. hz[0] hz[1] ... hz[nz-1] // grid cell spacing in z, from 0 to nz-1
  47. // c++ style (//) comments are allowed anywhere, c-style are not
  48. @endverbatim
  49. */
  50. void ReadASCIIGridFile( const std::string& name );
  51. // ==================== ACCESS =======================
  52. /**
  53. * Accessor method for the underlying RectilinearGrid class constructed
  54. * from the input file.
  55. */
  56. std::shared_ptr<Grid> GetGrid();
  57. // ==================== INQUIRY =======================
  58. protected:
  59. // ==================== LIFECYCLE =======================
  60. /** Default protected constructor, use New */
  61. RectilinearGridReader ( );
  62. /** Default protected constructor, use Delete */
  63. ~RectilinearGridReader ();
  64. private:
  65. // ==================== DATA MEMBERS =========================
  66. /** ASCII string representation of the class name */
  67. static constexpr auto CName = "RectilinearGridReader";
  68. /** Object holding constructed Grid */
  69. std::shared_ptr<RectilinearGrid> rGrid;
  70. /** Performs actual file parsing */
  71. std::shared_ptr<ASCIIParser> Parser;
  72. }; // ----- end of class RectilinearGridReader -----
  73. } // ----- end of Lemma name -----
  74. #endif // ----- #ifndef RECTILINEARGRIDREADER_INC -----