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

Method AssignAndLoadBlocks

IO/AMR/vtkAMRBaseReader.cxx:503–558  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

501
502//------------------------------------------------------------------------------
503void vtkAMRBaseReader::AssignAndLoadBlocks(vtkOverlappingAMR* output)
504{
505 assert("pre: AMR data-structure is nullptr" && (output != nullptr));
506
507 // Initialize counter of the number of blocks at each level.
508 // This counter is used to compute the block index w.r.t. the
509 // hierarchical box data-structure. Note that then number of blocks
510 // can change based on user constraints, e.g., the number of levels
511 // visible.
512 std::vector<int> idxcounter;
513 idxcounter.resize(this->GetNumberOfLevels() + 1, 0);
514
515 // Find the number of blocks to be processed. BlockMap.size()
516 // has all the blocks that are to be processesed and may be
517 // less than or equal to this->GetNumberOfBlocks(), i.e., the
518 // total number of blocks.
519 int numBlocks = static_cast<int>(this->BlockMap.size());
520 for (int block = 0; block < numBlocks; ++block)
521 {
522 int blockIndex = this->BlockMap[block];
523 int blockIdx = this->Metadata->GetOverlappingAMRMetaData()->GetAMRBlockSourceIndex(blockIndex);
524
525 unsigned int metaLevel;
526 unsigned int metaIdx;
527 this->Metadata->ComputeIndexPair(blockIndex, metaLevel, metaIdx);
528 unsigned int level = this->GetBlockLevel(blockIdx);
529 assert(level == metaLevel);
530
531 if (this->IsBlockMine(block))
532 {
533 // STEP 0: Get the AMR block
534 vtkTimerLog::MarkStartEvent("GetAMRBlock");
535 vtkUniformGrid* amrBlock = this->GetAMRBlock(blockIdx);
536 vtkTimerLog::MarkEndEvent("GetAMRBlock");
537 assert("pre: AMR block is nullptr" && (amrBlock != nullptr));
538
539 // STEP 2: Load any point-data
540 vtkTimerLog::MarkStartEvent("vtkARMBaseReader::LoadPointData");
541 this->LoadPointData(blockIdx, amrBlock);
542 vtkTimerLog::MarkEndEvent("vtkAMRBaseReader::LoadPointData");
543
544 // STEP 3: Load any cell data
545 vtkTimerLog::MarkStartEvent("vtkAMRBaseReader::LoadCellData");
546 this->LoadCellData(blockIdx, amrBlock);
547 vtkTimerLog::MarkEndEvent("vtkAMRBaseReader::LoadCellData");
548
549 // STEP 4: Add dataset
550 output->SetDataSet(level, metaIdx, amrBlock);
551 amrBlock->Delete();
552 } // END if the block belongs to this process
553 else
554 {
555 output->SetDataSet(level, metaIdx, nullptr);
556 }
557 } // END for all blocks
558}
559
560//------------------------------------------------------------------------------

Callers 1

RequestDataMethod · 0.95

Calls 14

IsBlockMineMethod · 0.95
GetAMRBlockMethod · 0.95
LoadPointDataMethod · 0.95
LoadCellDataMethod · 0.95
DeleteMethod · 0.65
assertFunction · 0.50
resizeMethod · 0.45
GetNumberOfLevelsMethod · 0.45
sizeMethod · 0.45
ComputeIndexPairMethod · 0.45

Tested by

no test coverage detected