------------------------------------------------------------------------------
| 287 | |
| 288 | //------------------------------------------------------------------------------ |
| 289 | std::vector<vtkPartitioningStrategy::PartitionInformation> |
| 290 | vtkNativePartitioningStrategy::ComputePartition(vtkPartitionedDataSetCollection* collection) |
| 291 | { |
| 292 | std::vector<PartitionInformation> res; |
| 293 | if (!collection) |
| 294 | { |
| 295 | vtkErrorMacro("Collection is nullptr!"); |
| 296 | return res; |
| 297 | } |
| 298 | |
| 299 | if (this->LoadBalanceAcrossAllBlocks) |
| 300 | { |
| 301 | // since we're load balancing across all blocks, build cuts using the whole |
| 302 | // input dataset. |
| 303 | this->InitializeCuts(collection); |
| 304 | } |
| 305 | |
| 306 | for (unsigned int part = 0, max = collection->GetNumberOfPartitionedDataSets(); part < max; |
| 307 | ++part) |
| 308 | { |
| 309 | auto inputPTD = collection->GetPartitionedDataSet(part); |
| 310 | if (!inputPTD) |
| 311 | { |
| 312 | vtkWarningMacro("Found nullptr partitioned data set"); |
| 313 | continue; |
| 314 | } |
| 315 | |
| 316 | if (!this->LoadBalanceAcrossAllBlocks) |
| 317 | { |
| 318 | // when not load balancing globally, initialize cuts per partitioned |
| 319 | // dataset. |
| 320 | this->InitializeCuts(inputPTD); |
| 321 | } |
| 322 | |
| 323 | for (unsigned int cc = 0; cc < inputPTD->GetNumberOfPartitions(); ++cc) |
| 324 | { |
| 325 | auto ds = inputPTD->GetPartition(cc); |
| 326 | if (ds && (ds->GetNumberOfPoints() > 0 || ds->GetNumberOfCells() > 0)) |
| 327 | { |
| 328 | res.emplace_back( |
| 329 | ::CutsToPartition(ds, this->Cuts, this->AssignBoundaryCellsToSmallestRegionId)); |
| 330 | } |
| 331 | else |
| 332 | { |
| 333 | res.emplace_back(); |
| 334 | } |
| 335 | } |
| 336 | auto controller = this->GetController(); |
| 337 | if (controller && controller->GetNumberOfProcesses() > 1) |
| 338 | { |
| 339 | vtkIdType locsize = static_cast<vtkIdType>(res.size()); |
| 340 | vtkIdType allsize = 0; |
| 341 | controller->AllReduce(&locsize, &allsize, 1, vtkCommunicator::MAX_OP); |
| 342 | res.resize(allsize); |
| 343 | } |
| 344 | } |
| 345 | |
| 346 | auto controller = this->GetController(); |
no test coverage detected