SpECTRE Documentation Coverage Report
Current view: top level - ParallelAlgorithms/Interpolation/Protocols - ComputeTargetPoints.hpp Hit Total Coverage
Commit: 6e1258ccd353220e12442198913007fb6c170b6b Lines: 2 9 22.2 %
Date: 2024-10-23 19:54:13
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 <type_traits>
       7             : 
       8             : #include "DataStructures/DataBox/DataBox.hpp"
       9             : #include "DataStructures/Tensor/TypeAliases.hpp"
      10             : #include "Utilities/TMPL.hpp"
      11             : 
      12             : /// \cond
      13             : struct DataVector;
      14             : /// \endcond
      15             : 
      16           1 : namespace intrp::protocols {
      17             : /*!
      18             :  * \brief A protocol for the type alias `compute_target_points` found in an
      19             :  * InterpolationTargetTag.
      20             :  *
      21             :  * \details A struct conforming to the `ComputeTargetPoints` protocol must have
      22             :  *
      23             :  * - a type alias `is_sequential` that is either `std::true_type` or
      24             :  *   `std::false_type` which indicates if interpolations depend on previous
      25             :  *   interpolations' results. It is assumed in the interpolation framework that
      26             :  *   only horizon finds are sequential (e.y. anything that uses the
      27             :  *   `intrp::Interpolator` component is a sequential horizon find).
      28             :  *
      29             :  * - a type alias `frame` that denotes the frame the target points are computed
      30             :  *   in
      31             :  *
      32             :  * - a function `points` with signature matching the one in the example that
      33             :  *   will compute the points in the given `frame`.
      34             :  *
      35             :  * A struct that conforms to this protocol can optionally have any of these
      36             :  * members as well:
      37             :  *
      38             :  * - a type alias `simple_tags` that list simple tags to be added to the DataBox
      39             :  *   of the InterpolationTarget
      40             :  *
      41             :  * - a type alias `compute_tags` that list compute tags to be added to the
      42             :  *   DataBox of the InterpolationTarget
      43             :  *
      44             :  * - a type alias `const_global_cache_tags` with tags to be put in the
      45             :  *   GlobalCache
      46             :  *
      47             :  * - a function `initialize` with signature matching the one in the example that
      48             :  *   is run during the Initialization phase of the InterpolationTarget and can
      49             :  *   initialize any of the `simple_tags` added.
      50             :  *
      51             :  * Here is an example of a class that conforms to this protocols:
      52             :  *
      53             :  * \snippet Helpers/ParallelAlgorithms/Interpolation/Examples.hpp ComputeTargetPoints
      54             :  */
      55           1 : struct ComputeTargetPoints {
      56             :   template <typename ConformingType>
      57           0 :   struct test {
      58             :     struct DummyMetavariables;
      59           0 :     struct DummyTag : db::SimpleTag {
      60           0 :       using type = int;
      61             :     };
      62             : 
      63           0 :     using is_sequential = typename ConformingType::is_sequential;
      64             :     static_assert(std::is_same_v<is_sequential, std::true_type> or
      65             :                   std::is_same_v<is_sequential, std::false_type>);
      66             : 
      67           0 :     using frame = typename ConformingType::frame;
      68             : 
      69             :     template <size_t Dim>
      70           0 :     static constexpr bool conforms = std::is_same_v<
      71             :         tnsr::I<DataVector, Dim, frame>,
      72             :         decltype(ConformingType::points(
      73             :             std::declval<const db::DataBox<DummyTag>&>(),
      74             :             std::declval<const tmpl::type_<DummyMetavariables>&>(),
      75             :             std::declval<const double&>()))>;
      76             : 
      77             :     static_assert(conforms<1> or conforms<2> or conforms<3>);
      78             : 
      79             :     // We don't check the initialize() function because it is optional
      80             :   };
      81             : };
      82             : }  // namespace intrp::protocols

Generated by: LCOV version 1.14