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

Method CreateProcessCellCountData

Filters/Parallel/vtkPKdTree.cxx:2550–2685  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2548//------------------------------------------------------------------------------
2549
2550int vtkPKdTree::CreateProcessCellCountData()
2551{
2552 int proc, reg;
2553 int retval = 0;
2554 char *procData(nullptr), *myData(nullptr);
2555
2556 this->SubGroup = vtkSubGroup::New();
2557 this->SubGroup->Initialize(
2558 0, this->NumProcesses - 1, this->MyId, 0x0000f000, this->Controller->GetCommunicator());
2559
2560 this->AllocateAndZeroProcessDataLists();
2561
2562 int fail = this->Top ? 0 : 1;
2563
2564 if (this->AllCheckForFailure(fail, "BuildRegionProcessTables", "memory allocation"))
2565 {
2566 this->FreeProcessDataLists();
2567 this->SubGroup->Delete();
2568 this->SubGroup = nullptr;
2569 return 1;
2570 }
2571
2572 // Build table indicating which processes have data for which regions
2573
2574 std::vector<int> cellCounts;
2575 fail = this->CollectLocalRegionProcessData(cellCounts) ? 0 : 1;
2576
2577 if (this->AllCheckForFailure(fail, "BuildRegionProcessTables", "error"))
2578 {
2579 this->FreeProcessDataLists();
2580 return 1;
2581 }
2582
2583 myData = &(this->DataLocationMap[this->MyId * this->GetNumberOfRegions()]);
2584
2585 for (reg = 0; reg < this->GetNumberOfRegions(); reg++)
2586 {
2587 if (cellCounts[reg] > 0)
2588 myData[reg] = 1;
2589 }
2590
2591 if (this->NumProcesses > 1)
2592 {
2593 this->SubGroup->Gather(myData, this->DataLocationMap.data(), this->GetNumberOfRegions(), 0);
2594 this->SubGroup->Broadcast(
2595 this->DataLocationMap.data(), this->GetNumberOfRegions() * this->NumProcesses, 0);
2596 }
2597
2598 // Other helpful tables - not the fastest way to create this
2599 // information, but it uses the least memory
2600
2601 procData = this->DataLocationMap.data();
2602
2603 for (proc = 0; proc < this->NumProcesses; proc++)
2604 {
2605 for (reg = 0; reg < this->GetNumberOfRegions(); reg++)
2606 {
2607 if (*procData)

Callers

nothing calls this directly

Calls 14

AllCheckForFailureMethod · 0.95
FreeProcessDataListsMethod · 0.95
AddEntryMethod · 0.95
GetNumberOfRegionsMethod · 0.80
DeleteMethod · 0.65
NewFunction · 0.50
InitializeMethod · 0.45
GetCommunicatorMethod · 0.45
GatherMethod · 0.45
dataMethod · 0.45

Tested by

no test coverage detected