1 #ifndef CalibCalorimetry_HcalAlgos_ConstantStepOdeSolver_h_
2 #define CalibCalorimetry_HcalAlgos_ConstantStepOdeSolver_h_
43 inline double getTime(
const unsigned idx)
const {
45 throw cms::Exception(
"In ConstantStepOdeSolver::getTime: index out of range");
51 throw cms::Exception(
"In ConstantStepOdeSolver::getCoordinate: index out of range");
73 void run(
const double* initialConditions,
unsigned lenConditions,
double dt,
unsigned nSteps);
77 void setHistory(
double dt,
const double*
data,
unsigned dim,
unsigned runLen);
80 void writeHistory(std::ostream& os,
double dt,
bool cubic =
false)
const;
93 virtual void step(
double t,
double dt,
const double*
x,
unsigned lenX,
double* coordIncrement)
const = 0;
121 inline const char*
methodName()
const override {
return "Euler"; }
124 void step(
double t,
double dt,
const double*
x,
unsigned lenX,
double* coordIncrement)
const override;
133 inline const char*
methodName()
const override {
return "2nd order Runge-Kutta"; }
136 void step(
double t,
double dt,
const double*
x,
unsigned lenX,
double* coordIncrement)
const override;
138 mutable std::vector<double>
buf_;
147 inline const char*
methodName()
const override {
return "4th order Runge-Kutta"; }
150 void step(
double t,
double dt,
const double*
x,
unsigned lenX,
double* coordIncrement)
const override;
152 mutable std::vector<double>
buf_;
155 #endif // CalibCalorimetry_HcalAlgos_ConstantStepOdeSolver_h_
virtual AbsODERHS * clone() const =0
double getCoordinate(const unsigned which, const unsigned idx) const
RK4(const AbsODERHS &rhs)
double lastDeltaT() const
double interpolateIntegrated(unsigned which, double t, bool cubic=false) const
void step(double t, double dt, const double *x, unsigned lenX, double *coordIncrement) const override
double getTime(const unsigned idx) const
std::ostream & operator<<(std::ostream &out, const ALILine &li)
ConstantStepOdeSolver(const AbsODERHS &rhs)
std::vector< double > chargeBuffer_
double getPeakTime(unsigned which) const
void step(double t, double dt, const double *x, unsigned lenX, double *coordIncrement) const override
double getIntegrated(unsigned which, unsigned idx) const
void writeIntegrated(std::ostream &os, unsigned which, double dt, bool cubic=false) const
virtual void step(double t, double dt, const double *x, unsigned lenX, double *coordIncrement) const =0
std::vector< double > buf_
virtual const char * methodName() const =0
EulerOdeSolver(const AbsODERHS &rhs)
void step(double t, double dt, const double *x, unsigned lenX, double *coordIncrement) const override
void setRHS(const AbsODERHS &rhs)
void integrateCoordinate(const unsigned which)
const AbsODERHS * getRHS() const
ConstantStepOdeSolver & operator=(const ConstantStepOdeSolver &r)
double interpolateCoordinate(unsigned which, double t, bool cubic=false) const
std::vector< double > historyBuffer_
void run(const double *initialConditions, unsigned lenConditions, double dt, unsigned nSteps)
virtual ~ConstantStepOdeSolver()
const char * methodName() const override
char data[epos_bytes_allocation]
std::vector< double > buf_
void truncateCoordinate(unsigned which, double minValue, double maxValue)
unsigned lastRunLength() const
const char * methodName() const override
void writeHistory(std::ostream &os, double dt, bool cubic=false) const
void setHistory(double dt, const double *data, unsigned dim, unsigned runLen)
const char * methodName() const override
RK2(const AbsODERHS &rhs)