| 3074 | // IDs. They will get permanent IDs later on. |
| 3075 | |
| 3076 | vtkIdTypeArray** vtkPDistributedDataFilter::FindGlobalPointIds(vtkFloatArray** ptarray, |
| 3077 | vtkIdTypeArray* ids, vtkUnstructuredGrid* grid, vtkIdType& numUniqueMissingPoints) |
| 3078 | { |
| 3079 | TimeLog timer("FindGlobalPointIds", this->Timing); |
| 3080 | (void)timer; |
| 3081 | |
| 3082 | int nprocs = this->NumProcesses; |
| 3083 | vtkIdTypeArray** gids = new vtkIdTypeArray*[nprocs]; |
| 3084 | |
| 3085 | if (grid->GetNumberOfCells() == 0) |
| 3086 | { |
| 3087 | // There are no cells in my assigned region |
| 3088 | std::fill_n(gids, nprocs, nullptr); |
| 3089 | |
| 3090 | return gids; |
| 3091 | } |
| 3092 | |
| 3093 | vtkKdTree* kd = vtkKdTree::New(); |
| 3094 | |
| 3095 | kd->BuildLocatorFromPoints(grid->GetPoints()); |
| 3096 | |
| 3097 | int procId; |
| 3098 | vtkIdType ptId, localId; |
| 3099 | |
| 3100 | vtkPointLocator* pl = nullptr; |
| 3101 | vtkPoints* missingPoints = nullptr; |
| 3102 | |
| 3103 | if (this->IncludeAllIntersectingCells == 0) |
| 3104 | { |
| 3105 | this->ComputeMyRegionBounds(); |
| 3106 | pl = vtkPointLocator::New(); |
| 3107 | pl->SetTolerance(this->Kdtree->GetFudgeFactor()); |
| 3108 | missingPoints = vtkPoints::New(); |
| 3109 | pl->InitPointInsertion(missingPoints, this->ConvexSubRegionBounds); |
| 3110 | } |
| 3111 | |
| 3112 | for (procId = 0; procId < nprocs; procId++) |
| 3113 | { |
| 3114 | if ((ptarray[procId] == nullptr) || (ptarray[procId]->GetNumberOfTuples() == 0)) |
| 3115 | { |
| 3116 | gids[procId] = nullptr; |
| 3117 | if (ptarray[procId]) |
| 3118 | ptarray[procId]->Delete(); |
| 3119 | continue; |
| 3120 | } |
| 3121 | |
| 3122 | gids[procId] = vtkIdTypeArray::New(); |
| 3123 | |
| 3124 | vtkIdType npoints = ptarray[procId]->GetNumberOfTuples() / 3; |
| 3125 | |
| 3126 | gids[procId]->SetNumberOfValues(npoints); |
| 3127 | vtkIdType next = 0; |
| 3128 | |
| 3129 | float* pt = ptarray[procId]->GetPointer(0); |
| 3130 | |
| 3131 | for (ptId = 0; ptId < npoints; ptId++) |
| 3132 | { |
| 3133 | localId = kd->FindPoint((double)pt[0], (double)pt[1], (double)pt[2]); |
no test coverage detected