Skip to content

Commit ef8a18c

Browse files
authored
Merge pull request #592 from PowerGridModel/feature/use-move-output
fix performance regression
2 parents 5cc47b4 + efca869 commit ef8a18c

File tree

1 file changed

+2
-5
lines changed
  • power_grid_model_c/power_grid_model/include/power_grid_model

1 file changed

+2
-5
lines changed

power_grid_model_c/power_grid_model/include/power_grid_model/main_model.hpp

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -665,15 +665,12 @@ class MainModelImpl<ExtraRetrievableTypes<ExtraRetrievableType...>, ComponentLis
665665

666666
template <symmetry_tag sym>
667667
auto calculate_power_flow(double err_tol, Idx max_iter, CalculationMethod calculation_method) {
668-
auto const result_pf =
668+
auto result_pf =
669669
optimizer::get_optimizer<MainModelState, ConstDataset>(
670670
OptimizerType::no_optimization, OptimizerStrategy::any, calculate_power_flow_<sym>(err_tol, max_iter),
671671
[this](ConstDataset update_data) { this->update_component<permanent_update_t>(update_data); })
672672
->optimize(state_, calculation_method);
673-
if constexpr (std::is_same<decltype(result_pf), OptimizerOutput>::value) {
674-
return MathOutput<SolverOutput<sym>>{.solver_output = {}, .optimizer_output = result_pf};
675-
}
676-
return MathOutput<SolverOutput<sym>>{.solver_output = result_pf, .optimizer_output = {}};
673+
return MathOutput<SolverOutput<sym>>{.solver_output = std::move(result_pf), .optimizer_output = {}};
677674
}
678675

679676
// Single load flow calculation, propagating the results to result_data

0 commit comments

Comments
 (0)