Skip to content
Snippets Groups Projects
Commit 5a48f088 authored by George Zagaris's avatar George Zagaris
Browse files

ENH: Change API of vtkRectilinearGrid::GetPoints()

The method now accepts an instance of vtkPoints that the user must
pre-allocate externally. Since the user explicitely allocates that
object, the responsibility for explicit de-allocation is more obvious
in contrast to the previous API that was implicitely propagating
ownership of the pointer to the caller.

Change-Id: Ia289653d7d9ba2dc784f5851328c321c99e0a72e
parent cd29c9f0
No related branches found
No related tags found
No related merge requests found
......@@ -427,18 +427,17 @@ void vtkRectilinearGrid::GetCellBounds(vtkIdType cellId, double bounds[6])
}
//----------------------------------------------------------------------------
vtkPoints* vtkRectilinearGrid::GetPoints()
void vtkRectilinearGrid::GetPoints(vtkPoints *pnts)
{
vtkPoints *pnts = vtkPoints::New();
assert("pre: points object should not be NULL" && (pnts !=NULL) );
pnts->Initialize();
pnts->SetNumberOfPoints( this->GetNumberOfPoints() );
vtkIdType pntIdx = 0;
for( ; pntIdx < this->GetNumberOfPoints(); ++pntIdx )
{
pnts->SetPoint( pntIdx, this->GetPoint(pntIdx) );
}// END for all points
return( pnts );
}
//----------------------------------------------------------------------------
......
......@@ -95,8 +95,9 @@ public:
vtkIdList *cellIds);
// Description:
// Returns the points for this instance of rectilinear grid.
vtkPoints* GetPoints();
// Given a user-supplied vtkPoints container object, this method fills in all
// the points of the RectilinearGrid.
void GetPoints(vtkPoints* pnts);
// Description:
// Set dimensions of rectilinear grid dataset.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment