Define a subset of intervals#

template<class F, class ...CT>
class subset_operator#

Define a subset of a set of intervals.

Template Parameters:
  • F – the function type (intersection, union, difference,…)

  • CT – the closure types for arguments of the function

Public Functions

inline subset_operator(F &&f, CT&&... e)#

Construct a subset from an algebra of sets.

Parameters:
  • f – function to apply on the sets (intersection, union, difference, …)

  • e – list of sets apply by f

inline auto on(std::size_t ref_level) const#

Specify the reference level where each set must be compared.

Parameters:

ref_level – the reference level

template<class Func>
inline void operator()(Func &&func)#

Apply a function on the subset.

Parameters:

func – function to apply on each element of the subset

template<class Func>
inline void apply_interval_index(Func &&func)#

Apply a function on the subset.

Parameters:

func – function to apply on each element of the subset

template<class ...Op>
inline void apply_op(Op&&... op)#

Apply one or more operators on the subset.

See also

operator

Parameters:

op – operator to apply on each element of the subset

inline void reset()#

Reset the algorithm to find the subset on each node.

inline void init(std::size_t ref_level)#

Initialize the subset by defining the reference level and the shift to be performed by each node of the subset to obtain the reference level.

Parameters:

ref_level – the reference level

inline bool eval(coord_index_t scan, std::size_t d) const#

Evaluate if the value scan is in the subset.

Parameters:
  • scan – the value to evaluate

  • dim – the current dimension

inline void update(coord_index_t scan, coord_index_t sentinel)#

Update the value of each node of the subset.

Parameters:
  • scan – the current state

  • sentinel – the end value of the algorithm

inline void increment_dim()#

Increment by 1 the current dimension.

inline void decrement_dim(coord_index_t i)#

Initialize the next dimension with the interval found for the current dimension.

Parameters:

i – the current value found for the current dimension

inline void set_shift(std::size_t ref_level, std::size_t common_level)#

Initialize the shift for each node which is computed by the difference between the reference level and the level of each node.

inline coord_index_t min() const#

Return the minimum value of the current values of each node of the subset.

inline coord_index_t max() const#

Return the maximum value of the current values of each node of the subset.

inline std::size_t common_level() const#

Return the common level of the subset which is the maximum level of all nodes.

inline std::size_t level() const#

Return the level of the resulting subset.

inline bool is_empty() const#

Check if the subset is empty.

For example:

  • the difference between an empty set and other sets is empty

  • the intersection of an empty set and other sets is empty

Private Functions

template<class Func, std::size_t d>
inline void sub_apply(Func &&func, std::integral_constant<std::size_t, d>)#

Apply the algorithm to find the subset on the dimension d - 1 given a matching interval for the dimension d.

Parameters:

func – function to apply on the subset at the end

template<class Func>
inline void sub_apply(Func &&func, std::integral_constant<std::size_t, 0>)#

Apply the function on the dimension 0 for the matching interval.

Parameters:

func – function to apply on the subset at the end

template<class Func, std::size_t d>
inline void apply(Func &&func, std::integral_constant<std::size_t, d>)#

Core algorithm to find the subset.

Parameters:

func – function to apply on the subset at the end if it exists

Private Members

tuple_type m_e#

The sets of the function defining the subset.

functor_type m_functor#

The function defining the subset (intersection, difference, union, …)

std::size_t m_ref_level = 0#

The level where we want a result if it exists.

xt::xtensor_fixed<coord_index_t, xt::xshape<dim - 1>> m_index_yz#

Storage of the current value in each dimension greater than 0.

xt::xtensor_fixed<interval_t, xt::xshape<dim>> m_result#

Intervals found for each dimension.