SpECTRE Documentation Coverage Report
Current view: top level - Evolution/Systems/Cce/InterfaceManagers - GhLockstep.hpp Coverage Total Hit
Commit: 0d1d717af84a81fb1284a20c4013708fe85cc2f0 Lines: 35.3 % 17 6
Test Date: 2026-10-22 17:29:42
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 <deque>
       7              : #include <memory>
       8              : #include <optional>
       9              : #include <tuple>
      10              : 
      11              : #include "DataStructures/Tensor/Tensor.hpp"
      12              : #include "DataStructures/Tensor/TypeAliases.hpp"
      13              : #include "Evolution/Systems/Cce/InterfaceManagers/GhInterfaceManager.hpp"
      14              : #include "Options/String.hpp"
      15              : #include "Time/TimeStepId.hpp"
      16              : #include "Utilities/Serialization/CharmPupable.hpp"
      17              : 
      18              : namespace Cce::InterfaceManagers {
      19              : 
      20              : /*!
      21              :  * \brief Simple implementation of a `GhInterfaceManager` that only
      22              :  * provides boundary data on matching `TimeStepId`s
      23              :  *
      24              :  * \details This version of the interface manager assumes that the CCE system
      25              :  * and the generalized harmonic system that it communicates with evolve with an
      26              :  * identical time stepper and on identical time step intervals (they evolve in
      27              :  * 'lock step'). As a result, and to streamline communications, new data is
      28              :  * always immediately 'ready' and requests are ignored to produce the behavior
      29              :  * of just immediately gauge-transforming and sending the data to the CCE
      30              :  * component as soon as it becomes available from the GH system.
      31              :  *
      32              :  * \warning Using this interface manager when the GH components and the CCE
      33              :  * evolution are not identically stepped is considered undefined behavior. For
      34              :  * current implementations involving dense output and local time-stepping, this
      35              :  * interface manager can only be used during self-start.
      36              :  */
      37            1 : class GhLockstep : public GhInterfaceManager {
      38              :  public:
      39            0 :   using GhInterfaceManager::gh_variables;
      40              : 
      41            0 :   static constexpr Options::String help{
      42              :       "Pass data between GH and CCE systems on matching timesteps only."};
      43              : 
      44            0 :   using options = tmpl::list<>;
      45              : 
      46            0 :   GhLockstep() = default;
      47              : 
      48            0 :   explicit GhLockstep(CkMigrateMessage* /*unused*/) {}
      49              : 
      50            0 :   WRAPPED_PUPable_decl_template(GhLockstep);  // NOLINT
      51              : 
      52            0 :   std::unique_ptr<GhInterfaceManager> get_clone() const override;
      53              : 
      54              :   /// \brief Store a provided data set in a `std::deque`.
      55              :   ///
      56              :   /// \details The lock-step constraint ensures that only the generalized
      57              :   /// harmonic variables `spacetime_metric`, `phi`, and `pi` are used. The
      58              :   /// remaining variables are accepted to comply with the more general abstract
      59              :   /// interface.
      60            1 :   void insert_gh_data(TimeStepId time_id,
      61              :                       const tnsr::aa<DataVector, 3>& spacetime_metric,
      62              :                       const tnsr::iaa<DataVector, 3>& phi,
      63              :                       const tnsr::aa<DataVector, 3>& pi);
      64              : 
      65            0 :   void request_gh_data(const TimeStepId& time_id) override;
      66              : 
      67              :   /// \brief Return a `std::optional<std::tuple>` of the least recently
      68              :   /// submitted generalized harmonic boundary data if any exists and removes it
      69              :   /// from the internal `std::deque`, otherwise returns `std::nullopt`.
      70            1 :   auto retrieve_and_remove_first_ready_gh_data()
      71              :       -> std::optional<std::tuple<TimeStepId, gh_variables>> override;
      72              : 
      73              :   /// \brief This class ignores requests to ensure a one-way communication
      74              :   /// pattern, so the number of requests is always 0.
      75            1 :   size_t number_of_pending_requests() const override { return 0; }
      76              : 
      77              :   /// \brief The number of times at which data from a GH evolution have been
      78              :   /// stored and not yet retrieved
      79            1 :   size_t number_of_gh_times() const override { return provided_data_.size(); }
      80              : 
      81              :   /// Serialization for Charm++.
      82            1 :   void pup(PUP::er& p) override;
      83              : 
      84              :  private:
      85            0 :   std::map<TimeStepId, gh_variables> provided_data_;
      86            0 :   std::set<TimeStepId> requests_;
      87              : };
      88              : 
      89              : }  // namespace Cce::InterfaceManagers
        

Generated by: LCOV version 2.0-1