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

Function Split

Filters/AMR/vtkImageToAMR.cxx:91–125  ·  view source on GitHub ↗

split the blocks into a tree that starts out as a single stem than turn a full tree. This shape is designed so that numLevels and maxNumBlocks constraint can be satisfied

Source from the content-addressed store, hash-verified

89// than turn a full tree. This shape is designed so that numLevels and maxNumBlocks
90// constraint can be satisfied
91void Split(const vtkAMRBox& rootBox, int numLevels, int refinementRatio, int maxNumBlocks,
92 std::vector<std::vector<vtkAMRBox>>& out)
93{
94 out.clear();
95 out.resize(1);
96 out.back().push_back(rootBox);
97 maxNumBlocks--;
98
99 int treeDegree = rootBox.ComputeDimension() * 2;
100 int numTreeLevels =
101 std::min(numLevels, ComputeTreeHeight(maxNumBlocks - (numLevels - 1), treeDegree)) -
102 1; // minus one because root already has one
103 int level = 1;
104 for (; level < numLevels - numTreeLevels; level++)
105 {
106 out.emplace_back();
107 const std::vector<vtkAMRBox>& parentBoxes = out[level - 1];
108 std::vector<vtkAMRBox>& childBoxes = out[level];
109 vtkAMRBox child = parentBoxes.back();
110 child.Refine(refinementRatio);
111 childBoxes.push_back(child);
112 }
113
114 for (; level < numLevels; level++)
115 {
116 out.emplace_back();
117 const std::vector<vtkAMRBox>& parentBoxes = out[level - 1];
118 std::vector<vtkAMRBox>& childBoxes = out[level];
119 for (size_t i = 0; i < parentBoxes.size(); i++)
120 {
121 const vtkAMRBox& parent = parentBoxes[i];
122 SplitXYZ(parent, refinementRatio, childBoxes);
123 }
124 }
125}
126
127// create a grid by sampling from input using the indices in box
128vtkUniformGrid* ConstructGrid(

Callers 10

RequestDataMethod · 0.70
ReadFileMethod · 0.50
NewBondMethod · 0.50
RequestDataMethod · 0.50
GetCoordinatesMethod · 0.50
AllReduceMethod · 0.50
CheckStringOperationsFunction · 0.50
SubtractMethod · 0.50
parseFloat3Method · 0.50

Calls 11

ComputeTreeHeightFunction · 0.85
SplitXYZFunction · 0.85
backMethod · 0.80
ComputeDimensionMethod · 0.80
minFunction · 0.50
clearMethod · 0.45
resizeMethod · 0.45
push_backMethod · 0.45
emplace_backMethod · 0.45
RefineMethod · 0.45
sizeMethod · 0.45

Tested by 1

CheckStringOperationsFunction · 0.40