6#ifndef CALLBACK_UTILS_SELECT_HPP
7#define CALLBACK_UTILS_SELECT_HPP
30 template<
typename AFields>
35 static constexpr size_t buf_size = 64UL;
36 size_t N_selects = 0UL;
37 std::pair<
void *, std::function<bool(
void *,
const GrpProperties &)>> selectors[buf_size];
39 void register_select (
void *obj, std::function<
bool(
void *,
const GrpProperties &)> fct)
41 selectors[N_selects++] = std::make_pair(obj, fct);
42 assert(N_selects < buf_size);
45 bool grp_select (
const GrpProperties &grp)
const override final
47 for (
size_t ii=0; ii != N_selects; ++ii)
48 if (!selectors[ii].second(selectors[ii].first, grp))
62 template<
typename AFields,
typename Child>
68 static bool this_grp_select_static (
void *obj,
const GrpProperties &grp)
70 Child *p = (Child *)obj;
71 return p->this_grp_select(grp);
89 template<
typename AFields,
typename Field>
92 private MultiSelect<AFields, Window<AFields, Field>>
96 static_assert(Field::dim == 1);
98 static_assert(std::is_floating_point_v<typename Field::value_type>);
100 typename Field::value_type min_val, max_val;
102 bool this_grp_select (
const GrpProperties &grp)
const override final
104 auto x = grp.template get<Field>();
105 return x > min_val && x < max_val;
111 Window (
typename Field::value_type min_val_,
typename Field::value_type max_val_) :
112 min_val { min_val_ }, max_val { max_val_ }
120 template<
typename AFields,
typename Field>
123 private Window<AFields, Field>
128 Window<AFields, Field> { min_val, std::numeric_limits<typename Field::value_type>::max() } { }
135 template<
typename AFields,
typename Field>
138 private Window<AFields, Field>
143 Window<AFields, Field> { std::numeric_limits<typename Field::value_type>::min(), max_val } { }
Contains the abstract base class that the user should subclass from in order to define the desired fu...
Specialization of the Callback::BaseProperties type to groups.
Definition callback.hpp:85
base class to apply multiple selection functions in Callback::grp_select.
Definition callback_utils_select.hpp:33
interface class to include a selection function in Callback::grp_select.
Definition callback_utils_select.hpp:66
virtual bool this_grp_select(const GrpProperties &grp) const =0
select only groups that have some 1-dimensional property fall into an interval.
Definition callback_utils_select.hpp:93
Window(typename Field::value_type min_val_, typename Field::value_type max_val_)
Definition callback_utils_select.hpp:111
contains classes that implement parts of the Callback base.
Definition callback_utils.hpp:35
The abstract base class the user should inherit from.
Definition callback.hpp:32
select only groups that have some 1-dimensional property below a certain value.
Definition callback_utils_select.hpp:139
HighCutoff(typename Field::value_type max_val)
Definition callback_utils_select.hpp:142
select only groups that have some 1-dimensional property above a certain value.
Definition callback_utils_select.hpp:124
LowCutoff(typename Field::value_type min_val)
Definition callback_utils_select.hpp:127