SpECTRE Documentation Coverage Report
Current view: top level - Evolution/Executables/GeneralizedHarmonic - Deadlock.hpp Hit Total Coverage
Commit: c428a3e2e0ca78fe0364ec1b0e0493c627d428d4 Lines: 0 3 0.0 %
Date: 2026-04-26 20:20:36
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 <string>
       7             : #include <vector>
       8             : 
       9             : #include "ControlSystem/Actions/PrintCurrentMeasurement.hpp"
      10             : #include "Domain/FunctionsOfTime/Tags.hpp"
      11             : #include "Evolution/Deadlock/PrintDgElementArray.hpp"
      12             : #include "Evolution/Deadlock/PrintFunctionsOfTime.hpp"
      13             : #include "Parallel/ArrayCollection/IsDgElementCollection.hpp"
      14             : #include "Parallel/ArrayCollection/SimpleActionOnElement.hpp"
      15             : #include "Parallel/GlobalCache.hpp"
      16             : #include "Parallel/Invoke.hpp"
      17             : #include "ParallelAlgorithms/ApparentHorizonFinder/PrintDeadlockAnalysis.hpp"
      18             : #include "ParallelAlgorithms/Interpolation/Actions/PrintInterpolationTargetForDeadlock.hpp"
      19             : #include "Utilities/FileSystem.hpp"
      20             : #include "Utilities/PrettyType.hpp"
      21             : #include "Utilities/TMPL.hpp"
      22             : 
      23             : /// \cond
      24             : namespace intrp {
      25             : template <class Metavariables, typename InterpolationTargetTag>
      26             : struct InterpolationTarget;
      27             : }  // namespace intrp
      28             : namespace observers {
      29             : template <class Metavariables>
      30             : struct ObserverWriter;
      31             : }  // namespace observers
      32             : /// \endcond
      33             : 
      34           0 : namespace gh::deadlock {
      35             : template <typename DgElementArray, typename ControlComponents,
      36             :           typename InterpolationTargetTags, typename AhFinders,
      37             :           typename Metavariables>
      38           0 : void run_deadlock_analysis_simple_actions(
      39             :     Parallel::GlobalCache<Metavariables>& cache,
      40             :     const std::vector<std::string>& deadlocked_components) {
      41             :   const std::string deadlock_dir{"deadlock"};
      42             :   if (file_system::check_if_dir_exists(deadlock_dir)) {
      43             :     file_system::rm(deadlock_dir, true);
      44             :   }
      45             : 
      46             :   file_system::create_directory(deadlock_dir);
      47             : 
      48             :   Parallel::simple_action<::deadlock::PrintFunctionsOfTime>(
      49             :       Parallel::get_parallel_component<
      50             :           observers::ObserverWriter<Metavariables>>(cache),
      51             :       deadlock_dir + "/functions_of_time.out");
      52             : 
      53             :   {
      54             :     auto cache_proxy = cache.get_this_proxy();
      55             : 
      56             :     cache_proxy.print_mutable_cache_callbacks(deadlock_dir +
      57             :                                               "/mutable_cache_callbacks.out");
      58             :   }
      59             : 
      60             :   if constexpr (tmpl::size<InterpolationTargetTags>::value > 0) {
      61             :     const std::string intrp_target_file =
      62             :         deadlock_dir + "/interpolation_targets.out";
      63             :     tmpl::for_each<InterpolationTargetTags>(
      64             :         [&cache, &intrp_target_file](const auto tag_v) {
      65             :           using TargetTag = tmpl::type_from<decltype(tag_v)>;
      66             : 
      67             :           Parallel::simple_action<::deadlock::PrintInterpolationTarget>(
      68             :               Parallel::get_parallel_component<
      69             :                   intrp::InterpolationTarget<Metavariables, TargetTag>>(cache),
      70             :               intrp_target_file);
      71             :         });
      72             :   }
      73             : 
      74             :   if constexpr (tmpl::size<AhFinders>::value > 0) {
      75             :     tmpl::for_each<AhFinders>([&cache,
      76             :                                &deadlock_dir](const auto horizon_metavars_v) {
      77             :       using HorizonMetavars = tmpl::type_from<decltype(horizon_metavars_v)>;
      78             :       const std::string ah_finder_file =
      79             :           deadlock_dir + "/" + pretty_type::name<HorizonMetavars>() + ".out";
      80             :       Parallel::simple_action<ah::Actions::PrintDeadlockAnalysis>(
      81             :           Parallel::get_parallel_component<
      82             :               ah::Component<Metavariables, HorizonMetavars>>(cache),
      83             :           ah_finder_file);
      84             :     });
      85             :   }
      86             : 
      87             :   if (alg::count(deadlocked_components, pretty_type::name<DgElementArray>()) ==
      88             :       1) {
      89             :     if constexpr (tmpl::size<ControlComponents>::value > 0) {
      90             :       tmpl::for_each<ControlComponents>(
      91             :           [&cache, &deadlock_dir](auto component_v) {
      92             :             using component = tmpl::type_from<decltype(component_v)>;
      93             :             Parallel::simple_action<
      94             :                 control_system::Actions::PrintCurrentMeasurement>(
      95             :                 Parallel::get_parallel_component<component>(cache),
      96             :                 deadlock_dir + "/control_systems.out");
      97             :           });
      98             :     }
      99             : 
     100             :     const std::string element_array_file =
     101             :         deadlock_dir + "/dg_element_array.out";
     102             :     if constexpr (Parallel::is_dg_element_collection_v<DgElementArray>) {
     103             :       Parallel::threaded_action<Parallel::Actions::SimpleActionOnElement<
     104             :           ::deadlock::PrintElementInfo, true>>(
     105             :           Parallel::get_parallel_component<DgElementArray>(cache),
     106             :           element_array_file);
     107             :     } else {
     108             :       Parallel::simple_action<::deadlock::PrintElementInfo>(
     109             :           Parallel::get_parallel_component<DgElementArray>(cache),
     110             :           element_array_file);
     111             :     }
     112             :   }
     113             : }
     114             : }  // namespace gh::deadlock

Generated by: LCOV version 1.14