瀏覽代碼

Tweaks for VTK RectilinearGrid import

add-code-of-conduct-1
Trevor Irons 6 年之前
父節點
當前提交
b2edeef661

+ 12
- 2
Modules/LemmaCore/include/RectilinearGridVTKImporter.h 查看文件

@@ -115,9 +115,18 @@ namespace Lemma {
115 115
 
116 116
         /**
117 117
          *  Performs the actual grid conversion
118
+         *  @param[in] xshift is additional offset to apply in x direction.
119
+         *  @param[in] yshift is additional offset to apply in y direction.
120
+         *  @param[in] zshift is additional offset to apply in z direction.
118 121
          */
119
-        void ConvertGrid( );
122
+        void ConvertGrid( const Real& xshift, const Real& yshift, const Real& zshift );
120 123
 
124
+        /**
125
+         *  @return smart pointer to RectilinearGrid class
126
+         */
127
+        std::shared_ptr<RectilinearGrid> GetGrid() {
128
+            return this->rGrid;
129
+        }
121 130
 
122 131
         // ====================  INQUIRY       =======================
123 132
         /**
@@ -145,7 +154,8 @@ namespace Lemma {
145 154
         /** VTK file to import */
146 155
         vtkSmartPointer<vtkRectilinearGrid> vtkGrid;
147 156
 
148
-        std::shared_ptr<RectilinearGrid>  rGrid;
157
+        /** container to hold imported grid */
158
+        std::shared_ptr<RectilinearGrid>  rGrid = nullptr;
149 159
 
150 160
     }; // -----  end of class  RectilinearGridVTKImporter  -----
151 161
 

+ 3
- 2
Modules/LemmaCore/src/RectilinearGridVTKImporter.cpp 查看文件

@@ -104,7 +104,8 @@ namespace Lemma {
104 104
     //       Class:  RectilinearGridVTKImporter
105 105
     //      Method:  ConvertGrid
106 106
     //--------------------------------------------------------------------------------------
107
-    void RectilinearGridVTKImporter::ConvertGrid (  ) {
107
+    void RectilinearGridVTKImporter::ConvertGrid ( const Real& shiftx, const Real& shifty, const Real& shiftz  ) {
108
+
108 109
         rGrid = RectilinearGrid::NewSP();
109 110
 
110 111
         int dims[3];
@@ -128,7 +129,7 @@ namespace Lemma {
128 129
         }
129 130
 
130 131
         rGrid->SetDimensions( dims[0], dims[1], dims[2] );
131
-        rGrid->SetOffset( xcoords->GetTuple1(0), ycoords->GetTuple1(0), zcoords->GetTuple1(0) );
132
+        rGrid->SetOffset( xcoords->GetTuple1(0)+shiftx, ycoords->GetTuple1(0)+shifty, zcoords->GetTuple1(0)+shiftz );
132 133
         rGrid->SetSpacing( dx, dy, dz  );
133 134
 
134 135
         return ;

Loading…
取消
儲存