9 if (order < 1 || order > 6)
17 if (max_steps_ < 1 || max_steps_ > 6)
23 static const std::array<std::vector<double>, 6> _alphas = {{
25 {4.0 / 3.0, -1.0 / 3.0},
26 {18.0 / 11.0, -9.0 / 11.0, 2.0 / 11.0},
27 {48.0 / 25.0, -36.0 / 25.0, 16.0 / 25.0, -3.0 / 25.0},
28 {300.0 / 137.0, -300.0 / 137.0, 200.0 / 137.0, -75.0 / 137.0, 12.0 / 137.0},
29 {360.0 / 147.0, -450.0 / 147.0, 400.0 / 147.0, -225.0 / 147.0, 72.0 / 147.0, -10.0 / 147.0},
31 assert(i >= 0 && i < _alphas.size());
37 static const std::array<double, 6> _betas = {{
45 assert(i >= 0 && i < _betas.size());
51 const std::vector<double> &alpha =
alphas(
steps() - 1);
53 Eigen::VectorXd sum = Eigen::VectorXd::Zero(
x_prev().size());
54 for (
int i = 0; i <
steps(); i++)
64 const std::vector<double> &alpha =
alphas(
steps() - 1);
66 Eigen::VectorXd sum = Eigen::VectorXd::Zero(
v_prev().size());
67 for (
int i = 0; i <
steps(); i++)
113 return beta * beta *
dt() *
dt();
double dv_dx(const unsigned prev_ti=0) const override
Compute the derivative of the velocity with respect to the solution.
Eigen::VectorXd compute_velocity(const Eigen::VectorXd &x) const override
Compute the current velocity given the current solution and using the stored previous solution(s).
void set_parameters(const json ¶ms) override
Set the number of steps parameters from a json object.
static double betas(const int i)
Retrieve the value of beta used for BDF with i steps.
Eigen::VectorXd weighted_sum_v_prevs() const
Compute the weighted sum of the previous velocities.
int max_steps_
The maximum number of steps to use for integration.
int max_steps() const override
Get the maximum number of steps to use for integration.
Eigen::VectorXd weighted_sum_x_prevs() const
Compute the weighted sum of the previous solutions.
static const std::vector< double > & alphas(const int i)
Retrieve the alphas used for BDF with i steps.
void update_quantities(const Eigen::VectorXd &x) override
Update the time integration quantities (i.e., , , and ).
Eigen::VectorXd compute_acceleration(const Eigen::VectorXd &v) const override
Compute the current acceleration given the current velocity and using the stored previous velocity(s)...
double acceleration_scaling() const override
Compute the acceleration scaling used to scale forces when integrating a second order ODE.
double beta_dt() const
Compute .
Eigen::VectorXd x_tilde() const override
Compute the predicted solution to be used in the inertia term .
const Eigen::VectorXd & v_prev() const
Get the most recent previous velocity value.
std::deque< Eigen::VectorXd > x_prevs_
Store the necessary previous values of the solution for single or multi-step integration.
const Eigen::VectorXd & x_prev() const
Get the most recent previous solution value.
const double & dt() const
Access the time step size.
std::deque< Eigen::VectorXd > a_prevs_
Store the necessary previous values of the acceleration for single or multi-step integration.
int steps() const
Get the current number of steps to use for integration.
std::deque< Eigen::VectorXd > v_prevs_
Store the necessary previous values of the velocity for single or multi-step integration.
void log_and_throw_error(const std::string &msg)