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 :
8 : #include "DataStructures/DataVector.hpp"
9 : #include "DataStructures/Tensor/Tensor.hpp"
10 : #include "Options/String.hpp"
11 : #include "Utilities/Gsl.hpp"
12 : #include "Utilities/Serialization/CharmPupable.hpp"
13 :
14 : /*!
15 : * \brief Holds the coupling functions for Einstein-scalar-Gauss-Bonnet gravity.
16 : */
17 1 : namespace ScalarTensor::sgb::CouplingFunctions {
18 :
19 : /*!
20 : * \brief Basic interface for the object defining the coupling function.
21 : *
22 : * \details This class is pure virtual and factory creatable, so that it acts as
23 : * a unique interface for all forms of coupling functions. The public member
24 : * functions that compute the profiles of \f$F[\Psi]\f$ and its
25 : * functional derivatives are: ``coupling_function``,
26 : * ``coupling_function_prime`` and ``coupling_function_prime_prime``; they
27 : * internally call ``coupling_function_impl``, ``coupling_function_prime_impl``
28 : * and ``coupling_function_prime_prime_impl``, which are pure virtual and
29 : * protected. Any class implementing a coupling function should inherit publicly
30 : * from this class and override only the latter three methods.
31 : */
32 1 : class CouplingFunction : public PUP::able {
33 : public:
34 0 : WRAPPED_PUPable_abstract(CouplingFunction); // NOLINT
35 0 : explicit CouplingFunction(CkMigrateMessage* m) : PUP::able(m) {}
36 :
37 0 : CouplingFunction() = default;
38 0 : ~CouplingFunction() override = default;
39 :
40 : /// @{
41 : /*!
42 : * \brief Evaluates the coupling function on a scalar field profile,
43 : * \f$F[\Psi]\f$.
44 : *
45 : * This methods act as an external interface and internally calls
46 : * ``coupling_function_impl``, which is the virtual function that needs to be
47 : * specialized for the different types of couplings.
48 : *
49 : * \see CouplingFunction::coupling_function_impl
50 : */
51 1 : void coupling_function(gsl::not_null<Scalar<DataVector>*> function_values,
52 : const Scalar<DataVector>& scalar_field) const;
53 :
54 1 : Scalar<DataVector> coupling_function(
55 : const Scalar<DataVector>& scalar_field) const;
56 : /// @}
57 :
58 : /// @{
59 : /*!
60 : * \brief Evaluates the functional derivative of the coupling function,
61 : * \f$\frac{\delta F[\Psi]}{\delta \Psi} \f$, on a scalar field profile.
62 : *
63 : * This methods act as an external interface and internally calls
64 : * ``coupling_function_prime_impl``, which is the virtual function that needs
65 : * to be specialized for the different types of couplings.
66 : *
67 : * \see CouplingFunction::coupling_function_prime_impl
68 : */
69 1 : void coupling_function_prime(
70 : gsl::not_null<Scalar<DataVector>*> function_values,
71 : const Scalar<DataVector>& scalar_field) const;
72 :
73 1 : Scalar<DataVector> coupling_function_prime(
74 : const Scalar<DataVector>& scalar_field) const;
75 : /// @}
76 :
77 : /// @{
78 : /*!
79 : * \brief Evaluates the second functional derivative of the coupling
80 : * function, \f$\frac{\delta^2 F[\Psi]}{\delta \Psi^2} \f$, on a scalar field
81 : * profile.
82 : *
83 : * This methods act as an external interface and internally calls
84 : * ``coupling_function_prime_prime_impl``, which is the virtual function that
85 : * needs to be specialized for the different types of couplings.
86 : *
87 : * \see CouplingFunction::coupling_function_prime_prime_impl
88 : */
89 1 : void coupling_function_prime_prime(
90 : gsl::not_null<Scalar<DataVector>*> function_values,
91 : const Scalar<DataVector>& scalar_field) const;
92 :
93 1 : Scalar<DataVector> coupling_function_prime_prime(
94 : const Scalar<DataVector>& scalar_field) const;
95 : /// @}
96 :
97 : protected:
98 : /*!
99 : * \brief Evaluates the coupling function on a scalar field profile,
100 : * \f$F[\Psi]\f$.
101 : *
102 : * This is the virtual function that is called by
103 : * ``coupling_function``, and needs to be specialized for the different
104 : * types of couplings.
105 : *
106 : * \see CouplingFunction::coupling_function
107 : */
108 1 : virtual void coupling_function_impl(
109 : gsl::not_null<Scalar<DataVector>*> function_values,
110 : const Scalar<DataVector>& scalar_field) const = 0;
111 :
112 : /*!
113 : * \brief Implementation of the function that evaluates the first functional
114 : * derivative of the coupling function on a scalar field profile,
115 : * \f$\frac{\delta F[\Psi]}{\delta \Psi}\f$.
116 : *
117 : * This is the virtual function that is called by
118 : * ``coupling_function_prime``, and needs to be specialized for the different
119 : * types of couplings.
120 : *
121 : * \see CouplingFunction::coupling_function_prime
122 : */
123 1 : virtual void coupling_function_prime_impl(
124 : gsl::not_null<Scalar<DataVector>*> function_values,
125 : const Scalar<DataVector>& scalar_field) const = 0;
126 :
127 : /*!
128 : * \brief Implementation of the function that evaluates the second functional
129 : * derivative of the coupling function on a scalar field profile,
130 : * \f$\frac{\delta^2 F[\Psi]}{\delta \Psi^2}\f$.
131 : *
132 : * This is the virtual function that is called by
133 : * ``coupling_function_prime_prime``, and needs to be specialized for the
134 : * different types of couplings.
135 : *
136 : * \see CouplingFunction::coupling_function_prime_prime
137 : */
138 1 : virtual void coupling_function_prime_prime_impl(
139 : gsl::not_null<Scalar<DataVector>*> function_values,
140 : const Scalar<DataVector>& scalar_field) const = 0;
141 : };
142 :
143 : } // namespace ScalarTensor::sgb::CouplingFunctions
|