SpECTRE Documentation Coverage Report
Current view: top level - PointwiseFunctions/MathFunctions - Sinusoid.hpp Coverage Total Hit
Commit: 0d1d717af84a81fb1284a20c4013708fe85cc2f0 Lines: 15.4 % 39 6
Test Date: 2026-10-22 17:29:42
Legend: Lines:     hit not hit

            Line data    Source code
       1            1 : // Distributed under the MIT License.
       2              : // See LICENSE.txt for details.
       3              : 
       4              : /// \file
       5              : /// Defines MathFunctions::Sinusoid.
       6              : 
       7              : #pragma once
       8              : 
       9              : #include <memory>
      10              : #include <pup.h>
      11              : 
      12              : #include "Options/String.hpp"
      13              : #include "PointwiseFunctions/MathFunctions/MathFunction.hpp"
      14              : #include "Utilities/Serialization/CharmPupable.hpp"
      15              : #include "Utilities/TMPL.hpp"
      16              : 
      17              : /// \cond
      18              : class DataVector;
      19              : /// \endcond
      20              : 
      21              : namespace MathFunctions {
      22              : template <size_t VolumeDim, typename Fr>
      23            0 : class Sinusoid;
      24              : 
      25              : /*!
      26              :  *  \ingroup MathFunctionsGroup
      27              :  *  \brief Sinusoid \f$f = A \sin\left(k x + \delta \right)\f$.
      28              :  *
      29              :  *  \details Input file options are: Amplitude, Phase, and Wavenumber
      30              :  */
      31              : template <typename Fr>
      32            1 : class Sinusoid<1, Fr> : public MathFunction<1, Fr> {
      33              :  public:
      34            0 :   struct Amplitude {
      35            0 :     using type = double;
      36            0 :     static constexpr Options::String help = {"The amplitude."};
      37              :   };
      38              : 
      39            0 :   struct Wavenumber {
      40            0 :     using type = double;
      41            0 :     static constexpr Options::String help = {"The wavenumber."};
      42              :   };
      43              : 
      44            0 :   struct Phase {
      45            0 :     using type = double;
      46            0 :     static constexpr Options::String help = {"The phase shift."};
      47              :   };
      48            0 :   using options = tmpl::list<Amplitude, Wavenumber, Phase>;
      49              : 
      50            0 :   static constexpr Options::String help = {
      51              :       "Applies a Sinusoid function to the input value"};
      52              : 
      53            0 :   Sinusoid(double amplitude, double wavenumber, double phase);
      54            0 :   Sinusoid() = default;
      55            0 :   std::unique_ptr<MathFunction<1, Fr>> get_clone() const override;
      56              : 
      57            0 :   WRAPPED_PUPable_decl_base_template(SINGLE_ARG(MathFunction<1, Fr>),
      58              :                                      Sinusoid);  // NOLINT
      59              : 
      60            0 :   explicit Sinusoid(CkMigrateMessage* /*unused*/) {}
      61              : 
      62            1 :   double operator()(const double& x) const override;
      63            0 :   DataVector operator()(const DataVector& x) const override;
      64              : 
      65            1 :   double first_deriv(const double& x) const override;
      66            0 :   DataVector first_deriv(const DataVector& x) const override;
      67              : 
      68            1 :   double second_deriv(const double& x) const override;
      69            0 :   DataVector second_deriv(const DataVector& x) const override;
      70              : 
      71            1 :   double third_deriv(const double& x) const override;
      72            0 :   DataVector third_deriv(const DataVector& x) const override;
      73              : 
      74            0 :   bool operator==(const MathFunction<1, Fr>& other) const override;
      75            0 :   bool operator!=(const MathFunction<1, Fr>& other) const override;
      76              : 
      77            0 :   bool operator==(const Sinusoid<1, Fr>& other) const;
      78            0 :   bool operator!=(const Sinusoid<1, Fr>& other) const;
      79              :   // NOLINTNEXTLINE(google-runtime-references)
      80            0 :   void pup(PUP::er& p) override;
      81              : 
      82              :  private:
      83            0 :   double amplitude_{};
      84            0 :   double wavenumber_{};
      85            0 :   double phase_{};
      86              : 
      87              :   template <typename T>
      88            0 :   T apply_call_operator(const T& x) const;
      89              :   template <typename T>
      90            0 :   T apply_first_deriv(const T& x) const;
      91              :   template <typename T>
      92            0 :   T apply_second_deriv(const T& x) const;
      93              :   template <typename T>
      94            0 :   T apply_third_deriv(const T& x) const;
      95              : };
      96              : 
      97              : }  // namespace MathFunctions
      98              : 
      99              : /// \cond
     100              : template <typename Fr>
     101              : PUP::able::PUP_ID MathFunctions::Sinusoid<1, Fr>::my_PUP_ID = 0;  // NOLINT
     102              : /// \endcond
        

Generated by: LCOV version 2.0-1