|
@@ -0,0 +1,161 @@
|
|
1
|
+/* This file is part of Lemma, a geophysical modelling and inversion API.
|
|
2
|
+ * More information is available at http://lemmasoftware.org
|
|
3
|
+ */
|
|
4
|
+
|
|
5
|
+/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
6
|
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
7
|
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
8
|
+ */
|
|
9
|
+
|
|
10
|
+/**
|
|
11
|
+ * @file
|
|
12
|
+ * @date 07/28/18 18:04:54
|
|
13
|
+ * @version $Id$
|
|
14
|
+ * @author Trevor Irons (ti)
|
|
15
|
+ * @email Trevor.Irons@LemmaSoftware.org
|
|
16
|
+ * @copyright Copyright (c) 2018, University of Utah
|
|
17
|
+ * @copyright Copyright (c) 2018, Lemma Software, LLC
|
|
18
|
+ */
|
|
19
|
+
|
|
20
|
+#pragma once
|
|
21
|
+
|
|
22
|
+#ifndef RECTILINEARGRIDVTKIMPORTER_INC
|
|
23
|
+#define RECTILINEARGRIDVTKIMPORTER_INC
|
|
24
|
+
|
|
25
|
+#ifdef LEMMAUSEVTK
|
|
26
|
+
|
|
27
|
+#pragma once
|
|
28
|
+#include "LemmaObject.h"
|
|
29
|
+#include "RectilinearGrid.h"
|
|
30
|
+
|
|
31
|
+#include "vtkSmartPointer.h"
|
|
32
|
+#include "vtkRectilinearGrid.h"
|
|
33
|
+#include "vtkDataArray.h"
|
|
34
|
+
|
|
35
|
+namespace Lemma {
|
|
36
|
+
|
|
37
|
+ /**
|
|
38
|
+ * \ingroup LemmaCore
|
|
39
|
+ * \brief
|
|
40
|
+ * \details
|
|
41
|
+ */
|
|
42
|
+ class RectilinearGridVTKImporter : public LemmaObject {
|
|
43
|
+
|
|
44
|
+ friend std::ostream &operator<<(std::ostream &stream, const RectilinearGridVTKImporter &ob);
|
|
45
|
+
|
|
46
|
+ protected:
|
|
47
|
+ /*
|
|
48
|
+ * This key is used to lock the constructor. It is protected so that inhereted
|
|
49
|
+ * classes also have the key to contruct their base class.
|
|
50
|
+ */
|
|
51
|
+ struct ctor_key {};
|
|
52
|
+
|
|
53
|
+ public:
|
|
54
|
+
|
|
55
|
+ // ==================== LIFECYCLE =======================
|
|
56
|
+
|
|
57
|
+ /**
|
|
58
|
+ * Default constructor.
|
|
59
|
+ * @note This method is locked, and cannot be called directly.
|
|
60
|
+ * The reason that the method is public is to enable the use
|
|
61
|
+ * of make_shared whilst enforcing the use of shared_ptr,
|
|
62
|
+ * in c++-17, this curiosity may be resolved.
|
|
63
|
+ * @see RectilinearGridVTKImporter::NewSP
|
|
64
|
+ */
|
|
65
|
+ explicit RectilinearGridVTKImporter ( const ctor_key& );
|
|
66
|
+
|
|
67
|
+ /**
|
|
68
|
+ * DeSerializing constructor.
|
|
69
|
+ * @note This method is locked, and cannot be called directly.
|
|
70
|
+ * The reason that the method is public is to enable the use
|
|
71
|
+ * of make_shared whilst enforcing the use of shared_ptr,
|
|
72
|
+ * in c++-17, this curiosity may be resolved.
|
|
73
|
+ * @see RectilinearGridVTKImporter::DeSerialize
|
|
74
|
+ */
|
|
75
|
+ RectilinearGridVTKImporter ( const YAML::Node& node, const ctor_key& );
|
|
76
|
+
|
|
77
|
+ /**
|
|
78
|
+ * Default destructor.
|
|
79
|
+ * @note This method should never be called due to the mandated
|
|
80
|
+ * use of smart pointers. It is necessary to keep the method
|
|
81
|
+ * public in order to allow for the use of the more efficient
|
|
82
|
+ * make_shared constructor.
|
|
83
|
+ */
|
|
84
|
+ virtual ~RectilinearGridVTKImporter ();
|
|
85
|
+
|
|
86
|
+ /**
|
|
87
|
+ * Uses YAML to serialize this object.
|
|
88
|
+ * @return a YAML::Node
|
|
89
|
+ * @see RectilinearGridVTKImporter::DeSerialize
|
|
90
|
+ */
|
|
91
|
+ virtual YAML::Node Serialize() const;
|
|
92
|
+
|
|
93
|
+ /*
|
|
94
|
+ * Factory method for generating concrete class.
|
|
95
|
+ * @return a std::shared_ptr of type RectilinearGridVTKImporter
|
|
96
|
+ */
|
|
97
|
+ static std::shared_ptr< RectilinearGridVTKImporter > NewSP();
|
|
98
|
+
|
|
99
|
+ /**
|
|
100
|
+ * Constructs an RectilinearGridVTKImporter object from a YAML::Node.
|
|
101
|
+ * @see RectilinearGridVTKImporter::Serialize
|
|
102
|
+ */
|
|
103
|
+ static std::shared_ptr<RectilinearGridVTKImporter> DeSerialize(const YAML::Node& node);
|
|
104
|
+
|
|
105
|
+ // ==================== OPERATORS =======================
|
|
106
|
+
|
|
107
|
+ // ==================== OPERATIONS =======================
|
|
108
|
+
|
|
109
|
+ // ==================== ACCESS =======================
|
|
110
|
+
|
|
111
|
+ /**
|
|
112
|
+ * Sets the name of the VTK file to convert
|
|
113
|
+ */
|
|
114
|
+ void SetVTKInput( vtkSmartPointer<vtkRectilinearGrid> vgrid );
|
|
115
|
+
|
|
116
|
+ /**
|
|
117
|
+ * Performs the actual grid conversion
|
|
118
|
+ */
|
|
119
|
+ void ConvertGrid( );
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+ // ==================== INQUIRY =======================
|
|
123
|
+ /**
|
|
124
|
+ * Returns the name of the underlying class, similiar to Python's type
|
|
125
|
+ * @return string of class name
|
|
126
|
+ */
|
|
127
|
+ virtual inline std::string GetName() const {
|
|
128
|
+ return CName;
|
|
129
|
+ }
|
|
130
|
+
|
|
131
|
+ protected:
|
|
132
|
+
|
|
133
|
+ // ==================== LIFECYCLE =======================
|
|
134
|
+
|
|
135
|
+ /** Copy is disabled */
|
|
136
|
+ RectilinearGridVTKImporter( const RectilinearGridVTKImporter& ) = delete;
|
|
137
|
+
|
|
138
|
+ // ==================== DATA MEMBERS =========================
|
|
139
|
+
|
|
140
|
+ private:
|
|
141
|
+
|
|
142
|
+ /** ASCII string representation of the class name */
|
|
143
|
+ static constexpr auto CName = "RectilinearGridVTKImporter";
|
|
144
|
+
|
|
145
|
+ /** VTK file to import */
|
|
146
|
+ vtkSmartPointer<vtkRectilinearGrid> vtkGrid;
|
|
147
|
+
|
|
148
|
+ std::shared_ptr<RectilinearGrid> rGrid;
|
|
149
|
+
|
|
150
|
+ }; // ----- end of class RectilinearGridVTKImporter -----
|
|
151
|
+
|
|
152
|
+} // ----- end of namespace Lemma ----
|
|
153
|
+
|
|
154
|
+/* vim: set tabstop=4 expandtab: */
|
|
155
|
+/* vim: set filetype=cpp: */
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+#endif // ----- LEMMAUSEVTK -----
|
|
159
|
+
|
|
160
|
+#endif // ----- #ifndef RECTILINEARGRIDVTKIMPORTER_INC -----
|
|
161
|
+
|