Actions.hpp
1 // Distributed under the MIT License.
2 // See LICENSE.txt for details.
3 
4 #pragma once
5 
6 #include <tuple>
7 
10 #include "Evolution/VariableFixing/Tags.hpp"
12 #include "Utilities/Requires.hpp"
13 #include "Utilities/TMPL.hpp"
14 
15 /// \cond
16 namespace tuples {
17 template <typename...>
18 class TaggedTuple;
19 } // namespace tuples
20 /// \endcond
21 
22 namespace VariableFixing {
23 namespace Actions {
24 /// \ingroup ActionsGroup
25 /// \ingroup VariableFixingGroup
26 /// \brief Adjust variables with a variable fixer.
27 ///
28 /// Typically this action is called to adjust either conservative or primitive
29 /// variables when they violate physical constraints. See the individual
30 /// variable fixers in the VariableFixing namespace for more details.
31 ///
32 /// Uses:
33 /// - DataBox:
34 /// - Metavariables::variable_fixer::argument_tags
35 /// - ConstGlobalCache:
36 /// - Metavariables::variable_fixer
37 ///
38 /// DataBox changes:
39 /// - Adds: nothing
40 /// - Removes: nothing
41 /// - Modifies: Metavariables::variable_fixer::return_tags
42 template <typename VariableFixer>
43 struct FixVariables {
44  using const_global_cache_tags =
45  tmpl::list<OptionTags::VariableFixerParams<VariableFixer>>;
46 
47  template <typename DbTagsList, typename... InboxTags, typename Metavariables,
48  typename ArrayIndex, typename ActionList,
49  typename ParallelComponent,
55  const ArrayIndex& /*array_index*/, const ActionList /*meta*/,
56  const ParallelComponent* const /*meta*/) noexcept {
57  const auto& variable_fixer =
58  get<OptionTags::VariableFixerParams<VariableFixer>>(cache);
59  db::mutate_apply<typename VariableFixer::return_tags,
60  typename VariableFixer::argument_tags>(
61  variable_fixer, make_not_null(&box));
62  return std::forward_as_tuple(std::move(box));
63  }
64 };
65 } // namespace Actions
66 } // namespace VariableFixing
constexpr auto mutate_apply(F f, const gsl::not_null< DataBox< BoxTags > *> box, Args &&... args) noexcept(DataBox_detail::check_mutate_apply_mutate_tags(BoxTags{}, MutateTags{}) and DataBox_detail::check_mutate_apply_argument_tags(BoxTags{}, ArgumentTags{}) and noexcept(DataBox_detail::mutate_apply(f, box, MutateTags{}, ArgumentTags{}, std::forward< Args >(args)...)))
Apply the function f mutating items MutateTags and taking as additional arguments ArgumentTags and ar...
Definition: DataBox.hpp:1773
Definition: TaggedTuple.hpp:25
Adjust variables with a variable fixer.
Definition: Actions.hpp:43
Defines the type alias Requires.
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
An associative container that is indexed by structs.
Definition: TaggedTuple.hpp:272
Defines classes and functions used for manipulating DataBox&#39;s.
Contains all variable fixers.
Definition: FixConservatives.cpp:55
Definition: InterpolationTargetWedgeSectionTorus.hpp:24
A Charm++ chare that caches constant data once per Charm++ node.
Definition: ConstGlobalCache.hpp:76
Wraps the template metaprogramming library used (brigand)
gsl::not_null< T * > make_not_null(T *ptr) noexcept
Construct a not_null from a pointer. Often this will be done as an implicit conversion, but it may be necessary to perform the conversion explicitly when type deduction is desired.
Definition: Gsl.hpp:863
typename Requires_detail::requires_impl< B >::template_error_type_failed_to_meet_requirements_on_template_parameters Requires
Express requirements on the template parameters of a function or class, replaces std::enable_if_t ...
Definition: Requires.hpp:67
Definition: SolvePoissonProblem.hpp:38
Defines classes SimpleTag, PrefixTag, ComputeTag and several functions for retrieving tag info...
Defines class template ConstGlobalCache.
Definition: ComputeTimeDerivative.hpp:28