Line data Source code
1 0 : // Distributed under the MIT License.
2 : // See LICENSE.txt for details.
3 :
4 : #pragma once
5 :
6 : #include <pup.h>
7 : #include <pup_stl.h>
8 :
9 : #include "Utilities/Serialization/CharmPupable.hpp"
10 :
11 : namespace evolution {
12 : /*!
13 : * \brief Namespace for things related to initial data used for evolution
14 : * systems.
15 : */
16 1 : namespace initial_data {
17 : /*!
18 : * \brief The abstract base class for initial data of evolution systems. All
19 : * analytic solutions and analytic data must virtually inherit from this class.
20 : */
21 1 : class InitialData : public PUP::able {
22 : protected:
23 0 : InitialData() = default;
24 :
25 : public:
26 0 : ~InitialData() override = default;
27 :
28 0 : virtual auto get_clone() const -> std::unique_ptr<InitialData> = 0;
29 :
30 : /*!
31 : * \brief Unwrap wrapper types (e.g. `WithNoise`, which wraps analytic
32 : * initial data and adds random noise) to reach the underlying analytic
33 : * solution or data.
34 : *
35 : * Most classes return `*this`. `WithNoise` overrides this to return its
36 : * inner solution, allowing dispatch sites to transparently look through
37 : * the wrapper without knowing about it explicitly.
38 : */
39 1 : virtual const InitialData& unwrap() const { return *this; }
40 :
41 : /// \cond
42 : explicit InitialData(CkMigrateMessage* msg) : PUP::able(msg) {}
43 : WRAPPED_PUPable_abstract(InitialData);
44 : /// \endcond
45 : };
46 : } // namespace initial_data
47 : } // namespace evolution
|