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

Method ComputeScalarRange

Common/DataModel/vtkDataSet.cxx:194–233  ·  view source on GitHub ↗

------------------------------------------------------------------------------ Description: Compute the range of the scalars and cache it into ScalarRange only if the cache became invalid (ScalarRangeComputeTime).

Source from the content-addressed store, hash-verified

192// Compute the range of the scalars and cache it into ScalarRange
193// only if the cache became invalid (ScalarRangeComputeTime).
194void vtkDataSet::ComputeScalarRange()
195{
196 if (this->GetMTime() > this->ScalarRangeComputeTime)
197 {
198 vtkDataArray *ptScalars, *cellScalars;
199 ptScalars = this->PointData->GetScalars();
200 cellScalars = this->CellData->GetScalars();
201
202 vtkUnsignedCharArray* ptGhosts = this->PointData->GetGhostArray();
203 const unsigned char* ptGhostsPtr = ptGhosts ? ptGhosts->GetPointer(0) : nullptr;
204 unsigned char ptGhostsToSkip = this->PointData->GetGhostsToSkip();
205
206 vtkUnsignedCharArray* cellGhosts = this->CellData->GetGhostArray();
207 const unsigned char* cellGhostsPtr = cellGhosts ? cellGhosts->GetPointer(0) : nullptr;
208 unsigned char cellGhostsToSkip = this->CellData->GetGhostsToSkip();
209
210 double r1[2], r2[2];
211 if (ptScalars && cellScalars)
212 {
213 ptScalars->GetRange(r1, 0, ptGhostsPtr, ptGhostsToSkip);
214 cellScalars->GetRange(r2, 0, cellGhostsPtr, cellGhostsToSkip);
215 this->ScalarRange[0] = (r1[0] < r2[0] ? r1[0] : r2[0]);
216 this->ScalarRange[1] = (r1[1] > r2[1] ? r1[1] : r2[1]);
217 }
218 else if (ptScalars)
219 {
220 ptScalars->GetRange(this->ScalarRange, 0, ptGhostsPtr, ptGhostsToSkip);
221 }
222 else if (cellScalars)
223 {
224 cellScalars->GetRange(this->ScalarRange, 0, cellGhostsPtr, cellGhostsToSkip);
225 }
226 else
227 {
228 this->ScalarRange[0] = 0.0;
229 this->ScalarRange[1] = 1.0;
230 }
231 this->ScalarRangeComputeTime.Modified();
232 }
233}
234
235//------------------------------------------------------------------------------
236void vtkDataSet::GetScalarRange(double range[2])

Callers 1

GetScalarRangeMethod · 0.95

Calls 6

GetMTimeMethod · 0.95
GetScalarsMethod · 0.45
GetGhostArrayMethod · 0.45
GetPointerMethod · 0.45
GetRangeMethod · 0.45
ModifiedMethod · 0.45

Tested by

no test coverage detected