Skip to content

Commit

Permalink
temporary fix to reload error - json is alphabetical - TODO: potentia…
Browse files Browse the repository at this point in the history
…lly check the max length dynamically zero pad

ceil(log10(maxlen)) zero padding would do but maybe we should store a new "maxlength" key
  • Loading branch information
tremblap committed Jan 8, 2024
1 parent 035638a commit 890985f
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions include/data/FluidJSON.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -140,11 +140,13 @@ void to_json(nlohmann::json &j, const FluidDataSeries<std::string, T, 1> &ds) {
auto ids = ds.getIds();
auto data = ds.getData();
j["cols"] = ds.pointSize();
for (index r = 0; r < ds.size(); r++)
{
char timestring[6];
for (index r = 0; r < ds.size(); r++) {
auto series = data[r];
for (index s = 0; s < series.rows(); s++)
j["data"][ids[r]]["t" + std::to_string(s)] = data[r].row(s);
for (index s = 0; s < series.rows(); s++) {
std::snprintf(timestring,6,"T%04ld",s);
j["data"][ids[r]][timestring] = data[r].row(s);
}
}
}

Expand Down

0 comments on commit 890985f

Please sign in to comment.