SpECTRE Documentation Coverage Report
Current view: top level - ParallelAlgorithms/Interpolation/Protocols - ComputeTargetPoints.hpp Hit Total Coverage
Commit: 817e13c5144619b701c7cd870655d8dbf94ab8ce Lines: 2 9 22.2 %
Date: 2024-07-19 22:17:05
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
      26             :  *
      27             :  * - a type alias `frame` that denotes the frame the target points are computed
      28             :  *   in
      29             :  *
      30             :  * - a function `points` with signature matching the one in the example that
      31             :  *   will compute the points in the given `frame`.
      32             :  *
      33             :  * A struct that conforms to this protocol can optionally have any of these
      34             :  * members as well:
      35             :  *
      36             :  * - a type alias `simple_tags` that list simple tags to be added to the DataBox
      37             :  *   of the InterpolationTarget
      38             :  *
      39             :  * - a type alias `compute_tags` that list compute tags to be added to the
      40             :  *   DataBox of the InterpolationTarget
      41             :  *
      42             :  * - a type alias `const_global_cache_tags` with tags to be put in the
      43             :  *   GlobalCache
      44             :  *
      45             :  * - a function `initialize` with signature matching the one in the example that
      46             :  *   is run during the Initialization phase of the InterpolationTarget and can
      47             :  *   initialize any of the `simple_tags` added.
      48             :  *
      49             :  * Here is an example of a class that conforms to this protocols:
      50             :  *
      51             :  * \snippet Helpers/ParallelAlgorithms/Interpolation/Examples.hpp ComputeTargetPoints
      52             :  */
      53           1 : struct ComputeTargetPoints {
      54             :   template <typename ConformingType>
      55           0 :   struct test {
      56             :     struct DummyMetavariables;
      57           0 :     struct DummyTag : db::SimpleTag {
      58           0 :       using type = int;
      59             :     };
      60             : 
      61           0 :     using is_sequential = typename ConformingType::is_sequential;
      62             :     static_assert(std::is_same_v<is_sequential, std::true_type> or
      63             :                   std::is_same_v<is_sequential, std::false_type>);
      64             : 
      65           0 :     using frame = typename ConformingType::frame;
      66             : 
      67             :     template <size_t Dim>
      68           0 :     static constexpr bool conforms = std::is_same_v<
      69             :         tnsr::I<DataVector, Dim, frame>,
      70             :         decltype(ConformingType::points(
      71             :             std::declval<const db::DataBox<DummyTag>&>(),
      72             :             std::declval<const tmpl::type_<DummyMetavariables>&>(),
      73             :             std::declval<const double&>()))>;
      74             : 
      75             :     static_assert(conforms<1> or conforms<2> or conforms<3>);
      76             : 
      77             :     // We don't check the initialize() function because it is optional
      78             :   };
      79             : };
      80             : }  // namespace intrp::protocols

Generated by: LCOV version 1.14