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
Allow overwriting members of a WorkspaceGroup when setting output properties to the same workspace name #828
Conversation
if (inputProperty && inputProperty->value() == prop->value()) | ||
outName = m_groups[inputProp - m_inputWorkspaceProps.begin()][entry] | ||
->name(); | ||
|
||
// Except if all inputs had similar names, then the name is "out_1" |
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.
Is it necessary to create inputProp variable and do the second if? It looks to me that the second if's condition is always true when the first if is true.
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.
@mantid-roman It protects against the dynamic_cast
failing, although there shouldn't really be a case where it does.
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 meant inputProperty. It is only used to repeat the checks done in WorkspacePropertyValueIs.
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 see what you were meaning now, I could remove the first if
.
dynamic_cast<Property *>(*inputProp)->value() == prop->value()) | ||
outName = m_groups[inputProp - m_inputWorkspaceProps.begin()][entry] | ||
->name(); | ||
|
||
// Except if all inputs had similar names, then the name is "out_1" |
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.
Wouldn't if (inputProp != m_inputWorkspaceProps.end())
be enough here?
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.
Yes. I have no idea what I was previously thinking.
|
||
class WorkspacePropertyValueIs { | ||
public: | ||
WorkspacePropertyValueIs(std::string value) : m_value(value){}; |
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.
Sorry I didn't see it earlier but value
should be passed by const reference.
…ithm_overwrite Allow overwriting members of a WorkspaceGroup when setting output properties to the same workspace name
Fixes #12717
This adds the ability for an algorithm to overwrite the members of a WorkspaceGroup when processing workspace groups when an output property is given the same name as an input property, before this would have created new workspaces with
name_n
style names, which is inconsistent with what you would expect given how algorithms run over single workspaces.To test: