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

Method SplitExtent

Common/ExecutionModel/vtkExtentTranslator.cxx:122–220  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

120
121//------------------------------------------------------------------------------
122int vtkExtentTranslator::SplitExtent(int piece, int numPieces, int* ext, int splitMode)
123{
124 int numPiecesInFirstHalf;
125 unsigned long size[3];
126 int splitAxis;
127 vtkLargeInteger mid;
128
129 if (piece >= numPieces || piece < 0)
130 {
131 return 0;
132 }
133
134 // keep splitting until we have only one piece.
135 // piece and numPieces will always be relative to the current ext.
136 int cnt = 0;
137 while (numPieces > 1)
138 {
139 // Get the dimensions for each axis.
140 size[0] = ext[1] - ext[0];
141 size[1] = ext[3] - ext[2];
142 size[2] = ext[5] - ext[4];
143 // choose what axis to split on based on the SplitMode
144 // if the user has requested x, y, or z slabs then try to
145 // honor that request. If that axis is already split as
146 // far as it can go, then drop to block mode.
147 if (this->SplitPath && cnt < this->SplitLen)
148 {
149 splitMode = this->SplitPath[cnt];
150 cnt++;
151 }
152 if (splitMode < 3 && size[splitMode] > 1)
153 {
154 splitAxis = splitMode;
155 }
156 // otherwise use block mode
157 else
158 {
159 // choose the biggest axis
160 if (size[2] >= size[1] && size[2] >= size[0] && size[2] / 2 >= 1)
161 {
162 splitAxis = 2;
163 }
164 else if (size[1] >= size[0] && size[1] / 2 >= 1)
165 {
166 splitAxis = 1;
167 }
168 else if (size[0] / 2 >= 1)
169 {
170 splitAxis = 0;
171 }
172 else
173 {
174 // signal no more splits possible
175 splitAxis = -1;
176 }
177 }
178
179 if (splitAxis == -1)

Callers 1

Calls 1

CastToIntMethod · 0.80

Tested by

no test coverage detected