Commit bdc81473 authored by Berk Geveci's avatar Berk Geveci Committed by Code Review
Browse files

Merge topic 'speedup_point2cell' into master

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