SpECTRE Documentation Coverage Report
Current view: top level - PointwiseFunctions/ConstraintDamping - Constant.hpp Coverage Total Hit
Commit: 0d1d717af84a81fb1284a20c4013708fe85cc2f0 Lines: 8.7 % 23 2
Test Date: 2026-10-22 17:29:42
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 <array>
       7              : #include <cstddef>
       8              : #include <limits>
       9              : #include <memory>
      10              : #include <string>
      11              : #include <unordered_map>
      12              : 
      13              : #include "DataStructures/Tensor/TypeAliases.hpp"
      14              : #include "Options/String.hpp"
      15              : #include "PointwiseFunctions/ConstraintDamping/DampingFunction.hpp"
      16              : #include "Utilities/Serialization/CharmPupable.hpp"
      17              : #include "Utilities/TMPL.hpp"
      18              : 
      19              : /// \cond
      20              : class DataVector;
      21              : namespace PUP {
      22              : class er;
      23              : }  // namespace PUP
      24              : namespace domain::FunctionsOfTime {
      25              : class FunctionOfTime;
      26              : }  // namespace domain::FunctionsOfTime
      27              : /// \endcond
      28              : 
      29            1 : namespace ConstraintDamping {
      30              : /*!
      31              :  * \brief A constant function: \f$f = C\f$
      32              :  *
      33              :  * \details Input file options are: `Value` \f$C\f$. The function takes input
      34              :  * coordinates of type `tnsr::I<T, VolumeDim, Fr>`, where `T` is e.g. `double`
      35              :  * or `DataVector`, `Fr` is a frame (e.g. `Frame::Inertial`), and `VolumeDim` is
      36              :  * the dimension of the spatial volume.
      37              :  */
      38              : template <size_t VolumeDim, typename Fr>
      39            1 : class Constant : public DampingFunction<VolumeDim, Fr> {
      40              :  public:
      41            0 :   struct Value {
      42            0 :     using type = double;
      43            0 :     static constexpr Options::String help = {"The value."};
      44              :   };
      45            0 :   using options = tmpl::list<Value>;
      46              : 
      47            0 :   static constexpr Options::String help = {"Returns a constant value"};
      48              : 
      49              :   /// \cond
      50              :   WRAPPED_PUPable_decl_base_template(SINGLE_ARG(DampingFunction<VolumeDim, Fr>),
      51              :                                      Constant);  // NOLINT
      52              : 
      53              :   explicit Constant(CkMigrateMessage* msg);
      54              :   /// \endcond
      55              : 
      56            0 :   Constant(double value);
      57              : 
      58            0 :   Constant() = default;
      59            0 :   ~Constant() override = default;
      60            0 :   Constant(const Constant& /*rhs*/) = default;
      61            0 :   Constant& operator=(const Constant& /*rhs*/) = default;
      62            0 :   Constant(Constant&& /*rhs*/) = default;
      63            0 :   Constant& operator=(Constant&& /*rhs*/) = default;
      64              : 
      65            0 :   void operator()(
      66              :       gsl::not_null<Scalar<double>*> value_at_x,
      67              :       const tnsr::I<double, VolumeDim, Fr>& x, double time,
      68              :       const std::unordered_map<
      69              :           std::string,
      70              :           std::unique_ptr<::domain::FunctionsOfTime::FunctionOfTime>>&
      71              :           functions_of_time) const override;
      72            0 :   void operator()(
      73              :       gsl::not_null<Scalar<DataVector>*> value_at_x,
      74              :       const tnsr::I<DataVector, VolumeDim, Fr>& x, double time,
      75              :       const std::unordered_map<
      76              :           std::string,
      77              :           std::unique_ptr<::domain::FunctionsOfTime::FunctionOfTime>>&
      78              :           functions_of_time) const override;
      79              : 
      80            0 :   auto get_clone() const
      81              :       -> std::unique_ptr<DampingFunction<VolumeDim, Fr>> override;
      82              : 
      83              :   // NOLINTNEXTLINE(google-runtime-references)
      84            0 :   void pup(PUP::er& p) override;
      85              : 
      86              :  private:
      87            0 :   friend bool operator==(const Constant& lhs, const Constant& rhs) {
      88              :     return lhs.value_ == rhs.value_;
      89              :   }
      90              : 
      91              :   template <typename T>
      92            0 :   void apply_call_operator(const gsl::not_null<Scalar<T>*> value_at_x) const;
      93              : 
      94            0 :   double value_ = std::numeric_limits<double>::signaling_NaN();
      95              : };
      96              : 
      97              : template <size_t VolumeDim, typename Fr>
      98            0 : bool operator!=(const Constant<VolumeDim, Fr>& lhs,
      99              :                 const Constant<VolumeDim, Fr>& rhs) {
     100              :   return not(lhs == rhs);
     101              : }
     102              : }  // namespace ConstraintDamping
     103              : 
     104              : /// \cond
     105              : template <size_t VolumeDim, typename Fr>
     106              : // NOLINTNEXTLINE(cppcoreguidelines-avoid-non-const-global-variables)
     107              : PUP::able::PUP_ID ConstraintDamping::Constant<VolumeDim, Fr>::my_PUP_ID =
     108              :     0;  // NOLINT
     109              : /// \endcond
        

Generated by: LCOV version 2.0-1