SpECTRE Documentation Coverage Report
Current view: top level - NumericalAlgorithms/Interpolation - CardinalInterpolator.hpp Hit Total Coverage
Commit: 1f2210958b4f38fdc0400907ee7c6d5af5111418 Lines: 3 14 21.4 %
Date: 2025-12-05 05:03:31
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             : 
       9             : #include "DataStructures/Matrix.hpp"
      10             : #include "DataStructures/Tensor/TypeAliases.hpp"
      11             : 
      12             : /// \cond
      13             : class DataVector;
      14             : template <size_t Dim>
      15             : class Mesh;
      16             : namespace PUP {
      17             : class er;
      18             : }  // namespace PUP
      19             : /// \endcond
      20             : 
      21             : namespace intrp {
      22             : /*!
      23             :  * \brief Interpolates by doing partial summation in each dimension using
      24             :  * one-dimensional interpolation
      25             :  *
      26             :  * \details The one-dimensional matrices used to do the interpolation depend
      27             :  * upon the Spectral::Basis used in each dimension:
      28             :  * - For a Chebyshev or Legendre basis, the matrices are given by
      29             :  * intrp::fornberg_interpolation_matrix at the quadrature points of the
      30             :  * source_mesh.  (These are equivalent to those returned by
      31             :  * Spectral::interpolation_matrix.)
      32             :  * - For a Fourier basis, the matrix is given by
      33             :  * intrp::fourier_interpolation_matrix at the quadrature points of the
      34             :  * source_mesh
      35             :  *
      36             :  */
      37             : template <size_t Dim>
      38           1 : class Cardinal {
      39             :  public:
      40           0 :   Cardinal(
      41             :       const Mesh<Dim>& source_mesh,
      42             :       const tnsr::I<DataVector, Dim, Frame::ElementLogical>& target_points);
      43           0 :   Cardinal(
      44             :       const Mesh<Dim>& source_mesh,
      45             :       const tnsr::I<double, Dim, Frame::ElementLogical>& target_point);
      46             : 
      47           0 :   Cardinal();
      48             : 
      49             :   /// Interpolates the function `f` provided on the `source_mesh` to the
      50             :   /// `target_points` with which the interpolator was constructed.
      51           1 :   DataVector interpolate(const DataVector& f) const;
      52             : 
      53             :   /// The one-dimensional interpolation matrices used to do the interpolation
      54           1 :   const std::array<Matrix, Dim>& interpolation_matrices() const;
      55             : 
      56             :   // NOLINTNEXTLINE(google-runtime-references)
      57           0 :   void pup(PUP::er& p);
      58             : 
      59             :  private:
      60           0 :   size_t n_target_points_;
      61           0 :   Mesh<Dim> source_mesh_;
      62           0 :   std::array<Matrix, Dim> interpolation_matrices_;
      63           0 :   bool using_spherical_harmonics_{false};
      64             : };
      65             : 
      66             : template <size_t Dim>
      67           0 : bool operator==(const Cardinal<Dim>& lhs, const Cardinal<Dim>& rhs);
      68             : 
      69             : template <size_t Dim>
      70           0 : bool operator!=(const Cardinal<Dim>& lhs, const Cardinal<Dim>& rhs);
      71             : }  // namespace intrp

Generated by: LCOV version 1.14