Commit 1c787973 authored by Utkarsh Ayachit's avatar Utkarsh Ayachit

Fix uninitialized memory reported by valgrind.

23dff2bd introduced a bug where it didn't copy the point data correctly
for all the layers. Fixed that.
parent 71ab7e7b
...@@ -668,13 +668,15 @@ int vtkNetCDFCAMReader::RequestData( ...@@ -668,13 +668,15 @@ int vtkNetCDFCAMReader::RequestData(
pointData->CopyAllocate(output->GetPointData(), pointData->CopyAllocate(output->GetPointData(),
output->GetNumberOfPoints()); output->GetNumberOfPoints());
vtkIdType newPtId = numFilePoints; vtkIdType newPtId=0;
for (std::vector<vtkIdType>::const_iterator it= for (std::vector<vtkIdType>::const_iterator it=
boundaryPoints.begin(); it!=boundaryPoints.end(); ++it, ++newPtId) boundaryPoints.begin(); it!=boundaryPoints.end(); ++it, ++newPtId)
{ {
for(long lev=0;lev<numLocalCellLevels+1-this->SingleLevel;lev++) for(long lev=0;lev<numLocalCellLevels+1-this->SingleLevel;lev++)
{ {
pointData->CopyData(pointData, (*it), newPtId); vtkIdType srcId = (*it) + lev * numPointsPerLevel;
vtkIdType destId = (newPtId + numFilePoints) + lev * numPointsPerLevel;
pointData->CopyData(pointData, srcId, destId);
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment