SpECTRE Documentation Coverage Report
Current view: top level - Time/Tags - StepperErrorTolerancesCompute.hpp Hit Total Coverage
Commit: 3ffcbc8ecf43797401b60bcca17d6040ee06f013 Lines: 2 12 16.7 %
Date: 2026-03-03 02:01:44
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 <memory>
       7             : #include <string>
       8             : #include <type_traits>
       9             : #include <typeindex>
      10             : #include <vector>
      11             : 
      12             : #include "DataStructures/DataBox/Tag.hpp"
      13             : #include "DataStructures/DataBox/TagName.hpp"
      14             : #include "ParallelAlgorithms/EventsAndTriggers/WhenToCheck.hpp"
      15             : #include "Time/Tags/StepperErrorEstimatesEnabled.hpp"
      16             : #include "Time/Tags/StepperErrorTolerances.hpp"
      17             : #include "Utilities/Gsl.hpp"
      18             : #include "Utilities/TMPL.hpp"
      19             : 
      20             : /// \cond
      21             : class EventsAndTriggers;
      22             : template <typename StepChooserUse>
      23             : class StepChooser;
      24             : struct StepperErrorTolerances;
      25             : class TimeStepper;
      26             : class VariableOrderAlgorithm;
      27             : namespace StepChooserUse {
      28             : struct LtsStep;
      29             : }  // namespace StepChooserUse
      30             : namespace Tags {
      31             : template <Triggers::WhenToCheck WhenToCheck>
      32             : struct EventsAndTriggers;
      33             : struct StepChoosers;
      34             : template <typename StepperInterface>
      35             : struct TimeStepper;
      36             : struct VariableOrderAlgorithm;
      37             : }  // namespace Tags
      38             : /// \endcond
      39             : 
      40             : namespace Tags {
      41             : namespace StepperErrorEstimatesEnabledCompute_detail {
      42             : void lts_function(
      43             :     gsl::not_null<bool*> error_estimates_enabled,
      44             :     const ::EventsAndTriggers& events_and_triggers,
      45             :     const std::vector<std::unique_ptr<::StepChooser<StepChooserUse::LtsStep>>>&
      46             :         step_choosers);
      47             : 
      48             : void gts_function(gsl::not_null<bool*> error_estimates_enabled,
      49             :                   const ::EventsAndTriggers& events_and_triggers);
      50             : }  // namespace StepperErrorEstimatesEnabledCompute_detail
      51             : 
      52             : /// \ingroup TimeGroup
      53             : /// \brief Searches the StepChoosers for any requesting error estimates.
      54             : template <bool LocalTimeStepping,
      55             :           template <typename> typename CacheTagPrefix = std::type_identity_t>
      56           1 : struct StepperErrorEstimatesEnabledCompute : db::ComputeTag,
      57             :                                              StepperErrorEstimatesEnabled {
      58           0 :   using base = StepperErrorEstimatesEnabled;
      59           0 :   using return_type = type;
      60           0 :   using argument_tags = tmpl::conditional_t<
      61             :       LocalTimeStepping,
      62             :       tmpl::list<::Tags::EventsAndTriggers<Triggers::WhenToCheck::AtSlabs>,
      63             :                  CacheTagPrefix<::Tags::StepChoosers>>,
      64             :       tmpl::list<::Tags::EventsAndTriggers<Triggers::WhenToCheck::AtSlabs>>>;
      65             : 
      66           0 :   static constexpr auto function = []() {
      67             :     if constexpr (LocalTimeStepping) {
      68             :       return &StepperErrorEstimatesEnabledCompute_detail::lts_function;
      69             :     } else {
      70             :       return &StepperErrorEstimatesEnabledCompute_detail::gts_function;
      71             :     }
      72             :   }();
      73             : };
      74             : 
      75             : namespace StepperErrorTolerancesCompute_detail {
      76             : void lts_impl(
      77             :     gsl::not_null<::StepperErrorTolerances*> tolerances,
      78             :     const ::EventsAndTriggers& events_and_triggers,
      79             :     const std::vector<std::unique_ptr<::StepChooser<StepChooserUse::LtsStep>>>&
      80             :         step_choosers,
      81             :     const ::TimeStepper& time_stepper,
      82             :     const ::VariableOrderAlgorithm& variable_order_algorithm,
      83             :     const std::type_index& tag_type, const std::string& tag_name);
      84             : 
      85             : void gts_impl(gsl::not_null<::StepperErrorTolerances*> tolerances,
      86             :               const ::EventsAndTriggers& events_and_triggers,
      87             :               const std::type_index& tag_type, const std::string& tag_name);
      88             : }  // namespace StepperErrorTolerancesCompute_detail
      89             : 
      90             : /// \ingroup TimeGroup
      91             : /// \brief A tag that contains the error tolerances if any StepChooser
      92             : /// requests an error estimate for the variable.
      93             : template <typename EvolvedVariableTag, bool LocalTimeStepping,
      94             :           template <typename> typename CacheTagPrefix = std::type_identity_t>
      95           1 : struct StepperErrorTolerancesCompute
      96             :     : db::ComputeTag,
      97             :       StepperErrorTolerances<EvolvedVariableTag> {
      98           0 :   using base = StepperErrorTolerances<EvolvedVariableTag>;
      99           0 :   using return_type = typename base::type;
     100           0 :   using argument_tags = tmpl::conditional_t<
     101             :       LocalTimeStepping,
     102             :       tmpl::list<::Tags::EventsAndTriggers<Triggers::WhenToCheck::AtSlabs>,
     103             :                  CacheTagPrefix<::Tags::StepChoosers>,
     104             :                  CacheTagPrefix<::Tags::TimeStepper<::TimeStepper>>,
     105             :                  CacheTagPrefix<::Tags::VariableOrderAlgorithm>>,
     106             :       tmpl::list<::Tags::EventsAndTriggers<Triggers::WhenToCheck::AtSlabs>>>;
     107             : 
     108             :   // local time stepping
     109           0 :   static void function(
     110             :       const gsl::not_null<::StepperErrorTolerances*> tolerances,
     111             :       const ::EventsAndTriggers& events_and_triggers,
     112             :       const std::vector<
     113             :           std::unique_ptr<::StepChooser<StepChooserUse::LtsStep>>>&
     114             :           step_choosers,
     115             :       const ::TimeStepper& time_stepper,
     116             :       const ::VariableOrderAlgorithm& variable_order_algorithm) {
     117             :     StepperErrorTolerancesCompute_detail::lts_impl(
     118             :         tolerances, events_and_triggers, step_choosers, time_stepper,
     119             :         variable_order_algorithm, typeid(EvolvedVariableTag),
     120             :         db::tag_name<EvolvedVariableTag>());
     121             :   }
     122             : 
     123             :   // global time stepping
     124           0 :   static void function(
     125             :       const gsl::not_null<::StepperErrorTolerances*> tolerances,
     126             :       const ::EventsAndTriggers& events_and_triggers) {
     127             :     StepperErrorTolerancesCompute_detail::gts_impl(
     128             :         tolerances, events_and_triggers, typeid(EvolvedVariableTag),
     129             :         db::tag_name<EvolvedVariableTag>());
     130             :   }
     131             : };
     132             : }  // namespace Tags

Generated by: LCOV version 1.14