SpECTRE Documentation Coverage Report
Current view: top level - Time - CollectStepperErrorTolerances.hpp Hit Total Coverage
Commit: c3e43f8d41800b0ecefb9d1393f1de1d5a280c8f Lines: 1 2 50.0 %
Date: 2026-07-24 22:09:25
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 <typeinfo>
       7             : #include <unordered_map>
       8             : 
       9             : #include "Time/RequestsStepperErrorTolerances.hpp"
      10             : #include "Utilities/Gsl.hpp"
      11             : 
      12             : /// \cond
      13             : struct StepperErrorTolerances;
      14             : /// \endcond
      15             : 
      16             : namespace collect_stepper_error_tolerances_detail {
      17             : void process_request(
      18             :     gsl::not_null<std::unordered_map<std::type_index, StepperErrorTolerances>*>
      19             :         tolerances,
      20             :     const RequestsStepperErrorTolerances& tolerance_request);
      21             : }  // namespace collect_stepper_error_tolerances_detail
      22             : 
      23             : /// If \p potential_request inherits from
      24             : /// `RequestsStepperErrorTolerances`, merge its tolerance requests
      25             : /// into \p tolerances.
      26             : template <typename PotentialRequest>
      27           1 : void collect_stepper_error_tolerances(
      28             :     const gsl::not_null<
      29             :         std::unordered_map<std::type_index, StepperErrorTolerances>*>
      30             :         tolerances,
      31             :     const PotentialRequest& potential_request) {
      32             :   // This will fail to compile for non-polymorphic types.  We could
      33             :   // check for that, but all normal uses of this should be on
      34             :   // polymorphic types and it serves as a check that you don't pass a
      35             :   // (smart) pointer to the object instead of the object itself.
      36             :   if (const auto* const tolerance_request =
      37             :           dynamic_cast<const RequestsStepperErrorTolerances*>(
      38             :               &potential_request);
      39             :       tolerance_request != nullptr) {
      40             :     collect_stepper_error_tolerances_detail::process_request(
      41             :         tolerances, *tolerance_request);
      42             :   }
      43             : }

Generated by: LCOV version 1.14