------------------------------------------------------------------------------
| 3376 | |
| 3377 | //------------------------------------------------------------------------------ |
| 3378 | vtkIdTypeArray** vtkPDistributedDataFilter::GetGhostPointIds( |
| 3379 | int ghostLevel, vtkUnstructuredGrid* grid, int AddCellsIAlreadyHave) |
| 3380 | { |
| 3381 | TimeLog timer("GetGhostPointIds", this->Timing); |
| 3382 | (void)timer; |
| 3383 | |
| 3384 | int nprocs = this->NumProcesses; |
| 3385 | int me = this->MyId; |
| 3386 | vtkIdType numPoints = grid->GetNumberOfPoints(); |
| 3387 | |
| 3388 | vtkIdTypeArray** ghostPtIds = new vtkIdTypeArray*[nprocs]; |
| 3389 | std::fill_n(ghostPtIds, nprocs, nullptr); |
| 3390 | |
| 3391 | if (numPoints < 1) |
| 3392 | { |
| 3393 | return ghostPtIds; |
| 3394 | } |
| 3395 | |
| 3396 | int processId = -1; |
| 3397 | int regionId = -1; |
| 3398 | |
| 3399 | vtkPKdTree* kd = this->Kdtree; |
| 3400 | |
| 3401 | vtkPoints* pts = grid->GetPoints(); |
| 3402 | |
| 3403 | vtkIdType* gidsPoint = this->GetGlobalNodeIds(grid); |
| 3404 | vtkIdType* gidsCell = this->GetGlobalElementIds(grid); |
| 3405 | |
| 3406 | vtkUnsignedCharArray* uca = grid->GetPointGhostArray(); |
| 3407 | unsigned char* levels = uca->GetPointer(0); |
| 3408 | |
| 3409 | unsigned char level = (unsigned char)(ghostLevel - 1); |
| 3410 | |
| 3411 | for (vtkIdType i = 0; i < numPoints; i++) |
| 3412 | { |
| 3413 | double* pt = pts->GetPoint(i); |
| 3414 | regionId = kd->GetRegionContainingPoint(pt[0], pt[1], pt[2]); |
| 3415 | processId = kd->GetProcessAssignedToRegion(regionId); |
| 3416 | |
| 3417 | if (ghostLevel == 1) |
| 3418 | { |
| 3419 | // I want all points that are outside my spatial region |
| 3420 | |
| 3421 | if (processId == me) |
| 3422 | { |
| 3423 | continue; |
| 3424 | } |
| 3425 | |
| 3426 | // Don't include points that are not part of any cell |
| 3427 | |
| 3428 | int used = vtkPDistributedDataFilter::LocalPointIdIsUsed(grid, i); |
| 3429 | |
| 3430 | if (!used) |
| 3431 | { |
| 3432 | continue; |
| 3433 | } |
| 3434 | } |
| 3435 | else if (levels[i] != level) |
no test coverage detected