TimeDependence.hpp
1 // Distributed under the MIT License.
2 // See LICENSE.txt for details.
3 
4 #pragma once
5 
6 #include <cstddef>
7 #include <memory>
8 #include <string>
9 #include <unordered_map>
10 #include <vector>
11 
12 #include "Utilities/TMPL.hpp"
13 
14 /// \cond
15 namespace domain {
16 template <typename SourceFrame, typename TargetFrame, size_t Dim>
17 class CoordinateMapBase;
18 namespace FunctionsOfTime {
19 class FunctionOfTime;
20 } // namespace FunctionsOfTime
21 } // namespace domain
22 namespace Frame {
23 struct Grid;
24 struct Inertial;
25 } // namespace Frame
26 
27 namespace domain {
28 namespace creators {
29 namespace time_dependence {
30 template <size_t MeshDim>
31 class CubicScale;
32 template <size_t MeshDim>
33 class None;
34 template <size_t MeshDim>
35 class UniformTranslation;
36 } // namespace time_dependence
37 } // namespace creators
38 } // namespace domain
39 /// \endcond
40 
41 namespace domain {
42 namespace creators {
43 /// \ingroup ComputationalDomainGroup
44 /// \brief Classes and functions for adding time dependence to a domain.
45 namespace time_dependence {
46 /// \brief The abstract base class off of which specific classes for adding
47 /// time dependence into a domain creator must inherit off of.
48 ///
49 /// The simplest examples of a `TimeDependence` are `None` and
50 /// `UniformTranslation`. The `None` class is treated in a special manner to
51 /// communicate to the code that the domain is time-independent.
52 template <size_t MeshDim>
54  using creatable_classes = tmpl::list<CubicScale<MeshDim>, None<MeshDim>,
56 
57  TimeDependence() = default;
58  virtual ~TimeDependence() = 0;
59  TimeDependence(const TimeDependence&) = default;
60  TimeDependence& operator=(const TimeDependence&) = default;
61  TimeDependence(TimeDependence&&) = default;
62  TimeDependence& operator=(TimeDependence&&) = default;
63 
64  /// Returns a `std::unique_ptr` pointing to a copy of the `TimeDependence`.
65  virtual auto get_clone() const noexcept
67 
68  /// Returns the coordinate maps from the `Frame::Grid` to the
69  /// `Frame::Inertial` frame for each block.
70  virtual auto block_maps(size_t number_of_blocks) const noexcept
72  Frame::Grid, Frame::Inertial, MeshDim>>> = 0;
73 
74  /// Returns the functions of time for the domain.
75  virtual auto functions_of_time() const noexcept -> std::unordered_map<
78 
79  /// Returns `true` if the instance is `None`, meaning no time dependence.
80  bool is_none() const noexcept {
81  return dynamic_cast<const None<MeshDim>*>(this) != nullptr;
82  }
83 };
84 
85 template <size_t MeshDim>
87 } // namespace time_dependence
88 } // namespace creators
89 } // namespace domain
90 
91 #include "Domain/Creators/TimeDependence/CubicScale.hpp"
92 #include "Domain/Creators/TimeDependence/None.hpp"
93 #include "Domain/Creators/TimeDependence/UniformTranslation.hpp"
Definition: IndexType.hpp:43
Definition: BlockId.hpp:16
Abstract base class for CoordinateMap.
Definition: CoordinateMap.hpp:46
A uniform translation in the and direction.
Definition: UniformTranslation.hpp:60
The abstract base class off of which specific classes for adding time dependence into a domain creato...
Definition: TimeDependence.hpp:53
Make the mesh time independent so that it isn&#39;t moving.
Definition: None.hpp:40
Indicates the Frame that a TensorIndexType is in.
Definition: IndexType.hpp:36
Wraps the template metaprogramming library used (brigand)
Definition: IndexType.hpp:44
bool is_none() const noexcept
Returns true if the instance is None, meaning no time dependence.
Definition: TimeDependence.hpp:80