|
HOPS
HOPS class reference
|
Trapezoidal integrator over tabular data with linear interpolation. More...
#include <MHO_ApMeanIntegrator.hh>
Public Member Functions | |
| MHO_ApMeanIntegrator () | |
| ~MHO_ApMeanIntegrator () | |
| int | Initialize (int n, const double *coords, const double *val1, const double *val2) |
| Load tabular data. Must be called before Integrate(). More... | |
| int | Integrate (double start, double stop, int *nstart, double *result1, double *result2) |
| Compute the average of val1 and val2 over [start, stop]. More... | |
Trapezoidal integrator over tabular data with linear interpolation.
Replaces the static-buffer ap_mean() function with a re-entrant object. The caller initializes the integrator once with a set of (coord, val1, val2) points, then queries integrated averages over successive [start, stop] intervals. The optional nstart pointer is an optimizer hint so that the search for the first relevant tabular point does not restart from the beginning on each call.
Thread-safe by design: each instance owns its own buffers.
| hops::MHO_ApMeanIntegrator::MHO_ApMeanIntegrator | ( | ) |
| hops::MHO_ApMeanIntegrator::~MHO_ApMeanIntegrator | ( | ) |
| int hops::MHO_ApMeanIntegrator::Initialize | ( | int | n, |
| const double * | coords, | ||
| const double * | val1, | ||
| const double * | val2 | ||
| ) |
Load tabular data. Must be called before Integrate().
| n | Number of data points (must be > 0). |
| coords | Monotonically increasing coordinate array of size n. |
| val1 | First value array (e.g. real part) of size n. |
| val2 | Second value array (e.g. imaginary part) of size n. |
| int hops::MHO_ApMeanIntegrator::Integrate | ( | double | start, |
| double | stop, | ||
| int * | nstart, | ||
| double * | result1, | ||
| double * | result2 | ||
| ) |
Compute the average of val1 and val2 over [start, stop].
Uses trapezoidal integration with linear interpolation at the interval boundaries. Guard points are extrapolated beyond the first and last tabular entries so that edge intervals are handled gracefully.
| start | Interval start coordinate. |
| stop | Interval stop coordinate (must be > start). |
| nstart | In/out optimizer index. Set to 0 for the first call after Initialize(); the method updates it for subsequent calls. |
| result1 | Output average of val1. |
| result2 | Output average of val2. |