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

Method ComputeNumbers

Common/DataModel/vtkGenericAttributeCollection.cxx:365–402  ·  view source on GitHub ↗

------------------------------------------------------------------------------ Description: Compute number of components, max number of components and actual memory size.

Source from the content-addressed store, hash-verified

363// Compute number of components, max number of components and actual memory
364// size.
365void 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

Callers 5

GetNumberOfComponentsMethod · 0.95
GetActualMemorySizeMethod · 0.95
GetAttributeIndexMethod · 0.95

Calls 9

GetMTimeMethod · 0.95
GetNumberOfAttributesMethod · 0.95
GetAttributeMethod · 0.95
GetCenteringMethod · 0.80
maxFunction · 0.50
assertFunction · 0.50
GetNumberOfComponentsMethod · 0.45
GetActualMemorySizeMethod · 0.45
ModifiedMethod · 0.45

Tested by

no test coverage detected