ElementActions.hpp
1 // Distributed under the MIT License.
2 // See LICENSE.txt for details.
3 
4 #pragma once
5 
6 #include <cstddef>
7 
10 #include "IO/Importers/VolumeDataReader.hpp"
11 #include "IO/Observer/ArrayComponentId.hpp"
12 #include "Parallel/GlobalCache.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 ElementId<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
std::string
Parallel::GlobalCache
Definition: ElementReceiveInterpPoints.hpp:16
GlobalCache.hpp
Parallel::get_parallel_component
auto get_parallel_component(GlobalCache< Metavariables > &cache) noexcept -> Parallel::proxy_from_parallel_component< GlobalCache_detail::get_component_if_mocked< typename Metavariables::component_list, ParallelComponentTag >> &
Access the Charm++ proxy associated with a ParallelComponent.
Definition: GlobalCache.hpp:223
importers
Items related to loading data from files.
Definition: ElementActions.hpp:18
std::tuple
Info.hpp
ElementId< Dim >
ElementId.hpp
std::add_pointer_t
DataBox.hpp
cstddef
tuples::TaggedTuple
An associative container that is indexed by structs.
Definition: TaggedTuple.hpp:271
Requires.hpp
importers::Actions::RegisterElementWithSelf
Invoked on the importers::VolumeDataReader component to store the registered data.
Definition: VolumeDataReaderActions.hpp:40
observers::ArrayComponentId
An ID type that identifies both the parallel component and the index in the parallel component.
Definition: ArrayComponentId.hpp:27
Parallel::ArrayIndex
The array index used for indexing Chare Arrays, mostly an implementation detail.
Definition: ArrayIndex.hpp:27
importers::VolumeDataReader
A nodegroup parallel component that reads in a volume data file and distributes its data to elements ...
Definition: VolumeDataReader.hpp:32
importers::Actions::RegisterWithVolumeDataReader
Register an element with the volume data reader component.
Definition: ElementActions.hpp:31
db::DataBox
Definition: InterpolationTargetWedgeSectionTorus.hpp:24
MakeString
Make a string by streaming into object.
Definition: MakeString.hpp:16