-
Notifications
You must be signed in to change notification settings - Fork 119
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
Handle partially supported options manually. #762
Conversation
I must say I am a bit sceptical to this - mainly because I think it will be a significant maintainance burden; and the moment we start reporting issues regarding (more or less) minor differences between flow and Eclipse we implicitly state that: "Everything else is implemented to perfection" - that is obviously not the case. I do not agree with this statement:
and - actually as flow continues to develop a identity of it's own - the number of such differences might actually increase instead of decrease. Iff we indeed choose to go in this direction I think the current approach is too verbose - I fear it will not be maintained. Common to all of these checks is is we check an item of a keyword for a specific value, and then report a problem. This should be possible to implement based on a collection of objects resembling: struct PartiallySupported {
std::string item;
std::string item_value;
std::string msg;
} and a multimap something like: std::multi_map<std::string, PartiallySupported> = {{"ENDSCALE" , PartiallySupported("DIRECT" , "DIRECT" , "Not supported ...")}, .... Then adding a new partially supported keyword would only be to add an entry in this map. |
I have no time now to make a proper review, but I like @joakim-hove's idea, it looks like a good and systematic way to do this. |
Is there a reason for making this a |
One keyword probably has more than one unsupported option. |
Didn't notice while skimming. That's fine I suppose. |
|
||
|
||
namespace Opm { | ||
|
||
namespace MissingFeatures { | ||
|
||
template<typename T> | ||
struct PartiallySupported { | ||
int item; |
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.
For increased readability I would prefer if you used item names instead - i.e std::string item
.
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.
Yeah, that's fine. My concern is that in the json format for these keywords, the options short cut(that is option name) are somehow different to Eclipse Manual, therefor I choose number instead, if you still think the item name is better, I will change.
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.
My concern is that in the json format for these keywords, the options short cut(that is option name) are somehow different to Eclipse Manual
Yes - I see your point - I would still prefer that you use the string names:
- Feel free to submit PR to parser changing the names to the Eclipse names.
- Please use the compiled in named constants (we should be better at using these ...):
#include <opm/parser/eclipse/Parser/ParserKeywords/C.hpp>
string_options = { {ParserKeywords::COMPORD::keywordName , PartiallySupported<std::string>{1, ParseKeywords::COMPORD::TRACK::itemName}},
With some template trickery I guess it should be possible just use ParserKeywords::COMPORD
and ParserKeywords::COMPORD::TRACK
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.
Untested suggestion:
template <typename Keyword, typename Item,typename T>
void addUnsupported(std::multimap<std::string, PartiallySupported<T>& map, T itemValue) {
std::pair<std::string,PartiallySupported<T>> pair( Keyword::keywordName , PartiallySupported<T>{ Item::itemName , itemValue});
map.insert( pair );
}
addUnsupported<ParserKeywords::COMPORD , ParseKeywords::COMPORD::TRACK>( string_options , "TRACK");
}
Ok - this looks fine to me. I'll merke tomorrow. |
@@ -55,6 +89,14 @@ namespace MissingFeatures { | |||
"VAPPARS", "VISCREF", "WATVISCT", | |||
"WPAVE", "WPIMULT", "WPITAB", "WTEMP", | |||
"WTEST", "WTRACER", "ZIPPY2" }; | |||
std::multimap<std::string, PartiallySupported<std::string> > string_options; |
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 would guess you could skip the last type in angular braces, since that can be inferred.
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.
The entire thing can be brace initialised.
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 you mean the last type in this line, I guess the answer is no, since the compiler reports error.
addUnsupported<ParserKeywords::COMPORD, ParserKeywords::COMPORD::ORDER_TYPE, std::string>
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.
The entire thing can be brace initialised.
Yes, it is.
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 would guess you could skip the last type in angular braces, since that can be inferred.
Not in the constructor unless you give it something to infer from.
Clumsy syntax aside, I'm still not convinced this is a good feature at all. |
I am now going to finish review and merging of this PR, sorry for ignoring it for so long! I have discussed some aspects with @joakim-hove, and will also make some comments in the diff. |
@@ -55,6 +89,14 @@ namespace MissingFeatures { | |||
"VAPPARS", "VISCREF", "WATVISCT", | |||
"WPAVE", "WPIMULT", "WPITAB", "WTEMP", | |||
"WTEST", "WTRACER", "ZIPPY2" }; | |||
std::multimap<std::string, PartiallySupported<std::string> > string_options; | |||
std::multimap<std::string, PartiallySupported<int> > int_options; | |||
addUnsupported<ParserKeywords::COMPORD, ParserKeywords::COMPORD::ORDER_TYPE, std::string>(string_options , "TRACK"); |
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.
Actually, it is the DEPTH option that is unsupported, not the TRACK option.
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.
Here it means only TRACK is supported.
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 realize that now, and see that I should have read the code a bit more carefully. I think that must change: addUnsupported could really be called addSupported! However, instead of maintaining a list of supported features it is better I think to have a list of unsupported parts, so that addUnsupported() works as I initially assumed. Then the checking loop on line 56 should use ==
instead of !=
and of course the message must be rewritten, and the calls change to supply the complement of the current options (unsupported parts instead of supported parts).
If you do not agree with that (perhaps there are many more unsupported than supported options for this keyword?) then we must rename addUnsupported->addSupported.
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.
perhaps there are many more unsupported than supported options for this keyword?
This is the main reason why we check supported options, I will rename the function.
I only found one thing that must change (TRACK->DEPTH) above, otherwise this is ready to be merged. Thanks! |
That's a long time, I almost forgot it means only the options listed is supported, will revert, sorry for the noise. |
c30c295
to
4ae5a0a
Compare
Ok, I am satisfied with this and will merge when Jenkins says it's ok. |
jenkins build this please |
Ert fails for Jenkins, is that related to ongoing changes @akva2? |
yes |
and i'm done with the pr for all modules. usual rules apply (no self-merge), cause somebody will likely jump on me if i do. |
jenkins build this please |
Travis says ok after recent updates, so in it goes. Thanks! |
There are some options of the keywords only partially supported by flow, handle them automatically is not that easy, so we decided to handle them manually, the lucky thing is that the number of these kind of keywords is limited.
Any feedback and suggestions are welcome.