Skip to content

Conversation

@mastep84
Copy link
Member

…ts all elements from the selection that are not in the specified subset.

…ts all elements from the selection that are not in the specified subset.
Copy link
Member

@sreiter sreiter left a comment

Choose a reason for hiding this comment

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

Thank's for providing the new functionality. I have some small comments. Summarizing: It would be great if you could remove the dynamic memory allocations by simply deselecting elements and if you could reduce code duplication by performing that deselection in an additional template helper function.

"volumes || value=true", TOOLTIP_SELECT_UNASSIGNED_ELEMENTS)
.add_function("RestrictSelectionToSubset", &RestrictSelectionToSubset, grp, "",
"mesh #"
"subset index#", TOOLTIP_RESTRICT_SELECTION_TO_SUBSET);
Copy link
Member

Choose a reason for hiding this comment

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

I think the '#' separator behind "subset index" is unnecessary and should probably be removed.

Selector& sel = obj->selector();

// Store selected elements that are contained in the specified subset
std::vector<Vertex*> vVertices;
Copy link
Member

Choose a reason for hiding this comment

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

While of course a matter of taste, The 'v' prefix is unnecessary, I'd say, since the type is clear. There are no prefixes on many other variables, so this is probably slightly inconsistent.

CloseSelection (obj->selector());
}

void RestrictSelectionToSubset(Mesh* obj, int si)
Copy link
Member

Choose a reason for hiding this comment

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

There is a lot of code duplication in that method. There could be an additional template method which performs the restriction for one element type. You'd then call that method here for 'Vertex', 'Edge', ...
Also - why do you store a list of selected elements, deselect all and reselect those elements. Instead you should simply deselect the ones which are not in the specified subset.

@@ -194,17 +194,17 @@ static void SelectUnassignedElementsHelper(

template <class TGeomObj>
static void DeselectUnassignedElementsHelper(
Copy link
Member

Choose a reason for hiding this comment

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

Do you actually still use this method? If not I would rather remove it.

Copy link
Member Author

Choose a reason for hiding this comment

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

You are right, I do not use it anymore, it's just left over from the previous implementation. Shall I remove it or will you do it?

Copy link
Member

Choose a reason for hiding this comment

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

Would be great if you could do it. Thanks!

@sreiter sreiter merged commit afbfbb4 into UG4:master Jun 8, 2020
@sreiter
Copy link
Member

sreiter commented Jun 8, 2020

Thanks!

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