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

Commits on Jan 26, 2020

  1. Copy the full SHA
    ae8f502 View commit details
  2. Merge pull request #2461 from pleroy/LinkerError

    Fix a linker error that only shows up on clang
    pleroy authored Jan 26, 2020
    Copy the full SHA
    7f4a4ab View commit details
Showing with 12 additions and 15 deletions.
  1. +5 −7 ksp_plugin/part.cpp
  2. +1 −2 ksp_plugin/part.hpp
  3. +1 −1 ksp_plugin/plugin.cpp
  4. +1 −1 ksp_plugin_test/part_test.cpp
  5. +2 −2 ksp_plugin_test/pile_up_test.cpp
  6. +2 −2 ksp_plugin_test/vessel_test.cpp
12 changes: 5 additions & 7 deletions ksp_plugin/part.cpp
Original file line number Diff line number Diff line change
@@ -213,8 +213,7 @@ not_null<std::unique_ptr<Part>> Part::ReadFromMessage(
message.part_id(),
message.name(),
Mass::ReadFromMessage(message.mass()),
MakeWaterSphereInertiaTensor<RigidPart>(
Mass::ReadFromMessage(message.mass())),
MakeWaterSphereInertiaTensor(Mass::ReadFromMessage(message.mass())),
RigidMotion<RigidPart, Barycentric>::MakeNonRotatingMotion(
degrees_of_freedom),
std::move(deletion_callback));
@@ -283,15 +282,14 @@ std::string Part::ShortDebugString() const {
return name_ + " (" + hex_id.data.get() + ")";
}

template<typename Frame>
InertiaTensor<Frame> MakeWaterSphereInertiaTensor(Mass const& mass) {
InertiaTensor<RigidPart> MakeWaterSphereInertiaTensor(Mass const& mass) {
static constexpr MomentOfInertia zero;
static constexpr Density ρ_of_water = 1000 * Kilogram / Pow<3>(Metre);
MomentOfInertia const I =
Cbrt(9 * Pow<5>(mass) / (250 * Pow<2>(π * ρ_of_water)));
return InertiaTensor<Frame>(R3x3Matrix<MomentOfInertia>({I, zero, zero},
{zero, I, zero},
{zero, zero, I}));
return InertiaTensor<RigidPart>(R3x3Matrix<MomentOfInertia>({I, zero, zero},
{zero, I, zero},
{zero, zero, I}));
}

std::ostream& operator<<(std::ostream& out, Part const& part) {
3 changes: 1 addition & 2 deletions ksp_plugin/part.hpp
Original file line number Diff line number Diff line change
@@ -167,8 +167,7 @@ class Part final {

// A factory that creates an inertia tensor for a solid sphere of water having
// the given mass. Useful, e.g., for save compatibility.
template<typename Frame>
InertiaTensor<Frame> MakeWaterSphereInertiaTensor(Mass const& mass);
InertiaTensor<RigidPart> MakeWaterSphereInertiaTensor(Mass const& mass);

std::ostream& operator<<(std::ostream& out, Part const& part);

2 changes: 1 addition & 1 deletion ksp_plugin/plugin.cpp
Original file line number Diff line number Diff line change
@@ -425,7 +425,7 @@ void Plugin::InsertUnloadedPart(
part_id,
name,
mass,
MakeWaterSphereInertiaTensor<RigidPart>(mass),
MakeWaterSphereInertiaTensor(mass),
RigidMotion<RigidPart, Barycentric>::MakeNonRotatingMotion(
degrees_of_freedom));
// NOTE(egg): we do not keep the part; it may disappear just as we load, if
2 changes: 1 addition & 1 deletion ksp_plugin_test/part_test.cpp
Original file line number Diff line number Diff line change
@@ -28,7 +28,7 @@ using testing_utilities::EqualsProto;
class PartTest : public testing::Test {
protected:
PartTest()
: inertia_tensor_(MakeWaterSphereInertiaTensor<RigidPart>(mass_)),
: inertia_tensor_(MakeWaterSphereInertiaTensor(mass_)),
part_(part_id_,
"part",
mass_,
4 changes: 2 additions & 2 deletions ksp_plugin_test/pile_up_test.cpp
Original file line number Diff line number Diff line change
@@ -107,8 +107,8 @@ class TestablePileUp : public PileUp {
class PileUpTest : public testing::Test {
protected:
PileUpTest()
: inertia_tensor1_(MakeWaterSphereInertiaTensor<RigidPart>(mass1_)),
inertia_tensor2_(MakeWaterSphereInertiaTensor<RigidPart>(mass2_)),
: inertia_tensor1_(MakeWaterSphereInertiaTensor(mass1_)),
inertia_tensor2_(MakeWaterSphereInertiaTensor(mass2_)),
p1_(part_id1_,
"p1",
mass1_,
4 changes: 2 additions & 2 deletions ksp_plugin_test/vessel_test.cpp
Original file line number Diff line number Diff line change
@@ -68,8 +68,8 @@ class VesselTest : public testing::Test {
/*right_ascension_of_pole=*/0 * Degree,
/*declination_of_pole=*/90 * Degree)),
celestial_(&body_),
inertia_tensor1_(MakeWaterSphereInertiaTensor<RigidPart>(mass1_)),
inertia_tensor2_(MakeWaterSphereInertiaTensor<RigidPart>(mass2_)),
inertia_tensor1_(MakeWaterSphereInertiaTensor(mass1_)),
inertia_tensor2_(MakeWaterSphereInertiaTensor(mass2_)),
vessel_("123",
"vessel",
&celestial_,