SpECTRE Documentation Coverage Report
Current view: top level - ParallelAlgorithms/EventsAndTriggers - Event.hpp Hit Total Coverage
Commit: a48770a280d0d66bc04cb5df30de1e3cc4985437 Lines: 2 7 28.6 %
Date: 2021-06-17 20:55:50
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 "DataStructures/DataBox/DataBox.hpp"
       7             : #include "Parallel/CharmPupable.hpp"
       8             : #include "Parallel/GlobalCache.hpp"
       9             : #include "Parallel/Tags/Metavariables.hpp"
      10             : #include "Utilities/FakeVirtual.hpp"
      11             : #include "Utilities/TMPL.hpp"
      12             : 
      13             : /// \ingroup EventsAndTriggersGroup
      14             : namespace Events {}
      15             : 
      16             : /// \ingroup EventsAndTriggersGroup
      17             : /// Base class for something that can happen during a simulation (such
      18             : /// as an observation).
      19           1 : class Event : public PUP::able {
      20             :  protected:
      21             :   /// \cond
      22             :   Event() = default;
      23             :   Event(const Event&) = default;
      24             :   Event(Event&&) = default;
      25             :   Event& operator=(const Event&) = default;
      26             :   Event& operator=(Event&&) = default;
      27             :   /// \endcond
      28             : 
      29             :  public:
      30           0 :   ~Event() override = default;
      31           0 :   explicit Event(CkMigrateMessage* msg) noexcept : PUP::able(msg) {}
      32             : 
      33           0 :   WRAPPED_PUPable_abstract(Event);  // NOLINT
      34             : 
      35             :   template <typename DbTags, typename Metavariables, typename ArrayIndex,
      36             :             typename ComponentPointer>
      37           0 :   void run(const db::DataBox<DbTags>& box,
      38             :            Parallel::GlobalCache<Metavariables>& cache,
      39             :            const ArrayIndex& array_index,
      40             :            const ComponentPointer /*meta*/) const noexcept {
      41             :     using factory_classes =
      42             :         typename std::decay_t<decltype(db::get<Parallel::Tags::Metavariables>(
      43             :             box))>::factory_creation::factory_classes;
      44             :     call_with_dynamic_type<void, tmpl::at<factory_classes, Event>>(
      45             :         this, [&box, &cache, &array_index](auto* const event) noexcept {
      46             :           db::apply(*event, box, cache, array_index, ComponentPointer{});
      47             :         });
      48             :   }
      49             : 
      50             :   /// Whether the event uses anything depending on the
      51             :   /// evolved_variables.  If this returns false, anything depending on
      52             :   /// the evolved variables may have an incorrect value when the event
      53             :   /// is run.
      54           1 :   virtual bool needs_evolved_variables() const noexcept = 0;
      55             : };

Generated by: LCOV version 1.14