Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Restore old cluster file format for compatibility with python code #180

Merged
merged 2 commits into from
Aug 23, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 4 additions & 13 deletions cxx/util_io.cc
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,7 @@ void to_txt(std::ostream& fp, const IRM& irm, const T_encoding& encoding) {
fp << " ";
}
}
fp << "\n\n";
fp << "\n";
}
}
}
Expand All @@ -418,7 +418,7 @@ void to_txt(std::ostream& fp, const HIRM& hirm, const T_encoding& encoding) {
}
fp << "\n";
}
fp << "\n\n";
fp << "\n";
// Write the IRMs.
int j = 0;
for (const auto& [table, rcs] : tables) {
Expand Down Expand Up @@ -510,24 +510,15 @@ load_clusters_hirm(const std::string& path) {

std::string line;
int irmc = 0;
// Only reset the IRM cluster when we see two newlines in a row.
bool start_of_irm_separator = false;

while (std::getline(fp, line)) {
std::istringstream stream(line);
// Skip a newline.
if (line.size() == 0) {
if (start_of_irm_separator) {
irmc = -1;
start_of_irm_separator = false;
} else {
start_of_irm_separator = true;
}
// Start of new IRM
irmc = -1;
continue;
}

start_of_irm_separator = false;

std::string first;
stream >> first;

Expand Down