FullSlab.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 class StepControllers::FullSlab
6 
7 #pragma once
8 
9 #include <pup.h>
10 
11 #include "ErrorHandling/Assert.hpp"
12 #include "Options/Options.hpp"
14 #include "Time/Slab.hpp"
15 #include "Time/StepControllers/StepController.hpp" // IWYU pragma: keep
16 #include "Time/Time.hpp"
17 #include "Utilities/TMPL.hpp"
18 
19 namespace StepControllers {
20 
21 /// \ingroup TimeSteppersGroup
22 ///
23 /// A StepController that always chooses to step a full slab,
24 /// independent of the desired step size. Intended for simuations
25 /// using global time stepping.
26 class FullSlab : public StepController {
27  public:
28  /// \cond
29  FullSlab() = default;
30  explicit FullSlab(CkMigrateMessage* /*unused*/) noexcept {}
31  WRAPPED_PUPable_decl(FullSlab); // NOLINT
32  /// \endcond
33 
34  using options = tmpl::list<>;
35  static constexpr OptionString help = {"Chooses the full slab."};
36 
37  TimeDelta choose_step(const Time& time,
38  const double desired_step) const noexcept override {
39  ASSERT(time.is_at_slab_boundary(),
40  "Trying to take a full slab step from the middle of a slab.");
41  return desired_step > 0 ? time.slab().duration() : -time.slab().duration();
42  }
43 };
44 } // namespace StepControllers
A StepController that always chooses to step a full slab, independent of the desired step size...
Definition: FullSlab.hpp:26
The time in a simulation. Times can be safely compared for exact equality as long as they do not belo...
Definition: Time.hpp:31
Defines base class StepController.
Defines classes and functions for making classes creatable from input files.
Defines macros to allow serialization of abstract template base classes.
#define ASSERT(a, m)
Assert that an expression should be true.
Definition: Assert.hpp:49
Defines Time and TimeDelta.
const char *const OptionString
The string used in option structs.
Definition: Options.hpp:26
StepControllers take desired step sizes (generally determined by StepChoosers) and convert them into ...
Definition: StepController.hpp:31
#define WRAPPED_PUPable_decl(className)
Wraps the Charm++ macro, see the Charm++ documentation.
Definition: CharmPupable.hpp:36
Holds all the StepControllers.
Definition: BinaryFraction.cpp:6
Represents an interval of time within a single slab.
Definition: Time.hpp:108
Defines class Slab.
Defines macro ASSERT.
Wraps the template metaprogramming library used (brigand)