------------------------------------------------------------------------------
| 33 | |
| 34 | //------------------------------------------------------------------------------ |
| 35 | int vtkUniformHyperTreeGridSource::RequestData( |
| 36 | vtkInformation*, vtkInformationVector**, vtkInformationVector* outputVector) |
| 37 | { |
| 38 | // Retrieve the output |
| 39 | vtkDataObject* outputDO = vtkDataObject::GetData(outputVector, 0); |
| 40 | vtkUniformHyperTreeGrid* output = vtkUniformHyperTreeGrid::SafeDownCast(outputDO); |
| 41 | if (!output) |
| 42 | { |
| 43 | vtkErrorMacro("pre: output_not_uniformHyperTreeGrid: " << outputDO->GetClassName()); |
| 44 | return 0; |
| 45 | } |
| 46 | |
| 47 | output->Initialize(); |
| 48 | |
| 49 | vtkCellData* outData = output->GetCellData(); |
| 50 | |
| 51 | this->LevelBitsIndexCnt.clear(); |
| 52 | this->LevelBitsIndexCnt.push_back(0); |
| 53 | |
| 54 | // When using descriptor-based definition, initialize descriptor parsing |
| 55 | if (this->UseDescriptor) |
| 56 | { |
| 57 | // Calculate refined block size |
| 58 | this->BlockSize = this->BranchFactor; |
| 59 | for (unsigned int i = 1; i < this->Dimension; ++i) |
| 60 | { |
| 61 | this->BlockSize *= this->BranchFactor; |
| 62 | } |
| 63 | |
| 64 | if (!this->DescriptorBits && !this->InitializeFromStringDescriptor()) |
| 65 | { |
| 66 | return 0; |
| 67 | } |
| 68 | else if (this->DescriptorBits && !this->InitializeFromBitsDescriptor()) |
| 69 | { |
| 70 | return 0; |
| 71 | } |
| 72 | } // if this->UseDescriptor |
| 73 | |
| 74 | // Set straightforward grid parameters |
| 75 | output->SetTransposedRootIndexing(this->TransposedRootIndexing); |
| 76 | output->SetBranchFactor(this->BranchFactor); |
| 77 | |
| 78 | // Set parameters that depend on dimension |
| 79 | switch (this->Dimension) |
| 80 | { |
| 81 | case 1: |
| 82 | { |
| 83 | // Set 1D grid size depending on orientation |
| 84 | unsigned int axis = this->Orientation; |
| 85 | unsigned int gs[] = { 1, 1, 1 }; |
| 86 | unsigned n = this->Dimensions[axis]; |
| 87 | gs[axis] = n; |
| 88 | output->SetDimensions(gs); |
| 89 | |
| 90 | // Assign coordinates |
| 91 | switch (axis) |
| 92 | { |
nothing calls this directly
no test coverage detected