AlgorithmMetafunctions.hpp
1 // Distributed under the MIT License.
2 // See LICENSE.txt for details.
3 
4 #pragma once
5 
6 #include <utility> // for declval
7 
8 #include "Utilities/TMPL.hpp"
10 
11 namespace Parallel {
12 namespace Algorithm_detail {
13 template <bool, typename AdditionalArgsList>
14 struct build_action_return_types_impl;
15 
16 template <typename... AdditionalArgs>
17 struct build_action_return_types_impl<false, tmpl::list<AdditionalArgs...>> {
18  template <typename LastReturnType, typename ReturnTypeList>
19  using f = tmpl::push_back<ReturnTypeList, LastReturnType>;
20 };
21 
22 template <typename... AdditionalArgs>
23 struct build_action_return_types_impl<true, tmpl::list<AdditionalArgs...>> {
24  template <typename LastReturnType, typename ReturnTypeList, typename Action,
25  typename... Actions>
26  using f = typename build_action_return_types_impl<
27  sizeof...(Actions) != 0, tmpl::list<AdditionalArgs...>>::
28  template f<
29  std::decay_t<std::tuple_element_t<
30  0,
31  std::decay_t<decltype(Action::apply(
33  std::declval<
35  tmpl::push_back<ReturnTypeList, LastReturnType>, Actions...>;
36 };
37 
38 /*!
39  * \ingroup ParallelGroup
40  * \brief Returns a typelist of the return types of all Actions in ActionList
41  *
42  * \metareturns
43  * typelist
44  *
45  * \tparam ActionsPack parameter pack of Actions taken
46  * \tparam FirstInputParameterType the type of the first argument of the first
47  * Action in the ActionsPack
48  * \tparam AdditionalArgsList the types of the arguments after the first
49  * argument, which must all be the same for all Actions in the ActionsPack
50  */
51 template <typename FirstInputParameterType, typename AdditionalArgsList,
52  typename... ActionsPack>
53 using build_action_return_typelist =
54  typename Algorithm_detail::build_action_return_types_impl<
55  sizeof...(ActionsPack) != 0, AdditionalArgsList>::
56  template f<FirstInputParameterType, tmpl::list<>, ActionsPack...>;
57 
58 CREATE_IS_CALLABLE(is_ready)
59 
61 } // namespace Algorithm_detail
62 } // namespace Parallel
#define CREATE_IS_CALLABLE(METHOD_NAME)
Generate a type trait to check if a class has a member function that can be invoked with arguments of...
Definition: TypeTraits.hpp:870
Definition: Digraph.hpp:11
Contains functions that forward to Charm++ parallel functions.
Definition: Abort.hpp:13
constexpr auto apply(F &&f, const DataBox< BoxTags > &box, Args &&... args)
Apply the function f with argument Tags TagsList from DataBox box
Definition: DataBox.hpp:1595
Wraps the template metaprogramming library used (brigand)
Defines type traits, some of which are future STL type_traits header.
Definition: ComputeTimeDerivative.hpp:28