1 #ifndef CalibCalorimetry_HcalAlgos_ConstantStepOdeSolver_h_ 2 #define CalibCalorimetry_HcalAlgos_ConstantStepOdeSolver_h_ 50 "In ConstantStepOdeSolver::getTime: index out of range");
57 "In ConstantStepOdeSolver::getCoordinate: index out of range");
71 bool cubic =
false)
const;
75 bool cubic =
false)
const;
81 void run(
const double* initialConditions,
unsigned lenConditions,
82 double dt,
unsigned nSteps);
87 unsigned dim,
unsigned runLen);
90 void writeHistory(std::ostream& os,
double dt,
bool cubic =
false)
const;
94 double dt,
bool cubic =
false)
const;
104 virtual void step(
double t,
double dt,
105 const double*
x,
unsigned lenX,
106 double* coordIncrement)
const = 0;
140 inline const char*
methodName()
const override {
return "Euler";}
144 const double*
x,
unsigned lenX,
145 double* coordIncrement)
const override;
156 inline const char*
methodName()
const override {
return "2nd order Runge-Kutta";}
160 const double*
x,
unsigned lenX,
161 double* coordIncrement)
const override;
163 mutable std::vector<double>
buf_;
174 inline const char*
methodName()
const override {
return "4th order Runge-Kutta";}
178 const double*
x,
unsigned lenX,
179 double* coordIncrement)
const override;
181 mutable std::vector<double>
buf_;
184 #endif // CalibCalorimetry_HcalAlgos_ConstantStepOdeSolver_h_ 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
std::ostream & operator<<(std::ostream &os, const ConstantStepOdeSolver &s)
double getTime(const unsigned idx) const
ConstantStepOdeSolver(const AbsODERHS &rhs)
std::vector< double > chargeBuffer_
virtual AbsODERHS * clone() const =0
double getPeakTime(unsigned which) const
double getIntegrated(unsigned which, unsigned idx) const
void writeIntegrated(std::ostream &os, unsigned which, double dt, bool cubic=false) const
const char * methodName() const override
std::vector< double > buf_
EulerOdeSolver(const AbsODERHS &rhs)
void setRHS(const AbsODERHS &rhs)
void integrateCoordinate(const unsigned which)
const AbsODERHS * getRHS() const
ConstantStepOdeSolver & operator=(const ConstantStepOdeSolver &r)
const char * methodName() const override
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()
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
virtual const char * methodName() const =0
void writeHistory(std::ostream &os, double dt, bool cubic=false) const
void setHistory(double dt, const double *data, unsigned dim, unsigned runLen)
virtual void step(double t, double dt, const double *x, unsigned lenX, double *coordIncrement) const =0
RK2(const AbsODERHS &rhs)