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

Method ComputeScalarRange

Common/DataModel/vtkExplicitStructuredGrid.cxx:923–963  ·  view source on GitHub ↗

------------------------------------------------------------------------------ Override this method because of blanking

Source from the content-addressed store, hash-verified

921//------------------------------------------------------------------------------
922// Override this method because of blanking
923void vtkExplicitStructuredGrid::ComputeScalarRange()
924{
925 if (this->GetMTime() > this->ScalarRangeComputeTime)
926 {
927 vtkDataArray* ptScalars = this->PointData->GetScalars();
928 vtkDataArray* cellScalars = this->CellData->GetScalars();
929
930 double ptRange[2];
931 ptRange[0] = VTK_DOUBLE_MAX;
932 ptRange[1] = VTK_DOUBLE_MIN;
933 if (ptScalars)
934 {
935 int num = this->GetNumberOfPoints();
936 for (int id = 0; id < num; id++)
937 {
938 double s = ptScalars->GetComponent(id, 0);
939 ptRange[0] = std::min(s, ptRange[0]);
940 ptRange[1] = std::max(s, ptRange[1]);
941 }
942 }
943
944 double cellRange[2];
945 cellRange[0] = ptRange[0];
946 cellRange[1] = ptRange[1];
947 if (cellScalars)
948 {
949 int num = this->GetNumberOfCells();
950 for (int id = 0; id < num; id++)
951 {
952 double s = cellScalars->GetComponent(id, 0);
953 cellRange[0] = std::min(s, cellRange[0]);
954 cellRange[1] = std::max(s, cellRange[1]);
955 }
956 }
957
958 this->ScalarRange[0] = (cellRange[0] >= VTK_DOUBLE_MAX ? 0.0 : cellRange[0]);
959 this->ScalarRange[1] = (cellRange[1] <= VTK_DOUBLE_MIN ? 1.0 : cellRange[1]);
960
961 this->ScalarRangeComputeTime.Modified();
962 }
963}
964
965//------------------------------------------------------------------------------
966vtkExplicitStructuredGrid* vtkExplicitStructuredGrid::GetData(vtkInformation* info)

Callers

nothing calls this directly

Calls 8

GetNumberOfCellsMethod · 0.95
minFunction · 0.50
maxFunction · 0.50
GetMTimeMethod · 0.45
GetScalarsMethod · 0.45
GetNumberOfPointsMethod · 0.45
GetComponentMethod · 0.45
ModifiedMethod · 0.45

Tested by

no test coverage detected