7#ifndef CALLBACK_UTILS_PRT_ACTION_HPP
8#define CALLBACK_UTILS_PRT_ACTION_HPP
34 template<
typename AFields,
typename Tdata>
47 template<
typename,
typename T>
48 struct has_prt_insert {
static_assert(std::integral_constant<T, false>::value); };
50 template<
typename C,
typename Ret,
typename... Args>
51 class has_prt_insert<C, Ret(Args...)>
54 static constexpr auto check (T *)
55 ->
typename std::is_same<
56 decltype(std::declval<T>().prt_insert(std::declval<Args>()...)),
61 static constexpr std::false_type check(...);
63 using type =
decltype(check<C>(0));
65 static constexpr bool value = type::value;
69 std::vector<Tdata> &data;
71 void this_grp_action (
const GrpProperties &grp)
override final
73 if constexpr (std::is_constructible_v<Tdata, const GrpProperties &>)
75 static_assert(!std::is_default_constructible_v<Tdata>);
76 data.emplace_back(grp);
110 assert((
"Need to override CallbackUtils::StorePrtHomogeneous<AFields,Tdata>::prt_insert if Tdata does not implement prt_insert method.",
false));
125 void prt_action (
size_t grp_idx,
const GrpProperties &grp,
126 const PrtProperties &prt,
coord_t Rsq)
override final
128 if constexpr (has_prt_insert<Tdata, void(
size_t,
const GrpProperties &,
129 const PrtProperties &,
coord_t)>::value)
130 data[grp_idx].
prt_insert(grp_idx, grp, prt, Rsq);
132 prt_insert(grp_idx, grp, prt, Rsq, data[grp_idx]);
Contains the abstract base class that the user should subclass from in order to define the desired fu...
Some common ways to override Callback::grp_action.
Specialization of the Callback::BaseProperties type to groups.
Definition callback.hpp:85
interface class to add an action to be performed during Callback::grp_action
Definition callback_utils_grp_action.hpp:64
implements the common case that each group gets an item of identical type into which the particles be...
Definition callback_utils_prt_action.hpp:38
StorePrtHomogeneous(std::vector< Tdata > &data_)
Definition callback_utils_prt_action.hpp:121
virtual void prt_insert(size_t grp_idx, const GrpProperties &grp, const PrtProperties &prt, coord_t Rsq, Tdata &data_item)
Definition callback_utils_prt_action.hpp:106
float coord_t
Internal coordinate type.
Definition fields.hpp:28
contains classes that implement parts of the Callback base.
Definition callback_utils.hpp:35
Specialization of the Callback::BaseProperties type to particles.
Definition callback.hpp:95
The abstract base class the user should inherit from.
Definition callback.hpp:32