------------------------------------------------------------------------------ Description: Compute number of components, max number of components and actual memory size.
| 363 | // Compute number of components, max number of components and actual memory |
| 364 | // size. |
| 365 | void vtkGenericAttributeCollection::ComputeNumbers() |
| 366 | { |
| 367 | if (this->GetMTime() > this->ComputeTime) |
| 368 | { |
| 369 | int nb = 0; |
| 370 | int pnb = 0; |
| 371 | int count; |
| 372 | int maxNb = 0; |
| 373 | unsigned long memory = 0; |
| 374 | int firstComponentIndex = 0; |
| 375 | |
| 376 | int c = this->GetNumberOfAttributes(); |
| 377 | |
| 378 | for (int i = 0; i < c; ++i) |
| 379 | { |
| 380 | count = this->GetAttribute(i)->GetNumberOfComponents(); |
| 381 | memory = memory + this->GetAttribute(i)->GetActualMemorySize(); |
| 382 | maxNb = std::max(count, maxNb); |
| 383 | nb += count; |
| 384 | if (this->GetAttribute(i)->GetCentering() == vtkPointCentered) |
| 385 | { |
| 386 | pnb += count; |
| 387 | this->AttributeIndices->Vector[i] = firstComponentIndex; |
| 388 | firstComponentIndex = firstComponentIndex + count; |
| 389 | } |
| 390 | } |
| 391 | this->NumberOfComponents = nb; |
| 392 | this->NumberOfPointCenteredComponents = pnb; |
| 393 | this->MaxNumberOfComponents = maxNb; |
| 394 | this->ActualMemorySize = memory; |
| 395 | |
| 396 | assert("check: positive_number" && this->NumberOfComponents >= 0); |
| 397 | assert("check: positive_point_centered_number" && this->NumberOfPointCenteredComponents >= 0); |
| 398 | assert("check: positiveMaxNumber" && this->MaxNumberOfComponents >= 0); |
| 399 | assert("check: valid_number" && this->MaxNumberOfComponents <= this->NumberOfComponents); |
| 400 | this->ComputeTime.Modified(); |
| 401 | } |
| 402 | } |
| 403 | |
| 404 | //------------------------------------------------------------------------------ |
| 405 | // *** ALL THE FOLLOWING METHODS SHOULD BE REMOVED WHEN vtkInformation |
no test coverage detected