SpECTRE Documentation Coverage Report
Current view: top level - Evolution/Particles/MonteCarlo - GhostZoneCommunicationTags.hpp Coverage Total Hit
Commit: 0d1d717af84a81fb1284a20c4013708fe85cc2f0 Lines: 25.0 % 16 4
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 <array>
       7              : #include <map>
       8              : #include <optional>
       9              : #include <utility>
      10              : 
      11              : #include "DataStructures/DataBox/Tag.hpp"
      12              : #include "DataStructures/Tensor/TypeAliases.hpp"
      13              : #include "Domain/Structure/DirectionalIdMap.hpp"
      14              : #include "Evolution/Particles/MonteCarlo/GhostZoneCommunicationStep.hpp"
      15              : #include "Evolution/Particles/MonteCarlo/Packet.hpp"
      16              : #include "Time/Slab.hpp"
      17              : #include "Time/Tags/TimeStepId.hpp"
      18              : #include "Time/Time.hpp"
      19              : #include "Time/TimeStepId.hpp"
      20              : #include "Utilities/Gsl.hpp"
      21              : 
      22              : /// \cond
      23              : class DataVector;
      24              : /// \endcond
      25              : 
      26              : /// Items related to the evolution of particles
      27              : /// Items related to Monte-Carlo radiation transport
      28              : namespace Particles::MonteCarlo {
      29              : 
      30              : /*!
      31              :  * \brief The container for ghost zone data to be communicated
      32              :  *        in the Monte-Carlo algorithm
      33              :  *
      34              :  * The stored data consists of
      35              :  * (1) The fluid variables in those ghost cells, in the form
      36              :  *     of a DataVector. The data should contain the
      37              :  *     scalars (baryon density, temperature, electron fraction,
      38              :  *     and cell light-crossing time) in pre-step communication
      39              :  *     and (coupling_tilde_tau, coupling_tilde_s, coupling_rho_ye)
      40              :  *     in post-step communication
      41              :  * (2) The packets moved from a neighbor to this element. This
      42              :  *     can be std::null_ptr in pre-step communication
      43              :  */
      44              : template <size_t Dim>
      45            1 : struct McGhostZoneData {
      46            0 :   void pup(PUP::er& p) {
      47              :     p | ghost_zone_hydro_variables;
      48              :     p | packets_entering_this_element;
      49              :   }
      50              : 
      51            0 :   DataVector ghost_zone_hydro_variables{};
      52              :   std::optional<std::vector<Particles::MonteCarlo::Packet>>
      53            0 :       packets_entering_this_element{};
      54              : };
      55              : 
      56              : /// Inbox tag to be used before MC step
      57              : template <size_t Dim, CommunicationStep CommStep>
      58            1 : struct McGhostZoneDataInboxTag {
      59            0 :   using stored_type = McGhostZoneData<Dim>;
      60              : 
      61            0 :   using temporal_id = TimeStepId;
      62            0 :   using type = std::map<TimeStepId, DirectionalIdMap<Dim, stored_type>>;
      63            0 :   using value_type = type;
      64              : 
      65            0 :   CommunicationStep comm_step = CommStep;
      66              : 
      67              :   template <typename ReceiveDataType>
      68            0 :   static bool insert_into_inbox(const gsl::not_null<type*> inbox,
      69              :                                 const temporal_id& time_step_id,
      70              :                                 ReceiveDataType&& data) {
      71              :     auto& current_inbox = (*inbox)[time_step_id];
      72              :     if (not current_inbox.insert(std::forward<ReceiveDataType>(data))
      73              :                   .second) {
      74              :      ERROR("Failed to insert data to receive at instance '"
      75              :            << time_step_id
      76              :            << " in McGhostZonePreStepDataInboxTag.\n");
      77              :     }
      78              :     return true;
      79              :   }
      80              : 
      81            0 :   void pup(PUP::er& /*p*/) {}
      82              : };
      83              : 
      84              : // Tags to put in DataBox for MC communication.
      85            1 : namespace Tags {
      86              : 
      87              : /// Simple tag for the structure containing ghost zone data
      88              : /// for Monte Carlo radiation transport.
      89              : template <size_t Dim>
      90            1 : struct McGhostZoneDataTag : db::SimpleTag {
      91            0 :   using type = DirectionalIdMap<Dim, McGhostZoneData<Dim>>;
      92              : };
      93              : 
      94              : }  // namespace Tags
      95              : 
      96              : } // namespace Particles::MonteCarlo
        

Generated by: LCOV version 2.0-1