diff --git a/sources/Launcher/DYNRobustnessAnalysisLauncher.cpp b/sources/Launcher/DYNRobustnessAnalysisLauncher.cpp index 23766b7..93945a9 100644 --- a/sources/Launcher/DYNRobustnessAnalysisLauncher.cpp +++ b/sources/Launcher/DYNRobustnessAnalysisLauncher.cpp @@ -486,9 +486,13 @@ RobustnessAnalysisLauncher::writeOutputs(const SimulationResult& result) const { std::string lostEquipmentsPath = createAbsolutePath("lostEquipments", workingDirectory_); if (!is_directory(lostEquipmentsPath)) create_directory(lostEquipmentsPath); + std::string finalStatePath = createAbsolutePath("finalState", workingDirectory_); + if (!is_directory(finalStatePath)) + create_directory(finalStatePath); std::string logPath = createAbsolutePath("logs", workingDirectory_); if (!is_directory(logPath)) create_directory(logPath); + if (!result.getConstraintsStreamStr().empty()) { std::ofstream file; std::string filepath = createAbsolutePath("constraints_" + result.getUniqueScenarioId() + "." + result.getConstraintsFileExtension(), constraintPath); @@ -523,6 +527,17 @@ RobustnessAnalysisLauncher::writeOutputs(const SimulationResult& result) const { file.close(); } + if (!result.getOutputIIDMStreamStr().empty()) { + std::string filepath = createAbsolutePath("outputIIDM_" + result.getUniqueScenarioId() + ".xml", finalStatePath); + std::ofstream file; + file.open(filepath); + if (!file.is_open()) { + throw DYNError(DYN::Error::API, KeyError_t::FileGenerationFailed, filepath); + } + file << result.getOutputIIDMStreamStr(); + file.close(); + } + if (!result.getLogPath().empty()) { boost::filesystem::path from(result.getLogPath()); boost::filesystem::path to(createAbsolutePath("log_" + result.getUniqueScenarioId() + ".log", logPath));