---------------------------------------------------------------------------
| 237 | |
| 238 | //--------------------------------------------------------------------------- |
| 239 | void vtkHyperTree::InitializeForReader(vtkIdType numberOfLevels, vtkIdType nbVertices, |
| 240 | vtkIdType nbVerticesOfLastdepth, vtkBitArray* isParent, vtkBitArray* isMasked, |
| 241 | vtkBitArray* outIsMasked) |
| 242 | { |
| 243 | if (isParent == nullptr) |
| 244 | { |
| 245 | this->Datas->ParentToElderChild.resize(1); |
| 246 | this->Datas->ParentToElderChild[0] = std::numeric_limits<unsigned int>::max(); |
| 247 | if (isMasked) |
| 248 | { |
| 249 | vtkIdType nbIsMasked = isMasked->GetNumberOfTuples(); |
| 250 | if (nbIsMasked) |
| 251 | { |
| 252 | assert(isMasked->GetNumberOfComponents() == 1); |
| 253 | outIsMasked->InsertValue(this->GetGlobalIndexFromLocal(0), isMasked->GetValue(0)); |
| 254 | } |
| 255 | } |
| 256 | return; |
| 257 | } |
| 258 | |
| 259 | vtkIdType nbIsParent = isParent->GetNumberOfTuples(); |
| 260 | assert(isParent->GetNumberOfComponents() == 1); |
| 261 | |
| 262 | vtkIdType firstOffsetLastdepth = nbVertices - nbVerticesOfLastdepth; |
| 263 | firstOffsetLastdepth = std::min(nbIsParent, firstOffsetLastdepth); |
| 264 | this->Datas->ParentToElderChild.resize(firstOffsetLastdepth); |
| 265 | |
| 266 | vtkIdType nbCoarses = isParent->GetValue(0); |
| 267 | if (nbCoarses) |
| 268 | { |
| 269 | vtkIdType off = 1; |
| 270 | this->Datas->ParentToElderChild.resize( |
| 271 | std::max(static_cast<vtkIdType>(1), firstOffsetLastdepth)); |
| 272 | this->Datas->ParentToElderChild[0] = off; |
| 273 | for (vtkIdType i = 1; i < firstOffsetLastdepth; ++i) |
| 274 | { |
| 275 | if (isParent->GetValue(i)) |
| 276 | { |
| 277 | off += this->NumberOfChildren; |
| 278 | this->Datas->ParentToElderChild[i] = off; |
| 279 | ++nbCoarses; |
| 280 | } |
| 281 | else |
| 282 | { |
| 283 | this->Datas->ParentToElderChild[i] = std::numeric_limits<unsigned int>::max(); |
| 284 | } |
| 285 | } |
| 286 | } |
| 287 | else |
| 288 | { |
| 289 | this->Datas->ParentToElderChild.resize(1); |
| 290 | this->Datas->ParentToElderChild[0] = std::numeric_limits<unsigned int>::max(); |
| 291 | } |
| 292 | |
| 293 | if (isMasked) |
| 294 | { |
| 295 | vtkIdType nbIsMasked = isMasked->GetNumberOfTuples(); |
| 296 | assert(isMasked->GetNumberOfComponents() == 1); |
no test coverage detected