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

Commits on Jul 18, 2021

  1. Log the compatibility paths

    eggrobin committed Jul 18, 2021
    Copy the full SHA
    0a06b0d View commit details
  2. indent and line length

    eggrobin committed Jul 18, 2021
    Copy the full SHA
    46c301e View commit details
  3. Merge pull request #3073 from eggrobin/log-compatibility

    Log the compatibility paths
    eggrobin authored Jul 18, 2021
    Copy the full SHA
    ecebea3 View commit details
15 changes: 15 additions & 0 deletions base/macros.hpp
Original file line number Diff line number Diff line change
@@ -241,5 +241,20 @@ template_and_result declared_name parameters; \
} \
using internal_##package_name::declared_name

#define LOG_IF_EVERY(severity, Δt, condition) \
static std::optional<std::chrono::steady_clock::time_point> \
LOG_EVERY_N_VARNAME(last_log_time, __LINE__); \
bool const LOG_EVERY_N_VARNAME(Δt_elapsed, __LINE__) = \
!LOG_EVERY_N_VARNAME(last_log_time, __LINE__).has_value() || \
(std::chrono::steady_clock::now() - \
*LOG_EVERY_N_VARNAME(last_log_time, __LINE__)) >= (Δt); \
LOG_IF(severity, (condition) && LOG_EVERY_N_VARNAME(Δt_elapsed, __LINE__)) \
<< (LOG_EVERY_N_VARNAME(last_log_time, __LINE__) = \
std::chrono::steady_clock::now(), \
"")

#define LOG_IF_EVERY_SECOND(severity, condition) \
LOG_IF_EVERY(severity, std::chrono::seconds(1), (condition))

} // namespace base
} // namespace principia
2 changes: 2 additions & 0 deletions geometry/orthogonal_map_body.hpp
Original file line number Diff line number Diff line change
@@ -106,6 +106,8 @@ OrthogonalMap<FromFrame, ToFrame>
OrthogonalMap<FromFrame, ToFrame>::ReadFromMessage(
serialization::OrthogonalMap const& message) {
bool const is_pre_frege = message.has_rotation();
LOG_IF_EVERY_SECOND(WARNING, is_pre_frege)
<< "Reading pre-Frege OrthogonalMap";
return OrthogonalMap(
is_pre_frege
? Quaternion::ReadFromMessage(message.rotation().quaternion())
4 changes: 4 additions & 0 deletions integrators/integrators_body.hpp
Original file line number Diff line number Diff line change
@@ -565,6 +565,8 @@ AdaptiveStepSizeIntegrator<ODE_>::Parameters::ReadFromMessage(
serialization::AdaptiveStepSizeIntegratorInstance::Parameters const&
message) {
bool const is_pre_cartan = !message.has_last_step_is_exact();
LOG_IF_EVERY_SECOND(WARNING, is_pre_cartan)
<< "Reading pre-Cartan AdaptiveStepSizeIntegrator";
Parameters result(Time::ReadFromMessage(message.first_time_step()),
message.safety_factor(),
message.max_steps(),
@@ -636,6 +638,8 @@ AdaptiveStepSizeIntegrator<ODE_>::Instance::ReadFromMessage(
auto const& extension = message.GetExtension(
serialization::AdaptiveStepSizeIntegratorInstance::extension);
bool const is_pre_cartan = !extension.has_time_step();
LOG_IF_EVERY_SECOND(WARNING, is_pre_cartan)
<< "Reading pre-Cartan AdaptiveStepSizeIntegrator Instance";

auto const parameters =
Parameters::ReadFromMessage(extension.parameters());
2 changes: 2 additions & 0 deletions ksp_plugin/flight_plan.cpp
Original file line number Diff line number Diff line change
@@ -264,6 +264,8 @@ std::unique_ptr<FlightPlan> FlightPlan::ReadFromMessage(

bool const is_pre_erdős =
!message.has_generalized_adaptive_step_parameters();
LOG_IF_EVERY_SECOND(WARNING, is_pre_erdős)
<< u8"Reading pre-Erdős FlightPlan";
std::unique_ptr<Ephemeris<Barycentric>::GeneralizedAdaptiveStepParameters>
generalized_adaptive_step_parameters;
if (is_pre_erdős) {
6 changes: 6 additions & 0 deletions ksp_plugin/part.cpp
Original file line number Diff line number Diff line change
@@ -266,6 +266,12 @@ not_null<std::unique_ptr<Part>> Part::ReadFromMessage(
is_pre_fréchet || (message.has_pre_frenet_inertia_tensor() &&
!message.has_intrinsic_torque());
bool const is_pre_galileo = !message.has_centre_of_mass();
LOG_IF_EVERY_SECOND(WARNING, is_pre_galileo)
<< "Reading pre-"
<< (is_pre_cesàro ? u8"Cesàro"
: is_pre_fréchet ? u8"Fréchet"
: is_pre_frenet ? "Frenet"
: "Galileo") << " Part";

std::unique_ptr<Part> part;
if (is_pre_fréchet) {
7 changes: 7 additions & 0 deletions ksp_plugin/pile_up.cpp
Original file line number Diff line number Diff line change
@@ -217,6 +217,13 @@ not_null<std::unique_ptr<PileUp>> PileUp::ReadFromMessage(
message.apparent_part_degrees_of_freedom_size() > 0;
bool const is_pre_frobenius = message.rigid_pile_up().empty() ||
!message.has_angular_momentum();
LOG_IF_EVERY_SECOND(WARNING, is_pre_frobenius)
<< "Reading pre-"
<< (is_pre_cartan ? "Cartan"
: is_pre_cesàro ? u8"Cesàro"
: is_pre_frege ? "Frege"
: "Frobenius") << " PileUp";

std::unique_ptr<PileUp> pile_up;
if (is_pre_cesàro) {
if (is_pre_cartan) {
5 changes: 5 additions & 0 deletions ksp_plugin/plugin.cpp
Original file line number Diff line number Diff line change
@@ -1453,6 +1453,8 @@ not_null<std::unique_ptr<Plugin>> Plugin::ReadFromMessage(
plugin->UpdatePlanetariumRotation();

bool const is_pre_cauchy = message.has_pre_cauchy_plotting_frame();
LOG_IF_EVERY_SECOND(WARNING, is_pre_cauchy) << "Reading pre-Cauchy Plugin";

if (is_pre_cauchy) {
plugin->renderer_ =
std::make_unique<Renderer>(
@@ -1577,6 +1579,9 @@ void Plugin::ReadCelestialsFromMessages(
int index = 0;
for (auto const& celestial_message : celestial_messages) {
bool const is_pre_cauchy = !celestial_message.has_ephemeris_index();
LOG_IF_EVERY_SECOND(WARNING, is_pre_cauchy)
<< "Reading pre-Cauchy Celestial";

auto const& body = is_pre_cauchy
? bodies[index++]
: bodies[celestial_message.ephemeris_index()];
5 changes: 5 additions & 0 deletions ksp_plugin/vessel.cpp
Original file line number Diff line number Diff line change
@@ -403,6 +403,11 @@ not_null<std::unique_ptr<Vessel>> Vessel::ReadFromMessage(
bool const is_pre_cesàro = message.has_psychohistory_is_authoritative();
bool const is_pre_chasles = message.has_prediction();
bool const is_pre_陈景润 = !message.history().has_downsampling();
LOG_IF_EVERY_SECOND(WARNING, is_pre_陈景润) << "Reading pre-"
<< (is_pre_cesàro ? u8"Cesàro"
: is_pre_chasles ? "Chasles"
: "陈景润")
<< " Vessel";

// NOTE(egg): for now we do not read the |MasslessBody| as it can contain no
// information.
4 changes: 4 additions & 0 deletions ksp_plugin_test/plugin_compatibility_test.cpp
Original file line number Diff line number Diff line change
@@ -32,6 +32,10 @@ const char preferred_encoder[] = "base64";

class PluginCompatibilityTest : public testing::Test {
protected:
PluginCompatibilityTest() {
google::SetStderrLogging(google::WARNING);
}

// Reads a plugin from a file containing only the "serialized_plugin = "
// lines, with "serialized_plugin = " dropped.
not_null<std::unique_ptr<Plugin const>> ReadPluginFromFile(
3 changes: 3 additions & 0 deletions numerics/polynomial_body.hpp
Original file line number Diff line number Diff line change
@@ -557,6 +557,9 @@ ReadFromMessage(serialization::Polynomial const& message) {

bool const is_pre_gröbner = extension.origin_case() ==
serialization::PolynomialInMonomialBasis::ORIGIN_NOT_SET;
LOG_IF_EVERY_SECOND(WARNING, is_pre_gröbner)
<< u8"Reading pre-Gröbner PolynomialInMonomialBasis";

Coefficients coefficients;
TupleSerializer<Coefficients, 0>::FillFromMessage(extension, coefficients);

6 changes: 6 additions & 0 deletions physics/continuous_trajectory_body.hpp
Original file line number Diff line number Diff line change
@@ -396,6 +396,12 @@ ContinuousTrajectory<Frame>::ReadFromMessage(
message.instant_polynomial_pair(0).polynomial()
.GetExtension(serialization::PolynomialInMonomialBasis::extension)
.coefficient(0).has_multivector());
LOG_IF_EVERY_SECOND(WARNING, is_pre_gröbner)
<< "Reading pre-"
<< (is_pre_cohen ? "Cohen"
: is_pre_fatou ? "Fatou"
: is_pre_grassmann ? "Grassmann"
: u8"Gröbner") << " ContinuousTrajectory";

not_null<std::unique_ptr<ContinuousTrajectory<Frame>>> continuous_trajectory =
std::make_unique<ContinuousTrajectory<Frame>>(
2 changes: 2 additions & 0 deletions physics/discrete_trajectory_body.hpp
Original file line number Diff line number Diff line change
@@ -617,6 +617,8 @@ void DiscreteTrajectory<Frame>::FillSubTreeFromMessage(
serialization::DiscreteTrajectory const& message,
std::vector<DiscreteTrajectory<Frame>**> const& forks) {
bool const is_pre_frobenius = !message.has_zfp();
LOG_IF_EVERY_SECOND(WARNING, is_pre_frobenius)
<< "Reading pre-Frobenius PolynomialInMonomialBasis";
if (is_pre_frobenius) {
for (auto const& instantaneous_dof : message.timeline()) {
Append(Instant::ReadFromMessage(instantaneous_dof.instant()),
5 changes: 5 additions & 0 deletions physics/ephemeris_body.hpp
Original file line number Diff line number Diff line change
@@ -790,6 +790,11 @@ not_null<std::unique_ptr<Ephemeris<Frame>>> Ephemeris<Frame>::ReadFromMessage(
bool const is_pre_ἐρατοσθένης = !message.has_accuracy_parameters();
bool const is_pre_fatou = !message.has_checkpoint_time();
bool const is_pre_grassmann = message.checkpoint_size() == 0;
LOG_IF_EVERY_SECOND(WARNING, is_pre_grassmann)
<< "Reading pre-"
<< (is_pre_ἐρατοσθένης ? u8"Ἐρατοσθένης"
: is_pre_fatou ? "Fatou"
: "Grassmann") << " Ephemeris";

std::vector<not_null<std::unique_ptr<MassiveBody const>>> bodies;
for (auto const& body : message.body()) {
2 changes: 2 additions & 0 deletions physics/rotating_body_body.hpp
Original file line number Diff line number Diff line change
@@ -193,6 +193,8 @@ RotatingBody<Frame>::ReadFromMessage(
MassiveBody::Parameters const& massive_body_parameters) {
bool is_pre_del_ferro = !message.has_min_radius() &&
!message.has_max_radius();
LOG_IF_EVERY_SECOND(WARNING, is_pre_del_ferro)
<< "Reading pre-del Ferro RotatingBody";
std::optional<Parameters> parameters;
if (is_pre_del_ferro) {
Length const mean_radius = Length::ReadFromMessage(message.mean_radius());