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

Method SetExtent

Common/DataModel/vtkHyperTreeGrid.cxx:508–599  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

506
507//------------------------------------------------------------------------------
508void 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)

Callers 14

CopyEmptyStructureMethod · 0.95
CopyStructureMethod · 0.95
SetDimensionsMethod · 0.95
CropMethod · 0.45
SetDimensionsFunction · 0.45
NewImageDataCopyMethod · 0.45
CropMethod · 0.45
InternalImageDataCopyMethod · 0.45
DoOrientationTestFunction · 0.45
DoTestFunction · 0.45

Calls 5

SetExtentFunction · 0.85
maxFunction · 0.50
assertFunction · 0.50
swapFunction · 0.50
ModifiedMethod · 0.45

Tested by 5

DoOrientationTestFunction · 0.36
DoTestFunction · 0.36
initSingleCellTreeHTGFunction · 0.36
DoTestFunction · 0.36