------------------------------------------------------------------------------
| 506 | |
| 507 | //------------------------------------------------------------------------------ |
| 508 | void vtkHyperTreeGrid::SetExtent(const int extent[6]) |
| 509 | { |
| 510 | int description = vtkStructuredData::SetExtent(const_cast<int*>(extent), this->Extent); |
| 511 | // why vtkStructuredData::SetExtent don't take const int* ? |
| 512 | |
| 513 | if (description < 0) // improperly specified |
| 514 | { |
| 515 | vtkErrorMacro(<< "Bad extent, retaining previous values"); |
| 516 | return; |
| 517 | } |
| 518 | |
| 519 | this->Dimension = 0; |
| 520 | this->Axis[0] = std::numeric_limits<unsigned int>::max(); |
| 521 | this->Axis[1] = std::numeric_limits<unsigned int>::max(); |
| 522 | for (unsigned int i = 0; i < 3; ++i) |
| 523 | { |
| 524 | this->Dimensions[i] = static_cast<unsigned int>(extent[2 * i + 1] - extent[2 * i] + 1); |
| 525 | if (this->Dimensions[i] == 1) |
| 526 | { |
| 527 | this->CellDims[i] = 1; |
| 528 | } |
| 529 | else |
| 530 | { |
| 531 | this->CellDims[i] = this->Dimensions[i] - 1; |
| 532 | if (this->Dimension == 2) |
| 533 | { |
| 534 | this->Axis[0] = std::numeric_limits<unsigned int>::max(); |
| 535 | this->Axis[1] = std::numeric_limits<unsigned int>::max(); |
| 536 | } |
| 537 | else |
| 538 | { |
| 539 | this->Axis[this->Dimension] = i; |
| 540 | } |
| 541 | ++this->Dimension; |
| 542 | } |
| 543 | } |
| 544 | |
| 545 | assert("post: valid_axis" && |
| 546 | (this->Dimension != 3 || |
| 547 | (this->Axis[0] == std::numeric_limits<unsigned int>::max() && |
| 548 | this->Axis[1] == std::numeric_limits<unsigned int>::max()))); |
| 549 | assert("post: valid_axis" && |
| 550 | (this->Dimension != 2 || |
| 551 | (this->Axis[0] != std::numeric_limits<unsigned int>::max() && |
| 552 | this->Axis[1] != std::numeric_limits<unsigned int>::max()))); |
| 553 | assert("post: valid_axis" && |
| 554 | (this->Dimension != 1 || |
| 555 | (this->Axis[0] != std::numeric_limits<unsigned int>::max() && |
| 556 | this->Axis[1] == std::numeric_limits<unsigned int>::max()))); |
| 557 | |
| 558 | switch (this->Dimension) |
| 559 | { |
| 560 | case 1: |
| 561 | this->Orientation = this->Axis[0]; |
| 562 | break; |
| 563 | case 2: |
| 564 | this->Orientation = 0; |
| 565 | for (unsigned int i = 0; i < 2; ++i) |