------------------------------------------------------------------------------
| 386 | |
| 387 | //------------------------------------------------------------------------------ |
| 388 | void vtkAMRUtilities::BlankGridsAtLevel(vtkOverlappingAMR* amr, int levelIdx, |
| 389 | std::vector<std::vector<unsigned int>>& children, const std::vector<int>& processMap) |
| 390 | { |
| 391 | unsigned int numDataSets = amr->GetNumberOfBlocks(levelIdx); |
| 392 | int N; |
| 393 | |
| 394 | for (unsigned int dataSetIdx = 0; dataSetIdx < numDataSets; dataSetIdx++) |
| 395 | { |
| 396 | const vtkAMRBox& box = amr->GetAMRBox(levelIdx, dataSetIdx); |
| 397 | vtkCartesianGrid* grid = amr->GetDataSetAsCartesianGrid(levelIdx, dataSetIdx); |
| 398 | if (grid == nullptr) |
| 399 | { |
| 400 | continue; |
| 401 | } |
| 402 | N = grid->GetNumberOfCells(); |
| 403 | |
| 404 | vtkUnsignedCharArray* ghosts = vtkUnsignedCharArray::New(); |
| 405 | ghosts->SetNumberOfTuples(N); |
| 406 | ghosts->FillComponent(0, 0); |
| 407 | ghosts->SetName(vtkDataSetAttributes::GhostArrayName()); |
| 408 | |
| 409 | if (children.size() > dataSetIdx) |
| 410 | { |
| 411 | std::vector<unsigned int>& dsChildren = children[dataSetIdx]; |
| 412 | std::vector<unsigned int>::iterator iter; |
| 413 | |
| 414 | // For each higher res box fill in the cells that |
| 415 | // it covers |
| 416 | for (iter = dsChildren.begin(); iter != dsChildren.end(); ++iter) |
| 417 | { |
| 418 | vtkAMRBox ibox; |
| 419 | int childGridIndex = amr->GetAbsoluteBlockIndex(levelIdx + 1, *iter); |
| 420 | if (processMap[childGridIndex] < 0) |
| 421 | { |
| 422 | continue; |
| 423 | } |
| 424 | |
| 425 | // Use refinement ratio and coarsened box if possible |
| 426 | vtkOverlappingAMRMetaData* amrMData = amr->GetOverlappingAMRMetaData(); |
| 427 | if (amrMData && amrMData->HasRefinementRatio() && |
| 428 | amrMData->GetCoarsenedAMRBox(levelIdx + 1, *iter, ibox)) |
| 429 | { |
| 430 | bool shouldBeTrue = ibox.Intersect(box); |
| 431 | assert(shouldBeTrue); // if the boxes don't intersect, there is a bug |
| 432 | (void)shouldBeTrue; // to avoid warning in release |
| 433 | const int* loCorner = ibox.GetLoCorner(); |
| 434 | int hi[3]; |
| 435 | ibox.GetValidHiCorner(hi); |
| 436 | for (int iz = loCorner[2]; iz <= hi[2]; iz++) |
| 437 | { |
| 438 | for (int iy = loCorner[1]; iy <= hi[1]; iy++) |
| 439 | { |
| 440 | for (int ix = loCorner[0]; ix <= hi[0]; ix++) |
| 441 | { |
| 442 | vtkIdType id = |
| 443 | vtkAMRBox::GetCellLinearIndex(box, ix, iy, iz, grid->GetDimensions()); |
| 444 | ghosts->SetValue(id, ghosts->GetValue(id) | vtkDataSetAttributes::REFINEDCELL); |
| 445 | } // END for x |
nothing calls this directly
no test coverage detected