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.

RectilinearGridVTKExporter.h 3.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  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 "vtkXMLRectilinearGridWriter.h"
  23. #include "vtkRectilinearGrid.h"
  24. #include "vtkDoubleArray.h"
  25. #include "vtkFieldData.h"
  26. #include "vtkCellData.h"
  27. namespace Lemma {
  28. /**
  29. \brief Exports a LemmaRectilinearGrid into a VTKRectilinearGrid.
  30. \details Results can then be dumped to a VTK file or used directly.
  31. */
  32. class RectilinearGridVTKExporter : public LemmaObject {
  33. friend std::ostream &operator<<(std::ostream &stream,
  34. const RectilinearGridVTKExporter &ob);
  35. public:
  36. // ==================== LIFECYCLE =======================
  37. /**
  38. * @copybrief LemmaObject::New()
  39. * @copydetails LemmaObject::New()
  40. */
  41. static RectilinearGridVTKExporter* New();
  42. /**
  43. * @copybrief LemmaObject::Delete()
  44. * @copydetails LemmaObject::Delete()
  45. */
  46. void Delete();
  47. // ==================== OPERATORS =======================
  48. // ==================== OPERATIONS =======================
  49. // ==================== ACCESS =======================
  50. /**
  51. * Sets the Grid to be exported
  52. */
  53. void SetGrid(RectilinearGrid* Grid);
  54. // ==================== INQUIRY =======================
  55. /**
  56. * @return Returns a pointer to a vtkRectilinearGrid containing same information as the Lemma Grid.
  57. */
  58. vtkRectilinearGrid* GetVTKGrid();
  59. /**
  60. * Writes the exported VTKGrid out to a .vtr XML file
  61. * @param[in] name is the filename to write to. The .vtr extension will be added
  62. */
  63. void WriteVTKGrid( const std::string& name );
  64. protected:
  65. // ==================== LIFECYCLE =======================
  66. /** Default protected constructor, use New */
  67. RectilinearGridVTKExporter (const std::string& name);
  68. /** Default protected destructor, use Delete */
  69. ~RectilinearGridVTKExporter ();
  70. /**
  71. * @copybrief LemmaObject::Release()
  72. * @copydetails LemmaObject::Release()
  73. */
  74. void Release();
  75. private:
  76. void BuildVTKRectilinearGrid();
  77. // ==================== DATA MEMBERS =========================
  78. /** The Grid to convert from */
  79. RectilinearGrid* Grid;
  80. /** The Grid to convert to */
  81. vtkRectilinearGrid* VTKGrid;
  82. }; // ----- end of class RectilinearGridVTKExporter -----
  83. } // ----- end of Lemma name -----
  84. #endif // ----- not LEMMAUSEVTK -----
  85. #endif // ----- #ifndef RECTILINEARGRIDVTKEXPORTER_INC -----