Skip to content

Commit

Permalink
Merge pull request #3794 from pleroy/Clang
Browse files Browse the repository at this point in the history
Fix errors found by Clang
  • Loading branch information
pleroy authored Nov 5, 2023
2 parents ce02653 + e9cc821 commit 0a78b1f
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 12 deletions.
4 changes: 2 additions & 2 deletions ksp_plugin/flight_plan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ FlightPlan::FlightPlan(
: initial_mass_(initial_mass),
initial_time_(initial_time),
initial_degrees_of_freedom_(std::move(initial_degrees_of_freedom)),
desired_final_time_(desired_final_time),
ephemeris_(ephemeris),
desired_final_time_(desired_final_time),
adaptive_step_parameters_(std::move(adaptive_step_parameters)),
generalized_adaptive_step_parameters_(
std::move(generalized_adaptive_step_parameters)) {
Expand All @@ -84,8 +84,8 @@ FlightPlan::FlightPlan(FlightPlan const& other)
anomalous_segments_(other.anomalous_segments_),
manœuvres_(other.manœuvres_),
coast_analysers_(),
analysis_is_enabled_(other.analysis_is_enabled_),
ephemeris_(other.ephemeris_),
analysis_is_enabled_(other.analysis_is_enabled_),
adaptive_step_parameters_(other.adaptive_step_parameters_),
generalized_adaptive_step_parameters_(
other.generalized_adaptive_step_parameters_) {
Expand Down
1 change: 0 additions & 1 deletion ksp_plugin/flight_plan_optimizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,6 @@ Gradient<double, FlightPlanOptimizer::HomogeneousArgument>
FlightPlanOptimizer::MetricForΔv::EvaluateGradient(
HomogeneousArgument const& homogeneous_argument) const {
auto const updated_Δv = UpdatedManœuvre(homogeneous_argument).Δv();
Time const Δinitial_time_component_of_grad;
Vector<double, Frenet<Navigation>> const ΔΔv_component_of_grad =
2 * speed_homogeneization_factor * updated_Δv / scale_;
auto const& ΔΔv_component_of_grad_coordinates =
Expand Down
18 changes: 9 additions & 9 deletions ksp_plugin_test/flight_plan_optimizer_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ class FlightPlanOptimizerTest : public testing::Test {
apoapsides,
periapsides);
auto const radius = celestial.body()->mean_radius();
for (const auto [time, degrees_of_freedom] : periapsides) {
for (auto const& [time, degrees_of_freedom] : periapsides) {
Length const periapsis_distance =
(celestial_trajectory.EvaluatePosition(time) -
degrees_of_freedom.position())
Expand Down Expand Up @@ -156,7 +156,6 @@ class FlightPlanOptimizerTest : public testing::Test {
NavigationFrame const& frame,
Instant& flyby_time,
Angle& flyby_inclination) {
auto const& celestial_trajectory = celestial.trajectory();
DegreesOfFreedom<Barycentric> flyby_degrees_of_freedom(
Barycentric::origin, Barycentric::unmoving);
ComputeFlyby(flight_plan, celestial, flyby_time, flyby_degrees_of_freedom);
Expand Down Expand Up @@ -650,13 +649,14 @@ TEST_P(MetricTest, Gradient) {
displacement(random),
displacement(random),
displacement(random)});
max_relative_error =
std::max(max_relative_error,
RelativeError(
metric_->Evaluate(argument + Δargument),
metric_->Evaluate(argument) +
TransposedView(metric_->EvaluateGradient(argument)) *
Δargument));
max_relative_error = std::max(
max_relative_error,
RelativeError(
metric_->Evaluate(argument + Δargument),
metric_->Evaluate(argument) +
TransposedView<FlightPlanOptimizer::HomogeneousArgument>(
metric_->EvaluateGradient(argument)) *
Δargument));
}
}
EXPECT_THAT(max_relative_error,
Expand Down

0 comments on commit 0a78b1f

Please sign in to comment.