| 1922 | //------------------------------------------------------------------------------ |
| 1923 | |
| 1924 | int vtkPKdTree::CompleteTree() |
| 1925 | { |
| 1926 | SCOPETIMER("CompleteTree"); |
| 1927 | |
| 1928 | // calculate depth of entire tree |
| 1929 | |
| 1930 | int depth; |
| 1931 | int myDepth = vtkPKdTree::ComputeDepth(this->Top); |
| 1932 | |
| 1933 | this->SubGroup->ReduceMax(&myDepth, &depth, 1, 0); |
| 1934 | this->SubGroup->Broadcast(&depth, 1, 0); |
| 1935 | |
| 1936 | // fill out nodes of tree |
| 1937 | |
| 1938 | int fail = vtkPKdTree::FillOutTree(this->Top, depth); |
| 1939 | |
| 1940 | if (this->AllCheckForFailure(fail, "CompleteTree", "memory allocation")) |
| 1941 | { |
| 1942 | return 1; |
| 1943 | } |
| 1944 | |
| 1945 | // Processor 0 collects all the nodes of the k-d tree, and then |
| 1946 | // processes the tree to ensure region boundaries are |
| 1947 | // consistent. The completed tree is then broadcast. |
| 1948 | std::vector<int> buf(this->NumProcesses); |
| 1949 | |
| 1950 | #ifdef YIELDS_INCONSISTENT_REGION_BOUNDARIES |
| 1951 | |
| 1952 | this->RetrieveData(this->Top, buf.data()); |
| 1953 | |
| 1954 | #else |
| 1955 | |
| 1956 | this->ReduceData(this->Top, buf.data()); |
| 1957 | |
| 1958 | if (this->MyId == 0) |
| 1959 | { |
| 1960 | CheckFixRegionBoundaries(this->Top); |
| 1961 | } |
| 1962 | |
| 1963 | this->BroadcastData(this->Top); |
| 1964 | #endif |
| 1965 | |
| 1966 | return 0; |
| 1967 | } |
| 1968 | |
| 1969 | void vtkPKdTree::PackData(vtkKdNode* kd, double* data) |
| 1970 | { |
no test coverage detected