MCPcopy Create free account
hub / github.com/Kitware/VTK / GetGhostPointIds

Method GetGhostPointIds

Filters/ParallelGeometry/vtkPDistributedDataFilter.cxx:3378–3463  ·  view source on GitHub ↗

------------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

3376
3377//------------------------------------------------------------------------------
3378vtkIdTypeArray** 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)

Calls 12

GetGlobalNodeIdsMethod · 0.95
GetGlobalElementIdsMethod · 0.95
fill_nFunction · 0.85
GetPointGhostArrayMethod · 0.80
NewFunction · 0.50
GetNumberOfPointsMethod · 0.45
GetPointsMethod · 0.45
GetPointerMethod · 0.45
GetPointMethod · 0.45
InsertNextValueMethod · 0.45

Tested by

no test coverage detected