SpECTRE Documentation Coverage Report
Current view: top level - ControlSystem/Protocols - ControlError.hpp Hit Total Coverage
Commit: 37c384043430860f87787999aa7399d01bb3d213 Lines: 2 6 33.3 %
Date: 2024-04-20 02:24:02
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 <cstddef>
       7             : #include <string>
       8             : #include <type_traits>
       9             : 
      10             : #include "DataStructures/DataVector.hpp"
      11             : #include "Parallel/GlobalCache.hpp"
      12             : #include "Utilities/TMPL.hpp"
      13             : #include "Utilities/TaggedTuple.hpp"
      14             : 
      15             : template <bool AllowDecrease>
      16             : struct TimescaleTuner;
      17             : 
      18           1 : namespace control_system::protocols {
      19             : namespace detail {
      20             : 
      21             : struct DummyMetavariables {
      22             :   using component_list = tmpl::list<>;
      23             : };
      24             : struct DummyTupleTags {
      25             :   using type = int;
      26             : };
      27             : 
      28             : template <typename T, bool AllowDecrease>
      29             : struct has_signature
      30             :     : std::is_invocable_r<DataVector, T, const ::TimescaleTuner<AllowDecrease>&,
      31             :                           const Parallel::GlobalCache<DummyMetavariables>&,
      32             :                           const double, const std::string&,
      33             :                           const tuples::TaggedTuple<DummyTupleTags>&> {};
      34             : }  // namespace detail
      35             : /// \brief Definition of a control error
      36             : ///
      37             : /// A control error is used within a control system to compute how far off the
      38             : /// the value you are controlling is from its expected value.
      39             : ///
      40             : /// A conforming type must specify:
      41             : ///
      42             : /// - a call operator that returns a DataVector with a signature the same as in
      43             : ///   the example shown here:
      44             : /// - a `static constexpr size_t expected_number_of_excisions` which specifies
      45             : ///   the number of excisions necessary in order to compute the control error.
      46             : /// - a type alias `object_centers` to a `domain::object_list` of
      47             : ///   `domain::ObjectLabel`s. These are the objects that will require the
      48             : ///   `domain::Tags::ObjectCenter`s tags to be in the GlobalCache for this
      49             : ///   control system to work.
      50             : ///
      51             : /// \note The TimescaleTuner can have it's template parameter be either `true`
      52             : /// or `false`.
      53             : ///
      54             : ///   \snippet Helpers/ControlSystem/Examples.hpp ControlError
      55           1 : struct ControlError {
      56             :   template <typename ConformingType>
      57           0 :   struct test {
      58           0 :     static constexpr size_t expected_number_of_excisions =
      59             :         ConformingType::expected_number_of_excisions;
      60             : 
      61           0 :     using object_centers = typename ConformingType::object_centers;
      62             : 
      63             :     static_assert(detail::has_signature<ConformingType, true>::value or
      64             :                   detail::has_signature<ConformingType, false>::value);
      65             :   };
      66             : };
      67             : }  // namespace control_system::protocols

Generated by: LCOV version 1.14