Factory.hpp
1 // Distributed under the MIT License.
2 // See LICENSE.txt for details.
3 
4 #pragma once
5 
6 #include <cstddef>
7 
8 #include "Time/StepChoosers/Cfl.hpp"
9 #include "Time/StepChoosers/Constant.hpp"
10 #include "Time/StepChoosers/Increase.hpp"
11 #include "Time/StepChoosers/PreventRapidIncrease.hpp"
12 #include "Time/StepChoosers/StepToTimes.hpp"
13 #include "Utilities/TMPL.hpp"
14 
15 /// \cond
16 namespace Frame {
17 struct Inertial;
18 } // namespace Frame
19 /// \endcond
20 
21 namespace StepChoosers {
22 namespace Factory_detail {
23 template <typename Use, typename System, bool HasCharSpeedFunctions>
24 using common_step_choosers = tmpl::push_back<
25  tmpl::conditional_t<
26  HasCharSpeedFunctions,
27  tmpl::list<StepChoosers::Cfl<Use, Frame::Inertial, System>>,
28  tmpl::list<>>,
30 template <typename Use>
31 using step_choosers_for_step_only =
32  tmpl::list<StepChoosers::PreventRapidIncrease<Use>>;
33 using step_choosers_for_slab_only = tmpl::list<StepChoosers::StepToTimes>;
34 
35 template <typename System, bool HasCharSpeedFunctions>
36 using lts_slab_choosers = tmpl::append<
37  common_step_choosers<StepChooserUse::Slab, System, HasCharSpeedFunctions>,
38  step_choosers_for_slab_only>;
39 } // namespace Factory_detail
40 
41 template <typename System, bool HasCharSpeedFunctions = true>
42 using standard_step_choosers = tmpl::append<
43  Factory_detail::common_step_choosers<StepChooserUse::LtsStep, System,
44  HasCharSpeedFunctions>,
45  Factory_detail::step_choosers_for_step_only<StepChooserUse::LtsStep>>;
46 
47 template <typename System, bool LocalTimeStepping,
48  bool HasCharSpeedFunctions = true>
49 using standard_slab_choosers = tmpl::conditional_t<
50  LocalTimeStepping,
51  Factory_detail::lts_slab_choosers<System, HasCharSpeedFunctions>,
52  tmpl::append<
53  Factory_detail::lts_slab_choosers<System, HasCharSpeedFunctions>,
54  Factory_detail::step_choosers_for_step_only<StepChooserUse::Slab>>>;
55 } // namespace StepChoosers
StepChoosers
Definition: ByBlock.hpp:33
domain::push_back
CoordinateMap< SourceFrame, TargetFrame, Maps..., NewMap > push_back(CoordinateMap< SourceFrame, TargetFrame, Maps... > old_map, NewMap new_map) noexcept
Creates a CoordinateMap by appending the new map to the end of the old maps.
cstddef
StepChoosers::Constant
Suggests a constant step size.
Definition: Constant.hpp:27
Frame
Definition: IndexType.hpp:36
StepChoosers::Increase
Suggests increasing the step size by a constant ratio.
Definition: Increase.hpp:27
TMPL.hpp