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

Method SubdivideFromBitsDescriptor

Filters/Sources/vtkHyperTreeGridSource.cxx:1147–1305  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

1145
1146//------------------------------------------------------------------------------
1147void vtkHyperTreeGridSource::SubdivideFromBitsDescriptor(vtkHyperTreeGrid* output,
1148 vtkHyperTreeGridNonOrientedCursor* cursor, unsigned int level, int treeIdx, int childIdx,
1149 int idx[3], int parentPos)
1150{
1151 // Get handle on point data
1152 vtkCellData* outData = output->GetCellData();
1153
1154 vtkIdType startIdx = this->LevelBitsIndex[level];
1155 int pointer = level ? childIdx + parentPos * this->BlockSize : treeIdx;
1156
1157 // Calculate the node global index
1158 vtkIdType id = this->LevelBitsIndexCnt[level];
1159 ++this->LevelBitsIndexCnt[level];
1160
1161 // Set depth array value
1162 outData->GetArray("Depth")->InsertTuple1(id, level);
1163
1164 if (this->GenerateInterfaceFields)
1165 {
1166 // Set interface arrays values
1167 double v = 1. / (1 << level);
1168 outData->GetArray("Normals")->InsertTuple3(id, v, v, v);
1169 outData->GetArray("Intercepts")->InsertTuple3(id, v, 0., 3.);
1170 }
1171
1172 // Initialize global index of tree
1173 cursor->SetGlobalIndexFromLocal(id);
1174 bool refine = false;
1175
1176 if (this->LevelZeroMaterialIndex && level == 0)
1177 {
1178 if (this->LevelZeroMaterialMap.find(treeIdx) != this->LevelZeroMaterialMap.end())
1179 {
1180 refine = this->DescriptorBits->GetValue(this->LevelZeroMaterialMap[treeIdx]) == 1;
1181 }
1182 }
1183 else
1184 {
1185 // Calculate pointer into level descriptor string
1186 refine = this->DescriptorBits->GetValue(startIdx + pointer) == 1;
1187 }
1188
1189 // Subdivide further or stop recursion with terminal leaf
1190 if (level + 1 < this->MaxDepth && refine)
1191 {
1192 // Before subdividing, one should in order:
1193 // 1) set global index from local
1194 // if implicit
1195 // set value by tree with SetGlobalIndexStart only once
1196 // if explicit
1197 // set value by cell with SetGlobalIndexFromLocal
1198 // 2) if use mask
1199 // set mask to false
1200 if (this->UseMask)
1201 {
1202 cursor->SetMask(false);
1203 }
1204

Callers 1

Calls 14

InsertTuple1Method · 0.80
InsertTuple3Method · 0.80
GetCellDataMethod · 0.45
GetArrayMethod · 0.45
findMethod · 0.45
endMethod · 0.45
GetValueMethod · 0.45
SetMaskMethod · 0.45
SubdivideLeafMethod · 0.45
ToChildMethod · 0.45
atMethod · 0.45

Tested by

no test coverage detected