Ver código fonte

Tweaks for VTK RectilinearGrid import

add-code-of-conduct-1
Trevor Irons 5 anos atrás
pai
commit
b2edeef661

+ 12
- 2
Modules/LemmaCore/include/RectilinearGridVTKImporter.h Ver arquivo

115
 
115
 
116
         /**
116
         /**
117
          *  Performs the actual grid conversion
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
         // ====================  INQUIRY       =======================
131
         // ====================  INQUIRY       =======================
123
         /**
132
         /**
145
         /** VTK file to import */
154
         /** VTK file to import */
146
         vtkSmartPointer<vtkRectilinearGrid> vtkGrid;
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
     }; // -----  end of class  RectilinearGridVTKImporter  -----
160
     }; // -----  end of class  RectilinearGridVTKImporter  -----
151
 
161
 

+ 3
- 2
Modules/LemmaCore/src/RectilinearGridVTKImporter.cpp Ver arquivo

104
     //       Class:  RectilinearGridVTKImporter
104
     //       Class:  RectilinearGridVTKImporter
105
     //      Method:  ConvertGrid
105
     //      Method:  ConvertGrid
106
     //--------------------------------------------------------------------------------------
106
     //--------------------------------------------------------------------------------------
107
-    void RectilinearGridVTKImporter::ConvertGrid (  ) {
107
+    void RectilinearGridVTKImporter::ConvertGrid ( const Real& shiftx, const Real& shifty, const Real& shiftz  ) {
108
+
108
         rGrid = RectilinearGrid::NewSP();
109
         rGrid = RectilinearGrid::NewSP();
109
 
110
 
110
         int dims[3];
111
         int dims[3];
128
         }
129
         }
129
 
130
 
130
         rGrid->SetDimensions( dims[0], dims[1], dims[2] );
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
         rGrid->SetSpacing( dx, dy, dz  );
133
         rGrid->SetSpacing( dx, dy, dz  );
133
 
134
 
134
         return ;
135
         return ;

Carregando…
Cancelar
Salvar