Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion register_selection_tools.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,10 @@ void RegisterSelectionTools(ProMeshRegistry& reg, string baseGrp)
"vertices || value=true #"
"edges || value=true #"
"faces || value=true #"
"volumes || value=true", TOOLTIP_SELECT_UNASSIGNED_ELEMENTS);
"volumes || value=true", TOOLTIP_SELECT_UNASSIGNED_ELEMENTS)
.add_function("RestrictSelectionToSubset", &RestrictSelectionToSubset, grp, "",
"mesh #"
"subset index", TOOLTIP_RESTRICT_SELECTION_TO_SUBSET);


grp = baseGrp + "/Coordinate Range";
Expand Down
39 changes: 39 additions & 0 deletions tools/selection_tools.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,21 @@ 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!

Grid& grid,
SubsetHandler& sh,
Selector& sel)
{
typedef typename geometry_traits<TGeomObj>::iterator iterator;
for(iterator iter = grid.begin<TGeomObj>(); iter != grid.end<TGeomObj>(); ++iter)
{
if(sh.get_subset_index(*iter) == -1){
sel.deselect(*iter);
}
}
}

void SelectUnassignedElements(
Mesh* obj,
bool selVrts,
Expand Down Expand Up @@ -255,6 +270,30 @@ void CloseSelection(Mesh* obj)
CloseSelection (obj->selector());
}

template <class TElem>
void RestrictSelectionToSubset (Selector& sel, const SubsetHandler& sh, int si)
{
typedef typename geometry_traits<TElem>::iterator iterator;

for (iterator iter = sel.begin<TElem>(); iter != sel.end<TElem>();){
TElem* elem = *iter;
++iter;
if (sh.get_subset_index(elem) != si)
sel.deselect(elem);
}
}

void RestrictSelectionToSubset(Mesh* obj, int si)
{
SubsetHandler& sh = obj->subset_handler();
Selector& sel = obj->selector();

RestrictSelectionToSubset<Vertex>(sel, sh, si);
RestrictSelectionToSubset<Edge>(sel, sh, si);
RestrictSelectionToSubset<Face>(sel, sh, si);
RestrictSelectionToSubset<Volume>(sel, sh, si);
}

////////////////////////////////////////////////////////////////////////////////
// VERTICES
void SelectBoundaryVertices(Mesh* obj)
Expand Down
2 changes: 2 additions & 0 deletions tools/selection_tools.h
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@
#define TOOLTIP_SELECT_SELECTION_BOUNDARY "Selects the boundary of the current selection."
#define TOOLTIP_SELECT_BENT_QUADRILATERALS "Selects quadrilaterals which do not lie in a plane."
#define TOOLTIP_CLOSE_SELECTION "Selects all associated elements of lower dimensions."
#define TOOLTIP_RESTRICT_SELECTION_TO_SUBSET "Deselects all elements from the selection that are not in the specified subset."
#define TOOLTIP_SELECT_SLIVERS "Selects flat tetrahedrons. Threshold-ratio specifies the minimal ratio between the distance of two opposing edges to the length of the longest edge."
#define TOOLTIP_SELECT_SELECTION_KINK_VERTICES "Selects kink vertices in selected paths"
#define TOOLTIP_SELECT_SUBSET_KINK_VERTICES "Selects kink vertices in subset-paths"
Expand Down Expand Up @@ -225,6 +226,7 @@ void SelectSelectionBoundary(Mesh* obj);

void CloseSelection(Mesh* obj);

void RestrictSelectionToSubset(Mesh* obj, int si);

template <class TElem>
void SelectInterfaceElements(Mesh* obj, bool regardSelectedNbrsOnly)
Expand Down