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

Generated by: LCOV version 1.14