-
Notifications
You must be signed in to change notification settings - Fork 90
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
Save provenance tracking info from grid file #2230
Conversation
Save (if present) the grid_id, hypnotoad_version, hypnotoad_git_hash, hypnotoad_git_diff and hypnotoad_geqdsk_filename.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clang-tidy made some suggestions
Would be nice to save the filename of the grid file too, but that looks like a faff at the moment. Hopefully it might be easier after the I/O refactor... Also would be nice to save the |
clang-tidy review says "All clean, LGTM! 👍" |
Probably wait for the I/O refactor? Hopefully won't be too long. Although I guess that doesn't help for the backport. It also looks like it should be possible to make bool GridFile::get(Mesh *UNUSED(m), std::string &sval, const std::string &name, const std::string& def) {
Timer timer("io");
TRACE("GridFile::get(std::string)");
if (!file->is_valid()) {
throw BoutException("File cannot be read");
}
// Try to read from a variable first, maximum of 2048 characters
constexpr int max_string_size = 2048;
std::string temp_var;
temp_var.reserve(max_string_size);
const bool success_var = file->read(&(*temp_var.begin()), name, max_string_size);
if (success_var) {
sval = std::move(temp_var);
return success_var;
}
const bool success = file->getAttribute("", name, sval);
if (!success) {
sval = def;
}
print_read_option(sval, name, filename, success);
return success;
} Not quite I suppose because |
std::string grid_id = ""; | ||
std::string hypnotoad_version = ""; | ||
std::string hypnotoad_git_hash = ""; | ||
std::string hypnotoad_git_diff = ""; | ||
std::string hypnotoad_geqdsk_filename = ""; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just to note that when we get the new I/O stuff in, we won't need to have these as class members
I think that's best. What's here is good enough for now, and I don't think it's worth putting more work into modifying |
Save (if present) the
grid_id
,hypnotoad_version
,hypnotoad_git_hash
,hypnotoad_git_diff
andhypnotoad_geqdsk_filename
. I've checked that this works on the v4.4 backport using a gridfile generated with a recent version of hypnotoad.Also update the docs to note useful attributes/variables for reproducibility and provenance tracking.