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"
11 #include "Parallel/GlobalCache.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 /// - GlobalCache:
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<Tags::VariableFixer<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 = get<Tags::VariableFixer<VariableFixer>>(cache);
58  db::mutate_apply(variable_fixer, make_not_null(&box));
59  return std::forward_as_tuple(std::move(box));
60  }
61 };
62 } // namespace Actions
63 } // namespace VariableFixing
DataBoxTag.hpp
Parallel::GlobalCache
Definition: ElementReceiveInterpPoints.hpp:16
GlobalCache.hpp
VariableFixing::Actions::FixVariables
Adjust variables with a variable fixer.
Definition: Actions.hpp:43
tuple
db::apply
constexpr auto apply(F &&f, const DataBox< BoxTags > &box, Args &&... args) noexcept
Apply the invokable f with argument Tags TagsList from DataBox box
Definition: DataBox.hpp:1424
DataBox.hpp
db::mutate_apply
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 invokable f mutating items MutateTags and taking as additional arguments ArgumentTags and a...
Definition: DataBox.hpp:1640
tuples::TaggedTuple
An associative container that is indexed by structs.
Definition: TaggedTuple.hpp:271
Requires.hpp
make_not_null
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,...
Definition: Gsl.hpp:880
Requires
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
VariableFixing
Contains all variable fixers.
Definition: Actions.hpp:22
db::DataBox
Definition: InterpolationTargetWedgeSectionTorus.hpp:24
TMPL.hpp