7#ifndef CALLBACK_UTILS_GRP_ACTION_HPP
8#define CALLBACK_UTILS_GRP_ACTION_HPP
29 template<
typename AFields>
35 static constexpr size_t buf_size = 64UL;
36 size_t N_actions = 0UL;
37 std::pair<
void *, std::function<void(
void *,
const GrpProperties &)>> grp_actions[buf_size];
39 void register_fct (
void *obj, std::function<
void(
void *,
const GrpProperties &)> fct)
41 grp_actions[N_actions++] = std::make_pair(obj, fct);
42 assert(N_actions < buf_size);
47 for (
size_t ii=0; ii != N_actions; ++ii)
48 grp_actions[ii].second(grp_actions[ii].first, grp);
60 template<
typename AFields,
typename Child>
66 static void this_grp_action_static (
void *obj,
const GrpProperties &grp)
68 Child *p = (Child *)obj;
69 p->this_grp_action(grp);
87 template<
typename AFields,
typename Tdata>
90 private MultiGrpAction<AFields, StoreGrpHomogeneous<AFields, Tdata>>
94 std::vector<Tdata> &data;
95 void this_grp_action (
const GrpProperties &grp)
override final
122 template<
typename AFields,
typename Field,
typename storeasT =
typename Field::value_type>
127 static_assert(Field::dim == 1,
"Currently not implemented, could probably be done");
128 static_assert(std::is_arithmetic_v<storeasT>);
131 return grp.template get<Field>();
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 have multiple actions performed in Callback::grp_action
Definition callback_utils_grp_action.hpp:32
interface class to add an action to be performed during Callback::grp_action
Definition callback_utils_grp_action.hpp:64
virtual void this_grp_action(const GrpProperties &grp)=0
implements the common case of storing a data item of identical type for each group.
Definition callback_utils_grp_action.hpp:91
StoreGrpHomogeneous(std::vector< Tdata > &data_)
Definition callback_utils_grp_action.hpp:110
virtual Tdata grp_reduce(const GrpProperties &grp) const =0
implements the common case of storing a single group property for each group.
Definition callback_utils_grp_action.hpp:126
StoreGrpProperty(std::vector< storeasT > &data)
Definition callback_utils_grp_action.hpp:136
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