| 149 | this->FreeFieldArrayMinMax(); |
| 150 | } |
| 151 | void vtkPKdTree::SetController(vtkMultiProcessController* c) |
| 152 | { |
| 153 | if (this->Controller == c) |
| 154 | { |
| 155 | return; |
| 156 | } |
| 157 | |
| 158 | if ((c == nullptr) || (c->GetNumberOfProcesses() == 0)) |
| 159 | { |
| 160 | this->NumProcesses = 1; |
| 161 | this->MyId = 0; |
| 162 | } |
| 163 | |
| 164 | this->Modified(); |
| 165 | |
| 166 | if (this->Controller != nullptr) |
| 167 | { |
| 168 | this->Controller->UnRegister(this); |
| 169 | this->Controller = nullptr; |
| 170 | } |
| 171 | |
| 172 | if (c == nullptr) |
| 173 | { |
| 174 | return; |
| 175 | } |
| 176 | |
| 177 | vtkSocketController* sc = vtkSocketController::SafeDownCast(c); |
| 178 | |
| 179 | if (sc) |
| 180 | { |
| 181 | vtkErrorMacro(<< "vtkPKdTree communication will fail with a socket controller"); |
| 182 | |
| 183 | return; |
| 184 | } |
| 185 | |
| 186 | this->NumProcesses = c->GetNumberOfProcesses(); |
| 187 | |
| 188 | this->Controller = c; |
| 189 | this->MyId = c->GetLocalProcessId(); |
| 190 | c->Register(this); |
| 191 | } |
| 192 | //------------------------------------------------------------------------------ |
| 193 | // Parallel k-d tree build, Floyd and Rivest (1975) select algorithm |
| 194 | // for median finding. |