From 88698d48df1468898ef3d2771a15e79f9cc73801 Mon Sep 17 00:00:00 2001 From: Abdoulbari Zakir Date: Fri, 20 Dec 2024 11:53:55 +0100 Subject: [PATCH] read new folder --- src/libs/antares/study/area/list.cpp | 10 ++++++---- .../study/parts/short-term-storage/container.cpp | 11 +++++------ 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/src/libs/antares/study/area/list.cpp b/src/libs/antares/study/area/list.cpp index 7af3a6a5a7..868c3d5490 100644 --- a/src/libs/antares/study/area/list.cpp +++ b/src/libs/antares/study/area/list.cpp @@ -1194,12 +1194,14 @@ bool AreaList::loadFromFolder(const StudyLoadOptions& options) if (fs::exists(stsFolder)) { - for (const auto& [id, area]: areas) + for (const auto& area: areas | std::views::values) { - fs::path folder = stsFolder / "clusters" / area->id.c_str(); + fs::path cluster_folder = stsFolder / "clusters" / area->id.c_str(); + ret = area->shortTermStorage.createSTStorageClustersFromIniFile(cluster_folder) && + ret; - ret = area->shortTermStorage.createSTStorageClustersFromIniFile(folder) && ret; - ret = area->shortTermStorage.LoadConstraintsFromIniFile(folder) && ret; + const auto constraints_folder = stsFolder / "constraints" / area->id.c_str(); + ret = area->shortTermStorage.LoadConstraintsFromIniFile(cluster_folder) && ret; } } else diff --git a/src/libs/antares/study/parts/short-term-storage/container.cpp b/src/libs/antares/study/parts/short-term-storage/container.cpp index 5dee3106dc..1e46be0a5f 100644 --- a/src/libs/antares/study/parts/short-term-storage/container.cpp +++ b/src/libs/antares/study/parts/short-term-storage/container.cpp @@ -163,12 +163,11 @@ bool STStorageInput::LoadConstraintsFromIniFile(const fs::path& parent_path) return false; } - auto it = std::find_if(storagesByIndex.begin(), - storagesByIndex.end(), - [&additional_constraints](const STStorageCluster& cluster) - { - return cluster.id == additional_constraints.cluster_id; - }); + auto it = std::ranges::find_if(storagesByIndex, + [&additional_constraints](const STStorageCluster& cluster) + { + return cluster.id == additional_constraints.cluster_id; + }); if (it == storagesByIndex.end()) { logs.warning() << " from file " << pathIni;