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

Method ProbeGridPointInAMRGraph

Filters/AMR/vtkAMRResampleFilter.cxx:626–672  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

624
625//------------------------------------------------------------------------------
626int vtkAMRResampleFilter::ProbeGridPointInAMRGraph(double q[3], unsigned int& donorLevel,
627 unsigned int& donorGridId, vtkOverlappingAMR* amrds, unsigned int maxLevel, bool useCached)
628{
629 assert("pre: AMR dataset is nullptr" && amrds != nullptr);
630
631 int donorCellIdx = -1;
632
633 vtkUniformGrid* donorGrid = nullptr;
634 // STEP 0: Check the previously cached donor-grid
635 if (useCached)
636 {
637 if (!amrds->GetOverlappingAMRMetaData()->FindCell(q, donorLevel, donorGridId, donorCellIdx))
638 {
639 // Lets find the grid's ancestor that contains the point
640 bool res = this->SearchGridAncestors(q, amrds, donorLevel, donorGridId, donorCellIdx);
641 donorGrid = res
642 ? vtkUniformGrid::SafeDownCast(amrds->GetDataSetAsCartesianGrid(donorLevel, donorGridId))
643 : nullptr;
644 }
645 else
646 {
647 donorGrid =
648 vtkUniformGrid::SafeDownCast(amrds->GetDataSetAsCartesianGrid(donorLevel, donorGridId));
649 ++this->NumberOfTimesFoundOnDonorLevel;
650 }
651 // if the point is not contained in an ancestor then lets just assume its on level
652 // 0 which is the default
653 }
654
655 // If there is no initial donor grid then search level 0
656 if (donorGrid == nullptr)
657 {
658 bool res = SearchForDonorGridAtLevel(q, amrds, 0, donorGridId, donorCellIdx);
659 // If we still can't find a grid then the point is not contained in the
660 // AMR Data
661 if (!res)
662 {
663 this->NumberOfFailedPoints++;
664 donorLevel = 0;
665 return -1;
666 }
667 }
668
669 // Now search the descendants of the donor grid
670 this->SearchGridDecendants(q, amrds, maxLevel, donorLevel, donorGridId, donorCellIdx);
671 return (donorCellIdx);
672}
673
674//------------------------------------------------------------------------------
675void vtkAMRResampleFilter::TransferToGridNodes(vtkUniformGrid* g, vtkOverlappingAMR* amrds)

Callers 1

TransferToGridNodesMethod · 0.95

Calls 6

SearchGridAncestorsMethod · 0.95
SearchGridDecendantsMethod · 0.95
assertFunction · 0.50
FindCellMethod · 0.45

Tested by

no test coverage detected