Skip to content
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

Merged
merged 24 commits into from
Nov 27, 2016

Conversation

pleroy
Copy link
Member

@pleroy pleroy commented Nov 26, 2016

No description provided.

double denominator;
};

template <typename Position, int order_>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no space

Copy link
Member Author

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_;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

constexpr int

Copy link
Member Author

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;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

constexpr int, both.

Copy link
Member Author

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,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No const per #1155.

Copy link
Member Author

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);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No const per #1155.

Copy link
Member Author

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_;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

constexpr.

Copy link
Member Author

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() {
Copy link
Member

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);
Copy link
Member

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.

Copy link
Member Author

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);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Allocate outside the loop?

Copy link
Member Author

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_;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

constexpr

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@eggrobin eggrobin added the LGTM label Nov 27, 2016
@pleroy pleroy merged commit 6bbc858 into mockingbirdnest:master Nov 27, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants