ElementActions.hpp
1 // Distributed under the MIT License.
2 // See LICENSE.txt for details.
3 
4 #pragma once
5 
6 #include <cstddef>
7 
9 #include "Domain/ElementId.hpp"
10 #include "IO/Importers/VolumeDataReader.hpp"
11 #include "IO/Observer/ArrayComponentId.hpp"
13 #include "Parallel/Info.hpp"
14 #include "Parallel/Invoke.hpp"
15 #include "Utilities/MakeString.hpp"
16 #include "Utilities/Requires.hpp"
17 
18 namespace importers {
19 namespace Actions {
20 
21 /// \cond
23 /// \endcond
24 
25 /*!
26  * \brief Register an element with the volume data reader component.
27  *
28  * Invoke this action on each element of an array parallel component to register
29  * them for receiving imported volume data.
30  */
32  template <typename DbTagsList, typename... InboxTags, typename Metavariables,
33  size_t Dim, typename ActionList, typename ParallelComponent>
34  static std::tuple<db::DataBox<DbTagsList>&&> apply(
36  const tuples::TaggedTuple<InboxTags...>& /*inboxes*/,
38  const ElementIndex<Dim>& array_index, const ActionList /*meta*/,
39  const ParallelComponent* const /*meta*/) noexcept {
40  const std::string element_name = MakeString{}
41  << ElementId<Dim>(array_index);
42  auto& local_reader_component =
45  .ckLocalBranch();
46  Parallel::simple_action<importers::Actions::RegisterElementWithSelf>(
47  local_reader_component,
51  element_name);
52  return {std::move(box)};
53  }
54 };
55 
56 } // namespace Actions
57 } // namespace importers
Register an element with the volume data reader component.
Definition: ElementActions.hpp:31
Defines functions for interfacing with the parallelization framework.
A nodegroup parallel component that reads in a volume data file and distributes its data to elements ...
Definition: VolumeDataReader.hpp:32
Defines class ElementId.
Defines the type alias Requires.
An ID type that identifies both the parallel component and the index in the parallel component...
Definition: ArrayComponentId.hpp:27
Make a string by streaming into object.
Definition: MakeString.hpp:16
An associative container that is indexed by structs.
Definition: TaggedTuple.hpp:273
Defines classes and functions used for manipulating DataBox&#39;s.
Definition: InterpolationTargetWedgeSectionTorus.hpp:24
A Charm++ chare that caches constant data once per Charm++ node.
Definition: ConstGlobalCache.hpp:135
Items related to loading data from files.
Definition: ElementActions.hpp:18
auto get_parallel_component(ConstGlobalCache< Metavariables > &cache) noexcept -> Parallel::proxy_from_parallel_component< ConstGlobalCache_detail::get_component_if_mocked< typename Metavariables::component_list, ParallelComponentTag >> &
Access the Charm++ proxy associated with a ParallelComponent.
Definition: ConstGlobalCache.hpp:222
A class for indexing a Charm array by Element.
Definition: ElementIndex.hpp:53
Defines class template ConstGlobalCache.
Definition: ComputeTimeDerivative.hpp:28
The array index used for indexing Chare Arrays, mostly an implementation detail.
Definition: ArrayIndex.hpp:25
Invoked on the importers::VolumeDataReader component to store the registered data.
Definition: VolumeDataReaderActions.hpp:39