SpECTRE Documentation Coverage Report
Current view: top level - ParallelAlgorithms/ApparentHorizonFinder/Callbacks - SendDependencyToObserverWriter.hpp Coverage Total Hit
Commit: 0d1d717af84a81fb1284a20c4013708fe85cc2f0 Lines: 33.3 % 3 1
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 <type_traits>
       7              : 
       8              : #include "DataStructures/DataBox/DataBox.hpp"
       9              : #include "DataStructures/LinkedMessageId.hpp"
      10              : #include "IO/Logging/Verbosity.hpp"
      11              : #include "IO/Observer/ObserverComponent.hpp"
      12              : #include "IO/Observer/VolumeActions.hpp"
      13              : #include "Parallel/GlobalCache.hpp"
      14              : #include "Parallel/Invoke.hpp"
      15              : #include "Parallel/Printf/Printf.hpp"
      16              : #include "ParallelAlgorithms/ApparentHorizonFinder/FastFlow.hpp"
      17              : #include "ParallelAlgorithms/ApparentHorizonFinder/Protocols/Callback.hpp"
      18              : #include "ParallelAlgorithms/ApparentHorizonFinder/Tags.hpp"
      19              : #include "Utilities/PrettyType.hpp"
      20              : #include "Utilities/ProtocolHelpers.hpp"
      21              : 
      22              : /// \cond
      23              : namespace logging::Tags {
      24              : template <typename OptionsGroup>
      25              : struct Verbosity;
      26              : }  // namespace logging::Tags
      27              : /// \endcond
      28              : 
      29              : namespace ah::callbacks {
      30              : /*!
      31              :  * \brief A `ah::protocols::Callback` that will send a message to the
      32              :  * ObserverWriter if we have a dependency using the
      33              :  * `observers::ThreadedActions::ContributeDependency` action.
      34              :  *
      35              :  * \details If we have a dependency, the template bool \p WriteVolumeData
      36              :  * determines if the message sent to the ObserverWriter says to write the volume
      37              :  * data to disk or not.
      38              :  */
      39              : template <typename HorizonMetavars, bool WriteVolumeData>
      40            1 : struct SendDependencyToObserverWriter
      41              :     : tt::ConformsTo<ah::protocols::Callback> {
      42              :   // Callback for when horizon find succeeds
      43              :   template <typename DbTags, typename Metavariables>
      44            0 :   static void apply(const db::DataBox<DbTags>& box,
      45              :                     Parallel::GlobalCache<Metavariables>& cache,
      46              :                     const FastFlow::Status /*status*/) {
      47              :     const auto& time = db::get<ah::Tags::CurrentTime>(box).value();
      48              :     const auto& dependency = db::get<ah::Tags::Dependency>(box);
      49              : 
      50              :     if (dependency.has_value()) {
      51              :       const auto& verbosity = db::get<ah::Tags::Verbosity>(box);
      52              : 
      53              :       auto& observer_writer_proxy = Parallel::get_parallel_component<
      54              :           observers::ObserverWriter<Metavariables>>(cache);
      55              : 
      56              :       Parallel::threaded_action<
      57              :           observers::ThreadedActions::ContributeDependency>(
      58              :           observer_writer_proxy, time.id, pretty_type::name<HorizonMetavars>(),
      59              :           dependency.value(), WriteVolumeData);
      60              : 
      61              :       if (verbosity >= ::Verbosity::Verbose) {
      62              :         Parallel::printf(
      63              :             "Remark: We are%s writing volume data for horizon finder %s\n",
      64              :             WriteVolumeData ? "" : " not",
      65              :             pretty_type::name<HorizonMetavars>());
      66              :       }
      67              :     }
      68              :   }
      69              : };
      70              : }  // namespace ah::callbacks
        

Generated by: LCOV version 2.0-1