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

Method MPIRedistribute

Filters/ParallelGeometry/vtkPDistributedDataFilter.cxx:2301–2369  ·  view source on GitHub ↗

------------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

2299
2300//------------------------------------------------------------------------------
2301vtkUnstructuredGrid* vtkPDistributedDataFilter::MPIRedistribute(
2302 vtkDataSet* in, vtkDataSet* input, int filterOutDuplicateCells)
2303{
2304 TimeLog timer("MPIRedistribute", this->Timing);
2305 (void)timer;
2306
2307 int proc;
2308 int nprocs = this->NumProcesses;
2309
2310 // A cell belongs to a spatial region if it's centroid lies in that
2311 // region. The kdtree object can create a list for each region of the
2312 // IDs of each cell I have read in that belong in that region. If we
2313 // are building subgrids of all cells that intersect a region (a
2314 // superset of all cells that belong to a region) then the kdtree object
2315 // can build another set of lists of all cells that intersect each
2316 // region (but don't have their centroid in that region).
2317
2318 if (this->IncludeAllIntersectingCells)
2319 {
2320 // TO DO:
2321 // We actually compute whether a cell intersects a spatial region.
2322 // This can be a lengthy calculation. Perhaps it's good enough
2323 // to compute whether a cell's bounding box intersects the region.
2324 // Some of the cells we list will actually not be in the region, but
2325 // if we are clipping later, it doesn't matter.
2326 //
2327 // Is there any rendering algorithm that needs exactly all cells
2328 // which intersect the region, and no more?
2329
2330 this->Kdtree->IncludeRegionBoundaryCellsOn(); // SLOW!!
2331 }
2332
2333 this->Kdtree->CreateCellLists(); // required by GetCellIdsForProcess
2334
2335 vtkIdList*** procCellLists = new vtkIdList**[nprocs];
2336 int* numLists = new int[nprocs];
2337
2338 for (proc = 0; proc < this->NumProcesses; proc++)
2339 {
2340 procCellLists[proc] = this->GetCellIdsForProcess(proc, numLists + proc);
2341 }
2342
2343 int deleteDataSet = DeleteNo;
2344
2345 if (in != input)
2346 {
2347 deleteDataSet = DeleteYes;
2348 }
2349
2350 vtkUnstructuredGrid* myNewGrid = this->ExchangeMergeSubGrids(procCellLists, numLists, DeleteNo,
2351 in, deleteDataSet, filterOutDuplicateCells, GhostCellsNo, 0x0012);
2352
2353 for (proc = 0; proc < nprocs; proc++)
2354 {
2355 delete[] procCellLists[proc];
2356 }
2357
2358 delete[] procCellLists;

Callers 1

RedistributeDataSetMethod · 0.95

Calls 4

GetCellIdsForProcessMethod · 0.95
ExchangeMergeSubGridsMethod · 0.95
GhostArrayNameFunction · 0.85
CreateCellListsMethod · 0.80

Tested by

no test coverage detected