OpenSWMM Engine  6.0.0-alpha.1
Data-oriented, plugin-extensible SWMM Engine (6.0.0-alpha.1)
Loading...
Searching...
No Matches
FindRoot.hpp
Go to the documentation of this file.
1
18#ifndef OPENSWMM_FIND_ROOT_HPP
19#define OPENSWMM_FIND_ROOT_HPP
20
21#include <functional>
22
23namespace openswmm {
24namespace findroot {
25
26constexpr int MAXIT = 60;
27
42using NewtonFunc = std::function<void(double x, double* f, double* df)>;
43
44int newton(double x1, double x2, double* rts, double xacc, const NewtonFunc& func);
45
55using RidderFunc = std::function<double(double x)>;
56
57double ridder(double x1, double x2, double xacc, const RidderFunc& func);
58
59} // namespace findroot
60} // namespace openswmm
61
62#endif // OPENSWMM_FIND_ROOT_HPP
std::function< double(double x)> RidderFunc
Ridder's method (derivative-free).
Definition FindRoot.hpp:55
std::function< void(double x, double *f, double *df)> NewtonFunc
Newton-Raphson with bisection fallback.
Definition FindRoot.hpp:42
int newton(double x1, double x2, double *rts, double xacc, const NewtonFunc &func)
Definition FindRoot.cpp:17
constexpr int MAXIT
Maximum iterations.
Definition FindRoot.hpp:26
double ridder(double x1, double x2, double xacc, const RidderFunc &func)
Definition FindRoot.cpp:60
Definition Controls.cpp:24