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

Also write RESTART paths between 72 and 132 characters to .SMSPEC file #4057

Merged
merged 3 commits into from
May 8, 2024

Conversation

vkip
Copy link
Member

@vkip vkip commented May 7, 2024

No description provided.

Copy link
Member

@bska bska left a 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.

Comment on lines 591 to 593
// 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};
Copy link
Member

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()));

// ...

Copy link
Member Author

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..)

Copy link
Member

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.

@vkip vkip marked this pull request as ready for review May 8, 2024 09:09
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)";
Copy link
Member

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.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point, will do.

@bska
Copy link
Member

bska commented May 8, 2024

jenkins build this please

Copy link
Member

@bska bska left a 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.

@bska bska merged commit 5daf849 into OPM:master May 8, 2024
1 check passed
@vkip vkip deleted the smspec_restart_longpath branch May 8, 2024 10:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants