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

Method ReduceData

Filters/Parallel/vtkPKdTree.cxx:2031–2090  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2029 rminData[0], rmaxData[0], rminData[1], rmaxData[1], rminData[2], rmaxData[2]);
2030}
2031void vtkPKdTree::ReduceData(vtkKdNode* kd, int* sources)
2032{
2033 int i;
2034 double data[27];
2035 vtkCommunicator* comm = this->Controller->GetCommunicator();
2036
2037 if (kd->GetLeft() == nullptr)
2038 return;
2039
2040 int ihave = (kd->GetDim() < 3);
2041
2042 this->SubGroup->Gather(&ihave, sources, 1, 0);
2043 this->SubGroup->Broadcast(sources, this->NumProcesses, 0);
2044
2045 // a contiguous group of process IDs built this node, the first
2046 // in the group sends it to node 0 if node 0 doesn't have it
2047
2048 if (sources[0] == 0)
2049 {
2050 int root = -1;
2051
2052 for (i = 1; i < this->NumProcesses; i++)
2053 {
2054 if (sources[i])
2055 {
2056 root = i;
2057 break;
2058 }
2059 }
2060 if (root == -1)
2061 {
2062
2063 // Normally BuildLocator will create a complete tree, but
2064 // it may refuse to divide a region if all the data is at
2065 // the same point along the axis it wishes to divide. In
2066 // that case, this region was not divided, so just return.
2067
2068 vtkKdTree::DeleteAllDescendants(kd);
2069
2070 return;
2071 }
2072
2073 if (root == this->MyId)
2074 {
2075 vtkPKdTree::PackData(kd, data);
2076
2077 comm->Send(data, 27, 0, 0x1111);
2078 }
2079 else if (0 == this->MyId)
2080 {
2081 comm->Receive(data, 27, root, 0x1111);
2082
2083 vtkPKdTree::UnpackData(kd, data);
2084 }
2085 }
2086
2087 this->ReduceData(kd->GetLeft(), sources);
2088

Callers 1

CompleteTreeMethod · 0.95

Calls 5

GetCommunicatorMethod · 0.45
GatherMethod · 0.45
BroadcastMethod · 0.45
SendMethod · 0.45
ReceiveMethod · 0.45

Tested by

no test coverage detected