Open CASCADE Technology Reference Manual 8.0.2
Loading...
Searching...
No Matches
MathRoot_MultipleUtils.hxx File Reference

Internal utilities for FindAllRoots / FindAllRootsWithDerivative. More...

#include <MathUtils_Types.hxx>
#include <MathUtils_Config.hxx>
#include <MathRoot_Brent.hxx>
#include <math_Vector.hxx>
#include <NCollection_DynamicArray.hxx>
#include <algorithm>
#include <cmath>

Data Structures

struct  MathRoot::MultipleResult
 Result for multiple root finding. Contains all found roots sorted in ascending order. More...
struct  MathRoot::MultipleConfig
 Configuration for multiple root finding. More...
struct  MathRoot::MultipleSampleValueFn< Function >
 Samples a Value-only function and stores f(x)-offset into a math_Vector. More...
struct  MathRoot::MultipleGetValueFn
 Returns the sampled value at a given index from a math_Vector. More...
struct  MathRoot::MultipleBrentValueWrapper< Function >
 Brent wrapper that adapts a Value-only function for offset root finding. More...
struct  MathRoot::MultipleGetRootValueFn< Function >
 Evaluates original (non-offset) function value at a root point via Value interface. More...
struct  MathRoot::MultipleDerivativeValueWrapper< Function >
 Wrapper exposing a function derivative through the Value() contract required by Brent. More...
struct  MathRoot::MultipleNoExtraHandler
 No-op interval handler for functions without derivative. More...

Namespaces

namespace  MathRoot
 Root finding algorithms for scalar functions.

Functions

void MathRoot::SortRoots (MultipleResult &theResult)
 In-place insertion sort of roots and corresponding values by ascending root value.
void MathRoot::AddRoot (MultipleResult &theResult, double theEpsX, double theRoot, double theValue)
 Helper to add a root if it is not a duplicate of an already found root.
double MathRoot::EffectiveXTolerance (double theLower, double theUpper, double theXTolerance)
 Compute the minimal X tolerance compatible with the established multi-root behavior.
template<typename Function>
bool MathRoot::EvaluateValue (Function &theFunc, double theX, double &theValue)
 Evaluate the original function value.
template<typename Function>
bool MathRoot::EvaluateShiftedValue (Function &theFunc, double theX, double theOffset, double &theValue)
 Evaluate the function value shifted by the requested offset.
template<typename Function>
bool MathRoot::EvaluateShiftedValues (Function &theFunc, double theX, double theOffset, double &theValue, double &theDerivative)
 Evaluate the function value and derivative, then shift the value by the requested offset.
template<typename Function>
bool MathRoot::RefineBracketedRoot (Function &theFunc, double theOffset, double theX1, double theY1, double theX2, double theY2, double theTolerance, double theEpsX, MultipleResult &theResult)
 Refine a bracketed sign change using the same Brent/Newton sequence as math_FunctionRoots.
template<typename Function>
MultipleResult MathRoot::FindAllRootsWithDerivativeImpl (Function &theFunc, double theLower, double theUpper, const MultipleConfig &theConfig)
 Derivative-aware implementation mirroring the proven math_FunctionRoots heuristics while operating on the modern callable-based MathRoot API.
template<typename SampleFn, typename GetValueFn, typename BrentWrapperT, typename GetRootValueFn, typename IntervalExtraFn>
MultipleResult MathRoot::FindAllRootsImpl (double theLower, double theUpper, const MultipleConfig &theConfig, SampleFn theSampleFn, GetValueFn theGetValue, BrentWrapperT &theBrentWrapper, GetRootValueFn theGetRootValue, IntervalExtraFn theIntervalExtra)
 Core implementation for finding all roots in an interval. Shared logic for both Value-only and Values (with derivative) interfaces.

Detailed Description

Internal utilities for FindAllRoots / FindAllRootsWithDerivative.

Contains result/config types, helper functions, functor adapters and the shared core implementation used by MathRoot_Multiple.hxx.