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

Method GetCellAttributeRange

Common/DataModel/vtkCellGrid.cxx:520–575  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

518}
519
520bool vtkCellGrid::GetCellAttributeRange(
521 vtkCellAttribute* attribute, int componentIndex, double range[2], bool finiteRange) const
522{
523 // Invalidate the range so early returns indicate we could not compute one.
524 range[0] = 1.;
525 range[1] = 0.;
526
527 if (!attribute || componentIndex < -2 || componentIndex >= attribute->GetNumberOfComponents())
528 {
529 return false;
530 }
531
532 // If attribute does not belong to this vtkCellGrid, we cannot proceed.
533 auto attIt = this->Attributes.find(attribute->GetHash());
534 if (attIt == this->Attributes.end())
535 {
536 return false;
537 }
538
539 // If the cache does not exist, is not up to date, or is not the right size
540 // (i.e., because someone forgot to call Modified() on the attribute), then
541 // recompute the range.
542 auto cacheIt = this->RangeCache.find(attribute);
543 if (cacheIt == this->RangeCache.end() ||
544 cacheIt->second.size() <= static_cast<std::size_t>(componentIndex + 2) ||
545 (finiteRange && cacheIt->second[componentIndex + 2].FiniteRangeTime < attribute->GetMTime()) ||
546 (!finiteRange && cacheIt->second[componentIndex + 2].EntireRangeTime < attribute->GetMTime()))
547 {
548 if (!this->ComputeRangeInternal(attribute, componentIndex, finiteRange))
549 {
550 return false;
551 }
552 cacheIt = this->RangeCache.find(attribute);
553 if (cacheIt == this->RangeCache.end())
554 {
555 return false;
556 }
557 }
558
559 // Copy the cache into our result.
560 if (finiteRange)
561 {
562 for (int ii = 0; ii < 2; ++ii)
563 {
564 range[ii] = cacheIt->second[componentIndex + 2].FiniteRange[ii];
565 }
566 }
567 else
568 {
569 for (int ii = 0; ii < 2; ++ii)
570 {
571 range[ii] = cacheIt->second[componentIndex + 2].EntireRange[ii];
572 }
573 }
574 return true;
575}
576
577void vtkCellGrid::ClearRangeCache(const std::string& attributeName)

Callers 5

RoundTripFunction · 0.80
PrepareHelperMethod · 0.80
runCaseMethod · 0.80
checkRangeForFileMethod · 0.80

Calls 7

ComputeRangeInternalMethod · 0.95
GetHashMethod · 0.80
GetNumberOfComponentsMethod · 0.45
findMethod · 0.45
endMethod · 0.45
sizeMethod · 0.45
GetMTimeMethod · 0.45

Tested by 3

RoundTripFunction · 0.64
runCaseMethod · 0.64
checkRangeForFileMethod · 0.64