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

Method LookupTimeAndValue

Filters/General/vtkTimeSourceExample.cxx:42–80  ·  view source on GitHub ↗

------------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

40
41//------------------------------------------------------------------------------
42void vtkTimeSourceExample::LookupTimeAndValue(double& time, double& value)
43{
44 double t = time;
45 if (this->Analytic)
46 {
47 time = t;
48 // clamp within range
49 time = std::max(time, this->Steps[0]);
50 time = std::min(time, this->Steps[this->NumSteps - 1]);
51 value = this->ValueFunction(time);
52 }
53 else
54 {
55 int index = -2;
56 for (int i = 0; i < this->NumSteps; i++)
57 {
58 if (this->Steps[i] == t)
59 {
60 index = i;
61 break;
62 }
63 if (this->Steps[i] > t)
64 {
65 index = i - 1;
66 break;
67 }
68 }
69 if (index == -1)
70 {
71 index = 0;
72 }
73 if (index == -2)
74 {
75 index = this->NumSteps - 1;
76 }
77 time = this->Steps[index];
78 value = this->Values[index];
79 }
80}
81
82//------------------------------------------------------------------------------
83int vtkTimeSourceExample::NumCellsFunction(double t)

Callers 1

RequestDataMethod · 0.95

Calls 3

ValueFunctionMethod · 0.95
maxFunction · 0.50
minFunction · 0.50

Tested by

no test coverage detected