#include <ConstantStepOdeSolver.h>
|
const char * | methodName () const |
|
| 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 |
|
const AbsODERHS * | getRHS () const |
|
AbsODERHS * | getRHS () |
|
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 |
|
|
std::vector< double > | buf_ |
|
Definition at line 167 of file ConstantStepOdeSolver.h.
const char* RK4::methodName |
( |
| ) |
const |
|
inlinevirtual |
void RK4::step |
( |
double |
t, |
|
|
double |
dt, |
|
|
const double * |
x, |
|
|
unsigned |
lenX, |
|
|
double * |
coordIncrement |
|
) |
| const |
|
privatevirtual |
Implements ConstantStepOdeSolver.
Definition at line 373 of file ConstantStepOdeSolver.cc.
References buf_, AbsODERHS::calc(), i, and ConstantStepOdeSolver::rhs_.
377 const double halfstep =
dt/2.0;
378 if (
buf_.size() < 4*lenX)
380 double* k1x = &
buf_[0];
381 double* k2x = k1x + lenX;
382 double* k3x = k2x + lenX;
383 double* k4x = k3x + lenX;
385 for (
unsigned i=0;
i<lenX; ++
i)
386 coordIncrement[
i] =
x[
i] + halfstep*k1x[
i];
387 rhs_->
calc(
t + halfstep, coordIncrement, lenX, k2x);
388 for (
unsigned i=0;
i<lenX; ++
i)
389 coordIncrement[
i] =
x[
i] + halfstep*k2x[
i];
390 rhs_->
calc(
t + halfstep, coordIncrement, lenX, k3x);
391 for (
unsigned i=0;
i<lenX; ++
i)
392 coordIncrement[
i] =
x[
i] +
dt*k3x[
i];
394 for (
unsigned i=0;
i<lenX; ++
i)
395 coordIncrement[
i] =
dt/6.0*(k1x[
i] + 2.0*(k2x[
i] + k3x[
i]) + k4x[i]);
std::vector< double > buf_
virtual void calc(double t, const double *x, unsigned lenX, double *derivative)=0
std::vector<double> RK4::buf_ |
|
mutableprivate |