Skip to content

Commit

Permalink
remove conversion + sep cluster list
Browse files Browse the repository at this point in the history
  • Loading branch information
payetvin committed Oct 15, 2024
1 parent d4df6c2 commit b89512c
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/libs/antares/study/area/links.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ void AreaLink::storeTimeseriesNumbers(Solver::IResultWriter& writer) const

std::string buffer;
timeseriesNumbers.saveToBuffer(buffer);
writer.addEntryFromBuffer(path.string(), buffer);
writer.addEntryFromBuffer(path, buffer);
}

void AreaLink::detach()
Expand Down
2 changes: 1 addition & 1 deletion src/libs/antares/study/area/store-timeseries-numbers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ static void storeTSnumbers(Solver::IResultWriter& writer,
std::string buffer;
timeseriesNumbers.saveToBuffer(buffer);

writer.addEntryFromBuffer(path.string(), buffer);
writer.addEntryFromBuffer(path, buffer);
}

void storeTimeseriesNumbersForLoad(Solver::IResultWriter& writer, const Area& area)
Expand Down
12 changes: 5 additions & 7 deletions src/libs/antares/study/parts/common/cluster_list.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
#include <antares/utils/utils.h>
#include "antares/study/study.h"

using namespace Yuni;
namespace fs = std::filesystem;

namespace Antares::Data
{
Expand Down Expand Up @@ -88,21 +88,19 @@ void ClusterList<ClusterT>::resizeAllTimeseriesNumbers(uint n) const
}
}

#define SEP IO::Separator

template<class ClusterT>
void ClusterList<ClusterT>::storeTimeseriesNumbers(Solver::IResultWriter& writer) const
{
Clob path;
std::string ts_content;
fs::path basePath = fs::path("ts-numbers") / typeID();

for (auto& cluster: each_enabled())
{
path.clear() << "ts-numbers" << SEP << typeID() << SEP << cluster->parentArea->id << SEP
<< cluster->id() << ".txt";
fs::path path = fs::path(cluster->parentArea->id) / std::string(cluster->id() + ".txt");

ts_content.clear(); // We must clear ts_content here, since saveToBuffer does not do it.
cluster->series.timeseriesNumbers.saveToBuffer(ts_content);
writer.addEntryFromBuffer(path.c_str(), ts_content);
writer.addEntryFromBuffer(path, ts_content);
}
}

Expand Down

0 comments on commit b89512c

Please sign in to comment.