SpECTRE Documentation Coverage Report
Current view: top level - ParallelAlgorithms/Amr/Actions - SendDataToChildren.hpp Hit Total Coverage
Commit: 9e4176f904ee1c51f05efc42ff1e485357699444 Lines: 1 3 33.3 %
Date: 2024-03-28 23:18:37
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 <vector>
       7             : 
       8             : #include "DataStructures/DataBox/DataBox.hpp"
       9             : #include "Domain/Structure/ElementId.hpp"
      10             : #include "Parallel/ElementRegistration.hpp"
      11             : #include "Parallel/GlobalCache.hpp"
      12             : #include "Parallel/Invoke.hpp"
      13             : #include "ParallelAlgorithms/Amr/Actions/InitializeChild.hpp"
      14             : 
      15             : namespace amr::Actions {
      16             : /// \brief Sends data from the parent element to its children elements during
      17             : /// adaptive mesh refinement
      18             : ///
      19             : /// \details  This action should be called after all children elements have been
      20             : /// created by amr::Actions::CreateChild.  This action sends a copy of all items
      21             : /// corresponding to the mutable_item_creation_tags of `box` to each of the
      22             : /// elements with `ids_of_children`.  Finally, the parent element destroys
      23             : /// itself.
      24           1 : struct SendDataToChildren {
      25             :   template <typename ParallelComponent, typename DbTagList,
      26             :             typename Metavariables>
      27           0 :   static void apply(db::DataBox<DbTagList>& box,
      28             :                     Parallel::GlobalCache<Metavariables>& cache,
      29             :                     const ElementId<Metavariables::volume_dim>& element_id,
      30             :                     const std::vector<ElementId<Metavariables::volume_dim>>&
      31             :                         ids_of_children) {
      32             :     auto& array_proxy =
      33             :         Parallel::get_parallel_component<ParallelComponent>(cache);
      34             :     for (const auto& child_id : ids_of_children) {
      35             :       Parallel::simple_action<amr::Actions::InitializeChild>(
      36             :           array_proxy[child_id],
      37             :           db::copy_items<
      38             :               typename db::DataBox<DbTagList>::mutable_item_creation_tags>(
      39             :               box));
      40             :     }
      41             : 
      42             :     Parallel::deregister_element<ParallelComponent>(box, cache, element_id);
      43             : 
      44             :     array_proxy[element_id].ckDestroy();
      45             :   }
      46             : };
      47             : }  // namespace amr::Actions

Generated by: LCOV version 1.14