SpECTRE Documentation Coverage Report
Current view: top level - Evolution/Systems/GeneralizedHarmonic/ConstraintDamping - DampingFunction.hpp Hit Total Coverage
Commit: 35a1e98cd3e4fdea528eb8100f99c2f707894fda Lines: 3 16 18.8 %
Date: 2024-04-19 00:10:48
Legend: Lines: hit not hit

          Line data    Source code
       1           0 : // 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             : 
      12             : #include "DataStructures/Tensor/TypeAliases.hpp"
      13             : #include "Utilities/Gsl.hpp"
      14             : #include "Utilities/Serialization/CharmPupable.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$).
      24             : namespace gh::ConstraintDamping {
      25             : /// \cond
      26             : template <size_t VolumeDim, typename Fr>
      27             : class Constant;
      28             : template <size_t VolumeDim, typename Fr>
      29             : class GaussianPlusConstant;
      30             : class TimeDependentTripleGaussian;
      31             : /// \endcond
      32             : 
      33             : /*!
      34             :  * \brief Base class defining interface for constraint damping functions.
      35             :  *
      36             :  * Encodes a function \f$R^n \to R\f$ where n is `VolumeDim` that represents
      37             :  * a generalized-harmonic constraint-damping parameter (i.e., Gamma0,
      38             :  * Gamma1, or Gamma2).
      39             :  */
      40             : template <size_t VolumeDim, typename Fr>
      41           1 : class DampingFunction : public PUP::able {
      42             :  public:
      43           0 :   using creatable_classes = tmpl::conditional_t<
      44             :       (VolumeDim == 3 and std::is_same<Fr, Frame::Grid>::value),
      45             :       tmpl::list<gh::ConstraintDamping::Constant<VolumeDim, Fr>,
      46             :                  gh::ConstraintDamping::GaussianPlusConstant<VolumeDim, Fr>,
      47             :                  gh::ConstraintDamping::TimeDependentTripleGaussian>,
      48             :       tmpl::list<gh::ConstraintDamping::GaussianPlusConstant<VolumeDim, Fr>,
      49             :                  gh::ConstraintDamping::Constant<VolumeDim, Fr>>>;
      50           0 :   constexpr static size_t volume_dim = VolumeDim;
      51           0 :   using frame = Fr;
      52             : 
      53           0 :   WRAPPED_PUPable_abstract(DampingFunction);  // NOLINT
      54             : 
      55           0 :   DampingFunction() = default;
      56           0 :   DampingFunction(const DampingFunction& /*rhs*/) = default;
      57           0 :   DampingFunction& operator=(const DampingFunction& /*rhs*/) = default;
      58           0 :   DampingFunction(DampingFunction&& /*rhs*/) = default;
      59           0 :   DampingFunction& operator=(DampingFunction&& /*rhs*/) = default;
      60           0 :   ~DampingFunction() override = default;
      61             : 
      62           0 :   explicit DampingFunction(CkMigrateMessage* msg) : PUP::able(msg) {}
      63             : 
      64             :   /// @{
      65             :   /// Returns the value of the function at the coordinate 'x'.
      66           1 :   virtual void operator()(
      67             :       const gsl::not_null<Scalar<double>*> value_at_x,
      68             :       const tnsr::I<double, VolumeDim, Fr>& x, double time,
      69             :       const std::unordered_map<
      70             :           std::string,
      71             :           std::unique_ptr<domain::FunctionsOfTime::FunctionOfTime>>&
      72             :           functions_of_time) const = 0;
      73           1 :   virtual void operator()(
      74             :       const gsl::not_null<Scalar<DataVector>*> value_at_x,
      75             :       const tnsr::I<DataVector, VolumeDim, Fr>& x, double time,
      76             :       const std::unordered_map<
      77             :           std::string,
      78             :           std::unique_ptr<domain::FunctionsOfTime::FunctionOfTime>>&
      79             :           functions_of_time) const = 0;
      80             :   /// @}
      81             : 
      82           0 :   virtual auto get_clone() const
      83             :       -> std::unique_ptr<DampingFunction<VolumeDim, Fr>> = 0;
      84             : };
      85             : }  // namespace gh::ConstraintDamping
      86             : 
      87             : #include "Evolution/Systems/GeneralizedHarmonic/ConstraintDamping/Constant.hpp"
      88             : #include "Evolution/Systems/GeneralizedHarmonic/ConstraintDamping/GaussianPlusConstant.hpp"
      89             : #include "Evolution/Systems/GeneralizedHarmonic/ConstraintDamping/TimeDependentTripleGaussian.hpp"

Generated by: LCOV version 1.14