SpECTRE Documentation Coverage Report
Current view: top level - ParallelAlgorithms/Amr/Actions - CreateParent.hpp Hit Total Coverage
Commit: aabde07399ba7837e5db64eedfd0a21f31f96922 Lines: 1 3 33.3 %
Date: 2024-04-26 02:38:13
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 <deque>
       7             : #include <memory>
       8             : #include <utility>
       9             : 
      10             : #include "Domain/Structure/ElementId.hpp"
      11             : #include "Parallel/Callback.hpp"
      12             : #include "Parallel/GlobalCache.hpp"
      13             : #include "Parallel/Phase.hpp"
      14             : #include "ParallelAlgorithms/Amr/Actions/CollectDataFromChildren.hpp"
      15             : 
      16             : /// \cond
      17             : namespace db {
      18             : template <typename>
      19             : class DataBox;
      20             : }  // namespace db
      21             : /// \endcond
      22             : 
      23             : namespace amr::Actions {
      24             : /// \brief Creates a new element in an ArrayAlgorithm whose id is `parent_id`
      25             : ///
      26             : /// \details This action is meant to be initially invoked by
      27             : /// amr::Actions::AdjustDomain on the amr::Component.  This action inserts a
      28             : /// new element with id `parent_id` in the array referenced by
      29             : /// `element_proxy`.  A Parallel::SimpleActionCallback `callback` is passed to
      30             : /// the constructor of the new DistributedObject, which will invoke
      31             : /// amr::Actions::CollectDataFromChildren on the element with id `child_id`.
      32             : ///
      33             : /// This action does not modify anything in the DataBox
      34           1 : struct CreateParent {
      35             :   template <typename ParallelComponent, typename DbTagList,
      36             :             typename Metavariables, typename ElementProxy>
      37           0 :   static void apply(
      38             :       db::DataBox<DbTagList>& /*box*/,
      39             :       Parallel::GlobalCache<Metavariables>& cache, const int /*array_index*/,
      40             :       ElementProxy element_proxy,
      41             :       ElementId<Metavariables::volume_dim> parent_id,
      42             :       const ElementId<Metavariables::volume_dim>& child_id,
      43             :       std::deque<ElementId<Metavariables::volume_dim>> sibling_ids_to_collect,
      44             :       const std::unordered_map<Parallel::Phase, size_t> child_phase_bookmarks) {
      45             :     auto child_proxy = element_proxy[child_id];
      46             :     element_proxy[parent_id].insert(
      47             :         cache.get_this_proxy(), Parallel::Phase::AdjustDomain,
      48             :         child_phase_bookmarks,
      49             :         std::make_unique<Parallel::SimpleActionCallback<
      50             :             CollectDataFromChildren, decltype(child_proxy),
      51             :             ElementId<Metavariables::volume_dim>,
      52             :             std::deque<ElementId<Metavariables::volume_dim>>>>(
      53             :             child_proxy, std::move(parent_id),
      54             :             std::move(sibling_ids_to_collect)));
      55             :   }
      56             : };
      57             : }  // namespace amr::Actions

Generated by: LCOV version 1.14