Line data Source code
1 0 : // Distributed under the MIT License.
2 : // See LICENSE.txt for details.
3 :
4 : #pragma once
5 :
6 : #include <memory>
7 : #include <string>
8 :
9 : #include "DataStructures/DataBox/Tag.hpp"
10 : #include "Options/String.hpp"
11 : #include "Utilities/PrettyType.hpp"
12 : #include "Utilities/Serialization/Serialize.hpp"
13 :
14 : /// Functionality related to solving elliptic partial differential equations
15 : namespace elliptic {
16 :
17 : namespace OptionTags {
18 :
19 : template <typename BackgroundType>
20 0 : struct Background {
21 0 : static constexpr Options::String help =
22 : "The variable-independent part of the equations that define the problem "
23 : "to solve (along with the boundary conditions).";
24 0 : using type = std::unique_ptr<BackgroundType>;
25 : };
26 :
27 : template <typename InitialGuessType>
28 0 : struct InitialGuess {
29 0 : static constexpr Options::String help =
30 : "The initial guess for the elliptic solve. The solve converges faster if "
31 : "the initial guess is close to the solution and may not converge at all "
32 : "if the initial guess is too far away.";
33 0 : using type = std::unique_ptr<InitialGuessType>;
34 : };
35 :
36 : } // namespace OptionTags
37 :
38 : namespace Tags {
39 :
40 : /// The variable-independent part of the elliptic equations, e.g. the
41 : /// fixed-sources \f$f(x)\f$ in a Poisson equation \f$-\Delta u=f(x)\f$, the
42 : /// matter-density in a TOV-solve or the conformal metric in an XCTS solve.
43 : template <typename BackgroundType>
44 1 : struct Background : db::SimpleTag {
45 0 : using type = std::unique_ptr<BackgroundType>;
46 0 : using option_tags = tmpl::list<OptionTags::Background<BackgroundType>>;
47 :
48 0 : static constexpr bool pass_metavariables = false;
49 0 : static type create_from_options(const type& value) {
50 : return serialize_and_deserialize<type>(value);
51 : }
52 : };
53 :
54 : /// The initial guess for the elliptic solve.
55 : template <typename InitialGuessType>
56 1 : struct InitialGuess : db::SimpleTag {
57 0 : using type = std::unique_ptr<InitialGuessType>;
58 0 : using option_tags = tmpl::list<OptionTags::InitialGuess<InitialGuessType>>;
59 :
60 0 : static constexpr bool pass_metavariables = false;
61 0 : static type create_from_options(const type& value) {
62 : return serialize_and_deserialize<type>(value);
63 : }
64 : };
65 :
66 : } // namespace Tags
67 : } // namespace elliptic
|