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

Method SimpleIntegrate

Filters/Generic/vtkGenericStreamTracer.cxx:1184–1245  ·  view source on GitHub ↗

------------------------------------------------------------------------------ This is used by sub-classes in certain situations. It does a lot less (for example, does not compute attributes) than Integrate.

Source from the content-addressed store, hash-verified

1182// does a lot less (for example, does not compute attributes)
1183// than Integrate.
1184void vtkGenericStreamTracer::SimpleIntegrate(
1185 double seed[3], double lastPoint[3], double delt, vtkGenericInterpolatedVelocityField* func)
1186{
1187 vtkIdType numSteps = 0;
1188 vtkIdType maxSteps = 20;
1189 double error = 0;
1190 double stepTaken;
1191 double point1[3], point2[3];
1192 double velocity[3];
1193 double speed;
1194
1195 (void)seed; // Seed is not used
1196
1197 memcpy(point1, lastPoint, 3 * sizeof(double));
1198
1199 // Create a new integrator, the type is the same as Integrator
1200 vtkInitialValueProblemSolver* integrator = this->GetIntegrator()->NewInstance();
1201 integrator->SetFunctionSet(func);
1202
1203 while (true)
1204 {
1205
1206 if (numSteps++ > maxSteps)
1207 {
1208 break;
1209 }
1210
1211 // Calculate the next step using the integrator provided
1212 // Break if the next point is out of bounds.
1213 if (integrator->ComputeNextStep(point1, point2, 0, delt, stepTaken, 0, 0, 0, error) != 0)
1214 {
1215 memcpy(lastPoint, point2, 3 * sizeof(double));
1216 break;
1217 }
1218
1219 // This is the next starting point
1220 for (int i = 0; i < 3; i++)
1221 {
1222 point1[i] = point2[i];
1223 }
1224
1225 // Interpolate the velocity at the next point
1226 if (!func->FunctionValues(point2, velocity))
1227 {
1228 memcpy(lastPoint, point2, 3 * sizeof(double));
1229 break;
1230 }
1231
1232 speed = vtkMath::Norm(velocity);
1233
1234 // Never call conversion methods if speed == 0
1235 if ((speed == 0) || (speed <= this->TerminalSpeed))
1236 {
1237 break;
1238 }
1239
1240 memcpy(point1, point2, 3 * sizeof(double));
1241 // End Integration

Callers

nothing calls this directly

Calls 7

GetIntegratorMethod · 0.80
SetFunctionSetMethod · 0.80
DeleteMethod · 0.65
NormEnum · 0.50
NewInstanceMethod · 0.45
ComputeNextStepMethod · 0.45
FunctionValuesMethod · 0.45

Tested by

no test coverage detected