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

Commits on Jan 25, 2020

  1. Renaming.

    pleroy committed Jan 25, 2020
    Copy the full SHA
    4eca585 View commit details
  2. Merge pull request #2459 from pleroy/MechanicalSystem

    Rename ClosedSystem into MechanicalSystem
    pleroy authored Jan 25, 2020
    Copy the full SHA
    68b0b3b View commit details
12 changes: 6 additions & 6 deletions physics/closed_system.hpp → physics/mechanical_system.hpp
Original file line number Diff line number Diff line change
@@ -9,7 +9,7 @@

namespace principia {
namespace physics {
namespace internal_closed_system {
namespace internal_mechanical_system {

using geometry::BarycentreCalculator;
using geometry::Bivector;
@@ -29,11 +29,11 @@ using quantities::MomentOfInertia;
// is given; |SystemFrame| is a non-rotating frame with the same axes as
// |InertialFrame| and whose origin is the centre of mass of the system.
template<typename InertialFrame, typename SystemFrame>
class ClosedSystem {
class MechanicalSystem {
public:
static_assert(InertialFrame::is_inertial);

ClosedSystem() = default;
MechanicalSystem() = default;

template<typename BodyFrame>
void AddRigidBody(
@@ -91,11 +91,11 @@ class ClosedSystem {
sum_of_inertia_tensors_;
};

} // namespace internal_closed_system
} // namespace internal_mechanical_system

using internal_closed_system::ClosedSystem;
using internal_mechanical_system::MechanicalSystem;

} // namespace physics
} // namespace principia

#include "physics/closed_system_body.hpp"
#include "physics/mechanical_system_body.hpp"
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#pragma once

#include "physics/closed_system.hpp"
#include "physics/mechanical_system.hpp"

namespace principia {
namespace physics {
namespace internal_closed_system {
namespace internal_mechanical_system {

using geometry::Displacement;
using geometry::OrthogonalMap;
@@ -18,7 +18,7 @@ using quantities::si::Radian;

template<typename InertialFrame, typename SystemFrame>
template<typename BodyFrame>
void ClosedSystem<InertialFrame, SystemFrame>::AddRigidBody(
void MechanicalSystem<InertialFrame, SystemFrame>::AddRigidBody(
RigidMotion<BodyFrame, InertialFrame> const& motion,
Mass const& mass,
SymmetricBilinearForm<MomentOfInertia, BodyFrame, Bivector> const&
@@ -38,7 +38,7 @@ void ClosedSystem<InertialFrame, SystemFrame>::AddRigidBody(

template<typename InertialFrame, typename SystemFrame>
RigidMotion<SystemFrame, InertialFrame>
ClosedSystem<InertialFrame, SystemFrame>::LinearMotion() const {
MechanicalSystem<InertialFrame, SystemFrame>::LinearMotion() const {
DegreesOfFreedom<InertialFrame> const centre_of_mass = centre_of_mass_.Get();
return RigidMotion<SystemFrame, InertialFrame>(
RigidTransformation<SystemFrame, InertialFrame>(
@@ -50,13 +50,13 @@ ClosedSystem<InertialFrame, SystemFrame>::LinearMotion() const {
}

template<typename InertialFrame, typename SystemFrame>
Mass const& ClosedSystem<InertialFrame, SystemFrame>::mass() const {
Mass const& MechanicalSystem<InertialFrame, SystemFrame>::mass() const {
return centre_of_mass_.weight();
}

template<typename InertialFrame, typename SystemFrame>
Bivector<AngularMomentum, SystemFrame>
ClosedSystem<InertialFrame, SystemFrame>::AngularMomentum() const {
MechanicalSystem<InertialFrame, SystemFrame>::AngularMomentum() const {
RigidMotion<InertialFrame, SystemFrame> const to_system_frame =
LinearMotion().Inverse();
Bivector<quantities::AngularMomentum, SystemFrame> result =
@@ -76,7 +76,7 @@ ClosedSystem<InertialFrame, SystemFrame>::AngularMomentum() const {

template<typename InertialFrame, typename SystemFrame>
SymmetricBilinearForm<MomentOfInertia, SystemFrame, Bivector>
ClosedSystem<InertialFrame, SystemFrame>::InertiaTensor() const {
MechanicalSystem<InertialFrame, SystemFrame>::InertiaTensor() const {
RigidMotion<InertialFrame, SystemFrame> const to_system_frame =
LinearMotion().Inverse();
SymmetricBilinearForm<MomentOfInertia, SystemFrame, Vector> result =
@@ -91,6 +91,6 @@ ClosedSystem<InertialFrame, SystemFrame>::InertiaTensor() const {
return result.Anticommutator();
}

} // namespace internal_closed_system
} // namespace internal_mechanical_system
} // namespace physics
} // namespace principia
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

#include "physics/closed_system.hpp"
#include "physics/mechanical_system.hpp"

#include "gmock/gmock.h"
#include "gtest/gtest.h"
@@ -39,15 +39,15 @@ using ::testing::Eq;

namespace physics {

class ClosedSystemTest : public testing::Test{
class MechanicalSystemTest : public testing::Test{
protected:
using InertialFrame = Frame<enum class InertialTag, Inertial>;
using SystemFrame = Frame<enum class SystemTag>;

ClosedSystem<InertialFrame, SystemFrame> system_;
MechanicalSystem<InertialFrame, SystemFrame> system_;
};

TEST_F(ClosedSystemTest, RigidTwoPointMasses) {
TEST_F(MechanicalSystemTest, RigidTwoPointMasses) {
// A rigid system of two point masses.
constexpr Mass m1 = 1 * Kilogram;
constexpr Mass m2 = 7 * Kilogram;
@@ -114,7 +114,7 @@ TEST_F(ClosedSystemTest, RigidTwoPointMasses) {
Eq(0.5 * m2 * Pow<2>(v)));
}

TEST_F(ClosedSystemTest, RigidTwoCubes) {
TEST_F(MechanicalSystemTest, RigidTwoCubes) {
// A rigid system of two lead cubes with three-metre-long sides, joined in a
// cuboid 3 m × 3 m × 6 m.
constexpr Mass cube_mass = 10 * Tonne;
@@ -167,7 +167,7 @@ TEST_F(ClosedSystemTest, RigidTwoCubes) {
Eq(system_.InertiaTensor() * Identity<InertialFrame, SystemFrame>()(ω)));
}

TEST_F(ClosedSystemTest, NonRigidTwoCubes) {
TEST_F(MechanicalSystemTest, NonRigidTwoCubes) {
// A system of two counter-rotating lead cubes.
constexpr Mass cube_mass = 10 * Tonne;
constexpr Length cube_side = 3 * Metre;
6 changes: 3 additions & 3 deletions physics/physics.vcxproj
Original file line number Diff line number Diff line change
@@ -22,8 +22,8 @@
<ClInclude Include="body_surface_frame_field_body.hpp" />
<ClInclude Include="checkpointer.hpp" />
<ClInclude Include="checkpointer_body.hpp" />
<ClInclude Include="closed_system.hpp" />
<ClInclude Include="closed_system_body.hpp" />
<ClInclude Include="mechanical_system.hpp" />
<ClInclude Include="mechanical_system_body.hpp" />
<ClInclude Include="continuous_trajectory_body.hpp" />
<ClInclude Include="continuous_trajectory.hpp" />
<ClInclude Include="degrees_of_freedom.hpp" />
@@ -81,7 +81,7 @@
<ClCompile Include="body_surface_frame_field_test.cpp" />
<ClCompile Include="body_test.cpp" />
<ClCompile Include="checkpointer_test.cpp" />
<ClCompile Include="closed_system_test.cpp" />
<ClCompile Include="mechanical_system_test.cpp" />
<ClCompile Include="continuous_trajectory_test.cpp" />
<ClCompile Include="degrees_of_freedom_test.cpp" />
<ClCompile Include="discrete_trajectory_test.cpp" />
6 changes: 3 additions & 3 deletions physics/physics.vcxproj.filters
Original file line number Diff line number Diff line change
@@ -191,10 +191,10 @@
<ClInclude Include="inertia_tensor_body.hpp">
<Filter>Source Files</Filter>
</ClInclude>
<ClInclude Include="closed_system.hpp">
<ClInclude Include="mechanical_system.hpp">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="closed_system_body.hpp">
<ClInclude Include="mechanical_system_body.hpp">
<Filter>Source Files</Filter>
</ClInclude>
</ItemGroup>
@@ -283,7 +283,7 @@
<ClCompile Include="inertia_tensor_test.cpp">
<Filter>Test Files</Filter>
</ClCompile>
<ClCompile Include="closed_system_test.cpp">
<ClCompile Include="mechanical_system_test.cpp">
<Filter>Test Files</Filter>
</ClCompile>
</ItemGroup>