Skip to content

Commit

Permalink
move vector declaration outside of the loop
Browse files Browse the repository at this point in the history
  • Loading branch information
alexbruy authored and nyalldawson committed Jan 30, 2025
1 parent a5c0cc9 commit b21a5f0
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/analysis/interpolation/qgsgridfilewriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ int QgsGridFileWriter::writeFile( QgsFeedback *feedback )
double currentXValue;
double interpolatedValue;

std::vector<float> float32Row( mNumColumns );
const double step = mNumRows > 0 ? 100.0 / mNumRows : 1;
for ( int row = 0; row < mNumRows; row++ )
{
Expand All @@ -73,10 +74,8 @@ int QgsGridFileWriter::writeFile( QgsFeedback *feedback )
}

currentXValue = mInterpolationExtent.xMinimum() + mCellSizeX / 2.0; //calculate value in the center of the cell

QgsRasterBlock block( Qgis::DataType::Float32, mNumColumns, 1 );

std::vector<float> float32Row( mNumColumns );
for ( int col = 0; col < mNumColumns; col++ )
{
if ( mInterpolator->interpolatePoint( currentXValue, currentYValue, interpolatedValue, feedback ) == 0 )
Expand Down

0 comments on commit b21a5f0

Please sign in to comment.