ug4
selection util

Functions

template<class TElem , class TSelector >
void ug::AssignSelectionStateToSides (TSelector &sel, bool recursive)
 Assigns the selection state of selected elements to associated sides. More...
 
template<class TAAPosVRT >
bool ug::CalculateCenter (typename TAAPosVRT::ValueType &centerOut, Selector &sel, TAAPosVRT &aaPos)
 calculates the center of selected objects More...
 
template<class TSelector >
UG_API void ug::CloseSelection (TSelector &sel)
 Selects all associated elements of lower dimensions. More...
 
size_t ug::CollectVerticesTouchingSelection (std::vector< Vertex * > &vrtsOut, ISelector &sel)
 Collects all vertices which are selected or which touch a selected element. More...
 
template<class TSelector >
void ug::DeselectBoundarySelectionEdges (TSelector &sel)
 deselects all edges that are connected to unselected elements. More...
 
template<class TSelector >
void ug::DeselectBoundarySelectionFaces (TSelector &sel)
 deselects all faces that are connected to unselected elements. More...
 
template<class TSelector >
void ug::DeselectBoundarySelectionVertices (TSelector &sel)
 deselects all vertices that are connected to unselected elements. More...
 
template<class TSelector >
void ug::EraseSelectedObjects (TSelector &sel)
 Erases selected objects from the associated grid. More...
 
template<class TSelector >
UG_API void ug::ExtendSelection (TSelector &sel, size_t extSize, ISelector::status_t status=ISelector::SELECTED)
 extends the selection to neighbours of selected elements. More...
 
template<class TSelector , class TAAPos >
UG_API void ug::ExtendSelectionInDirection (TSelector &sel, size_t extSize, const typename TAAPos::ValueType &dir, number minAngle, number maxAngle, const TAAPos &aaPos, ISelector::status_t status=ISelector::SELECTED)
 extends the selection to neighbours of selected elements in the given direction. More...
 
template<class TAAPosVRT >
UG_API number ug::FaceArea (ISelector &sel, TAAPosVRT &aaPos)
 
template<class TSelector >
void ug::InvertSelection (TSelector &sel)
 Inverts the selection. More...
 
template<class TSelector , class TIterator >
void ug::InvertSelection (TSelector &sel, TIterator begin, TIterator end)
 Inverts the selection of the elements between begin and end. More...
 
template<class TIter >
void ug::SelectAreaBoundary (ISelector &sel, const TIter begin, const TIter end)
 selects sides that are only adjacent to one of the given inner elements More...
 
template<class TElem , class TIterator >
void ug::SelectAssociated (ISelector &sel, TIterator begin, TIterator end, ISelector::status_t status=ISelector::SELECTED)
 Selects all elements of type TElem, which touch an element between begin and end. More...
 
template<class TSelector , class TElemIterator >
void ug::SelectAssociatedEdges (TSelector &sel, TElemIterator elemsBegin, TElemIterator elemsEnd, ISelector::status_t status=ISelector::SELECTED)
 selects all associated edges of the elements between elemsBegin and elemsEnd More...
 
template<class TSelector , class TElemIterator >
void ug::SelectAssociatedFaces (TSelector &sel, TElemIterator elemsBegin, TElemIterator elemsEnd, ISelector::status_t status=ISelector::SELECTED)
 selects all associated faces of the elements between elemsBegin and elemsEnd More...
 
void ug::SelectAssociatedGenealogy (MGSelector &msel, bool selectAssociatedElements)
 Selects the complete genealogy of all selected elements. More...
 
template<class TSelector >
UG_API void ug::SelectAssociatedGridObjects (TSelector &sel, ISelector::status_t status=ISelector::SELECTED)
 selects associated geometric objects of selected ones on each level. More...
 
template<class TSelector , class TElemIterator >
void ug::SelectAssociatedVertices (TSelector &sel, TElemIterator elemsBegin, TElemIterator elemsEnd, ISelector::status_t status=ISelector::SELECTED)
 selects all associated vertices of the elements between elemsBegin and elemsEnd More...
 
template<class TSelector , class TElemIterator >
void ug::SelectAssociatedVolumes (TSelector &sel, TElemIterator elemsBegin, TElemIterator elemsEnd, ISelector::status_t status=ISelector::SELECTED)
 selects all associated faces of the elements between elemsBegin and elemsEnd More...
 
template<class TElemIterator >
void ug::SelectBoundaryElements (ISelector &sel, TElemIterator elemsBegin, TElemIterator elemsEnd)
 selects elements that lie on the associated grid's boundary More...
 
template<class TEdgeIterator >
void ug::SelectCreaseEdges (ISelector &sel, TEdgeIterator edgesBegin, TEdgeIterator edgesEnd, number minAngle, APosition aVrtPos, bool ignoreBoundaryEdges=true, ISelector::status_t state=ISelector::SELECTED)
 Selects edges which at which triangles meet in a large angle. More...
 
template<class TAAPos >
void ug::SelectEdgesByDirection (Selector &sel, TAAPos &aaPos, const vector3 &dir, number minDeviationAngle, number maxDeviationAngle, bool selectFlipped)
 Selects all edges that face a given direction. More...
 
template<class TElemIterator >
void ug::SelectInnerElements (ISelector &sel, TElemIterator elemsBegin, TElemIterator elemsEnd)
 selects elements that do not lie on the associated grid's boundary More...
 
template<class TSelector >
void ug::SelectInnerSelectionEdges (TSelector &sel)
 selects all edges that are only connected to selected elements. More...
 
template<class TSelector >
void ug::SelectInnerSelectionFaces (TSelector &sel)
 selects all faces that are only connected to selected elements. More...
 
template<class TSelector >
void ug::SelectInnerSelectionVertices (TSelector &sel)
 selects all vertices that are only connected to selected elements. More...
 
template<class TIter >
void ug::SelectInterfaceElements (ISelector &sel, ISubsetHandler &sh, const TIter begin, const TIter end, bool regardSelectedNbrsOnly=false)
 Selects elements which are adjacent to higher dimensional elements of different subsets. More...
 
template<class TGeomObj >
void ug::SelectionFill (Selector &sel, typename Grid::traits< typename TGeomObj::side >::callback cbRegionBoundary)
 Extends the selection around selected objects until selected sides are reached. More...
 
template<class TElem >
void ug::SelectLinkedElements (ISelector &sel, typename Grid::traits< TElem >::callback cbIsSelectable=ConsiderAll(), typename Grid::traits< typename TElem::side >::callback cbIsTraversable=ConsiderAll())
 Repeatedly traverses sides of selected elements and selects associated elements. More...
 
void ug::SelectLinkedFlatAndDegeneratedFaces (Selector &sel, number maxDeviationAngle, bool ignoreOrientation=false, bool stopAtSelectedEdges=false, number degThreshold=SMALL, APosition &aPos=aPosition)
 Extends the selection of faces to all neighbouring faces that have a similar normal. More...
 
void ug::SelectLinkedFlatFaces (Selector &sel, number maxDeviationAngle, bool ignoreOrientation=false, bool stopAtSelectedEdges=false, APosition &aPos=aPosition)
 Extends the selection of faces to all neighbouring faces that have a similar normal. More...
 
template<class TGeomObj , class TAAPos >
bool ug::SelectRegion (Selector &sel, const typename TAAPos::ValueType &p, TAAPos &aaPos, typename Grid::traits< typename TGeomObj::side >::callback cbRegionBoundary)
 Selects the region which contains the given point. More...
 
template<class TAAPos >
void ug::SelectShortPolychains (ISelector &sel, number maxLength, bool closedChainsOnly, TAAPos aaPos)
 Selects regular polygonal chains which are shorter than a given threshold. More...
 
void ug::SelectSmoothEdgePath (Selector &sel, number thresholdDegree, number normalWeight, bool stopAtSelVrts=true, APosition &aPos=aPosition)
 selects for each selected edge all edges that can be reached by a smooth path. More...
 
void ug::SelectSubset (ISelector &sel, const ISubsetHandler &sh, int si, ISelector::status_t status)
 Select all elements specified by a subset index ans selection status. More...
 
template<class TAAPos >
void ug::SelectSubsetEdgesByDirection (Selector &sel, SubsetHandler &sh, int subsetIndex, TAAPos &aaPos, const vector3 &dir, number minDeviationAngle, number maxDeviationAngle, bool selectFlipped)
 Selects all subset edges that face a given direction. More...
 
template<class TElem >
void ug::SelectSubsetElements (ISelector &sel, ISubsetHandler &sh, int subsetIndex, ISelector::status_t status=ISelector::SELECTED)
 selects all elements of the given type in the given subset More...
 
template<class TAAPosVRT >
void ug::TranslateSelection (Selector &sel, const typename TAAPosVRT::ValueType &offset, TAAPosVRT &aaPos)
 moves all vertices touching the selection by the specified offset. More...
 
template<class elem_t >
void ug::GetSelectedElementIndices (const ISelector &sel, std::vector< int > &indsOut)
 Returns indices of selected elements in ascending order. More...
 
void ug::GetSelectedElementIndices (const ISelector &sel, std::vector< size_t > &vrtIndsOut, std::vector< size_t > &edgeIndsOut, std::vector< size_t > &faceIndsOut, std::vector< size_t > &volIndsOut)
 Returns indices of selected elements in ascending order. More...
 
template<class elem_t >
void ug::SelectElementsByIndex (ISelector &sel, const std::vector< size_t > &inds)
 Selects elements with the specified indices. More...
 
void ug::SelectElementsByIndex (ISelector &sel, const std::vector< size_t > &vrtInds, const std::vector< size_t > &edgeInds, const std::vector< size_t > &faceInds, const std::vector< size_t > &volInds)
 Selects elements with the specified indices. More...
 

Detailed Description

Several methods that ease selection-handling are grouped here.

Function Documentation

◆ AssignSelectionStateToSides()

template<class TElem , class TSelector >
void ug::AssignSelectionStateToSides ( TSelector &  sel,
bool  recursive 
)

Assigns the selection state of selected elements to associated sides.

If recursive is set to true, the method will recursively call itself, to copy the state to sides of sides and so on.

The new status of the side will be an or combination of the initial state of the side and the states of adjacent elements.

Valid types for TSelector are Selector and MGSelector.

References ug::Grid::associated_elements(), ug::PointerConstArray< TPtr >::size(), and UG_ASSERT.

◆ CalculateCenter()

template<class TAAPosVRT >
bool ug::CalculateCenter ( typename TAAPosVRT::ValueType &  centerOut,
Selector sel,
TAAPosVRT &  aaPos 
)

◆ CloseSelection()

template<class TSelector >
UG_API void ug::CloseSelection ( TSelector &  sel)

Selects all associated elements of lower dimensions.

References SelectAssociatedEdges(), SelectAssociatedFaces(), and SelectAssociatedVertices().

◆ CollectVerticesTouchingSelection()

UG_API size_t ug::CollectVerticesTouchingSelection ( std::vector< Vertex * > &  vrtsOut,
ISelector sel 
)

◆ DeselectBoundarySelectionEdges()

template<class TSelector >
void ug::DeselectBoundarySelectionEdges ( TSelector &  sel)

deselects all edges that are connected to unselected elements.

TSelector either has to be of type Selector or MGSelector. Only elements of higher dimension are regarded.

References ug::CollectFaces(), and ug::CollectVolumes().

◆ DeselectBoundarySelectionFaces()

template<class TSelector >
void ug::DeselectBoundarySelectionFaces ( TSelector &  sel)

deselects all faces that are connected to unselected elements.

TSelector either has to be of type Selector or MGSelector. Only elements of higher dimension are regarded.

References ug::CollectVolumes().

◆ DeselectBoundarySelectionVertices()

template<class TSelector >
void ug::DeselectBoundarySelectionVertices ( TSelector &  sel)

deselects all vertices that are connected to unselected elements.

TSelector either has to be of type Selector or MGSelector. Only elements of higher dimension are regarded.

References ug::Grid::associated_edges_begin(), ug::Grid::associated_edges_end(), ug::Grid::associated_faces_begin(), ug::Grid::associated_faces_end(), ug::Grid::associated_volumes_begin(), and ug::Grid::associated_volumes_end().

◆ EraseSelectedObjects()

template<class TSelector >
void ug::EraseSelectedObjects ( TSelector &  sel)

Erases selected objects from the associated grid.

TSelector has to either be of type Selector or MGSelector.

Referenced by ug::DistributeGrid(), and ug::AdaptiveRegularRefiner_MultiGrid::remove_closure_elements().

◆ ExtendSelection()

template<class TSelector >
UG_API void ug::ExtendSelection ( TSelector &  sel,
size_t  extSize,
ISelector::status_t  status = ISelector::SELECTED 
)

◆ ExtendSelectionInDirection()

template<class TSelector , class TAAPos >
UG_API void ug::ExtendSelectionInDirection ( TSelector &  sel,
size_t  extSize,
const typename TAAPos::ValueType &  dir,
number  minAngle,
number  maxAngle,
const TAAPos &  aaPos,
ISelector::status_t  status = ISelector::SELECTED 
)

extends the selection to neighbours of selected elements in the given direction.

This algorithm uses Grid::mark.

Extension is performed extSize times.

Only elements which can be reached in the given direction (centers are compared) are selected.

by setting minAngle to 0 and maxAngle to 10 you may e.g. extend only in roughly the given direction.

By setting minAngle to 89 and maxAngle to 91 you may e.g. extend only orthogonal to the given direction

Todo:
: Performance can be improved. See implementation.

References ug::Grid::associated_edges_begin(), ug::Grid::associated_edges_end(), ug::Grid::associated_faces_begin(), ug::Grid::associated_faces_end(), ug::Grid::associated_volumes_begin(), ug::Grid::associated_volumes_end(), ug::Grid::begin_marking(), ug::CheckDirection(), ug::Grid::end_marking(), ug::Grid::is_marked(), ug::Grid::mark(), ug::SelectAssociatedGridObjects(), and UG_LOG.

◆ FaceArea()

template<class TAAPosVRT >
UG_API number ug::FaceArea ( ISelector sel,
TAAPosVRT &  aaPos 
)

Returns the area sum of convex faces selected by ISelector sel

Parameters
selSelector
aaPosPosition attachment
Returns
area sum of convex faces

References ug::GridObjectCollection::begin(), ug::GridObjectCollection::end(), ug::FaceArea(), ug::ISelector::get_grid_objects(), ug::ISelector::grid(), ug::GridObjectCollection::num_levels(), and UG_WARNING.

◆ GetSelectedElementIndices() [1/2]

template<class elem_t >
void ug::GetSelectedElementIndices ( const ISelector sel,
std::vector< int > &  indsOut 
)

Returns indices of selected elements in ascending order.

Warning
this method has linear complexity and should be avoided unless required to exchange selection states with external programs or scripts.

◆ GetSelectedElementIndices() [2/2]

void ug::GetSelectedElementIndices ( const ISelector sel,
std::vector< size_t > &  vrtIndsOut,
std::vector< size_t > &  edgeIndsOut,
std::vector< size_t > &  faceIndsOut,
std::vector< size_t > &  volIndsOut 
)

Returns indices of selected elements in ascending order.

Warning
this method has linear complexity and should be avoided unless required to exchange selection states with external programs or scripts.

◆ InvertSelection() [1/2]

template<class TSelector >
void ug::InvertSelection ( TSelector &  sel)

Inverts the selection.

TSelector has to either be of type Selector or MGSelector.

References ug::Grid::begin(), and ug::Grid::end().

◆ InvertSelection() [2/2]

template<class TSelector , class TIterator >
void ug::InvertSelection ( TSelector &  sel,
TIterator  begin,
TIterator  end 
)

Inverts the selection of the elements between begin and end.

TSelector has to either be of type Selector or MGSelector.

◆ SelectAreaBoundary()

template<class TIter >
void ug::SelectAreaBoundary ( ISelector sel,
const TIter  begin,
const TIter  end 
)

selects sides that are only adjacent to one of the given inner elements

This algorithm uses Grid::mark. selects the sides of the elements between begin and end that are only adjacent to one of those elements.

Edges that already are selected will stay selected, even if they are inner edges.

Please note that only existing sides are checked.

References ug::Grid::begin_marking(), ug::CollectAssociated(), ug::ISelector::deselect(), ug::Grid::end_marking(), ug::ISelector::grid(), ug::Grid::is_marked(), ug::ISelector::is_selected(), ug::Grid::mark(), and ug::ISelector::select().

Referenced by ug::ExtrudeCylinder().

◆ SelectAssociated()

template<class TElem , class TIterator >
void ug::SelectAssociated ( ISelector sel,
TIterator  begin,
TIterator  end,
ISelector::status_t  status = ISelector::SELECTED 
)

Selects all elements of type TElem, which touch an element between begin and end.

To select all associated volumes of selected faces, call this method like this:

SelectAssociated<Volume>(sel, sel.begin<Face>, sel.end<Face>());

References ug::CollectAssociated(), ug::ISelector::grid(), and ug::ISelector::select().

◆ SelectAssociatedEdges()

template<class TSelector , class TElemIterator >
void ug::SelectAssociatedEdges ( TSelector &  sel,
TElemIterator  elemsBegin,
TElemIterator  elemsEnd,
ISelector::status_t  status = ISelector::SELECTED 
)

selects all associated edges of the elements between elemsBegin and elemsEnd

TSelector has to feature a method select(TElemIterator::value_type&);

TElemIterator has to be a stl-compatible iterator. The underlying element-type has to be a pointer to a class that is supported by libGrid::CollectEdges(...)

Valid classes are for example Face and Volume.

Make sure that the elements only reference edges that belong to the grid at which the selector is registered.

References ug::CollectEdges().

Referenced by ug::AdjustSubsetsForSimulation(), and ug::HangingNodeRefiner_MultiGrid::collect_objects_for_coarsen().

◆ SelectAssociatedFaces()

template<class TSelector , class TElemIterator >
void ug::SelectAssociatedFaces ( TSelector &  sel,
TElemIterator  elemsBegin,
TElemIterator  elemsEnd,
ISelector::status_t  status = ISelector::SELECTED 
)

selects all associated faces of the elements between elemsBegin and elemsEnd

TSelector has to feature a method select(TElemIterator::value_type&);

TElemIterator has to be a stl-compatible iterator. The underlying element-type has to be a pointer to a class that is supported by libGrid::CollectFaces(...)

A valid classe is for example Volume.

Make sure that the elements only reference faces that belong to the grid at which the selector is registered.

References ug::CollectFaces().

Referenced by ug::HangingNodeRefiner_MultiGrid::collect_objects_for_coarsen().

◆ SelectAssociatedGenealogy()

UG_API void ug::SelectAssociatedGenealogy ( MGSelector msel,
bool  selectAssociatedElements 
)

Selects the complete genealogy of all selected elements.

After the method returns the selection in msel is complete regarding the property that the parent of each selected element is selected, too.

If selectAssociatedElements is set to true, the selection will be complete regarding the property that for each selected element all elements of lower dimension are selected, too.

It is assumed that the given selector references a valid multi-grid. That means a grid whose elements only refence elements on the same level.

References ug::MGSelector::begin(), ug::MGSelector::edges_begin(), ug::MGSelector::edges_end(), ug::MGSelector::end(), ug::MGSelector::faces_begin(), ug::MGSelector::faces_end(), ug::MGSelector::multi_grid(), ug::MGSelector::num_levels(), SelectAssociatedEdges(), SelectAssociatedFaces(), SelectAssociatedVertices(), ug::SelectParents(), ug::MGSelector::vertices_begin(), ug::MGSelector::vertices_end(), ug::MGSelector::volumes_begin(), and ug::MGSelector::volumes_end().

◆ SelectAssociatedGridObjects()

◆ SelectAssociatedVertices()

template<class TSelector , class TElemIterator >
void ug::SelectAssociatedVertices ( TSelector &  sel,
TElemIterator  elemsBegin,
TElemIterator  elemsEnd,
ISelector::status_t  status = ISelector::SELECTED 
)

selects all associated vertices of the elements between elemsBegin and elemsEnd

TSelector has to feature a method select(TElemIterator::value_type&);

TElemIterator has to be a stl-compatible iterator. The underlying element-type has to be a pointer to a class that features the following methods:

Vertex* vertex(int i);//returns the i-th vertex of the element. uint num_vertices();//returns the number of vertices that the element holds.

Valid classes are for example Edge, Face and Volume.

Make sure that the elements only reference vertices that belong to the grid at which the selector is registered.

Referenced by ug::AdjustSubsetsForSimulation(), ug::HangingNodeRefiner_MultiGrid::collect_objects_for_coarsen(), and ug::ResolveTriangleIntersections().

◆ SelectAssociatedVolumes()

template<class TSelector , class TElemIterator >
void ug::SelectAssociatedVolumes ( TSelector &  sel,
TElemIterator  elemsBegin,
TElemIterator  elemsEnd,
ISelector::status_t  status = ISelector::SELECTED 
)

selects all associated faces of the elements between elemsBegin and elemsEnd

TSelector has to feature a method select(TElemIterator::value_type&);

TElemIterator has to be a stl-compatible iterator. The underlying element-type has to be a pointer to a class that is supported by libGrid::CollectFaces(...)

A valid classe is for example Volume.

Make sure that the elements only reference faces that belong to the grid at which the selector is registered.

◆ SelectBoundaryElements()

template<class TElemIterator >
void ug::SelectBoundaryElements ( ISelector sel,
TElemIterator  elemsBegin,
TElemIterator  elemsEnd 
)

selects elements that lie on the associated grid's boundary

References ug::ISelector::grid(), ug::LiesOnBoundary(), ug::ISelector::select(), and UG_ASSERT.

Referenced by ug::AdjustSubsetsForSimulation().

◆ SelectCreaseEdges()

template<class TEdgeIterator >
void ug::SelectCreaseEdges ( ISelector sel,
TEdgeIterator  edgesBegin,
TEdgeIterator  edgesEnd,
number  minAngle,
APosition  aVrtPos,
bool  ignoreBoundaryEdges = true,
ISelector::status_t  state = ISelector::SELECTED 
)

◆ SelectEdgesByDirection()

template<class TAAPos >
void ug::SelectEdgesByDirection ( Selector sel,
TAAPos &  aaPos,
const vector3 dir,
number  minDeviationAngle,
number  maxDeviationAngle,
bool  selectFlipped 
)

◆ SelectElementsByIndex() [1/2]

template<class elem_t >
void ug::SelectElementsByIndex ( ISelector sel,
const std::vector< size_t > &  inds 
)

Selects elements with the specified indices.

Warning
this method has linear complexity and should be avoided unless required to exchange selection states with external programs or scripts.

References ug::Grid::begin(), ug::Grid::end(), ug::ISelector::grid(), ug::Grid::num(), ug::ISelector::select(), and UG_COND_THROW.

◆ SelectElementsByIndex() [2/2]

void ug::SelectElementsByIndex ( ISelector sel,
const std::vector< size_t > &  vrtInds,
const std::vector< size_t > &  edgeInds,
const std::vector< size_t > &  faceInds,
const std::vector< size_t > &  volInds 
)

Selects elements with the specified indices.

Warning
this method has linear complexity and should be avoided unless required to exchange selection states with external programs or scripts.

References ug::SelectElementsByIndex< Edge >(), ug::SelectElementsByIndex< Face >(), ug::SelectElementsByIndex< Vertex >(), and ug::SelectElementsByIndex< Volume >().

◆ SelectInnerElements()

template<class TElemIterator >
void ug::SelectInnerElements ( ISelector sel,
TElemIterator  elemsBegin,
TElemIterator  elemsEnd 
)

selects elements that do not lie on the associated grid's boundary

References ug::ISelector::grid(), ug::LiesOnBoundary(), ug::ISelector::select(), and UG_ASSERT.

◆ SelectInnerSelectionEdges()

template<class TSelector >
void ug::SelectInnerSelectionEdges ( TSelector &  sel)

selects all edges that are only connected to selected elements.

This algorithm uses Grid::mark.

TSelector either has to be of type Selector or MGSelector. Only elements of higher dimension are regarded.

References ug::Grid::begin_marking(), ug::CollectEdges(), ug::CollectFaces(), ug::CollectVolumes(), ug::Grid::end_marking(), ug::Grid::is_marked(), and ug::Grid::mark().

Referenced by ug::ResolveTriangleIntersections().

◆ SelectInnerSelectionFaces()

template<class TSelector >
void ug::SelectInnerSelectionFaces ( TSelector &  sel)

selects all faces that are only connected to selected elements.

This algorithm uses Grid::mark.

TSelector either has to be of type Selector or MGSelector. Only elements of higher dimension are regarded.

References ug::Grid::begin_marking(), ug::CollectFaces(), ug::CollectVolumes(), ug::Grid::end_marking(), ug::Grid::is_marked(), and ug::Grid::mark().

◆ SelectInnerSelectionVertices()

◆ SelectInterfaceElements()

template<class TIter >
void ug::SelectInterfaceElements ( ISelector sel,
ISubsetHandler sh,
const TIter  begin,
const TIter  end,
bool  regardSelectedNbrsOnly = false 
)

Selects elements which are adjacent to higher dimensional elements of different subsets.

Please note, that this method does not select boundary segments. If regardSelectedNbrsOnly is set to true (default false), then only selected neighbors are checked for different interfaces.

References ug::CollectAssociated(), ug::ISubsetHandler::get_subset_index(), ug::ISelector::grid(), ug::ISelector::is_selected(), and ug::ISelector::select().

Referenced by ug::AdjustSubsetsForSimulation().

◆ SelectionFill()

template<class TGeomObj >
void ug::SelectionFill ( Selector sel,
typename Grid::traits< typename TGeomObj::side >::callback  cbRegionBoundary 
)

Extends the selection around selected objects until selected sides are reached.

Selects all elements of the given base-type which are reachable without traversing a bounding side. Whether a side is bounding can be specified through the cbRegionBoundary callback

  • Use e.g. IsSelected(sel) to indicate that all selected edges are region boundaries.
  • Use e.g. IsNotInSubset(sh, -1) to indicate, that all faces which are in a subset should be considered as region boundaryies.

Those callbacks are declared in lib_grid/algorithms/callback_util.h"

Valid types for TGeomBaseObj are Edge, Face and Volume.

References ug::Selector::begin(), ug::CollectAssociated(), ug::Selector::end(), ug::Grid::front(), ug::ISelector::grid(), ug::ISelector::is_selected(), ug::ISelector::select(), and UG_LOG.

◆ SelectLinkedElements()

template<class TElem >
void ug::SelectLinkedElements ( ISelector sel,
typename Grid::traits< TElem >::callback  cbIsSelectable = ConsiderAll(),
typename Grid::traits< typename TElem::side >::callback  cbIsTraversable = ConsiderAll() 
)

Repeatedly traverses sides of selected elements and selects associated elements.

The method extends the selection as long as it finds new candidates. Given a selected element, the method first checks the elements sides whether they may be traversed by calling cbIsTraversable on each. If a side may be traversed, cbIsSelectable is called on the adjacent unselected elements to the given side. If the callback returns true, the corresponding elements are selected and considered as new starting points for the search. By default all elements and all sides are considered to be selectable / traversable.

References ug::Grid::associated_elements(), ug::GridObjectCollection::begin(), ug::GridObjectCollection::end(), ug::ISelector::get_grid_objects(), ug::ISelector::grid(), ug::ISelector::is_selected(), ug::GridObjectCollection::num_levels(), ug::ISelector::select(), and ug::PointerConstArray< TPtr >::size().

◆ SelectLinkedFlatAndDegeneratedFaces()

UG_API void ug::SelectLinkedFlatAndDegeneratedFaces ( Selector sel,
number  maxDeviationAngle,
bool  ignoreOrientation = false,
bool  stopAtSelectedEdges = false,
number  degThreshold = SMALL,
APosition aPos = aPosition 
)

Extends the selection of faces to all neighbouring faces that have a similar normal.

In contrast to SelectLinkedFlatFaces this method also traverses degenerated faces over their non-degenerated sides.

Parameters
selSelector
maxDeviationAnglein degree. Maximal angle between normals of faces considered as flat.
ignoreOrientation(default false): If true, neighboured faces which have inverted orientation are traversed anyways.
aPosPosition attachment

References ug::aPosition, ug::Selector::begin(), ug::CalculateNormal(), ug::CollectAssociated(), ug::deg_to_rad(), ug::EdgeLengthSq(), ug::Selector::end(), ug::ISelector::grid(), ug::Grid::has_vertex_attachment(), ug::ISelector::is_selected(), ug::IsDegenerated(), ug::ISelector::select(), and ug::VecDot().

◆ SelectLinkedFlatFaces()

UG_API void ug::SelectLinkedFlatFaces ( Selector sel,
number  maxDeviationAngle,
bool  ignoreOrientation = false,
bool  stopAtSelectedEdges = false,
APosition aPos = aPosition 
)

Extends the selection of faces to all neighbouring faces that have a similar normal.

Parameters
selSelector
maxDeviationAnglein degree. Maximal angle between normals of faces considered as flat.
ignoreOrientation(default false): If true, neighboured faces which have inverted orientation are traversed anyways.
aPosPosition attachment

References ug::aPosition, ug::Selector::begin(), ug::CalculateNormal(), ug::CollectAssociated(), ug::deg_to_rad(), ug::Selector::end(), ug::ISelector::grid(), ug::Grid::has_vertex_attachment(), ug::ISelector::is_selected(), ug::ISelector::select(), and ug::VecDot().

◆ SelectRegion()

template<class TGeomObj , class TAAPos >
bool ug::SelectRegion ( Selector sel,
const typename TAAPos::ValueType &  p,
TAAPos &  aaPos,
typename Grid::traits< typename TGeomObj::side >::callback  cbRegionBoundary 
)

Selects the region which contains the given point.

Selects all elements of the given base-type which are reachable without traversing a bounding side. The method starts at the element which contains the given point.

Whether a side is bounding can be specified through the cbRegionBoundary callback

  • Use e.g. IsSelected(sel) to indicate that all selected sides are region boundaries.
  • Use e.g. IsNotInSubset(sh, -1) to indicate, that all sides which are in a subset should be considered as region boundaryies.

Those callbacks are declared in lib_grid/algorithms/callback_util.h"

The method tries to find the start element using a brute force approach with runtime O(n). If no element which contains the given point was found, the method returns false.

Valid types for TGeomBaseObj are Edge, Face and Volume.

References ug::Grid::begin(), ug::Selector::clear(), ug::ContainsPoint(), ug::Grid::end(), ug::ISelector::grid(), p, and ug::ISelector::select().

◆ SelectShortPolychains()

template<class TAAPos >
void ug::SelectShortPolychains ( ISelector sel,
number  maxLength,
bool  closedChainsOnly,
TAAPos  aaPos 
)

◆ SelectSmoothEdgePath()

UG_API void ug::SelectSmoothEdgePath ( Selector sel,
number  thresholdDegree,
number  normalWeight,
bool  stopAtSelVrts = true,
APosition aPos = aPosition 
)

selects for each selected edge all edges that can be reached by a smooth path.

Parameters
selSelector
thresholdDegreedefines the maximal degree at which the angle between two edges is regarded as smooth. Between 0 and 180.
normalWeightdefines how much the surrounding of an edge shall be taken into account when determining the path. 1: The surrounding is the most important feature 2: The direction of the edge is the most important feature ]0,1[: Gradually shifting between the both extreme settings
stopAtSelVrtsIf set to true, the edge-path will stop at selected vertices.
aPosPosition attachment
Todo:
: replace aPos by an template AttachmentAccessor TAAPosVrt.

References ug::Grid::associated_edges_begin(), ug::Grid::associated_edges_end(), ug::Selector::begin(), ug::CalculateNormal(), ug::deg_to_rad(), ug::Grid::enable_options(), ug::Selector::end(), ug::GetConnectedVertex(), ug::ISelector::grid(), ug::Grid::has_vertex_attachment(), ug::ISelector::is_selected(), ug::Grid::option_is_enabled(), ug::ISelector::select(), UG_LOG, ug::VecDot(), ug::VecNormalize(), ug::VecSubtract(), and ug::VRTOPT_STORE_ASSOCIATED_EDGES.

◆ SelectSubset()

void ug::SelectSubset ( ISelector sel,
const ISubsetHandler sh,
int  si,
ISelector::status_t  status 
)

Select all elements specified by a subset index ans selection status.

Parameters
[in,out]sel
[in]sh
[in]si
[in]status

References ug::GridObjectCollection::begin(), ug::GridObjectCollection::end(), ug::ISubsetHandler::get_grid_objects_in_subset(), ug::GridObjectCollection::num_levels(), and ug::ISelector::select().

◆ SelectSubsetEdgesByDirection()

template<class TAAPos >
void ug::SelectSubsetEdgesByDirection ( Selector sel,
SubsetHandler sh,
int  subsetIndex,
TAAPos &  aaPos,
const vector3 dir,
number  minDeviationAngle,
number  maxDeviationAngle,
bool  selectFlipped 
)

◆ SelectSubsetElements()

template<class TElem >
void ug::SelectSubsetElements ( ISelector sel,
ISubsetHandler sh,
int  subsetIndex,
ISelector::status_t  status = ISelector::SELECTED 
)

selects all elements of the given type in the given subset

If you want to deselect elements, pass ISelector::DESELECT to the status argument.

References ug::GridObjectCollection::begin(), ug::GridObjectCollection::end(), ug::ISubsetHandler::get_grid_objects_in_subset(), ug::GridObjectCollection::num_levels(), and ug::ISelector::select().

◆ TranslateSelection()

template<class TAAPosVRT >
void ug::TranslateSelection ( Selector sel,
const typename TAAPosVRT::ValueType &  offset,
TAAPosVRT &  aaPos 
)