Developer Documentation
OpenMesh::SmartRangeT< RangeT, HandleT > Struct Template Reference

Base class for all smart range types. More...

#include <OpenFlipper/libs_required/OpenMesh/src/OpenMesh/Core/Mesh/SmartRange.hh>

Public Types

using Handle = HandleT
 
using SmartRange = SmartRangeT< RangeT, HandleT >
 
using Range = RangeT
 

Public Member Functions

template<typename Functor >
auto sum (Functor &&f) -> typename std::decay< decltype(f(std::declval< HandleT >()))>::type
 Computes the sum of elements. More...
 
template<typename Functor >
auto avg (Functor &&f) -> typename std::decay< decltype(f(std::declval< HandleT >()))>::type
 Computes the average of elements. More...
 
template<typename Functor , typename WeightFunctor >
auto avg (Functor &&f, WeightFunctor &&w) -> typename std::decay< decltype((1.0/(w(std::declval< HandleT >())+w(std::declval< HandleT >()))) *f(std::declval< HandleT >()))>::type
 Computes the weighted average of elements. More...
 
template<typename Functor >
auto any_of (Functor &&f) -> bool
 Check if any element fulfils condition. More...
 
template<typename Functor >
auto all_of (Functor &&f) -> bool
 Check if all elements fulfil condition. More...
 
template<int n, typename Functor = Identity>
auto to_array (Functor &&f={}) -> std::array< typename std::decay< decltype(f(std::declval< HandleT >()))>::type, n >
 Convert range to array. More...
 
template<typename Functor = Identity>
auto to_vector (Functor &&f={}) -> std::vector< typename std::decay< decltype(f(std::declval< HandleT >()))>::type >
 Convert range to vector. More...
 
template<typename Functor = Identity>
auto to_set (Functor &&f={}) -> std::set< typename std::decay< decltype(f(std::declval< HandleT >()))>::type >
 Convert range to set. More...
 
template<typename Functor >
auto first (Functor &&f={}) -> HandleT
 Get the first element that fulfills a condition. More...
 
template<typename Functor >
auto min (Functor &&f) -> typename std::decay< decltype(f(std::declval< HandleT >()))>::type
 Compute minimum. More...
 
template<typename Functor >
auto argmin (Functor &&f) -> HandleT
 Compute minimal element. More...
 
template<typename Functor >
auto max (Functor &&f) -> typename std::decay< decltype(f(std::declval< HandleT >()))>::type
 Compute maximum. More...
 
template<typename Functor >
auto argmax (Functor &&f) -> HandleT
 Compute maximal element. More...
 
template<typename Functor >
auto minmax (Functor &&f) -> std::pair< typename std::decay< decltype(f(std::declval< HandleT >()))>::type, typename std::decay< decltype(f(std::declval< HandleT >()))>::type >
 Computes minimum and maximum. More...
 
template<typename Functor >
auto count_if (Functor &&f) -> int
 Compute number of elements that satisfy a given predicate. More...
 
template<typename Functor >
auto for_each (Functor &&f) -> void
 Apply a functor to each element. More...
 
template<typename Functor >
auto filtered (Functor &&f) -> FilteredSmartRangeT< SmartRange, Handle, Functor >
 Only iterate over a subset of elements. More...
 

Detailed Description

template<typename RangeT, typename HandleT>
struct OpenMesh::SmartRangeT< RangeT, HandleT >

Base class for all smart range types.

Definition at line 73 of file SmartRange.hh.

Member Function Documentation

◆ all_of()

template<typename RangeT, typename HandleT>
template<typename Functor >
auto OpenMesh::SmartRangeT< RangeT, HandleT >::all_of ( Functor &&  f) -> bool
inline

Check if all elements fulfil condition.

Checks if functor f returns true for all of the elements in the range. Returns true if that is the case, false otherwise.

Parameters
fFunctor that is evaluated for all elements.

Definition at line 180 of file SmartRange.hh.

◆ any_of()

template<typename RangeT, typename HandleT>
template<typename Functor >
auto OpenMesh::SmartRangeT< RangeT, HandleT >::any_of ( Functor &&  f) -> bool
inline

Check if any element fulfils condition.

Checks if functor f returns true for any of the elements in the range. Returns true if that is the case, false otherwise.

Parameters
fFunctor that is evaluated for all elements.

Definition at line 163 of file SmartRange.hh.

◆ argmax()

template<typename RangeT, typename HandleT>
template<typename Functor >
auto OpenMesh::SmartRangeT< RangeT, HandleT >::argmax ( Functor &&  f) -> HandleT
inline

Compute maximal element.

Computes the element that maximizes f.

Parameters
fFunctor that is applied to all elements before comparing.

Definition at line 352 of file SmartRange.hh.

◆ argmin()

template<typename RangeT, typename HandleT>
template<typename Functor >
auto OpenMesh::SmartRangeT< RangeT, HandleT >::argmin ( Functor &&  f) -> HandleT
inline

Compute minimal element.

Computes the element that minimizes f.

Parameters
fFunctor that is applied to all elements before comparing.

Definition at line 295 of file SmartRange.hh.

◆ avg() [1/2]

template<typename RangeT, typename HandleT>
template<typename Functor >
auto OpenMesh::SmartRangeT< RangeT, HandleT >::avg ( Functor &&  f) -> typename std::decay<decltype (f(std::declval<HandleT>()))>::type
inline

Computes the average of elements.

Computes the average of all elements in the range after applying the functor f.

Parameters
fFunctor that is applied to all elements before computing the average.

Definition at line 109 of file SmartRange.hh.

◆ avg() [2/2]

template<typename RangeT, typename HandleT>
template<typename Functor , typename WeightFunctor >
auto OpenMesh::SmartRangeT< RangeT, HandleT >::avg ( Functor &&  f,
WeightFunctor &&  w 
) -> typename std::decay<decltype ((1.0/(w(std::declval<HandleT>())+w(std::declval<HandleT>())))*f(std::declval<HandleT>()))>::type
inline

Computes the weighted average of elements.

Computes the weighted average of all elements in the range after applying the functor f.

Parameters
fFunctor that is applied to all elements before computing the average.
wFunctor returning element weight.

Definition at line 135 of file SmartRange.hh.

◆ count_if()

template<typename RangeT, typename HandleT>
template<typename Functor >
auto OpenMesh::SmartRangeT< RangeT, HandleT >::count_if ( Functor &&  f) -> int
inline

Compute number of elements that satisfy a given predicate.

Computes the numer of elements which satisfy functor f.

Parameters
fPredicate that elements have to satisfy in order to be counted.

Definition at line 398 of file SmartRange.hh.

◆ filtered()

template<typename RangeT, typename HandleT>
template<typename Functor >
auto OpenMesh::SmartRangeT< RangeT, HandleT >::filtered ( Functor &&  f) -> FilteredSmartRangeT<SmartRange, Handle, Functor>
inline

Only iterate over a subset of elements.

Returns a smart range which skips all elements that do not satisfy functor f

Parameters
fFunctor that needs to be evaluated to true if the element should not be skipped.

Definition at line 431 of file SmartRange.hh.

◆ first()

template<typename RangeT, typename HandleT>
template<typename Functor >
auto OpenMesh::SmartRangeT< RangeT, HandleT >::first ( Functor &&  f = {}) -> HandleT
inline

Get the first element that fulfills a condition.

Finds the first element of the range for which the functor f evaluates to true. Returns an invalid handle if none evaluates to true

Parameters
fFunctor that is applied to all elements before putting them into the set. If no functor is provided the set will contain the handles.

Definition at line 254 of file SmartRange.hh.

◆ for_each()

template<typename RangeT, typename HandleT>
template<typename Functor >
auto OpenMesh::SmartRangeT< RangeT, HandleT >::for_each ( Functor &&  f) -> void
inline

Apply a functor to each element.

Calls functor f with each element as parameter

Parameters
fFunctor that is called for each element.

Definition at line 416 of file SmartRange.hh.

◆ max()

template<typename RangeT, typename HandleT>
template<typename Functor >
auto OpenMesh::SmartRangeT< RangeT, HandleT >::max ( Functor &&  f) -> typename std::decay<decltype (f(std::declval<HandleT>()))>::type
inline

Compute maximum.

Computes the maximum of all objects returned by functor f.

Parameters
fFunctor that is applied to all elements before computing maximum.

Definition at line 326 of file SmartRange.hh.

◆ min()

template<typename RangeT, typename HandleT>
template<typename Functor >
auto OpenMesh::SmartRangeT< RangeT, HandleT >::min ( Functor &&  f) -> typename std::decay<decltype (f(std::declval<HandleT>()))>::type
inline

Compute minimum.

Computes the minimum of all objects returned by functor f.

Parameters
fFunctor that is applied to all elements before computing minimum.

Definition at line 270 of file SmartRange.hh.

◆ minmax()

template<typename RangeT, typename HandleT>
template<typename Functor >
auto OpenMesh::SmartRangeT< RangeT, HandleT >::minmax ( Functor &&  f) -> std::pair<typename std::decay<decltype (f(std::declval<HandleT>()))>::type, typename std::decay<decltype (f(std::declval<HandleT>()))>::type>
inline

Computes minimum and maximum.

Computes the minimum and maximum of all objects returned by functor f. Result is returned as std::pair containing minimum as first and maximum as second element.

Parameters
fFunctor that is applied to all elements before computing maximum.

Definition at line 384 of file SmartRange.hh.

◆ sum()

template<typename RangeT, typename HandleT>
template<typename Functor >
auto OpenMesh::SmartRangeT< RangeT, HandleT >::sum ( Functor &&  f) -> typename std::decay<decltype (f(std::declval<HandleT>()))>::type
inline

Computes the sum of elements.

Computes the sum of all elements in the range after applying the functor f.

Parameters
fFunctor that is applied to all elements before computing the sum

Definition at line 88 of file SmartRange.hh.

◆ to_array()

template<typename RangeT, typename HandleT>
template<int n, typename Functor = Identity>
auto OpenMesh::SmartRangeT< RangeT, HandleT >::to_array ( Functor &&  f = {}) -> std::array<typename std::decay<decltype (f(std::declval<HandleT>()))>::type, n>
inline

Convert range to array.

Converts the range of elements into an array of objects returned by functor f. The size of the array needs to be provided by the user. If the size is larger than the number of elements in the range, the remaining entries of the array will be uninitialized.

Parameters
fFunctor that is applied to all elements before putting them into the array. If no functor is provided the array will contain the handles.

Definition at line 199 of file SmartRange.hh.

◆ to_set()

template<typename RangeT, typename HandleT>
template<typename Functor = Identity>
auto OpenMesh::SmartRangeT< RangeT, HandleT >::to_set ( Functor &&  f = {}) -> std::set<typename std::decay<decltype (f(std::declval<HandleT>()))>::type>
inline

Convert range to set.

Converts the range of elements into a set of objects returned by functor f.

Parameters
fFunctor that is applied to all elements before putting them into the set. If no functor is provided the set will contain the handles.

Definition at line 236 of file SmartRange.hh.

◆ to_vector()

template<typename RangeT, typename HandleT>
template<typename Functor = Identity>
auto OpenMesh::SmartRangeT< RangeT, HandleT >::to_vector ( Functor &&  f = {}) -> std::vector<typename std::decay<decltype (f(std::declval<HandleT>()))>::type>
inline

Convert range to vector.

Converts the range of elements into a vector of objects returned by functor f.

Parameters
fFunctor that is applied to all elements before putting them into the vector. If no functor is provided the vector will contain the handles.

Definition at line 219 of file SmartRange.hh.


The documentation for this struct was generated from the following file: