InitializeWorldtubeBoundary.hpp
1 // Distributed under the MIT License.
2 // See LICENSE.txt for details.
3 
4 #pragma once
5 
6 #include <cstddef>
7 #include <tuple>
8 #include <utility>
9 
12 #include "Evolution/Systems/Cce/BoundaryData.hpp"
13 #include "Evolution/Systems/Cce/OptionTags.hpp"
14 #include "Evolution/Systems/Cce/ReadBoundaryDataH5.hpp"
15 #include "Evolution/Systems/Cce/Tags.hpp"
16 #include "NumericalAlgorithms/Interpolation/SpanInterpolator.hpp"
17 #include "Parallel/Algorithm.hpp"
18 #include "Parallel/Info.hpp"
19 #include "Parallel/Invoke.hpp"
20 #include "ParallelAlgorithms/Initialization/MergeIntoDataBox.hpp"
21 #include "Utilities/Gsl.hpp"
22 #include "Utilities/Requires.hpp"
23 #include "Utilities/TMPL.hpp"
25 
26 namespace Cce {
27 /*!
28  * \ingroup ActionsGroup
29  * \brief Initializes a H5WorldtubeBoundary
30  *
31  * \details Uses:
32  * - initialization tag
33  * `Cce::InitializationTags::H5WorldtubeBoundaryDataManager`,
34  * - const global cache tag `Spectral::Swsh::Tags::LMax`.
35  *
36  * Databox changes:
37  * - Adds:
38  * - `Cce::Tags::H5WorldtubeBoundaryDataManager`
39  * - `Tags::Variables<typename
40  * Metavariables::cce_boundary_communication_tags>`
41  * - Removes: nothing
42  * - Modifies: nothing
43  */
45  using initialization_tags =
46  tmpl::list<InitializationTags::H5WorldtubeBoundaryDataManager>;
47 
48  using const_global_cache_tags = tmpl::list<Spectral::Swsh::Tags::LMax>;
49 
50  template <class Metavariables>
51  using h5_boundary_manager_simple_tags = db::AddSimpleTags<
53  typename Metavariables::cce_boundary_communication_tags>,
55 
56  template <class Metavariables>
57  using return_tag_list = h5_boundary_manager_simple_tags<Metavariables>;
58 
59  template <typename DbTags, typename... InboxTags, typename Metavariables,
60  typename ArrayIndex, typename ActionList,
61  typename ParallelComponent,
62  Requires<tmpl::list_contains_v<
64  nullptr>
65  static auto apply(db::DataBox<DbTags>& box,
66  const tuples::TaggedTuple<InboxTags...>& /*inboxes*/,
68  const ArrayIndex& /*array_index*/,
69  const ActionList /*meta*/,
70  const ParallelComponent* const /*meta*/) noexcept {
71  const size_t l_max = Parallel::get<Spectral::Swsh::Tags::LMax>(cache);
72  Variables<typename Metavariables::cce_boundary_communication_tags>
73  boundary_variables{
75 
76  WorldtubeDataManager boundary_data_manager;
77  db::mutate<InitializationTags::H5WorldtubeBoundaryDataManager>(
78  make_not_null(&box),
79  [&boundary_data_manager](const gsl::not_null<WorldtubeDataManager*>
80  initialization_data_manager) noexcept {
81  boundary_data_manager = std::move(*initialization_data_manager);
82  });
83  auto initial_box = Initialization::merge_into_databox<
85  h5_boundary_manager_simple_tags<Metavariables>, db::AddComputeTags<>,
86  Initialization::MergePolicy::Overwrite>(
87  std::move(box), std::move(boundary_variables),
88  std::move(boundary_data_manager));
89 
90  return std::make_tuple(std::move(initial_box));
91  }
92 
93  template <typename DbTags, typename... InboxTags, typename Metavariables,
94  typename ArrayIndex, typename ActionList,
95  typename ParallelComponent,
96  Requires<not tmpl::list_contains_v<
97  DbTags, InitializationTags::H5WorldtubeBoundaryDataManager>> =
98  nullptr>
99  static auto apply(db::DataBox<DbTags>& box,
100  const tuples::TaggedTuple<InboxTags...>& /*inboxes*/,
102  const ArrayIndex& /*array_index*/,
103  const ActionList /*meta*/,
104  const ParallelComponent* const /*meta*/) noexcept {
105  return std::make_tuple(std::move(box));
106  }
107 };
108 } // namespace Cce
Definition: Variables.hpp:46
Defines class tuples::TaggedTuple.
A simple tag for the WorldtubeDataManager
Definition: Tags.hpp:327
Defines functions for interfacing with the parallelization framework.
Contains functionality for Cauchy Characteristic Extraction.
Definition: BoundaryComputeAndSendToEvolution.hpp:24
constexpr size_t number_of_swsh_collocation_points(const size_t l_max) noexcept
Convenience function for determining the number of spin-weighted spherical harmonic collocation value...
Definition: SwshCollocation.hpp:25
Defines the type alias Requires.
auto merge_into_databox(db::DataBox< DbTagsList > &&box, Args &&... args) noexcept
Add tags that are not yet in the DataBox.
Definition: MergeIntoDataBox.hpp:132
An associative container that is indexed by structs.
Definition: TaggedTuple.hpp:273
Defines classes and functions used for manipulating DataBox&#39;s.
Initializes a H5WorldtubeBoundary.
Definition: InitializeWorldtubeBoundary.hpp:44
An initialization tag that constructs a WorldtubeDataManager from options.
Definition: OptionTags.hpp:129
tmpl::flatten< tmpl::list< Tags... > > AddSimpleTags
List of Tags to add to the DataBox.
Definition: DataBox.hpp:1227
Definition: InterpolationTargetWedgeSectionTorus.hpp:24
A Charm++ chare that caches constant data once per Charm++ node.
Definition: ConstGlobalCache.hpp:135
Wraps the template metaprogramming library used (brigand)
Defines functions and classes from the GSL.
gsl::not_null< T * > make_not_null(T *ptr) noexcept
Construct a not_null from a pointer. Often this will be done as an implicit conversion, but it may be necessary to perform the conversion explicitly when type deduction is desired.
Definition: Gsl.hpp:879
typename Requires_detail::requires_impl< B >::template_error_type_failed_to_meet_requirements_on_template_parameters Requires
Express requirements on the template parameters of a function or class, replaces std::enable_if_t ...
Definition: Requires.hpp:67
Defines classes SimpleTag, PrefixTag, ComputeTag and several functions for retrieving tag info...
Manages the cached buffer data associated with a CCE worldtube and interpolates to requested time poi...
Definition: ReadBoundaryDataH5.hpp:372
Require a pointer to not be a nullptr
Definition: Gsl.hpp:182
tmpl::flatten< tmpl::list< Tags... > > AddComputeTags
List of Compute Item Tags to add to the DataBox.
Definition: DataBox.hpp:1248