FinalTime.hpp
Go to the documentation of this file.
1 // Distributed under the MIT License.
2 // See LICENSE.txt for details.
3 
4 /// \file
5 /// Defines action FinalTime
6 
7 #pragma once
8 
9 #include <tuple>
10 
13 #include "Time/EvolutionOrdering.hpp"
14 #include "Time/Time.hpp"
15 #include "Utilities/TMPL.hpp"
17 
18 /// \cond
19 namespace OptionTags {
20 struct FinalTime;
21 } // namespace OptionTags
22 namespace Tags {
23 struct Time;
24 struct TimeId;
25 } // namespace Tags
26 // IWYU pragma: no_forward_declare db::DataBox
27 /// \endcond
28 
29 namespace Actions {
30 /// \ingroup ActionsGroup
31 /// \ingroup TimeGroup
32 /// \brief Terminate after reaching a specified time
33 ///
34 /// Uses:
35 /// - ConstGlobalCache: OptionTags::FinalTime
36 /// - DataBox: Tags::Time, Tags::TimeId
37 ///
38 /// DataBox changes:
39 /// - Adds: nothing
40 /// - Removes: nothing
41 /// - Modifies: nothing
42 struct FinalTime {
43  using const_global_cache_tags = tmpl::list<OptionTags::FinalTime>;
44 
45  template <typename DbTags, typename... InboxTags, typename Metavariables,
46  typename ArrayIndex, typename ActionList,
47  typename ParallelComponent>
48  static std::tuple<db::DataBox<DbTags>&&, bool> apply(
51  const ArrayIndex& /*array_index*/, const ActionList /*meta*/,
52  const ParallelComponent* const /*meta*/) noexcept {
53  const double final_time = Parallel::get<OptionTags::FinalTime>(cache);
54  const Time& time = db::get<Tags::Time>(box);
55  const bool time_runs_forward =
56  db::get<Tags::TimeId>(box).time_runs_forward();
57 
58  return {std::move(box), evolution_greater_equal<double>{time_runs_forward}(
59  time.value(), final_time)};
60  }
61 };
62 } // namespace Actions
Terminate after reaching a specified time.
Definition: FinalTime.hpp:42
Defines class tuples::TaggedTuple.
The time in a simulation. Times can be safely compared for exact equality as long as they do not belo...
Definition: Time.hpp:31
A unique identifier for the temporal state of an integrated system.
Definition: TimeId.hpp:25
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
Defines Time and TimeDelta.
An associative container that is indexed by structs.
Definition: TaggedTuple.hpp:272
Defines classes and functions used for manipulating DataBox&#39;s.
Definition: Strahlkorper.hpp:167
Definition: InterpolationTargetWedgeSectionTorus.hpp:24
Definition: DataBoxTag.hpp:29
A Charm++ chare that caches constant data once per Charm++ node.
Definition: ConstGlobalCache.hpp:76
Wraps the template metaprogramming library used (brigand)
Definition: SolvePoissonProblem.hpp:38
Defines class template ConstGlobalCache.
Definition: ComputeTimeDerivative.hpp:28
Definition: EvolutionOrdering.hpp:49