------------------------------------------------------------------------------
| 221 | |
| 222 | //------------------------------------------------------------------------------ |
| 223 | int vtkExtentTranslator::SplitExtentByPoints(int piece, int numPieces, int* ext, int splitMode) |
| 224 | { |
| 225 | int numPiecesInFirstHalf; |
| 226 | int size[3], splitAxis; |
| 227 | vtkLargeInteger mid; |
| 228 | |
| 229 | // keep splitting until we have only one piece. |
| 230 | // piece and numPieces will always be relative to the current ext. |
| 231 | while (numPieces > 1) |
| 232 | { |
| 233 | // Get the dimensions for each axis. |
| 234 | size[0] = ext[1] - ext[0] + 1; |
| 235 | size[1] = ext[3] - ext[2] + 1; |
| 236 | size[2] = ext[5] - ext[4] + 1; |
| 237 | // choose what axis to split on based on the SplitMode |
| 238 | // if the user has requested x, y, or z slabs then try to |
| 239 | // honor that request. If that axis is already split as |
| 240 | // far as it can go, then drop to block mode. |
| 241 | if (splitMode < 3 && size[splitMode] > 1) |
| 242 | { |
| 243 | splitAxis = splitMode; |
| 244 | } |
| 245 | // otherwise use block mode |
| 246 | else |
| 247 | { |
| 248 | if (size[2] >= size[1] && size[2] >= size[0] && size[2] / 2 >= 1) |
| 249 | { |
| 250 | splitAxis = 2; |
| 251 | } |
| 252 | else if (size[1] >= size[0] && size[1] / 2 >= 1) |
| 253 | { |
| 254 | splitAxis = 1; |
| 255 | } |
| 256 | else if (size[0] / 2 >= 1) |
| 257 | { |
| 258 | splitAxis = 0; |
| 259 | } |
| 260 | else |
| 261 | { |
| 262 | // signal no more splits possible |
| 263 | splitAxis = -1; |
| 264 | } |
| 265 | } |
| 266 | |
| 267 | if (splitAxis == -1) |
| 268 | { |
| 269 | // can not split any more. |
| 270 | if (piece == 0) |
| 271 | { |
| 272 | // just return the remaining piece |
| 273 | numPieces = 1; |
| 274 | } |
| 275 | else |
| 276 | { |
| 277 | // the rest must be empty |
| 278 | return 0; |
| 279 | } |
| 280 | } |
no test coverage detected