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: 45f6327bea11
Choose a base ref
...
head repository: mockingbirdnest/Principia
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 3348e1965290
Choose a head ref
  • 3 commits
  • 7 files changed
  • 1 contributor

Commits on Aug 22, 2021

  1. Zermelo.

    pleroy committed Aug 22, 2021
    Copy the full SHA
    aef3cec View commit details
  2. Typo.

    pleroy committed Aug 22, 2021
    Copy the full SHA
    ce8f0ad View commit details
  3. Merge pull request #3111 from pleroy/Zermelo

    Zermelo
    pleroy authored Aug 22, 2021
    Copy the full SHA
    3348e19 View commit details
Showing with 22 additions and 23 deletions.
  1. +4 −5 ksp_plugin/vessel.cpp
  2. +1 −1 ksp_plugin/vessel.hpp
  3. +4 −4 physics/discrete_trajectory_body.hpp
  4. +1 −1 physics/forkable.hpp
  5. +5 −5 physics/forkable_body.hpp
  6. +2 −2 serialization/ksp_plugin.proto
  7. +5 −5 serialization/physics.proto
9 changes: 4 additions & 5 deletions ksp_plugin/vessel.cpp
Original file line number Diff line number Diff line change
@@ -477,14 +477,13 @@ not_null<std::unique_ptr<Vessel>> Vessel::ReadFromMessage(
bool const is_pre_chasles = message.has_prediction();
bool const is_pre_陈景润 = !message.history().has_downsampling();
// TODO(phl): Decide in which version it goes.
bool const is_pre_grothendieck_haar =
!message.history().has_tracked_position();
LOG_IF(WARNING, is_pre_grothendieck_haar)
bool const is_pre_zermelo = !message.history().has_tracked_position();
LOG_IF(WARNING, is_pre_zermelo)
<< "Reading pre-"
<< (is_pre_cesàro ? u8"Cesàro"
: is_pre_chasles ? "Chasles"
: is_pre_陈景润 ? u8"陈景润"
: "Grothendieck/Haar")
: "Zermelo")
<< " Vessel";

// NOTE(egg): for now we do not read the |MasslessBody| as it can contain no
@@ -540,7 +539,7 @@ not_null<std::unique_ptr<Vessel>> Vessel::ReadFromMessage(
/*tracked=*/{&vessel->psychohistory_});
vessel->backstory_ = vessel->psychohistory_->parent();
vessel->prediction_ = vessel->psychohistory_->NewForkAtLast();
} else if (is_pre_grothendieck_haar) {
} else if (is_pre_zermelo) {
vessel->history_ = DiscreteTrajectory<Barycentric>::ReadFromMessage(
message.history(),
/*tracked=*/{&vessel->psychohistory_,
2 changes: 1 addition & 1 deletion ksp_plugin/vessel.hpp
Original file line number Diff line number Diff line change
@@ -272,7 +272,7 @@ class Vessel {
not_null<Celestial const*> parent_;
not_null<Ephemeris<Barycentric>*> const ephemeris_;

// When reading a pre-Grothendieck/Haar save, the existing history must be
// When reading a pre-Zermelo save, the existing history must be
// non-collapsible as we don't know anything about it.
bool is_collapsible_ = false;

8 changes: 4 additions & 4 deletions physics/discrete_trajectory_body.hpp
Original file line number Diff line number Diff line change
@@ -528,17 +528,17 @@ typename DiscreteTrajectory<Frame>::Downsampling
DiscreteTrajectory<Frame>::Downsampling::ReadFromMessage(
serialization::DiscreteTrajectory::Downsampling const& message,
DiscreteTrajectory const& trajectory) {
bool const is_pre_grothendieck_haar = message.has_start_of_dense_timeline();
LOG_IF(WARNING, is_pre_grothendieck_haar)
<< "Reading pre-Grothendieck/Haar Downsampling";
bool const is_pre_zermelo = message.has_start_of_dense_timeline();
LOG_IF(WARNING, is_pre_zermelo)
<< "Reading pre-Zermelo Downsampling";
Downsampling downsampling(message.max_dense_intervals(),
Length::ReadFromMessage(message.tolerance()),
[&trajectory](Instant const& t){
auto const it = trajectory.Find(t);
CHECK(it != trajectory.end());
return it.current();
});
if (is_pre_grothendieck_haar) {
if (is_pre_zermelo) {
// No support for forks in legacy saves, so |find| will succeed and ++ is
// safe.
auto it = trajectory.timeline_.find(
2 changes: 1 addition & 1 deletion physics/forkable.hpp
Original file line number Diff line number Diff line change
@@ -207,7 +207,7 @@ class Forkable {
// serialized. The forks in |tracked| will be retrieved in the same order
// when reading. The pointers in |excluded| are removed, the pointers in
// |tracked| are nulled-out as they are used.
// Note that prior to Grothendieck/Haar all forks that were not tracked were
// Note that prior to Zermelo all forks that were not tracked were
// implicitly excluded (so the serialized-but-not-tracked case didn't happen).
// Returns false if this trajectory is excluded.
bool WriteSubTreeToMessage(
10 changes: 5 additions & 5 deletions physics/forkable_body.hpp
Original file line number Diff line number Diff line change
@@ -525,11 +525,11 @@ void Forkable<Tr4jectory, It3rator, Traits>::FillSubTreeFromMessage(
serialization::DiscreteTrajectory const& message,
std::vector<Tr4jectory**> const& tracked,
Timeline const& exact) {
bool const is_pre_grothendieck_haar = !message.has_tracked_position();
LOG_IF(WARNING, is_pre_grothendieck_haar)
<< "Reading pre-Grothendieck/Haar Forkable";
bool const is_pre_zermelo = !message.has_tracked_position();
LOG_IF(WARNING, is_pre_zermelo)
<< "Reading pre-Zermelo Forkable";

if (!is_pre_grothendieck_haar) {
if (!is_pre_zermelo) {
std::int32_t const tracked_position = message.tracked_position();
if (tracked_position !=
serialization::DiscreteTrajectory::MISSING_TRACKED_POSITION) {
@@ -540,7 +540,7 @@ void Forkable<Tr4jectory, It3rator, Traits>::FillSubTreeFromMessage(
// There were no fork positions prior to Буняковский, but we don't maintain
// compatibility that far back.
bool const has_fork_position = message.fork_position_size() > 0;
CHECK(is_pre_grothendieck_haar || !has_fork_position)
CHECK(is_pre_zermelo || !has_fork_position)
<< message.DebugString();

std::int32_t index = 0;
4 changes: 2 additions & 2 deletions serialization/ksp_plugin.proto
Original file line number Diff line number Diff line change
@@ -176,7 +176,7 @@ message Vessel {
optional bool psychohistory_is_authoritative = 17; // Pre-Cesàro.
optional DiscreteTrajectory prediction = 18; // Pre-Chasles.
optional FlightPlan flight_plan = 4;
repeated Checkpoint checkpoint = 21; // Added in Grothendieck/Haar.
repeated Checkpoint checkpoint = 21; // Added in Zermelo.

// Pre-Буняковский.
reserved 2, 3, 5;
@@ -190,7 +190,7 @@ message Vessel {
"prediction_fork_time";
// Pre-Cesàro.
reserved "psychohistory";
// Grothendieck/Haar failed attempt.
// Zermelo failed attempt.
reserved 20;
reserved "prehistory";
}
10 changes: 5 additions & 5 deletions serialization/physics.proto
Original file line number Diff line number Diff line change
@@ -80,17 +80,17 @@ message ContinuousTrajectory {

message DiscreteTrajectory {
// A marker to indicate that a fork doesn't have its position tracked.
// Added in Grothendieck/Haar.
// Added in Zermelo.
enum TrackedPosition {
MISSING_TRACKED_POSITION = -1;
}
message Downsampling {
required int64 max_dense_intervals = 2;
required Quantity tolerance = 3;
// The instant of the iterator; absent if it is the end of the timeline.
// Pre Grothendieck/Haar.
// Pre Zermelo.
optional Point start_of_dense_timeline = 1;
// Added in Grothendieck/Haar.
// Added in Zermelo.
repeated Point dense_timeline = 4;
}
message InstantaneousDegreesOfFreedom {
@@ -104,9 +104,9 @@ message DiscreteTrajectory {
}
repeated Brood children = 1;
repeated InstantaneousDegreesOfFreedom timeline = 2;
// Pre Grothendieck/Haar.
// Pre-Zermelo.
repeated int32 fork_position = 3;
// Added in Grothendieck/Haar.
// Added in Zermelo.
optional int32 tracked_position = 7; // Required.
// Added in 陈景润.
optional Downsampling downsampling = 4;