Main Lemma Repository
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.

RectilinearGridVTKExporter.h 3.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  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/25/2013 08:20:01 AM
  11. * @version $Id$
  12. * @author Trevor Irons (ti)
  13. * @email Trevor.Irons@xri-geo.com
  14. * @copyright Copyright (c) 2013, XRI Geophysics, LLC
  15. * @copyright Copyright (c) 2013, Trevor Irons
  16. */
  17. #ifndef RECTILINEARGRIDVTKEXPORTER_INC
  18. #define RECTILINEARGRIDVTKEXPORTER_INC
  19. #ifdef LEMMAUSEVTK
  20. #include "LemmaObject.h"
  21. #include "RectilinearGrid.h"
  22. #include <vtkSmartPointer.h>
  23. #include "vtkXMLRectilinearGridWriter.h"
  24. #include "vtkRectilinearGrid.h"
  25. #include "vtkDoubleArray.h"
  26. #include "vtkFieldData.h"
  27. #include "vtkCellData.h"
  28. namespace Lemma {
  29. /**
  30. \brief Exports a LemmaRectilinearGrid into a VTKRectilinearGrid.
  31. \details Results can then be dumped to a VTK file or used directly.
  32. */
  33. class RectilinearGridVTKExporter : public LemmaObject {
  34. friend std::ostream &operator<<(std::ostream &stream,
  35. const RectilinearGridVTKExporter &ob);
  36. public:
  37. // ==================== LIFECYCLE =======================
  38. /**
  39. * @copybrief LemmaObject::New()
  40. * @copydetails LemmaObject::New()
  41. */
  42. static RectilinearGridVTKExporter* New();
  43. /**
  44. * Factory method for generating concrete class.
  45. * @return a std::shared_ptr of type RectilinearGridVTKExporter
  46. */
  47. static std::shared_ptr< RectilinearGridVTKExporter > NewSP();
  48. // ==================== OPERATORS =======================
  49. // ==================== OPERATIONS =======================
  50. // ==================== ACCESS =======================
  51. /**
  52. * Sets the Grid to be exported
  53. */
  54. void SetGrid( std::shared_ptr<RectilinearGrid> Grid);
  55. // ==================== INQUIRY =======================
  56. /**
  57. * @return Returns a pointer to a vtkRectilinearGrid containing same information as the Lemma Grid.
  58. */
  59. vtkSmartPointer<vtkRectilinearGrid> GetVTKGrid();
  60. /**
  61. * Writes the exported VTKGrid out to a .vtr XML file
  62. * @param[in] name is the filename to write to. The .vtr extension will be added
  63. */
  64. void WriteVTKGrid( const std::string& name );
  65. protected:
  66. // ==================== LIFECYCLE =======================
  67. /** Default protected constructor, use New */
  68. RectilinearGridVTKExporter (const std::string& name);
  69. /** Default protected destructor, use Delete */
  70. ~RectilinearGridVTKExporter ();
  71. private:
  72. void BuildVTKRectilinearGrid();
  73. // ==================== DATA MEMBERS =========================
  74. /** The Grid to convert from */
  75. std::shared_ptr<RectilinearGrid> Grid;
  76. /** The Grid to convert to */
  77. vtkSmartPointer<vtkRectilinearGrid> VTKGrid;
  78. }; // ----- end of class RectilinearGridVTKExporter -----
  79. } // ----- end of Lemma name -----
  80. #endif // ----- not LEMMAUSEVTK -----
  81. #endif // ----- #ifndef RECTILINEARGRIDVTKEXPORTER_INC -----