#include <ConstantStepOdeSolver.h>
|
const char * | methodName () const override |
|
| RK4 () |
|
| RK4 (const AbsODERHS &rhs) |
|
| ConstantStepOdeSolver () |
|
| ConstantStepOdeSolver (const AbsODERHS &rhs) |
|
| ConstantStepOdeSolver (const ConstantStepOdeSolver &r) |
|
double | getCoordinate (const unsigned which, const unsigned idx) const |
|
double | getIntegrated (unsigned which, unsigned idx) const |
|
double | getPeakTime (unsigned which) const |
|
AbsODERHS * | getRHS () |
|
const AbsODERHS * | getRHS () const |
|
double | getTime (const unsigned idx) const |
|
double | interpolateCoordinate (unsigned which, double t, bool cubic=false) const |
|
double | interpolateIntegrated (unsigned which, double t, bool cubic=false) const |
|
double | lastDeltaT () const |
|
unsigned | lastDim () const |
|
double | lastMaxT () const |
|
unsigned | lastRunLength () const |
|
ConstantStepOdeSolver & | operator= (const ConstantStepOdeSolver &r) |
|
void | run (const double *initialConditions, unsigned lenConditions, double dt, unsigned nSteps) |
|
void | setHistory (double dt, const double *data, unsigned dim, unsigned runLen) |
|
void | setRHS (const AbsODERHS &rhs) |
|
void | truncateCoordinate (unsigned which, double minValue, double maxValue) |
|
void | writeHistory (std::ostream &os, double dt, bool cubic=false) const |
|
void | writeIntegrated (std::ostream &os, unsigned which, double dt, bool cubic=false) const |
|
virtual | ~ConstantStepOdeSolver () |
|
|
void | step (double t, double dt, const double *x, unsigned lenX, double *coordIncrement) const override |
|
|
std::vector< double > | buf_ |
|
Definition at line 141 of file ConstantStepOdeSolver.h.
◆ RK4() [1/2]
◆ RK4() [2/2]
◆ methodName()
const char* RK4::methodName |
( |
| ) |
const |
|
inlineoverridevirtual |
◆ step()
void RK4::step |
( |
double |
t, |
|
|
double |
dt, |
|
|
const double * |
x, |
|
|
unsigned |
lenX, |
|
|
double * |
coordIncrement |
|
) |
| const |
|
overrideprivatevirtual |
Implements ConstantStepOdeSolver.
Definition at line 314 of file ConstantStepOdeSolver.cc.
315 const double halfstep =
dt / 2.0;
316 if (
buf_.size() < 4 * lenX)
317 buf_.resize(4 * lenX);
318 double* k1x = &
buf_[0];
319 double* k2x = k1x + lenX;
320 double* k3x = k2x + lenX;
321 double* k4x = k3x + lenX;
323 for (
unsigned i = 0;
i < lenX; ++
i)
324 coordIncrement[
i] =
x[
i] + halfstep * k1x[
i];
325 rhs_->
calc(
t + halfstep, coordIncrement, lenX, k2x);
326 for (
unsigned i = 0;
i < lenX; ++
i)
327 coordIncrement[
i] =
x[
i] + halfstep * k2x[
i];
328 rhs_->
calc(
t + halfstep, coordIncrement, lenX, k3x);
329 for (
unsigned i = 0;
i < lenX; ++
i)
330 coordIncrement[
i] =
x[
i] +
dt * k3x[
i];
332 for (
unsigned i = 0;
i < lenX; ++
i)
333 coordIncrement[
i] =
dt / 6.0 * (k1x[
i] + 2.0 * (k2x[
i] + k3x[
i]) + k4x[
i]);
References buf_, AbsODERHS::calc(), dt, mps_fire::i, ConstantStepOdeSolver::rhs_, OrderedSet::t, and x.
◆ buf_
std::vector<double> RK4::buf_ |
|
mutableprivate |