|
| 1 | +# API Documentation |
| 2 | + |
| 3 | +This section contains the comprehensive API reference for the DiffEq library. |
| 4 | + |
| 5 | +## 🔗 Auto-Generated Documentation |
| 6 | + |
| 7 | +The complete API documentation is automatically generated using Doxygen and is available at: |
| 8 | + |
| 9 | +- **[HTML Documentation](../generated/html/index.html)** - Complete API reference with inheritance diagrams |
| 10 | +- **[XML Documentation](../generated/xml/)** - Machine-readable API documentation |
| 11 | + |
| 12 | +## 📋 Quick Reference |
| 13 | + |
| 14 | +### Core Concepts |
| 15 | + |
| 16 | +- **State Types** - Supported state representations (vectors, arrays, custom types) |
| 17 | +- **Integrator Interface** - Common interface for all integrators |
| 18 | +- **Step Control** - Adaptive step size control mechanisms |
| 19 | +- **Error Estimation** - Built-in error estimation and control |
| 20 | + |
| 21 | +### Namespaces |
| 22 | + |
| 23 | +- `diffeq::concepts` - C++20 concepts for type checking |
| 24 | +- `diffeq::integrators::ode` - ODE integrators |
| 25 | +- `diffeq::integrators::sde` - SDE integrators |
| 26 | +- `diffeq::state` - State management utilities |
| 27 | +- `diffeq::traits` - Type traits and metaprogramming utilities |
| 28 | + |
| 29 | +### Main Classes |
| 30 | + |
| 31 | +#### ODE Integrators |
| 32 | + |
| 33 | +- `euler<StateType>` - Simple Euler method |
| 34 | +- `improved_euler<StateType>` - Improved Euler (Heun's method) |
| 35 | +- `rk4<StateType>` - Fourth-order Runge-Kutta |
| 36 | +- `rk23<StateType>` - Adaptive Runge-Kutta 2(3) |
| 37 | +- `rk45<StateType>` - Dormand-Prince method |
| 38 | +- `dop853<StateType>` - High-order adaptive method |
| 39 | +- `bdf<StateType>` - Backward differentiation formulas |
| 40 | +- `lsoda<StateType>` - Automatic stiffness detection |
| 41 | + |
| 42 | +#### SDE Integrators |
| 43 | + |
| 44 | +- `euler_maruyama<StateType>` - Basic SDE integration |
| 45 | +- `milstein<StateType>` - Higher-order SDE method |
| 46 | +- `sri1<StateType>` - Stochastic Runge-Kutta |
| 47 | +- `sra1<StateType>`, `sra2<StateType>` - Simplified stochastic RK |
| 48 | +- `sosri<StateType>`, `sosra<StateType>` - Second-order methods |
| 49 | +- `implicit_euler_maruyama<StateType>` - For stiff SDEs |
| 50 | + |
| 51 | +## 🔧 Usage Patterns |
| 52 | + |
| 53 | +### Basic Integration |
| 54 | + |
| 55 | +```cpp |
| 56 | +// Create integrator |
| 57 | +diffeq::integrators::rk4<std::vector<double>> integrator; |
| 58 | + |
| 59 | +// Define system |
| 60 | +auto system = [](double t, const auto& y, auto& dydt) { |
| 61 | + dydt[0] = -0.1 * y[0]; |
| 62 | +}; |
| 63 | + |
| 64 | +// Integrate |
| 65 | +std::vector<double> state = {1.0}; |
| 66 | +double time = 0.0; |
| 67 | +double dt = 0.01; |
| 68 | + |
| 69 | +integrator.step(system, state, time, dt); |
| 70 | +``` |
| 71 | +
|
| 72 | +### Adaptive Integration |
| 73 | +
|
| 74 | +```cpp |
| 75 | +// Create adaptive integrator |
| 76 | +diffeq::integrators::rk45<std::vector<double>> integrator; |
| 77 | +
|
| 78 | +// Set tolerances |
| 79 | +integrator.set_tolerances(1e-8, 1e-6); |
| 80 | +
|
| 81 | +// Integrate with automatic step size control |
| 82 | +integrator.integrate(system, state, t_start, t_end, dt_initial); |
| 83 | +``` |
| 84 | + |
| 85 | +### Stochastic Integration |
| 86 | + |
| 87 | +```cpp |
| 88 | +// Create SDE integrator |
| 89 | +diffeq::integrators::euler_maruyama<std::vector<double>> integrator; |
| 90 | + |
| 91 | +// Define drift and diffusion |
| 92 | +auto drift = [](double t, const auto& y, auto& dydt) { |
| 93 | + dydt[0] = -0.1 * y[0]; |
| 94 | +}; |
| 95 | + |
| 96 | +auto diffusion = [](double t, const auto& y, auto& dgdt) { |
| 97 | + dgdt[0] = 0.1; |
| 98 | +}; |
| 99 | + |
| 100 | +// Integrate with noise |
| 101 | +integrator.step(drift, diffusion, state, time, dt); |
| 102 | +``` |
| 103 | + |
| 104 | +## 🎯 Advanced Features |
| 105 | + |
| 106 | +### Parallel Execution |
| 107 | + |
| 108 | +```cpp |
| 109 | +// Use with standard library algorithms |
| 110 | +std::vector<std::vector<double>> initial_conditions = /* ... */; |
| 111 | + |
| 112 | +std::for_each(std::execution::par, |
| 113 | + initial_conditions.begin(), |
| 114 | + initial_conditions.end(), |
| 115 | + [&](auto& state) { |
| 116 | + integrator.integrate(system, state, t0, t1, dt); |
| 117 | + }); |
| 118 | +``` |
| 119 | +
|
| 120 | +### Custom State Types |
| 121 | +
|
| 122 | +```cpp |
| 123 | +// Define custom state type |
| 124 | +struct MyState { |
| 125 | + double x, y, z; |
| 126 | + |
| 127 | + // Required operations |
| 128 | + MyState operator+(const MyState& other) const; |
| 129 | + MyState operator*(double scalar) const; |
| 130 | + // ... other required operations |
| 131 | +}; |
| 132 | +
|
| 133 | +// Use with integrator |
| 134 | +diffeq::integrators::rk4<MyState> integrator; |
| 135 | +``` |
| 136 | + |
| 137 | +## 📚 Detailed Documentation |
| 138 | + |
| 139 | +For complete details on all classes, methods, and advanced usage, please refer to the auto-generated Doxygen documentation. |
| 140 | + |
| 141 | +## 🐛 Error Handling |
| 142 | + |
| 143 | +The library uses exceptions for error handling: |
| 144 | + |
| 145 | +- `std::invalid_argument` - Invalid parameters |
| 146 | +- `std::runtime_error` - Runtime integration errors |
| 147 | +- `std::out_of_range` - Array bounds errors |
| 148 | + |
| 149 | +## 🔗 See Also |
| 150 | + |
| 151 | +- [Examples](../examples/README.md) - Practical usage examples |
| 152 | +- [Performance Guide](../performance/README.md) - Optimization tips |
| 153 | +- [Main Documentation](../index.md) - Library overview |
0 commit comments