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

Commits on Mar 31, 2018

  1. Copy the full SHA
    21e3d48 View commit details
  2. Fix some compilation errors.

    pleroy committed Mar 31, 2018
    Copy the full SHA
    f45f390 View commit details
  3. No TR1.

    pleroy committed Mar 31, 2018
    Copy the full SHA
    76dfc07 View commit details

Commits on Apr 1, 2018

  1. Makefile and filesystem.

    pleroy committed Apr 1, 2018
    Copy the full SHA
    a803d09 View commit details
  2. Copy the full SHA
    558b1c0 View commit details
  3. Looser regexp.

    pleroy committed Apr 1, 2018
    Copy the full SHA
    cfe49d4 View commit details
  4. Copy the full SHA
    0422951 View commit details
  5. A typo.

    pleroy committed Apr 1, 2018
    Copy the full SHA
    302bc31 View commit details
  6. Optional is back on Mac.

    pleroy committed Apr 1, 2018
    Copy the full SHA
    6f1f6ee View commit details
  7. Copy the full SHA
    79e09d2 View commit details
  8. Merge pull request #1783 from pleroy/C++17

    Move away from the experimental headers
    pleroy authored Apr 1, 2018

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    ec72987 View commit details
Showing with 256 additions and 249 deletions.
  1. +8 −7 Makefile
  2. +1 −1 astronomy/ksp_fingerprint_test.cpp
  3. +0 −1 astronomy/ksp_resonance_test.cpp
  4. +0 −1 astronomy/ksp_system_test.cpp
  5. +4 −8 astronomy/solar_system_dynamics_test.cpp
  6. +1 −1 astronomy/молния_orbit_test.cpp
  7. +2 −2 base/bundle.hpp
  8. +2 −2 base/disjoint_sets.hpp
  9. +2 −2 base/file.hpp
  10. +18 −4 base/file_body.hpp
  11. +2 −2 base/optional_logging.hpp
  12. +3 −1 base/optional_logging_body.hpp
  13. +0 −1 base/optional_serialization.hpp
  14. +2 −2 base/status_or.hpp
  15. +0 −1 benchmarks/dynamic_frame.cpp
  16. +2 −2 geometry/perspective.hpp
  17. +4 −6 geometry/perspective_body.hpp
  18. +1 −1 include_solution.props
  19. +6 −7 install_deps.sh
  20. +2 −2 integrators/embedded_explicit_runge_kutta_nyström_integrator_body.hpp
  21. +0 −1 integrators/integrators.hpp
  22. +2 −1 integrators/symmetric_linear_multistep_integrator_test.cpp
  23. +2 −1 journal/player.cpp
  24. +2 −2 journal/player.hpp
  25. +3 −1 journal/recorder.cpp
  26. +2 −2 journal/recorder.hpp
  27. +2 −1 journal/recorder_test.cpp
  28. +2 −2 ksp_plugin/flight_plan.cpp
  29. +14 −13 ksp_plugin/interface.cpp
  30. +3 −3 ksp_plugin/manœuvre.hpp
  31. +0 −1 ksp_plugin/part.hpp
  32. +5 −4 ksp_plugin/planetarium.cpp
  33. +6 −6 ksp_plugin/plugin.cpp
  34. +8 −9 ksp_plugin/plugin.hpp
  35. +3 −2 ksp_plugin/renderer.cpp
  36. +2 −2 ksp_plugin/renderer.hpp
  37. +4 −4 ksp_plugin_test/fake_plugin.cpp
  38. +4 −3 ksp_plugin_test/interface_test.cpp
  39. +2 −1 ksp_plugin_test/mock_plugin.hpp
  40. +1 −1 ksp_plugin_test/plugin_compatibility_test.cpp
  41. +7 −7 ksp_plugin_test/plugin_integration_test.cpp
  42. +8 −7 ksp_plugin_test/plugin_test.cpp
  43. +0 −1 mathematica/integrator_plots.cpp
  44. +2 −1 mathematica/local_error_analysis.cpp
  45. +3 −1 mathematica/local_error_analysis.hpp
  46. +6 −7 mathematica/main.cpp
  47. +0 −1 mathematica/retrobop_dynamical_stability.cpp
  48. +8 −8 physics/apsides_body.hpp
  49. +7 −6 physics/apsides_test.cpp
  50. +2 −2 physics/continuous_trajectory.hpp
  51. +2 −1 physics/continuous_trajectory_body.hpp
  52. +2 −1 physics/discrete_trajectory.hpp
  53. +0 −1 physics/ephemeris.hpp
  54. +3 −3 physics/ephemeris_body.hpp
  55. +4 −3 physics/ephemeris_test.cpp
  56. +3 −5 physics/forkable.hpp
  57. +6 −5 physics/forkable_body.hpp
  58. +25 −25 physics/kepler_orbit.hpp
  59. +3 −3 physics/oblate_body.hpp
  60. +0 −1 physics/rotating_body.hpp
  61. +4 −5 physics/solar_system.hpp
  62. +5 −4 physics/solar_system_body.hpp
  63. +0 −1 physics/solar_system_test.cpp
  64. +1 −1 principia.props
  65. +1 −1 testing_utilities/actions.hpp
  66. +5 −7 testing_utilities/serialization.hpp
  67. +6 −9 testing_utilities/serialization_body.hpp
  68. +0 −1 testing_utilities/solar_system_factory_body.hpp
  69. +9 −8 testing_utilities/solar_system_factory_test.cpp
  70. +3 −3 tools/generate_configuration.cpp
  71. +4 −6 tools/generate_profiles.cpp
15 changes: 8 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
@@ -65,14 +65,14 @@ LIBS := $(DEP_DIR)/protobuf/src/.libs/libprotobuf.a \
TEST_INCLUDES := \
-I$(DEP_DIR)googletest/googlemock/include -I$(DEP_DIR)googletest/googletest/include \
-I$(DEP_DIR)googletest/googlemock/ -I$(DEP_DIR)googletest/googletest/ -I$(DEP_DIR)benchmark/include
INCLUDES := -I. -I$(DEP_DIR)glog/src -I$(DEP_DIR)protobuf/src -I$(DEP_DIR)Optional -I$(DEP_DIR)eggsperimental_filesystem/
INCLUDES := -I. -I$(DEP_DIR)glog/src -I$(DEP_DIR)protobuf/src -I$(DEP_DIR)compatibility/filesystem
SHARED_ARGS := \
-std=c++1z -stdlib=libc++ -O3 -g \
-fPIC -fexceptions -ferror-limit=1 -fno-omit-frame-pointer \
-Wall -Wpedantic \
-DPROJECT_DIR='std::experimental::filesystem::path("$(PROJECT_DIR)")' \
-DSOLUTION_DIR='std::experimental::filesystem::path("$(SOLUTION_DIR)")' \
-DTEMP_DIR='std::experimental::filesystem::path("/tmp")' \
-std=c++1z -stdlib=libc++ -O3 -g \
-fPIC -fexceptions -ferror-limit=1 -fno-omit-frame-pointer \
-Wall -Wpedantic \
-DPROJECT_DIR='std::filesystem::path("$(PROJECT_DIR)")' \
-DSOLUTION_DIR='std::filesystem::path("$(SOLUTION_DIR)")' \
-DTEMP_DIR='std::filesystem::path("/tmp")' \
-DNDEBUG

ifeq ($(UNAME_S),Linux)
@@ -87,6 +87,7 @@ ifeq ($(UNAME_S),Linux)
SHAREDFLAG := -shared
endif
ifeq ($(UNAME_S),Darwin)
INCLUDES += -I$(DEP_DIR)compatibility/optional -I$(DEP_DIR)Optional
SHARED_ARGS += -mmacosx-version-min=10.11 -arch x86_64
MDTOOL ?= "/Applications/Xamarin Studio.app/Contents/MacOS/mdtool"
SHAREDFLAG := -dynamiclib
2 changes: 1 addition & 1 deletion astronomy/ksp_fingerprint_test.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include <experimental/filesystem>

#include <string>

#include "astronomy/solar_system_fingerprints.hpp"
1 change: 0 additions & 1 deletion astronomy/ksp_resonance_test.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@

#include <algorithm>
#include <experimental/filesystem>
#include <map>
#include <string>
#include <vector>
1 change: 0 additions & 1 deletion astronomy/ksp_system_test.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@

#include <algorithm>
#include <chrono>
#include <experimental/filesystem>
#include <fstream>
#include <map>
#include <string>
12 changes: 4 additions & 8 deletions astronomy/solar_system_dynamics_test.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@

#include <algorithm>
#include <experimental/filesystem>
#include <experimental/optional>
#include <optional>
#include <map>
#include <string>
#include <tuple>
@@ -92,10 +91,8 @@ class SolarSystemDynamicsTest : public testing::Test {
struct OrbitError final {
Angle separation_per_orbit;
Angle inclination_drift_per_orbit;
std::experimental::optional<Angle>
longitude_of_ascending_node_drift_per_orbit;
std::experimental::optional<Angle>
argument_of_periapsis_drift_per_orbit;
std::optional<Angle> longitude_of_ascending_node_drift_per_orbit;
std::optional<Angle> argument_of_periapsis_drift_per_orbit;
};

SolarSystemDynamicsTest() {
@@ -166,8 +163,7 @@ class SolarSystemDynamicsTest : public testing::Test {
enum LocalFrameTag { tag };
using ParentEquator = Frame<LocalFrameTag, tag, /*frame_is_inertial=*/true>;
auto const z = Bivector<double, ICRFJ2000Equator>({0, 0, 1});
std::experimental::optional<Rotation<ICRFJ2000Equator, ParentEquator>>
rotation;
std::optional<Rotation<ICRFJ2000Equator, ParentEquator>> rotation;

if (SolarSystemFactory::parent(index) == SolarSystemFactory::Sun) {
Bivector<AngularMomentum, ICRFJ2000Equator>
2 changes: 1 addition & 1 deletion astronomy/молния_orbit_test.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

#include <experimental/filesystem>
#include <filesystem>
#include <vector>

#include "astronomy/epoch.hpp"
4 changes: 2 additions & 2 deletions base/bundle.hpp
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@

#pragma once

#include <experimental/optional>
#include <functional>
#include <queue>
#include <memory>
#include <mutex>
#include <optional>
#include <shared_mutex>
#include <vector>

@@ -77,7 +77,7 @@ class Bundle final {
// workers will terminate without considering queued tasks. Set by |Abort|,
// accessed by |Aborting|, returned by |Join|.
Status status_ GUARDED_BY(status_lock_);
std::experimental::optional<std::chrono::steady_clock::time_point> deadline_
std::optional<std::chrono::steady_clock::time_point> deadline_
GUARDED_BY(status_lock_);

// Whether the workers should terminate when no tasks are available. Set by
4 changes: 2 additions & 2 deletions base/disjoint_sets.hpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

#pragma once

#include <experimental/optional>
#include <optional>
#include <list>

#include "base/not_null.hpp"
@@ -61,7 +61,7 @@ class Subset final {
int rank_ = 0;

// Do not require a default constructor for |Properties|.
std::experimental::optional<Properties> properties_;
std::optional<Properties> properties_;

friend class Subset<T>;
};
4 changes: 2 additions & 2 deletions base/file.hpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#pragma once

#include <experimental/filesystem>
#include <filesystem>
#include <fstream>
#include <string>

@@ -12,7 +12,7 @@ namespace internal_file {
class OFStream {
public:
OFStream();
explicit OFStream(std::experimental::filesystem::path const& path);
explicit OFStream(std::filesystem::path const& path);
~OFStream();

OFStream& operator=(OFStream&& other);
22 changes: 18 additions & 4 deletions base/file_body.hpp
Original file line number Diff line number Diff line change
@@ -2,26 +2,40 @@

#include "base/file.hpp"

#include <filesystem>
#include <string>

#include "base/macros.hpp"
#include "glog/logging.h"

// In 15.7.0 preview 2 <filesystem> is not yet up to speed compared to
// <experimental/filesystem>.
#if PRINCIPIA_COMPILER_MSVC && _MSC_FULL_VER <= 191426316
#include <experimental/filesystem>
#endif

namespace principia {
namespace base {
namespace internal_file {

inline OFStream::OFStream() {}

inline OFStream::OFStream(std::experimental::filesystem::path const& path) {
inline OFStream::OFStream(std::filesystem::path const& path) {
#if PRINCIPIA_COMPILER_MSVC
CHECK(path.has_filename()) << path;
std::experimental::filesystem::path directory = path;
std::filesystem::path directory = path;
directory.remove_filename();
if (!std::experimental::filesystem::exists(directory)) {
CHECK(std::experimental::filesystem::create_directories(directory))
#if _MSC_FULL_VER <= 191426316
if (!std::experimental::filesystem::exists(directory.native())) {
CHECK(std::experimental::filesystem::create_directories(directory.native()))
<< directory;
}
#else
if (!std::filesystem::exists(directory)) {
CHECK(std::filesystem::create_directories(directory))
<< directory;
}
#endif
#endif
stream_.open(path);
CHECK(stream_.good()) << path;
4 changes: 2 additions & 2 deletions base/optional_logging.hpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

#pragma once

#include <experimental/optional>
#include <optional>

// We need to pollute the |::| namespace in order for lookup to work, like
// glog/stl_logging.h. The following caveat from glog/stl_logging.h applies
@@ -19,6 +19,6 @@
// If |optional|, logs |*optional|, otherwise, logs |"nullopt"|.
template<typename T>
std::ostream& operator<<(std::ostream& out,
std::experimental::optional<T> const& optional);
std::optional<T> const& optional);

#include "base/optional_logging_body.hpp"
4 changes: 3 additions & 1 deletion base/optional_logging_body.hpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@

#pragma once

#include "base/optional_logging.hpp"

template<typename T>
std::ostream& operator<<(std::ostream& out,
std::experimental::optional<T> const& optional) {
std::optional<T> const& optional) {
if (optional) {
return out << *optional;
} else {
1 change: 0 additions & 1 deletion base/optional_serialization.hpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@

#pragma once

#include <experimental/optional>
#include <functional>
#include <type_traits>

4 changes: 2 additions & 2 deletions base/status_or.hpp
Original file line number Diff line number Diff line change
@@ -86,8 +86,8 @@
// }
//

#include <experimental/optional>
#include <new>
#include <optional>
#include <string>
#include <utility>

@@ -145,7 +145,7 @@ class StatusOr final {

private:
Status status_;
std::experimental::optional<T> value_;
std::optional<T> value_;

template<typename U>
friend class StatusOr;
1 change: 0 additions & 1 deletion benchmarks/dynamic_frame.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@

// .\Release\x64\benchmarks.exe --benchmark_filter=DynamicFrame --benchmark_repetitions=5 // NOLINT(whitespace/line_length)

#include <experimental/optional>
#include <memory>
#include <utility>
#include <vector>
4 changes: 2 additions & 2 deletions geometry/perspective.hpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

#pragma once

#include <experimental/optional>
#include <optional>
#include <utility>
#include <vector>

@@ -50,7 +50,7 @@ class Perspective final {
// Returns the part of |segment| that is behind the focal plane as seen from
// the camera. Returns nullopt if |segment| is entirely in front of the focal
// plane.
std::experimental::optional<Segment<FromFrame>>
std::optional<Segment<FromFrame>>
SegmentBehindFocalPlane(Segment<FromFrame> const& segment) const;

// The square of the tangent of the angular distance between the given points
10 changes: 4 additions & 6 deletions geometry/perspective_body.hpp
Original file line number Diff line number Diff line change
@@ -60,7 +60,7 @@ operator()(Position<FromFrame> const& point) const {
}

template<typename FromFrame, typename ToFrame>
std::experimental::optional<Segment<FromFrame>>
std::optional<Segment<FromFrame>>
Perspective<FromFrame, ToFrame>::SegmentBehindFocalPlane(
Segment<FromFrame> const& segment) const {
Vector<double, FromFrame> const z =
@@ -72,20 +72,18 @@ Perspective<FromFrame, ToFrame>::SegmentBehindFocalPlane(
if (first_is_visible && second_is_visible) {
return segment;
} else if (!first_is_visible && !second_is_visible) {
return std::experimental::nullopt;
return std::nullopt;
} else {
// λ determines where the segment intersects the focal plane.
double const λ = (focal_ - z2) / (z1 - z2);
auto const intercept =
Barycentre<Position<FromFrame>, double>(segment,
{λ, 1.0 - λ});
if (first_is_visible) {
return std::experimental::make_optional<Segment<FromFrame>>(
{segment.first, intercept});
return std::make_optional<Segment<FromFrame>>(segment.first, intercept);
} else {
CHECK(second_is_visible);
return std::experimental::make_optional<Segment<FromFrame>>(
{intercept, segment.second});
return std::make_optional<Segment<FromFrame>>(intercept, segment.second);
}
}
}
2 changes: 1 addition & 1 deletion include_solution.props
Original file line number Diff line number Diff line change
@@ -9,7 +9,7 @@
<ItemDefinitionGroup>
<ClCompile>
<AdditionalIncludeDirectories>$(SolutionDir).;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>SOLUTION_DIR=std::experimental::filesystem::path(R"literal($(SolutionDir))literal");TEMP_DIR=std::experimental::filesystem::path(R"literal($(SolutionDir)temp\$(Configuration)\$(Platform)\)literal");%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>SOLUTION_DIR=std::filesystem::path(R"literal($(SolutionDir))literal");TEMP_DIR=std::filesystem::path(R"literal($(SolutionDir)temp\$(Configuration)\$(Platform)\)literal");%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
</ItemDefinitionGroup>
<ItemGroup />
13 changes: 6 additions & 7 deletions install_deps.sh
Original file line number Diff line number Diff line change
@@ -71,21 +71,20 @@ git checkout master
git pull
popd

if [ ! -d "eggsperimental_filesystem" ]; then
git clone "https://github.com/Norgg/eggsperimental_filesystem.git"
if [ ! -d "compatibility" ]; then
git clone "https://github.com/mockingbirdnest/compatibility"
fi
pushd eggsperimental_filesystem
pushd compatibility
git checkout master
git pull
popd

# Optional doesn't need to be compiled either
if [ ! -d "Optional" ]; then
git clone "https://github.com/mockingbirdnest/Optional.git"
mkdir Optional
fi
pushd Optional
git checkout master
git pull
curl "https://raw.githubusercontent.com/llvm-mirror/libcxx/52f9ca28a39aa02a2e78fa0eb5aa927ad046487f/include/optional" > principia_optional_impl
touch __undef_macros
popd

# TODO(egg): This probably needs to be compiled
Original file line number Diff line number Diff line change
@@ -6,7 +6,7 @@
#include <algorithm>
#include <cmath>
#include <ctime>
#include <experimental/optional>
#include <optional>
#include <vector>

#include "geometry/sign.hpp"
@@ -65,7 +65,7 @@ Instance::Solve(Instant const& t_final) {
// restartability.

// State before the last, truncated step.
std::experimental::optional<typename ODE::SystemState> final_state;
std::optional<typename ODE::SystemState> final_state;

// Argument checks.
int const dimension = current_state.positions.size();
1 change: 0 additions & 1 deletion integrators/integrators.hpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#ifndef PRINCIPIA_INTEGRATORS_INTEGRATORS_HPP_
#define PRINCIPIA_INTEGRATORS_INTEGRATORS_HPP_

#include <experimental/optional>
#include <functional>
#include <string>

3 changes: 2 additions & 1 deletion integrators/symmetric_linear_multistep_integrator_test.cpp
Original file line number Diff line number Diff line change
@@ -2,6 +2,7 @@
#include "integrators/symmetric_linear_multistep_integrator.hpp"

#include <algorithm>
#include <filesystem>
#include <vector>
#include <string>

@@ -271,7 +272,7 @@ TEST_P(SymmetricLinearMultistepIntegratorTest, Convergence) {
}

{
std::experimental::filesystem::path filename;
std::filesystem::path filename;
filename += "convergence.";
filename += GetParam().name;
filename += ".generated.wl";
Loading