-
Notifications
You must be signed in to change notification settings - Fork 69
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Symmetric linear multistep integrator #1154
Conversation
double denominator; | ||
}; | ||
|
||
template <typename Position, int order_> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no space
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
// Definition of an Adams-Moulton integrator used for computing velocities. | ||
template<int order_> | ||
struct AdamsMoulton { | ||
static int const order = order_; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
constexpr int
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
// The velocity is evaluated for a single step, and for a method of order | ||
// n a single step has order n + 1. This declaration gives us the velocity | ||
// with order |order_|. | ||
static int const velocity_order_ = order_ - 1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
constexpr int
, both.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
using ODE = SpecialSecondOrderDifferentialEquation<Position>; | ||
|
||
SymmetricLinearMultistepIntegrator( | ||
serialization::FixedStepSizeIntegrator::Kind const kind, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No const per #1155.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
AdamsMoulton<velocity_order_> const& velocity_integrator, | ||
FixedVector<double, half_order_> const& ɑ, | ||
FixedVector<double, half_order_> const& β_numerator, | ||
double const β_denominator); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No const per #1155.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
IntegrationInstance::AppendState<ODE> append_state, | ||
Time const& step) const; | ||
|
||
static int const order = order_; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
constexpr
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
// The latter has a general formula for the coefficients and was used to | ||
// compute the high-order integrators. | ||
|
||
AdamsMoulton<1> const& AdamsMoultonOrder1() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is a unique Adams-Moulton method of order k
. Make this a function template and write specializations. Moreover, I'd like AdamsMoulton
to be in a separate file: even though we do not implement the actual Adams-Moulton method, it is a different thing which we happen to reuse for the symmetric linear multistep integrator.
|
||
// Fill the new step. We skip the division by ɑk as it is equal to 1.0. | ||
double const ɑk = ɑ_[0]; | ||
CHECK_EQ(ɑk, 1.0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we have to do this in a loop? it seems like it should be done at construction.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
CHECK_EQ(ɑk, 1.0); | ||
typename ODE::SystemState& system_state = down_cast_instance->current_state; | ||
std::vector<Position> positions; | ||
positions.reserve(dimension); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Allocate outside the loop?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
@@ -32,6 +32,8 @@ class FixedVector { | |||
|
|||
operator std::vector<Scalar>() const; | |||
|
|||
static int const size = size_; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
constexpr
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
No description provided.