SpECTRE Documentation Coverage Report
Current view: top level - Evolution/DgSubcell/Tags - InitialTciData.hpp Hit Total Coverage
Commit: 2c4f624839e832d3d5b2abc37601f7e1f9a600c9 Lines: 1 6 16.7 %
Date: 2024-05-04 01:01:37
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 <cstddef>
       7             : #include <iomanip>
       8             : #include <map>
       9             : #include <sstream>
      10             : #include <string>
      11             : #include <utility>
      12             : 
      13             : #include "Domain/Structure/Direction.hpp"
      14             : #include "Domain/Structure/DirectionalId.hpp"
      15             : #include "Domain/Structure/DirectionalIdMap.hpp"
      16             : #include "Domain/Structure/ElementId.hpp"
      17             : #include "Evolution/DgSubcell/InitialTciData.hpp"
      18             : #include "Utilities/Gsl.hpp"
      19             : 
      20             : namespace evolution::dg::subcell::Tags {
      21             : /*!
      22             :  * \brief Inbox tag for communicating the RDMP and TCI status/decision during
      23             :  * initialization.
      24             :  */
      25             : template <size_t Dim>
      26           1 : struct InitialTciData {
      27           0 :   using temporal_id = int;
      28           0 :   using type =
      29             :       std::map<temporal_id,
      30             :                DirectionalIdMap<Dim, evolution::dg::subcell::InitialTciData>>;
      31             : 
      32             :   template <typename ReceiveDataType>
      33           0 :   static void insert_into_inbox(const gsl::not_null<type*> inbox,
      34             :                                 const temporal_id& time_step_id,
      35             :                                 ReceiveDataType&& data) {
      36             :     auto& current_inbox = (*inbox)[time_step_id];
      37             : 
      38             :     const auto& direction_and_element_id = data.first;
      39             : 
      40             :     ASSERT(current_inbox.find(direction_and_element_id) == current_inbox.end(),
      41             :            "Received data from direction "
      42             :                << direction_and_element_id.direction << " and element ID "
      43             :                << direction_and_element_id.id << " more than once");
      44             :     current_inbox.emplace(std::forward<ReceiveDataType>(data));
      45             :   }
      46             : 
      47           0 :   static std::string output_inbox(const type& inbox,
      48             :                                   const size_t padding_size) {
      49             :     std::stringstream ss{};
      50             :     const std::string pad(padding_size, ' ');
      51             : 
      52             :     ss << std::scientific << std::setprecision(16);
      53             :     ss << pad << "InitialTciDataInbox:\n";
      54             :     for (const auto& [action_number, hash_map] : inbox) {
      55             :       ss << pad << " Action number: " << action_number << "\n";
      56             :       for (const auto& [key, initial_tci_data] : hash_map) {
      57             :         using ::operator<<;
      58             :         ss << pad << "  Key: " << key
      59             :            << ", TCI: " << initial_tci_data.tci_status << "\n";
      60             :       }
      61             :     }
      62             : 
      63             :     return ss.str();
      64             :   }
      65             : };
      66             : }  // namespace evolution::dg::subcell::Tags

Generated by: LCOV version 1.14