Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: mockingbirdnest/Principia
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 7e816b45ba62
Choose a base ref
...
head repository: mockingbirdnest/Principia
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 88fd27214b5c
Choose a head ref
  • 6 commits
  • 3 files changed
  • 2 contributors

Commits on Mar 31, 2017

  1. Copy the full SHA
    e6b8e36 View commit details
  2. return auto&

    eggrobin committed Mar 31, 2017
    Copy the full SHA
    bedaa41 View commit details
  3. consistency

    eggrobin committed Mar 31, 2017
    Copy the full SHA
    07142b9 View commit details
  4. indent is hard

    eggrobin committed Mar 31, 2017
    Copy the full SHA
    6ff7d3a View commit details
  5. missing dereference

    eggrobin committed Mar 31, 2017
    Copy the full SHA
    70b8c30 View commit details
  6. Merge pull request #1298 from eggrobin/constref-trajectory-functor

    Make the primary_trajectory_ functor return a constreference
    pleroy authored Mar 31, 2017
    Copy the full SHA
    88fd272 View commit details
6 changes: 2 additions & 4 deletions physics/body_centred_body_direction_dynamic_frame.hpp
Original file line number Diff line number Diff line change
@@ -49,8 +49,7 @@ class BodyCentredBodyDirectionDynamicFrame

BodyCentredBodyDirectionDynamicFrame(
not_null<Ephemeris<InertialFrame> const*> ephemeris,
std::function<not_null<Trajectory<InertialFrame> const*>()>
primary_trajectory,
std::function<Trajectory<InertialFrame> const&()> primary_trajectory,
not_null<MassiveBody const*> secondary);

RigidMotion<InertialFrame, ThisFrame> ToThisFrameAtTime(
@@ -86,8 +85,7 @@ class BodyCentredBodyDirectionDynamicFrame
std::function<Vector<Acceleration, InertialFrame>(
Position<InertialFrame> const& position,
Instant const& t)> compute_gravitational_acceleration_on_primary_;
std::function<not_null<Trajectory<InertialFrame> const*>()> const
primary_trajectory_;
std::function<Trajectory<InertialFrame> const&()> const primary_trajectory_;
not_null<ContinuousTrajectory<InertialFrame> const*> const
secondary_trajectory_;
};
9 changes: 5 additions & 4 deletions physics/body_centred_body_direction_dynamic_frame_body.hpp
Original file line number Diff line number Diff line change
@@ -39,14 +39,15 @@ BodyCentredBodyDirectionDynamicFrame(
return ephemeris_->ComputeGravitationalAccelerationOnMassiveBody(
primary_, t);
}),
primary_trajectory_([t = ephemeris_->trajectory(primary_)] { return t; }),
primary_trajectory_(
[&t = *ephemeris_->trajectory(primary_)]() -> auto& { return t; }),
secondary_trajectory_(ephemeris_->trajectory(secondary_)) {}

template<typename InertialFrame, typename ThisFrame>
BodyCentredBodyDirectionDynamicFrame<InertialFrame, ThisFrame>::
BodyCentredBodyDirectionDynamicFrame(
not_null<Ephemeris<InertialFrame> const*> const ephemeris,
std::function<not_null<Trajectory<InertialFrame> const*>()> const
std::function<Trajectory<InertialFrame> const&()> const
primary_trajectory,
not_null<MassiveBody const*> const secondary)
: ephemeris_(ephemeris),
@@ -65,7 +66,7 @@ RigidMotion<InertialFrame, ThisFrame>
BodyCentredBodyDirectionDynamicFrame<InertialFrame, ThisFrame>::
ToThisFrameAtTime(Instant const& t) const {
DegreesOfFreedom<InertialFrame> const primary_degrees_of_freedom =
primary_trajectory_()->EvaluateDegreesOfFreedom(t);
primary_trajectory_().EvaluateDegreesOfFreedom(t);
DegreesOfFreedom<InertialFrame> const secondary_degrees_of_freedom =
secondary_trajectory_->EvaluateDegreesOfFreedom(t);

@@ -123,7 +124,7 @@ AcceleratedRigidMotion<InertialFrame, ThisFrame>
BodyCentredBodyDirectionDynamicFrame<InertialFrame, ThisFrame>::
MotionOfThisFrame(Instant const& t) const {
DegreesOfFreedom<InertialFrame> const primary_degrees_of_freedom =
primary_trajectory_()->EvaluateDegreesOfFreedom(t);
primary_trajectory_().EvaluateDegreesOfFreedom(t);
DegreesOfFreedom<InertialFrame> const secondary_degrees_of_freedom =
secondary_trajectory_->EvaluateDegreesOfFreedom(t);

7 changes: 4 additions & 3 deletions physics/body_centred_body_direction_dynamic_frame_test.cpp
Original file line number Diff line number Diff line change
@@ -489,9 +489,10 @@ TEST_F(BodyCentredBodyDirectionDynamicFrameTest, ConstructFromOneBody) {
barycentre_trajectory.Append(t0_ + t, barycentre);
}
BodyCentredBodyDirectionDynamicFrame<ICRFJ2000Equator, BigSmallFrame>
barycentric_from_discrete{ephemeris_.get(),
[t = &barycentre_trajectory] { return t; },
small_};
barycentric_from_discrete{
ephemeris_.get(),
[&t = barycentre_trajectory]() -> auto& { return t; },
small_};
BarycentricRotatingDynamicFrame<ICRFJ2000Equator, BigSmallFrame>
barycentric_from_both_bodies{ephemeris_.get(), big_, small_};
for (Time t = period_ / 32; t <= period_ / 2; t += period_ / 32) {