| 2992 | leafNodeIds->Delete(); |
| 2993 | } |
| 2994 | int vtkPKdTree::AssignRegionsContiguous() |
| 2995 | { |
| 2996 | int p; |
| 2997 | |
| 2998 | this->RegionAssignment = ContiguousAssignment; |
| 2999 | |
| 3000 | if (this->Top == nullptr) |
| 3001 | { |
| 3002 | return 0; |
| 3003 | } |
| 3004 | |
| 3005 | int nProcesses = this->NumProcesses; |
| 3006 | int nRegions = this->GetNumberOfRegions(); |
| 3007 | |
| 3008 | if (nRegions <= nProcesses) |
| 3009 | { |
| 3010 | this->AssignRegionsRoundRobin(); |
| 3011 | this->RegionAssignment = ContiguousAssignment; |
| 3012 | return 0; |
| 3013 | } |
| 3014 | |
| 3015 | this->AllocateAndZeroRegionAssignmentLists(); |
| 3016 | |
| 3017 | int floorLogP, ceilLogP; |
| 3018 | |
| 3019 | for (floorLogP = 0; (nProcesses >> floorLogP) > 0; floorLogP++) |
| 3020 | { |
| 3021 | // empty loop. |
| 3022 | } |
| 3023 | floorLogP--; |
| 3024 | |
| 3025 | int P = (floorLogP >= 0) ? (1 << floorLogP) : 0; |
| 3026 | |
| 3027 | if (nProcesses == P) |
| 3028 | { |
| 3029 | ceilLogP = floorLogP; |
| 3030 | } |
| 3031 | else |
| 3032 | { |
| 3033 | ceilLogP = floorLogP + 1; |
| 3034 | } |
| 3035 | |
| 3036 | vtkKdNode** nodes = new vtkKdNode*[P]; |
| 3037 | |
| 3038 | this->GetRegionsAtLevel(floorLogP, nodes); |
| 3039 | |
| 3040 | if (floorLogP == ceilLogP) |
| 3041 | { |
| 3042 | for (p = 0; p < nProcesses; p++) |
| 3043 | { |
| 3044 | this->AddProcessRegions(p, nodes[p]); |
| 3045 | } |
| 3046 | } |
| 3047 | else |
| 3048 | { |
| 3049 | int nodesLeft = 1 << ceilLogP; |
| 3050 | int procsLeft = nProcesses; |
| 3051 | int procId = 0; |
no test coverage detected