DampingFunction.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 <type_traits>
10 #include <unordered_map>
11 
14 #include "Utilities/Gsl.hpp"
15 
16 /// \cond
17 class DataVector;
18 namespace domain::FunctionsOfTime {
19 class FunctionOfTime;
20 } // namespace domain::FunctionsOfTime
21 /// \endcond
22 
23 /// Holds classes implementing DampingFunction (functions \f$R^n \to R\f$).
25 /// \cond
26 template <size_t VolumeDim, typename Fr>
29 /// \endcond
30 
31 /*!
32  * \brief Base class defining interface for constraint damping functions.
33  *
34  * Encodes a function \f$R^n \to R\f$ where n is `VolumeDim` that represents
35  * a generalized-harmonic constraint-damping parameter (i.e., Gamma0,
36  * Gamma1, or Gamma2).
37  */
38 template <size_t VolumeDim, typename Fr>
39 class DampingFunction : public PUP::able {
40  public:
41  using creatable_classes = tmpl::conditional_t<
42  (VolumeDim == 3 and std::is_same<Fr, Frame::Grid>::value),
43  tmpl::list<
45  VolumeDim, Fr>,
48  VolumeDim, Fr>>>;
49  constexpr static size_t volume_dim = VolumeDim;
50  using frame = Fr;
51 
52  WRAPPED_PUPable_abstract(DampingFunction); // NOLINT
53 
54  DampingFunction() = default;
55  DampingFunction(const DampingFunction& /*rhs*/) = default;
56  DampingFunction& operator=(const DampingFunction& /*rhs*/) = default;
57  DampingFunction(DampingFunction&& /*rhs*/) noexcept = default;
58  DampingFunction& operator=(DampingFunction&& /*rhs*/) noexcept = default;
59  ~DampingFunction() override = default;
60 
61  explicit DampingFunction(CkMigrateMessage* msg) noexcept : PUP::able(msg) {}
62 
63  //@{
64  /// Returns the value of the function at the coordinate 'x'.
65  virtual void operator()(
66  const gsl::not_null<Scalar<double>*> value_at_x,
67  const tnsr::I<double, VolumeDim, Fr>& x, double time,
68  const std::unordered_map<
71  functions_of_time) const noexcept = 0;
72  virtual void operator()(
73  const gsl::not_null<Scalar<DataVector>*> value_at_x,
74  const tnsr::I<DataVector, VolumeDim, Fr>& x, double time,
75  const std::unordered_map<
78  functions_of_time) const noexcept = 0;
79  //@}
80 
81  virtual auto get_clone() const noexcept
83 };
84 } // namespace GeneralizedHarmonic::ConstraintDamping
85 
86 #include "Evolution/Systems/GeneralizedHarmonic/ConstraintDamping/GaussianPlusConstant.hpp"
87 #include "Evolution/Systems/GeneralizedHarmonic/ConstraintDamping/TimeDependentTripleGaussian.hpp"
std::is_same
GeneralizedHarmonic::ConstraintDamping
Holds classes implementing DampingFunction (functions ).
Definition: DampingFunction.hpp:24
std::string
CharmPupable.hpp
GeneralizedHarmonic::ConstraintDamping::GaussianPlusConstant
A Gaussian plus a constant: .
Definition: GaussianPlusConstant.hpp:41
domain::FunctionsOfTime
Contains functions of time to support the dual frame system.
Definition: FunctionOfTime.hpp:17
GeneralizedHarmonic::ConstraintDamping::DampingFunction::operator()
virtual void operator()(const gsl::not_null< Scalar< double > * > value_at_x, const tnsr::I< double, VolumeDim, Fr > &x, double time, const std::unordered_map< std::string, std::unique_ptr< domain::FunctionsOfTime::FunctionOfTime >> &functions_of_time) const noexcept=0
Returns the value of the function at the coordinate 'x'.
cstddef
DataVector
Stores a collection of function values.
Definition: DataVector.hpp:46
memory
GeneralizedHarmonic::ConstraintDamping::TimeDependentTripleGaussian
A sum of three Gaussians plus a constant, where the Gaussian widths are scaled by a domain::Functions...
Definition: TimeDependentTripleGaussian.hpp:51
Scalar
Tensor< T, Symmetry<>, index_list<> > Scalar
Definition: TypeAliases.hpp:21
Gsl.hpp
TypeAliases.hpp
GeneralizedHarmonic::ConstraintDamping::DampingFunction
Base class defining interface for constraint damping functions.
Definition: DampingFunction.hpp:39
std::unique_ptr
unordered_map
type_traits
gsl::not_null
Require a pointer to not be a nullptr
Definition: ReadSpecThirdOrderPiecewisePolynomial.hpp:13
string