-
Notifications
You must be signed in to change notification settings - Fork 113
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
Also write RESTART paths between 72 and 132 characters to .SMSPEC file #4057
Conversation
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.
I'm fine with raising the maximum string length here if it doesn't cause problems elsewhere. In particular, we should verify that we're still okay to claim this level of compatibility.
opm/io/eclipse/OutputStream.cpp
Outdated
// If the length of the path is 72 < N <= 132, 17 8-character words are used | ||
const auto maxSubstrings2 = std::size_t{17}; | ||
const auto maxStringLength2 = std::size_t{132}; |
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.
It's mostly academic and I haven't really thought about it, but maybe we could consider switching to calculating the number of substrings in terms of the maximum string size instead of the other way around? E.g.,
const auto maxStringLength = std::array {
std::string::size_type{72},
std::string::size_type{132}
};
auto numSubStr = [&maxSubStr, subStrLength](const std::size_t i)
{
return maxSubStr[i] / subStrLength + (maxSubStr[i] % subStrLength > 0);
};
if (restart.root.empty()) {
ret.resize(numSubStr(0));
return ret;
}
if (restart.root.size() > maxStringLength.back()) {
// Handle long strings
}
ret.resize(numSubStr(restart.root.size() > maxStringLength.front()));
// ...
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.
Certainly possible. Since there are here only two specific alternatives depending on the restart path length I think I might prefer to be more explicit - example incoming (but no strong opinion..)
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.
Since there are here only two specific alternatives depending on the restart path length I think I might prefer to be more explicit - example incoming (but no strong opinion..)
Cool. I was just looking at ways of potentially avoiding the magic constant 17. Granted, 72 and 132 are more or less equally magic, but at least they're somewhat more reasonable in context.
…an 132 characters).
opm/io/eclipse/OutputStream.cpp
Outdated
const auto msg = "Restart root name of size " | ||
+ std::to_string(restart.root.size()) | ||
+ std::to_string(N) | ||
+ " exceeds " | ||
+ std::to_string(maxStringLength) | ||
+ " character limit (Ignored)"; |
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.
If we're truncating, then we should probably update this message to reflect that fact.
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.
Good point, will do.
jenkins build this please |
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.
Thanks a lot for the updates. This looks good to me now and I'll merge into master.
No description provided.