![]() |
OpenSWMM Engine
6.0.0-alpha.1
Data-oriented, plugin-extensible SWMM Engine (6.0.0-alpha.1)
|
Typedefs | |
| using | NewtonFunc = std::function< void(double x, double *f, double *df)> |
| Newton-Raphson with bisection fallback. | |
| using | RidderFunc = std::function< double(double x)> |
| Ridder's method (derivative-free). | |
Functions | |
| int | newton (double x1, double x2, double *rts, double xacc, const NewtonFunc &func) |
| double | ridder (double x1, double x2, double xacc, const RidderFunc &func) |
Variables | |
| constexpr int | MAXIT = 60 |
| Maximum iterations. | |
| using openswmm::findroot::NewtonFunc = typedef std::function<void(double x, double* f, double* df)> |
Newton-Raphson with bisection fallback.
Finds x in [x1, x2] such that f(x) = 0. Requires f(x1) and f(x2) to have opposite signs. Uses Newton steps when reliable, falls back to bisection when Newton would exit the bracket or converge slowly.
| x1 | Left bracket. |
| x2 | Right bracket. |
| rts | [in/out] Initial guess → root. |
| xacc | Convergence tolerance (|dx| < xacc). |
| func | Callback: func(x, &f, &df) sets f=f(x), df=f'(x). |
| using openswmm::findroot::RidderFunc = typedef std::function<double(double x)> |
Ridder's method (derivative-free).
| x1 | Left bracket. |
| x2 | Right bracket. |
| xacc | Convergence tolerance. |
| func | Callback: func(x) returns f(x). |
| int openswmm::findroot::newton | ( | double | x1, |
| double | x2, | ||
| double * | rts, | ||
| double | xacc, | ||
| const NewtonFunc & | func | ||
| ) |
| double openswmm::findroot::ridder | ( | double | x1, |
| double | x2, | ||
| double | xacc, | ||
| const RidderFunc & | func | ||
| ) |
|
constexpr |
Maximum iterations.