SpECTRE Documentation Coverage Report
Current view: top level - Evolution/Systems/Cce/Actions - InitializeFirstHypersurface.hpp Coverage Total Hit
Commit: 0d1d717af84a81fb1284a20c4013708fe85cc2f0 Lines: 25.0 % 4 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 <cstddef>
       7              : #include <optional>
       8              : #include <tuple>
       9              : #include <utility>
      10              : 
      11              : #include "DataStructures/DataBox/DataBox.hpp"
      12              : #include "Evolution/Systems/Cce/Components/WorldtubeBoundary.hpp"
      13              : #include "Evolution/Systems/Cce/Initialize/InitializeJ.hpp"
      14              : #include "Evolution/Systems/Cce/OptionTags.hpp"
      15              : #include "Evolution/Systems/Cce/ScriPlusValues.hpp"
      16              : #include "IO/Observer/Actions/GetLockPointer.hpp"
      17              : #include "Parallel/AlgorithmExecution.hpp"
      18              : #include "Parallel/GlobalCache.hpp"
      19              : #include "Utilities/Gsl.hpp"
      20              : #include "Utilities/TMPL.hpp"
      21              : 
      22              : /// \cond
      23              : namespace Tags {
      24              : struct TimeStepId;
      25              : }  // namespace Tags
      26              : /// \endcond
      27              : 
      28              : namespace Cce {
      29              : namespace Actions {
      30              : 
      31              : /*!
      32              :  * \ingroup ActionsGroup
      33              :  * \brief Given initial boundary data for \f$J\f$ and \f$\partial_r J\f$,
      34              :  * computes the initial hypersurface quantities \f$J\f$ and gauge values.
      35              :  *
      36              :  * \details This action is to be called after boundary data has been received,
      37              :  * but before the time-stepping evolution loop. So, it should be either late in
      38              :  * an initialization phase or early (before a `Actions::Goto` loop or similar)
      39              :  * in the `Evolve` phase.
      40              :  *
      41              :  * Internally, this dispatches to the call function of
      42              :  * `Tags::InitializeJ`, which designates a hypersurface initial data generator
      43              :  * chosen by input file options, `InitializeGauge`, and
      44              :  * `InitializeScriPlusValue<Tags::InertialRetardedTime>` to perform the
      45              :  * computations. Refer to the documentation for those mutators for mathematical
      46              :  * details.
      47              :  */
      48              : template <bool EvolveCcm, typename BoundaryComponent>
      49            1 : struct InitializeFirstHypersurface {
      50            0 :   using const_global_cache_tags =
      51              :       tmpl::list<Tags::LMax, Tags::NumberOfRadialPoints>;
      52              : 
      53              :   template <typename DbTags, typename... InboxTags, typename Metavariables,
      54              :             typename ArrayIndex, typename ActionList,
      55              :             typename ParallelComponent>
      56            0 :   static Parallel::iterable_action_return_t apply(
      57              :       db::DataBox<DbTags>& box,
      58              :       const tuples::TaggedTuple<InboxTags...>& /*inboxes*/,
      59              :       Parallel::GlobalCache<Metavariables>& cache,
      60              :       const ArrayIndex& /*array_index*/, const ActionList /*meta*/,
      61              :       const ParallelComponent* const /*meta*/) {
      62              :     // In some contexts, this action may get re-run (e.g. self-start procedure)
      63              :     // In those cases, we do not want to alter the existing hypersurface data,
      64              :     // so we just exit. However, we do want to re-run the action each time
      65              :     // the self start 'reset's from the beginning
      66              :     if (db::get<::Tags::TimeStepId>(box).slab_number() > 0 or
      67              :         not db::get<::Tags::TimeStepId>(box).is_at_slab_boundary()) {
      68              :       return {Parallel::AlgorithmExecution::Continue, std::nullopt};
      69              :     }
      70              :     // some initialization schemes need the hdf5_lock so that they can read
      71              :     // their own input data from disk.
      72              :     auto hdf5_lock = Parallel::local_branch(
      73              :                          Parallel::get_parallel_component<
      74              :                              observers::ObserverWriter<Metavariables>>(cache))
      75              :                          ->template local_synchronous_action<
      76              :                              observers::Actions::GetLockPointer<
      77              :                                  observers::Tags::H5FileLock>>();
      78              :     // Box-based dispatch (see `InitializeJ::InitializeJ::operator()`): the
      79              :     // generator picks the right derived-class `return_tags`/`argument_tags`
      80              :     // via `call_with_dynamic_type` and forwards to `db::mutate_apply`.
      81              :     if constexpr (tt::is_a_v<AnalyticWorldtubeBoundary, BoundaryComponent>) {
      82              :       db::get<Tags::InitializeJ<false>>(box)(make_not_null(&box),
      83              :                                              make_not_null(hdf5_lock));
      84              :     } else {
      85              :       db::get<Tags::InitializeJ<EvolveCcm>>(box)(make_not_null(&box),
      86              :                                                  make_not_null(hdf5_lock));
      87              :     }
      88              :     db::mutate_apply<InitializeScriPlusValue<Tags::InertialRetardedTime>>(
      89              :         make_not_null(&box), db::get<::Tags::TimeStepId>(box).substep_time());
      90              :     return {Parallel::AlgorithmExecution::Continue, std::nullopt};
      91              :   }
      92              : };
      93              : }  // namespace Actions
      94              : }  // namespace Cce
        

Generated by: LCOV version 2.0-1