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: 3473dbc3727a
Choose a base ref
...
head repository: mockingbirdnest/Principia
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 3f99fea62d2f
Choose a head ref
Loading
Showing with 5,847 additions and 4,490 deletions.
  1. +1 −0 astronomy/geodesy_test.cpp
  2. +4 −2 astronomy/lunar_orbit_test.cpp
  3. +0 −2 astronomy/mercury_perihelion_test.cpp
  4. +1 −0 astronomy/orbit_analysis_test.cpp
  5. +9 −8 astronomy/orbit_ground_track_body.hpp
  6. +5 −4 astronomy/orbital_elements_body.hpp
  7. +1 −0 astronomy/orbital_elements_test.cpp
  8. +6 −6 astronomy/standard_product_3.cpp
  9. +24 −22 astronomy/standard_product_3_test.cpp
  10. +4 −2 astronomy/лидов_古在_test.cpp
  11. +1 −2 base/pull_serializer_test.cpp
  12. +1 −2 base/push_deserializer_test.cpp
  13. +1 −0 base/status_utilities.hpp
  14. +8 −5 benchmarks/apsides.cpp
  15. +1 −0 benchmarks/benchmarks.vcxproj
  16. +3 −0 benchmarks/benchmarks.vcxproj.filters
  17. +156 −109 benchmarks/discrete_trajectory.cpp
  18. +4 −4 benchmarks/dynamic_frame.cpp
  19. +3 −3 benchmarks/ephemeris.cpp
  20. +3 −1 benchmarks/planetarium_plot_methods.cpp
  21. +28 −38 ksp_plugin/flight_plan.cpp
  22. +18 −18 ksp_plugin/flight_plan.hpp
  23. +2 −2 ksp_plugin/integrators.cpp
  24. +3 −3 ksp_plugin/integrators.hpp
  25. +4 −2 ksp_plugin/interface.cpp
  26. +16 −16 ksp_plugin/interface_external.cpp
  27. +27 −31 ksp_plugin/interface_flight_plan.cpp
  28. +3 −3 ksp_plugin/interface_iterator.cpp
  29. +16 −14 ksp_plugin/interface_planetarium.cpp
  30. +21 −19 ksp_plugin/interface_renderer.cpp
  31. +5 −5 ksp_plugin/iterators.hpp
  32. +9 −11 ksp_plugin/iterators_body.hpp
  33. +0 −1 ksp_plugin/ksp_plugin.vcxproj
  34. +0 −3 ksp_plugin/ksp_plugin.vcxproj.filters
  35. +7 −7 ksp_plugin/manœuvre.hpp
  36. +5 −4 ksp_plugin/manœuvre_body.hpp
  37. +2 −1 ksp_plugin/orbit_analyser.cpp
  38. +52 −46 ksp_plugin/part.cpp
  39. +17 −15 ksp_plugin/part.hpp
  40. +96 −55 ksp_plugin/pile_up.cpp
  41. +15 −6 ksp_plugin/pile_up.hpp
  42. +14 −14 ksp_plugin/planetarium.cpp
  43. +11 −8 ksp_plugin/planetarium.hpp
  44. +27 −22 ksp_plugin/plugin.cpp
  45. +22 −13 ksp_plugin/plugin.hpp
  46. +21 −21 ksp_plugin/renderer.cpp
  47. +9 −9 ksp_plugin/renderer.hpp
  48. +94 −71 ksp_plugin/vessel.cpp
  49. +28 −19 ksp_plugin/vessel.hpp
  50. BIN ksp_plugin_adapter_stub/ksp_plugin_adapter_stub.dll
  51. BIN ksp_plugin_adapter_stub/ksp_plugin_adapter_stub.pdb
  52. +37 −44 ksp_plugin_test/flight_plan_test.cpp
  53. +10 −11 ksp_plugin_test/interface_flight_plan_test.cpp
  54. +0 −2 ksp_plugin_test/interface_renderer_test.cpp
  55. +1 −1 ksp_plugin_test/ksp_plugin_test.vcxproj
  56. +3 −3 ksp_plugin_test/ksp_plugin_test.vcxproj.filters
  57. +27 −6 ksp_plugin_test/manœuvre_test.cpp
  58. +2 −4 ksp_plugin_test/mock_flight_plan.hpp
  59. +3 −3 ksp_plugin_test/mock_renderer.hpp
  60. +2 −2 ksp_plugin_test/mock_vessel.hpp
  61. +2 −6 ksp_plugin_test/part_test.cpp
  62. +6 −3 ksp_plugin_test/pile_up_test.cpp
  63. +55 −37 ksp_plugin_test/planetarium_test.cpp
  64. +69 −60 ksp_plugin_test/plugin_compatibility_test.cpp
  65. +49 −45 ksp_plugin_test/plugin_integration_test.cpp
  66. +29 −7 ksp_plugin_test/plugin_test.cpp
  67. +66 −47 ksp_plugin_test/renderer_test.cpp
  68. +72 −60 ksp_plugin_test/vessel_test.cpp
  69. +11 −9 physics/apsides.hpp
  70. +16 −13 physics/apsides_body.hpp
  71. +10 −6 physics/apsides_test.cpp
  72. +1 −0 physics/body_centred_body_direction_dynamic_frame_test.cpp
  73. +162 −237 physics/discrete_trajectory.hpp
  74. +702 −533 physics/discrete_trajectory_body.hpp
  75. +105 −0 physics/discrete_trajectory_iterator.hpp
  76. +310 −0 physics/discrete_trajectory_iterator_body.hpp
  77. +310 −0 physics/discrete_trajectory_iterator_test.cpp
  78. +224 −0 physics/discrete_trajectory_segment.hpp
  79. +611 −0 physics/discrete_trajectory_segment_body.hpp
  80. +96 −0 physics/discrete_trajectory_segment_iterator.hpp
  81. +104 −0 physics/discrete_trajectory_segment_iterator_body.hpp
  82. +105 −0 physics/discrete_trajectory_segment_iterator_test.cpp
  83. +3 −0 physics/discrete_trajectory_segment_range.hpp
  84. +12 −0 physics/discrete_trajectory_segment_range_body.hpp
  85. +3 −0 physics/discrete_trajectory_segment_range_test.cpp
  86. +543 −0 physics/discrete_trajectory_segment_test.cpp
  87. +656 −850 physics/discrete_trajectory_test.cpp
  88. +66 −0 physics/discrete_trajectory_types.hpp
  89. +33 −0 physics/discrete_trajectory_types_body.hpp
  90. +8 −10 physics/ephemeris_body.hpp
  91. +27 −24 physics/ephemeris_test.cpp
  92. +0 −249 physics/forkable.hpp
  93. +0 −551 physics/forkable_body.hpp
  94. +0 −793 physics/forkable_test.cpp
  95. +15 −6 physics/physics.vcxproj
  96. +45 −18 physics/physics.vcxproj.filters
  97. +39 −12 serialization/physics.proto
  98. +116 −0 testing_utilities/discrete_trajectory_factories.hpp
  99. +145 −0 testing_utilities/discrete_trajectory_factories_body.hpp
  100. +39 −14 testing_utilities/{trajectory_factories_test.cpp → discrete_trajectory_factories_test.cpp}
  101. +0 −1 testing_utilities/solar_system_factory.hpp
  102. +38 −0 testing_utilities/string_log_sink.cpp
  103. +36 −0 testing_utilities/string_log_sink.hpp
  104. +5 −3 testing_utilities/testing_utilities.vcxproj
  105. +10 −4 testing_utilities/testing_utilities.vcxproj.filters
  106. +0 −72 testing_utilities/trajectory_factories.hpp
  107. +0 −95 testing_utilities/trajectory_factories_body.hpp
1 change: 1 addition & 0 deletions astronomy/geodesy_test.cpp
Original file line number Diff line number Diff line change
@@ -7,6 +7,7 @@
#include "gmock/gmock.h"
#include "gtest/gtest.h"
#include "physics/body_surface_dynamic_frame.hpp"
#include "physics/discrete_trajectory.hpp"
#include "physics/solar_system.hpp"
#include "quantities/si.hpp"
#include "testing_utilities/approximate_quantity.hpp"
6 changes: 4 additions & 2 deletions astronomy/lunar_orbit_test.cpp
Original file line number Diff line number Diff line change
@@ -415,7 +415,8 @@ TEST_P(LunarOrbitTest, NearCircularRepeatGroundTrackOrbit) {

DiscreteTrajectory<LunarSurface> ascending_nodes;
DiscreteTrajectory<LunarSurface> descending_nodes;
ComputeNodes(surface_trajectory.begin(),
ComputeNodes(surface_trajectory,
surface_trajectory.begin(),
surface_trajectory.end(),
/*north=*/Vector<double, LunarSurface>({0, 0, 1}),
/*max_points=*/std::numeric_limits<int>::max(),
@@ -425,6 +426,7 @@ TEST_P(LunarOrbitTest, NearCircularRepeatGroundTrackOrbit) {
DiscreteTrajectory<ICRS> apoapsides;
DiscreteTrajectory<ICRS> periapsides;
ComputeApsides(*ephemeris_->trajectory(moon_),
trajectory,
trajectory.begin(),
trajectory.end(),
/*max_points=*/std::numeric_limits<int>::max(),
@@ -530,7 +532,7 @@ TEST_P(LunarOrbitTest, NearCircularRepeatGroundTrackOrbit) {
{
EccentricityVectorRange actual_period_ends;
for (int orbit = 0;
orbit < descending_nodes.Size();
orbit < descending_nodes.size();
orbit += orbits_per_period) {
auto& actual = actual_period_ends;
auto const e = descending_node_eccentricities[orbit];
2 changes: 0 additions & 2 deletions astronomy/mercury_perihelion_test.cpp
Original file line number Diff line number Diff line change
@@ -12,7 +12,6 @@
#include "integrators/symmetric_linear_multistep_integrator.hpp"
#include "mathematica/mathematica.hpp"
#include "physics/degrees_of_freedom.hpp"
#include "physics/discrete_trajectory.hpp"
#include "physics/ephemeris.hpp"
#include "physics/kepler_orbit.hpp"
#include "physics/massive_body.hpp"
@@ -33,7 +32,6 @@ using geometry::Position;
using integrators::SymmetricLinearMultistepIntegrator;
using integrators::methods::QuinlanTremaine1990Order12;
using physics::ContinuousTrajectory;
using physics::DiscreteTrajectory;
using physics::Ephemeris;
using physics::KeplerianElements;
using physics::KeplerOrbit;
1 change: 1 addition & 0 deletions astronomy/orbit_analysis_test.cpp
Original file line number Diff line number Diff line change
@@ -14,6 +14,7 @@
#include "mathematica/mathematica.hpp"
#include "numerics/polynomial.hpp"
#include "physics/body_centred_non_rotating_dynamic_frame.hpp"
#include "physics/discrete_trajectory.hpp"
#include "physics/ephemeris.hpp"
#include "physics/solar_system.hpp"
#include "testing_utilities/approximate_quantity.hpp"
17 changes: 9 additions & 8 deletions astronomy/orbit_ground_track_body.hpp
Original file line number Diff line number Diff line change
@@ -34,11 +34,11 @@ std::vector<Angle> PlanetocentricLongitudes(
DiscreteTrajectory<PrimaryCentred> const& nodes,
RotatingBody<Inertial> const& primary) {
std::vector<Angle> longitudes;
longitudes.reserve(nodes.Size());
for (auto const& node : nodes) {
longitudes.reserve(nodes.size());
for (auto const& [time, degrees_of_freedom] : nodes) {
longitudes.push_back(
CelestialLongitude(node.degrees_of_freedom.position()) -
primary.AngleAt(node.time) - π / 2 * Radian);
CelestialLongitude(degrees_of_freedom.position()) -
primary.AngleAt(time) - π / 2 * Radian);
}
return longitudes;
}
@@ -126,18 +126,19 @@ absl::StatusOr<OrbitGroundTrack> OrbitGroundTrack::ForTrajectory(
DiscreteTrajectory<PrimaryCentred> ascending_nodes;
DiscreteTrajectory<PrimaryCentred> descending_nodes;
OrbitGroundTrack ground_track;
RETURN_IF_ERROR(ComputeNodes(trajectory.begin(),
RETURN_IF_ERROR(ComputeNodes(trajectory,
trajectory.begin(),
trajectory.end(),
Vector<double, PrimaryCentred>({0, 0, 1}),
/*max_points=*/std::numeric_limits<int>::max(),
ascending_nodes,
descending_nodes));
if (mean_sun.has_value()) {
if (!ascending_nodes.Empty()) {
if (!ascending_nodes.empty()) {
ground_track.mean_solar_times_of_ascending_nodes_ =
MeanSolarTimesOfNodes(ascending_nodes, *mean_sun);
}
if (!descending_nodes.Empty()) {
if (!descending_nodes.empty()) {
ground_track.mean_solar_times_of_descending_nodes_ =
MeanSolarTimesOfNodes(descending_nodes, *mean_sun);
}
@@ -147,7 +148,7 @@ absl::StatusOr<OrbitGroundTrack> OrbitGroundTrack::ForTrajectory(
ground_track.longitudes_of_equator_crossings_of_descending_passes_ =
PlanetocentricLongitudes(descending_nodes, primary);
ground_track.first_descending_pass_before_first_ascending_pass_ =
!ascending_nodes.Empty() && !descending_nodes.Empty() &&
!ascending_nodes.empty() && !descending_nodes.empty() &&
descending_nodes.front().time < ascending_nodes.front().time;
return ground_track;
}
9 changes: 5 additions & 4 deletions astronomy/orbital_elements_body.hpp
Original file line number Diff line number Diff line change
@@ -5,6 +5,7 @@
#include <algorithm>
#include <vector>

#include "absl/strings/str_cat.h"
#include "base/jthread.hpp"
#include "base/status_utilities.hpp"
#include "physics/kepler_orbit.hpp"
@@ -36,9 +37,9 @@ absl::StatusOr<OrbitalElements> OrbitalElements::ForTrajectory(
MassiveBody const& primary,
Body const& secondary) {
OrbitalElements orbital_elements;
if (trajectory.Size() < 2) {
if (trajectory.size() < 2) {
return absl::InvalidArgumentError(
"trajectory.Size() is " + std::to_string(trajectory.Size()));
absl::StrCat("trajectory.Size() is ", trajectory.size()));
}
orbital_elements.osculating_equinoctial_elements_ =
OsculatingEquinoctialElements(trajectory, primary, secondary);
@@ -144,7 +145,7 @@ OrbitalElements::OsculatingEquinoctialElements(
DegreesOfFreedom<PrimaryCentred> const primary_dof{
PrimaryCentred::origin, PrimaryCentred::unmoving};
std::vector<EquinoctialElements> result;
result.reserve(trajectory.Size());
result.reserve(trajectory.size());
for (auto const& [time, degrees_of_freedom] : trajectory) {
auto const osculating_elements =
KeplerOrbit<PrimaryCentred>(primary,
@@ -177,7 +178,7 @@ template<typename PrimaryCentred>
std::vector<Length> OrbitalElements::RadialDistances(
DiscreteTrajectory<PrimaryCentred> const& trajectory) {
std::vector<Length> radial_distances;
radial_distances.reserve(trajectory.Size());
radial_distances.reserve(trajectory.size());
DegreesOfFreedom<PrimaryCentred> const primary_dof{PrimaryCentred::origin,
PrimaryCentred::unmoving};
for (auto const& [time, degrees_of_freedom] : trajectory) {
1 change: 1 addition & 0 deletions astronomy/orbital_elements_test.cpp
Original file line number Diff line number Diff line change
@@ -10,6 +10,7 @@
#include "gtest/gtest.h"
#include "mathematica/mathematica.hpp"
#include "physics/body_centred_non_rotating_dynamic_frame.hpp"
#include "physics/discrete_trajectory.hpp"
#include "physics/ephemeris.hpp"
#include "physics/kepler_orbit.hpp"
#include "physics/solar_system.hpp"
12 changes: 6 additions & 6 deletions astronomy/standard_product_3.cpp
Original file line number Diff line number Diff line change
@@ -35,7 +35,7 @@ template<int n>
not_null<std::unique_ptr<DiscreteTrajectory<ITRS>>> ComputeVelocities(
DiscreteTrajectory<ITRS> const& arc) {
auto result = make_not_null_unique<DiscreteTrajectory<ITRS>>();
CHECK_GE(arc.Size(), n);
CHECK_GE(arc.size(), n);
std::array<Instant, n> times;
std::array<Position<ITRS>, n> positions;
auto it = arc.begin();
@@ -49,7 +49,7 @@ not_null<std::unique_ptr<DiscreteTrajectory<ITRS>>> ComputeVelocities(
// We use a central difference formula wherever possible, so we keep
// |offset| at (n - 1) / 2 except at the beginning and end of the arc.
int offset = 0;
for (int i = 0; i < arc.Size(); ++i) {
for (int i = 0; i < arc.size(); ++i) {
result->Append(
times[offset],
{positions[offset],
@@ -71,7 +71,7 @@ not_null<std::unique_ptr<DiscreteTrajectory<ITRS>>> ComputeVelocities(
}
// Note that having the right number of calls to |Append| does not guarantee
// this, as appending at an existing time merely emits a warning.
CHECK_EQ(result->Size(), arc.Size());
CHECK_EQ(result->size(), arc.size());
return result;
}

@@ -375,7 +375,7 @@ StandardProduct3::StandardProduct3(

// Bad or absent positional and velocity values are to be set to 0.000000.
if (position == ITRS::origin || velocity == ITRS::unmoving) {
if (!arc.Empty()) {
if (!arc.empty()) {
orbit.push_back(make_not_null_unique<DiscreteTrajectory<ITRS>>());
}
} else {
@@ -390,7 +390,7 @@ StandardProduct3::StandardProduct3(
for (auto& [id, orbit] : orbits_) {
// Do not leave a final empty trajectory if the orbit ends with missing
// data.
if (orbit.back()->Empty()) {
if (orbit.back()->empty()) {
orbit.pop_back();
}
}
@@ -403,7 +403,7 @@ StandardProduct3::StandardProduct3(
arc = ComputeVelocities<n>(*arc); \
break

switch (arc->Size()) {
switch (arc->size()) {
COMPUTE_VELOCITIES_CASE(1);
COMPUTE_VELOCITIES_CASE(2);
COMPUTE_VELOCITIES_CASE(3);
46 changes: 24 additions & 22 deletions astronomy/standard_product_3_test.cpp
Original file line number Diff line number Diff line change
@@ -374,28 +374,30 @@ TEST_P(StandardProduct3DynamicsTest, PerturbedKeplerian) {
if (++it == arc->end()) {
break;
}
ephemeris_->FlowWithAdaptiveStep(
&integrated_arc,
Ephemeris<ICRS>::NoIntrinsicAcceleration,
it->time,
Ephemeris<ICRS>::AdaptiveStepParameters(
EmbeddedExplicitRungeKuttaNyströmIntegrator<
DormandالمكاوىPrince1986RKN434FM,
Position<ICRS>>(),
std::numeric_limits<std::int64_t>::max(),
/*length_integration_tolerance=*/1 * Milli(Metre),
/*speed_integration_tolerance=*/1 * Milli(Metre) / Second),
/*max_ephemeris_steps=*/std::numeric_limits<std::int64_t>::max());
DegreesOfFreedom<ICRS> actual =
integrated_arc.back().degrees_of_freedom;
DegreesOfFreedom<ICRS> expected =
itrs_.FromThisFrameAtTime(it->time)(it->degrees_of_freedom);
EXPECT_THAT(AbsoluteError(expected.position(), actual.position()),
Lt(25 * Metre))
<< "orbit of satellite " << satellite << " flowing from point " << i;
EXPECT_THAT(AbsoluteError(expected.velocity(), actual.velocity()),
Lt(1 * Deci(Metre) / Second))
<< "orbit of satellite " << satellite << " flowing from point " << i;
ephemeris_->FlowWithAdaptiveStep(
&integrated_arc,
Ephemeris<ICRS>::NoIntrinsicAcceleration,
it->time,
Ephemeris<ICRS>::AdaptiveStepParameters(
EmbeddedExplicitRungeKuttaNyströmIntegrator<
DormandالمكاوىPrince1986RKN434FM,
Position<ICRS>>(),
std::numeric_limits<std::int64_t>::max(),
/*length_integration_tolerance=*/1 * Milli(Metre),
/*speed_integration_tolerance=*/1 * Milli(Metre) / Second),
/*max_ephemeris_steps=*/std::numeric_limits<std::int64_t>::max());
DegreesOfFreedom<ICRS> actual =
integrated_arc.back().degrees_of_freedom;
DegreesOfFreedom<ICRS> expected =
itrs_.FromThisFrameAtTime(it->time)(it->degrees_of_freedom);
EXPECT_THAT(AbsoluteError(expected.position(), actual.position()),
Lt(25 * Metre))
<< "orbit of satellite " << satellite << " flowing from point "
<< i;
EXPECT_THAT(AbsoluteError(expected.velocity(), actual.velocity()),
Lt(1 * Deci(Metre) / Second))
<< "orbit of satellite " << satellite << " flowing from point "
<< i;
}
}
}
6 changes: 4 additions & 2 deletions astronomy/лидов_古在_test.cpp
Original file line number Diff line number Diff line change
@@ -7,6 +7,7 @@
#include "gmock/gmock.h"
#include "gtest/gtest.h"
#include "physics/body_centred_non_rotating_dynamic_frame.hpp"
#include "physics/discrete_trajectory.hpp"
#include "physics/solar_system.hpp"
#include "mathematica/mathematica.hpp"
#include "testing_utilities/matchers.hpp"
@@ -85,8 +86,9 @@ TEST_F(Лидов古在Test, MercuryOrbiter) {
DiscreteTrajectory<ICRS> icrs_trajectory;
icrs_trajectory.Append(MercuryOrbiterInitialTime,
MercuryOrbiterInitialDegreesOfFreedom<ICRS>);
icrs_trajectory.SetDownsampling({.max_dense_intervals = 10'000,
.tolerance = 10 * Metre});
auto& icrs_segment = icrs_trajectory.segments().front();
icrs_segment.SetDownsampling({.max_dense_intervals = 10'000,
.tolerance = 10 * Metre});
auto const instance = ephemeris_->NewInstance(
{&icrs_trajectory},
Ephemeris<ICRS>::NoIntrinsicAccelerations,
3 changes: 1 addition & 2 deletions base/pull_serializer_test.cpp
Original file line number Diff line number Diff line change
@@ -49,8 +49,7 @@ class PullSerializerTest : public ::testing::Test {
make_not_null_unique<DiscreteTrajectory>();
// Build a biggish protobuf for serialization.
for (int i = 0; i < 100; ++i) {
DiscreteTrajectory::InstantaneousDegreesOfFreedom* idof =
result->add_timeline();
auto* const idof = result->add_timeline();
Point* instant = idof->mutable_instant();
Quantity* scalar = instant->mutable_scalar();
scalar->set_dimensions(3);
3 changes: 1 addition & 2 deletions base/push_deserializer_test.cpp
Original file line number Diff line number Diff line change
@@ -66,8 +66,7 @@ class PushDeserializerTest : public ::testing::Test {
make_not_null_unique<DiscreteTrajectory>();
// Build a biggish protobuf for serialization.
for (int i = 0; i < 100; ++i) {
DiscreteTrajectory::InstantaneousDegreesOfFreedom* idof =
result->add_timeline();
auto* const idof = result->add_timeline();
Point* instant = idof->mutable_instant();
Quantity* scalar = instant->mutable_scalar();
scalar->set_dimensions(3);
1 change: 1 addition & 0 deletions base/status_utilities.hpp
Original file line number Diff line number Diff line change
@@ -19,6 +19,7 @@ absl::Status const& GetStatus(absl::StatusOr<T> const& s) {
} // namespace internal_status_utilities

#define CHECK_OK(value) CHECK_EQ((value), ::absl::OkStatus())
#define DCHECK_OK(value) DCHECK_EQ((value), ::absl::OkStatus())
#define EXPECT_OK(value) \
EXPECT_THAT((value), ::principia::testing_utilities::IsOk());

13 changes: 8 additions & 5 deletions benchmarks/apsides.cpp
Original file line number Diff line number Diff line change
@@ -16,6 +16,7 @@
#include "physics/apsides.hpp"
#include "physics/body_centred_non_rotating_dynamic_frame.hpp"
#include "physics/body_surface_dynamic_frame.hpp"
#include "physics/discrete_trajectory.hpp"
#include "physics/ephemeris.hpp"
#include "physics/solar_system.hpp"
#include "quantities/astronomy.hpp"
@@ -135,28 +136,30 @@ BENCHMARK_F(ApsidesBenchmark, ComputeApsides)(benchmark::State& state) {
DiscreteTrajectory<ICRS> apoapsides;
DiscreteTrajectory<ICRS> periapsides;
ComputeApsides(*earth_trajectory_,
*ilrsa_lageos2_trajectory_icrs_,
ilrsa_lageos2_trajectory_icrs_->begin(),
ilrsa_lageos2_trajectory_icrs_->end(),
/*max_points=*/std::numeric_limits<int>::max(),
apoapsides,
periapsides);
CHECK_EQ(2364, apoapsides.Size());
CHECK_EQ(2365, periapsides.Size());
CHECK_EQ(2364, apoapsides.size());
CHECK_EQ(2365, periapsides.size());
}
}

BENCHMARK_F(ApsidesBenchmark, ComputeNodes)(benchmark::State& state) {
for (auto _ : state) {
DiscreteTrajectory<GCRS> ascending;
DiscreteTrajectory<GCRS> descending;
ComputeNodes(ilrsa_lageos2_trajectory_gcrs_->begin(),
ComputeNodes(*ilrsa_lageos2_trajectory_gcrs_,
ilrsa_lageos2_trajectory_gcrs_->begin(),
ilrsa_lageos2_trajectory_gcrs_->end(),
Vector<double, GCRS>({0, 0, 1}),
/*max_points=*/std::numeric_limits<int>::max(),
ascending,
descending);
CHECK_EQ(2365, ascending.Size());
CHECK_EQ(2365, descending.Size());
CHECK_EQ(2365, ascending.size());
CHECK_EQ(2365, descending.size());
}
}

1 change: 1 addition & 0 deletions benchmarks/benchmarks.vcxproj
Original file line number Diff line number Diff line change
@@ -25,6 +25,7 @@
<ClCompile Include="..\numerics\fast_sin_cos_2π.cpp" />
<ClCompile Include="..\physics\protector.cpp" />
<ClCompile Include="apsides.cpp" />
<ClCompile Include="discrete_trajectory.cpp" />
<ClCompile Include="dynamic_frame.cpp" />
<ClCompile Include="elliptic_integrals_benchmark.cpp" />
<ClCompile Include="elliptic_functions_benchmark.cpp" />
3 changes: 3 additions & 0 deletions benchmarks/benchmarks.vcxproj.filters
Original file line number Diff line number Diff line change
@@ -92,6 +92,9 @@
<ClCompile Include="..\geometry\instant_output.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="discrete_trajectory.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="quantities.hpp">
Loading