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

Method GetType

Common/DataModel/vtkPiecewiseFunction.cxx:171–242  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

169
170//------------------------------------------------------------------------------
171const char* vtkPiecewiseFunction::GetType()
172{
173 unsigned int i;
174 double value;
175 double prev_value = 0.0;
176 int function_type;
177
178 function_type = 0;
179
180 if (!this->Internal->Nodes.empty())
181 {
182 prev_value = this->Internal->Nodes[0]->Y;
183 }
184
185 for (i = 1; i < this->Internal->Nodes.size(); i++)
186 {
187 value = this->Internal->Nodes[i]->Y;
188
189 // Do not change the function type if equal
190 if (value != prev_value)
191 {
192 if (value > prev_value)
193 {
194 switch (function_type)
195 {
196 case 0:
197 case 1:
198 function_type = 1; // NonDecreasing
199 break;
200 case 2:
201 function_type = 3; // Varied
202 break;
203 }
204 }
205 else // value < prev_value
206 {
207 switch (function_type)
208 {
209 case 0:
210 case 2:
211 function_type = 2; // NonIncreasing
212 break;
213 case 1:
214 function_type = 3; // Varied
215 break;
216 }
217 }
218 }
219
220 prev_value = value;
221
222 // Exit loop if we find a Varied function
223 if (function_type == 3)
224 {
225 break;
226 }
227 }
228

Callers 9

GetDistinctCellTypesMethod · 0.45
FunctionValuesMethod · 0.45
TessellateMethod · 0.45
TessellateFaceMethod · 0.45
TriangulateMethod · 0.45
ContourMethod · 0.45
ClipMethod · 0.45
TessellateMethod · 0.45

Calls 2

emptyMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected