bool avtStreamlineIC::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; } } } ++numSteps; if( !shouldTerminate && numSteps >= maxSteps ) { terminatedBecauseOfMaxSteps = true; shouldTerminate = true; } return shouldTerminate; }
void avtStateRecorderIntegralCurve::AnalyzeStep( avtIVPStep& step, avtIVPField* field ) { if (history.size() == 0) { // Record the first position of the step. RecordStep( field, step, step.GetT0() ); } if (CheckForTermination(step, field)) status.SetTerminationMet(); // These must be called after CheckForTermination, because // CheckForTermination will modify the step if it goes beyond the // termination criteria. (Example: streamlines will split a step if it // is terminating by distance.) time = step.GetT1(); distance += step.GetLength(); RecordStep( field, step, step.GetT1() ); }
// **************************************************************************** // Method: avtLCSIC::AnalyzeStep // // Purpose: // Analyzes the current step. // // Programmer: Allen Sanderson // Creation: August 14, 2013 // // Modifications: // // **************************************************************************** void avtLCSIC::AnalyzeStep( avtIVPStep &step, avtIVPField *field) { if (CheckForTermination(step, field)) status.SetTerminationMet(); // These must be called after CheckForTermination, because // CheckForTermination will modify the step if it goes beyond the // termination criteria. (Example: streamlines will split a step if it // is terminating by distance.) p_end = step.GetP1(); time = step.GetT1(); arcLength += step.GetLength(); distance += step.GetLength(); summation0 += (p_start - p_end).length(); summation1 = (p_start - p_end).length(); }