------------------------------------------------------------------------------
| 930 | |
| 931 | //------------------------------------------------------------------------------ |
| 932 | void vtkHyperTreeGridSource::SubdivideFromStringDescriptor(vtkHyperTreeGrid* output, |
| 933 | vtkHyperTreeGridNonOrientedCursor* cursor, unsigned int level, int treeIdx, int childIdx, |
| 934 | int idx[3], int parentPos, int offset) |
| 935 | { |
| 936 | // Get handle on point data |
| 937 | vtkCellData* outData = output->GetCellData(); |
| 938 | |
| 939 | // Calculate pointer into level descriptor string |
| 940 | unsigned int pointer = level ? childIdx + parentPos * this->BlockSize : treeIdx + offset; |
| 941 | |
| 942 | // Calculate the node global index |
| 943 | vtkIdType id = this->LevelBitsIndexCnt[level]; |
| 944 | ++this->LevelBitsIndexCnt[level]; |
| 945 | |
| 946 | // Set depth array value |
| 947 | outData->GetArray("Depth")->InsertTuple1(id, level); |
| 948 | |
| 949 | if (this->GenerateInterfaceFields) |
| 950 | { |
| 951 | // Set interface arrays values |
| 952 | double v = 1. / (1 << level); |
| 953 | outData->GetArray("Normals")->InsertTuple3(id, v, v, v); |
| 954 | outData->GetArray("Intercepts")->InsertTuple3(id, v, 0., 3.); |
| 955 | } |
| 956 | |
| 957 | // Initialize global index of tree and mask state |
| 958 | cursor->SetGlobalIndexFromLocal(id); |
| 959 | cursor->SetMask(false); |
| 960 | |
| 961 | // Subdivide further or stop recursion with terminal leaf |
| 962 | if (level + 1 < this->MaxDepth && |
| 963 | static_cast<unsigned int>(this->LevelDescriptors.size()) > level && |
| 964 | this->LevelDescriptors.at(level).at(pointer) == 'R') |
| 965 | { |
| 966 | // Before subdividing, one should in order: |
| 967 | // 1) set global index from local |
| 968 | // if implicit |
| 969 | // set value by tree with SetGlobalIndexStart only once |
| 970 | // if explicit |
| 971 | // set value by cell with SetGlobalIndexFromLocal |
| 972 | // 2) set mask to false |
| 973 | |
| 974 | // Subdivide hyper tree grid leaf |
| 975 | cursor->SubdivideLeaf(); |
| 976 | |
| 977 | // Figure out index bounds depending on dimension and orientation |
| 978 | int xDim = this->BranchFactor; |
| 979 | int yDim = this->BranchFactor; |
| 980 | int zDim = this->BranchFactor; |
| 981 | if (this->Dimension == 1) |
| 982 | { |
| 983 | switch (this->Orientation) |
| 984 | { |
| 985 | case 0: |
| 986 | yDim = 1; |
| 987 | zDim = 1; |
| 988 | break; |
| 989 | case 1: |
no test coverage detected