SpECTRE Documentation Coverage Report
Current view: top level - Evolution/Imex - ImplicitDenseOutput.hpp Hit Total Coverage
Commit: 965048f86d23c819715b3af1ca3f880c8145d4bb Lines: 1 6 16.7 %
Date: 2024-05-16 17:00:40
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 "Evolution/Imex/Protocols/ImexSystem.hpp"
       7             : #include "Time/Tags/TimeStepper.hpp"
       8             : #include "Time/TimeSteppers/TimeStepper.hpp"
       9             : #include "Utilities/ErrorHandling/Error.hpp"
      10             : #include "Utilities/Gsl.hpp"
      11             : #include "Utilities/ProtocolHelpers.hpp"
      12             : #include "Utilities/TMPL.hpp"
      13             : 
      14             : /// \cond
      15             : namespace Parallel {
      16             : template <typename Metavariables>
      17             : struct GlobalCache;
      18             : }  // namespace Parallel
      19             : namespace Tags {
      20             : struct Time;
      21             : }  // namespace Tags
      22             : namespace db {
      23             : template <typename TagsList>
      24             : class DataBox;
      25             : }  // namespace db
      26             : namespace imex::Tags {
      27             : template <typename ImplicitSector>
      28             : struct ImplicitHistory;
      29             : }  // namespace imex::Tags
      30             : namespace tuples {
      31             : template <class... Tags>
      32             : class TaggedTuple;
      33             : }  // namespace tuples
      34             : /// \endcond
      35             : 
      36             : namespace imex {
      37             : /// Mutator to apply the implicit portion of dense output, intended
      38             : /// for use in `RunEventsAndDenseTriggers`.
      39             : template <typename ImexSystem>
      40           1 : struct ImplicitDenseOutput {
      41             :   static_assert(tt::assert_conforms_to_v<ImexSystem, protocols::ImexSystem>);
      42             : 
      43           0 :   using return_tags = tmpl::list<typename ImexSystem::variables_tag>;
      44           0 :   using argument_tags = tmpl::push_front<
      45             :       tmpl::transform<typename ImexSystem::implicit_sectors,
      46             :                       tmpl::bind<Tags::ImplicitHistory, tmpl::_1>>,
      47             :       ::Tags::TimeStepper<TimeStepper>, ::Tags::Time>;
      48             : 
      49             :   template <typename... Histories>
      50           0 :   static void apply(
      51             :       const gsl::not_null<typename ImexSystem::variables_tag::type*> variables,
      52             :       const TimeStepper& time_stepper, const double time,
      53             :       const Histories&... histories) {
      54             :     const auto update_sector = [&](auto sector_v, auto history) {
      55             :       using sector = tmpl::type_from<decltype(sector_v)>;
      56             :       auto sector_variables =
      57             :           variables->template reference_subset<typename sector::tensors>();
      58             :       const bool success = time_stepper.dense_update_u(
      59             :           make_not_null(&sector_variables), history, time);
      60             :       if (not success) {
      61             :         ERROR("IMEX dense output failed with history:\n" << history);
      62             :       }
      63             :     };
      64             :     tmpl::as_pack<typename ImexSystem::implicit_sectors>(
      65             :         [&](auto... sectors_v) {
      66             :           EXPAND_PACK_LEFT_TO_RIGHT(update_sector(sectors_v, histories));
      67             :         });
      68             :   }
      69             : 
      70             :   template <typename DbTagsList, typename... InboxTags, typename Metavariables,
      71             :             typename ArrayIndex, typename ParallelComponent>
      72           0 :   static bool is_ready(
      73             :       const gsl::not_null<db::DataBox<DbTagsList>*> /*box*/,
      74             :       const gsl::not_null<tuples::TaggedTuple<InboxTags...>*> /*inboxes*/,
      75             :       Parallel::GlobalCache<Metavariables>& /*cache*/,
      76             :       const ArrayIndex& /*array_index*/,
      77             :       const ParallelComponent* /*component*/) {
      78             :     return true;
      79             :   }
      80             : };
      81             : }  // namespace imex

Generated by: LCOV version 1.14