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

Method AllocateAndZeroFieldArrayMinMax

Filters/Parallel/vtkPKdTree.cxx:2472–2519  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2470}
2471
2472void vtkPKdTree::AllocateAndZeroFieldArrayMinMax()
2473{
2474 this->NumCellArrays = 0;
2475 this->NumPointArrays = 0;
2476
2477 for (int set = 0; set < this->GetNumberOfDataSets(); set++)
2478 {
2479 this->NumCellArrays += this->GetDataSet(set)->GetCellData()->GetNumberOfArrays();
2480 this->NumPointArrays += this->GetDataSet(set)->GetPointData()->GetNumberOfArrays();
2481 }
2482
2483 // Find maximum number of cell and point arrays. Set this number on all processes.
2484 // This handles the case where some processes have datasets with no cell or point
2485 // arrays, which may happen if a dataset on a process has no points or cells.
2486 if (this->NumProcesses > 1)
2487 {
2488 int tmpNumArrays[2], maxNumArrays[2];
2489 tmpNumArrays[0] = this->NumCellArrays;
2490 tmpNumArrays[1] = this->NumPointArrays;
2491 this->Controller->AllReduce(tmpNumArrays, maxNumArrays, 2, vtkCommunicator::MAX_OP);
2492 this->NumCellArrays = maxNumArrays[0];
2493 this->NumPointArrays = maxNumArrays[1];
2494 }
2495
2496 this->FreeFieldArrayMinMax();
2497
2498 if (this->NumCellArrays > 0)
2499 {
2500 std::fill(this->CellDataMin.begin(), this->CellDataMin.end(), 0);
2501 this->CellDataMin.resize(this->NumCellArrays, 0);
2502 std::fill(this->CellDataMax.begin(), this->CellDataMax.end(), 0);
2503 this->CellDataMax.resize(this->NumCellArrays, 0);
2504
2505 std::fill(this->CellDataName.begin(), this->CellDataName.end(), std::string());
2506 this->CellDataName.resize(this->NumCellArrays, std::string());
2507 }
2508
2509 if (this->NumPointArrays > 0)
2510 {
2511 std::fill(this->PointDataMin.begin(), this->PointDataMin.end(), 0);
2512 this->PointDataMin.resize(this->NumPointArrays, 0);
2513 std::fill(this->PointDataMax.begin(), this->PointDataMax.end(), 0);
2514 this->PointDataMax.resize(this->NumPointArrays, 0);
2515
2516 std::fill(this->PointDataName.begin(), this->PointDataName.end(), std::string());
2517 this->PointDataName.resize(this->NumPointArrays);
2518 }
2519}
2520void vtkPKdTree::FreeFieldArrayMinMax()
2521{
2522 this->CellDataMin.clear();

Callers 1

Calls 12

FreeFieldArrayMinMaxMethod · 0.95
fillFunction · 0.50
stringClass · 0.50
GetNumberOfDataSetsMethod · 0.45
GetNumberOfArraysMethod · 0.45
GetCellDataMethod · 0.45
GetDataSetMethod · 0.45
GetPointDataMethod · 0.45
AllReduceMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
resizeMethod · 0.45

Tested by

no test coverage detected