@@ -93,6 +93,13 @@ std::vector<QuantLib::ext::shared_ptr<ore::data::TodaysMarketParameters>> Analyt
9393
9494void AnalyticsManager::runAnalytics (
9595 const QuantLib::ext::shared_ptr<MarketCalibrationReportBase>& marketCalibrationReport) {
96+ runAnalytics (marketCalibrationReport == nullptr
97+ ? std::vector<QuantLib::ext::shared_ptr<MarketCalibrationReportBase>>()
98+ : std::vector<QuantLib::ext::shared_ptr<MarketCalibrationReportBase>>{marketCalibrationReport});
99+ }
100+
101+ void AnalyticsManager::runAnalytics (
102+ const std::vector<QuantLib::ext::shared_ptr<MarketCalibrationReportBase>>& marketCalibrationReport) {
96103 QL_REQUIRE (initialised_, " AnalyticsManager has not been initialised" );
97104 if (analytics_.size () == 0 )
98105 return ;
@@ -150,8 +157,7 @@ void AnalyticsManager::runAnalytics(
150157 a.second ->stopTimer (" Run " + a.second ->label () + " Analytic" );
151158 LOG (" run analytic with label '" << a.first << " ' finished." );
152159 // then populate the market calibration report if required
153- if (marketCalibrationReport)
154- a.second ->marketCalibration (marketCalibrationReport);
160+ a.second ->marketCalibration (marketCalibrationReport);
155161 }
156162
157163 if (inputs_->portfolio ()) {
@@ -173,13 +179,16 @@ void AnalyticsManager::runAnalytics(
173179 reports_[" STATS" ][" runtimes" ] = runTimesReport;
174180 }
175181
176- if (marketCalibrationReport) {
177- if (auto rpt =
178- QuantLib::ext::dynamic_pointer_cast<InMemoryReport>(marketCalibrationReport->outputCalibrationReport ()))
179- reports_[" MARKET" ][" todaysmarketcalibration" ] = rpt;
180- if (auto rpt =
181- QuantLib::ext::dynamic_pointer_cast<InMemoryReport>(marketCalibrationReport->outputCashflowReport ()))
182- reports_[" MARKET" ][" todaysmarketcalibration_cashflows" ] = rpt;
182+ Size noa = 0 , nob = 0 ;
183+ for (auto r : marketCalibrationReport) {
184+ if (auto rpt = QuantLib::ext::dynamic_pointer_cast<InMemoryReport>(r->outputCalibrationReport ())) {
185+ std::string suffix = noa++ == 0 ? std::string () : " _" + std::to_string (noa);
186+ reports_[" MARKET" ][" todaysmarketcalibration" + suffix] = rpt;
187+ }
188+ if (auto rpt = QuantLib::ext::dynamic_pointer_cast<InMemoryReport>(r->outputCashflowReport ())) {
189+ std::string suffix = nob++ == 0 ? std::string () : " _" + std::to_string (nob);
190+ reports_[" MARKET" ][" todaysmarketcalibration_cashflows" + suffix] = rpt;
191+ }
183192 }
184193
185194 inputs_->writeOutParameters ();
0 commit comments