Commit 038024b7 authored by Berk Geveci's avatar Berk Geveci Committed by Utkarsh Ayachit
Browse files

Performance improvement to CellToPoint.

Using faster API to import performance of vtkCellDataToPointData.
vtkCellDataToPointData was using ds->GetCell(..)->GetPointIds() which is
considerably slower than directly calling ds->GetCellPoints(...). That change
considerably improves the speed of this filter.

Change-Id: I99660cde38a1b359b76d8c71b673d5ae9a229507
parent 4eb4a238
......@@ -20,11 +20,12 @@
#include "vtkIdList.h"
#include "vtkInformation.h"
#include "vtkInformationVector.h"
#include "vtkUnstructuredGrid.h"
#include "vtkSmartPointer.h"
#include "vtkUnsignedIntArray.h"
#include "vtkNew.h"
#include "vtkObjectFactory.h"
#include "vtkPointData.h"
#include "vtkSmartPointer.h"
#include "vtkUnsignedIntArray.h"
#include "vtkUnstructuredGrid.h"
#include <algorithm>
#include <functional>
......@@ -164,9 +165,10 @@ namespace
// accumulate
T const* srcbeg = srcptr;
vtkNew<vtkIdList> pids;
for (vtkIdType cid = 0; cid < ncells; ++cid, srcbeg += ncomps)
{
vtkIdList* const pids = src->GetCell(cid)->GetPointIds();
src->GetCellPoints(cid, pids.GetPointer());
for (vtkIdType i = 0, I = pids->GetNumberOfIds(); i < I; ++i)
{
T* const dstbeg = dstptr + pids->GetId(i)*ncomps;
......@@ -216,9 +218,10 @@ int vtkCellDataToPointData::RequestDataForUnstructuredGrid
num->SetNumberOfComponents(1);
num->SetNumberOfTuples(npoints);
std::fill_n(num->GetPointer(0), npoints, 0u);
vtkNew<vtkIdList> pids;
for (vtkIdType cid = 0; cid < ncells; ++cid)
{
vtkIdList* const pids = src->GetCell(cid)->GetPointIds();
src->GetCellPoints(cid, pids.GetPointer());
for (vtkIdType i = 0, I = pids->GetNumberOfIds(); i < I; ++i)
{
vtkIdType const pid = pids->GetId(i);
......
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