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

Method TransferToGridNodes

Filters/AMR/vtkAMRResampleFilter.cxx:675–798  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

673
674//------------------------------------------------------------------------------
675void vtkAMRResampleFilter::TransferToGridNodes(vtkUniformGrid* g, vtkOverlappingAMR* amrds)
676{
677 this->NumberOfBlocksTested = 0;
678 this->NumberOfBlocksVisSkipped = 0;
679 this->NumberOfTimesFoundOnDonorLevel = 0;
680 this->NumberOfTimesLevelUp = 0;
681 this->NumberOfTimesLevelDown = 0;
682 this->NumberOfFailedPoints = 0;
683 this->AverageLevel = 0.0;
684 assert("pre: uniform grid is nullptr" && (g != nullptr));
685 assert("pre: AMR data-structure is nullptr" && (amrds != nullptr));
686
687 // STEP 0: Initialize the fields on the grid
688 vtkUniformGrid* refGrid = this->GetReferenceGrid(amrds);
689
690 vtkCellData* CD = refGrid->GetCellData();
691 assert("pre: Donor CellData is nullptr!" && (CD != nullptr));
692
693 vtkPointData* PD = g->GetPointData();
694 assert("pre: Target PointData is nullptr!" && (PD != nullptr));
695
696 // STEP 0: Initialize the fields on the grid
697 this->InitializeFields(PD, g->GetNumberOfPoints(), CD);
698
699 // STEP 1: If no arrays are selected, there is no need to interpolate
700 // anything on the grid, just return
701 if (PD->GetNumberOfArrays() == 0)
702 {
703 return;
704 }
705
706 // STEP 2: Fix the maximum level at which the search algorithm will operate
707 unsigned int maxLevelToLoad = 0;
708 if (this->LevelOfResolution < static_cast<int>(amrds->GetNumberOfLevels()) &&
709 this->DemandDrivenMode == 1)
710 {
711 maxLevelToLoad = this->LevelOfResolution + 1;
712 }
713 else
714 {
715 maxLevelToLoad = amrds->GetNumberOfLevels();
716 }
717
718 // STEP 3: Loop through all the points and find the donors.
719 unsigned int donorLevel = 0;
720 unsigned int donorGridId = 0;
721 double qPoint[3];
722 vtkIdType pIdx;
723 int donorCellIdx;
724 bool useCached(false);
725 // Do we have parent/child meta information (yes, we always do)
726 if (this->AMRMetaData)
727 {
728 for (pIdx = 0; pIdx < g->GetNumberOfPoints(); ++pIdx)
729 {
730 g->GetPoint(pIdx, qPoint);
731 donorCellIdx = this->ProbeGridPointInAMRGraph(
732 qPoint, donorLevel, donorGridId, amrds, maxLevelToLoad, useCached);

Callers 1

TransferSolutionMethod · 0.95

Calls 14

GetReferenceGridMethod · 0.95
InitializeFieldsMethod · 0.95
CopyDataMethod · 0.95
ProbeGridPointInAMRMethod · 0.95
assertFunction · 0.50
GetCellDataMethod · 0.45
GetPointDataMethod · 0.45
GetNumberOfPointsMethod · 0.45
GetNumberOfArraysMethod · 0.45
GetNumberOfLevelsMethod · 0.45

Tested by

no test coverage detected