Main Lemma Repository
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

RectilinearGridReader.h 3.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  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 (const std::string& name);
  62. /** Default protected constructor, use Delete */
  63. ~RectilinearGridReader ();
  64. private:
  65. // ==================== DATA MEMBERS =========================
  66. /** Object holding constructed Grid */
  67. std::shared_ptr<RectilinearGrid> rGrid;
  68. /** Performs actual file parsing */
  69. std::shared_ptr<ASCIIParser> Parser;
  70. }; // ----- end of class RectilinearGridReader -----
  71. } // ----- end of Lemma name -----
  72. #endif // ----- #ifndef RECTILINEARGRIDREADER_INC -----