bool avtLCSIC::CheckForTermination(avtIVPStep& step, avtIVPField *field) { bool shouldTerminate = false; // Check for termination. if( doTime ) { if( (direction == DIRECTION_FORWARD && step.GetT1() >= maxTime) || (direction == DIRECTION_BACKWARD && step.GetT1() <= maxTime) ) shouldTerminate = true; } if( doDistance ) { double Lstep = step.GetLength(); double Ltogo = std::abs(maxDistance) - distance; if( Lstep > Ltogo ) { step.ClampToLength( Ltogo ); shouldTerminate = true; } else if (field->VelocityIsInstantaneous() && (Lstep / std::abs(step.t1 - step.t0) < 1e-8)) { { // Above condition ensures that the curve makes progress // w.r.t. distance to avoid infinite integration into a // critical point. // // FIXME: I don't like the above hardcoded threshold - // this should probably be something like // Lstep / Lmax < 1e-6 ? // // FIXME: Also, this should only be tested in the stationary // case, since in a time-varying scenario, the critical point // might move. shouldTerminate = true; } } } if( !shouldTerminate && numSteps >= maxSteps ) { terminatedBecauseOfMaxSteps = true; shouldTerminate = true; } // Update other termination criteria. numSteps += 1; return shouldTerminate; }